diff --git a/MinimalBible/res/drawable-hdpi/ic_action_search.png b/MinimalBible/res/drawable-hdpi/ic_action_search.png new file mode 100644 index 0000000..f594b4e Binary files /dev/null and b/MinimalBible/res/drawable-hdpi/ic_action_search.png differ diff --git a/MinimalBible/res/drawable-mdpi/ic_action_search.png b/MinimalBible/res/drawable-mdpi/ic_action_search.png new file mode 100644 index 0000000..2e446ec Binary files /dev/null and b/MinimalBible/res/drawable-mdpi/ic_action_search.png differ diff --git a/MinimalBible/res/drawable-xhdpi/ic_action_search.png b/MinimalBible/res/drawable-xhdpi/ic_action_search.png new file mode 100644 index 0000000..aad535e Binary files /dev/null and b/MinimalBible/res/drawable-xhdpi/ic_action_search.png differ diff --git a/MinimalBible/res/drawable-xxhdpi/ic_action_search.png b/MinimalBible/res/drawable-xxhdpi/ic_action_search.png new file mode 100644 index 0000000..9c0ea3c Binary files /dev/null and b/MinimalBible/res/drawable-xxhdpi/ic_action_search.png differ diff --git a/MinimalBible/res/layout/activity_download.xml b/MinimalBible/res/layout/activity_download.xml index a6fb5e3..fc52f60 100644 --- a/MinimalBible/res/layout/activity_download.xml +++ b/MinimalBible/res/layout/activity_download.xml @@ -7,26 +7,24 @@ tools:context="org.bspeice.minimalbible.activities.downloader.DownloadActivity" > + android:layout_height="match_parent" /> diff --git a/MinimalBible/res/layout/fragment_download.xml b/MinimalBible/res/layout/fragment_download.xml index 7dc1a6a..e1b9542 100644 --- a/MinimalBible/res/layout/fragment_download.xml +++ b/MinimalBible/res/layout/fragment_download.xml @@ -8,9 +8,12 @@ android:paddingTop="@dimen/activity_vertical_margin" tools:context="org.bspeice.minimalbible.DownloadActivity$PlaceholderFragment" > - - + diff --git a/MinimalBible/res/layout/list_download_items.xml b/MinimalBible/res/layout/list_download_items.xml new file mode 100644 index 0000000..501be4c --- /dev/null +++ b/MinimalBible/res/layout/list_download_items.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/MinimalBible/res/values/styles.xml b/MinimalBible/res/values/styles.xml index 845fb57..5255562 100644 --- a/MinimalBible/res/values/styles.xml +++ b/MinimalBible/res/values/styles.xml @@ -10,6 +10,8 @@ res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> + + @@ -17,4 +19,13 @@ + + + diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookItemView.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookItemView.java new file mode 100644 index 0000000..2bcde3e --- /dev/null +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookItemView.java @@ -0,0 +1,28 @@ +package org.bspeice.minimalbible.activities.downloader; + +import android.content.Context; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import org.androidannotations.annotations.EViewGroup; +import org.androidannotations.annotations.ViewById; +import org.bspeice.minimalbible.R; +import org.crosswire.jsword.book.Book; + +@EViewGroup(R.layout.list_download_items) +public class BookItemView extends RelativeLayout { + + @ViewById (R.id.img_download_icon) ImageView downloadIcon; + @ViewById(R.id.txt_download_item_name) TextView itemName; + @ViewById(R.id.img_download_index_downloaded) ImageView isIndexedDownloaded; + @ViewById(R.id.img_download_item_downloaded) ImageView isDownloaded; + + public BookItemView (Context ctx) { + super(ctx); + } + + public void bind(Book b) { + itemName.setText(b.getName()); + } +} diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java new file mode 100644 index 0000000..edac3e1 --- /dev/null +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java @@ -0,0 +1,53 @@ +package org.bspeice.minimalbible.activities.downloader; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; + +import org.crosswire.jsword.book.Book; + +import java.util.List; + +/** + * Adapter to inflate list_download_items.xml + */ +public class BookListAdapter extends BaseAdapter { + private List bookList; + + private Context ctx; + + public BookListAdapter(Context context, List bookList) { + this.bookList = bookList; + this.ctx = context; + } + + @Override + public int getCount() { + return bookList.size(); + } + + @Override + public Book getItem(int position) { + return bookList.get(position); + } + + @Override + public long getItemId(int i) { + return i; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + BookItemView itemView; + if (convertView == null) { + itemView = BookItemView_.build(this.ctx); + + } else { + itemView = (BookItemView) convertView; + } + + itemView.bind(getItem(position)); + return itemView; + } +} diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java index ca8f6b0..c422e9a 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java @@ -1,15 +1,20 @@ package org.bspeice.minimalbible.activities.downloader; +import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.os.Build; import android.support.v4.app.Fragment; import android.util.Log; -import android.widget.TextView; +import android.view.View; +import android.widget.ListView; import android.widget.Toast; +import com.readystatesoftware.systembartint.SystemBarTintManager; + import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.EFragment; import org.androidannotations.annotations.FragmentArg; @@ -38,8 +43,8 @@ public class BookListFragment extends Fragment { @FragmentArg BookCategory bookCategory; - @ViewById(R.id.section_label) - protected TextView tv; + @ViewById(R.id.lst_download_available) + protected ListView downloadsAvailable; private ProgressDialog refreshDialog; @@ -47,7 +52,6 @@ public class BookListFragment extends Fragment { @AfterViews public void updateName() { ((DownloadActivity) getActivity()).onSectionAttached(bookCategory.toString()); - tv.setText(bookCategory.toString()); displayModules(); } @@ -97,11 +101,19 @@ public class BookListFragment extends Fragment { displayBooks(event.getBookList()); } + public static void setInsets(Activity context, View view) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return; + SystemBarTintManager tintManager = new SystemBarTintManager(context); + SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); + view.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom()); + } + public void displayBooks(List bookList) { try { BookFilter f = FilterUtil.filterFromCategory(bookCategory); List filteredBooks = FilterUtil.applyFilter(bookList, f); - tv.setText(filteredBooks.get(0).getName()); + downloadsAvailable.setAdapter(new BookListAdapter(this.getActivity(), filteredBooks)); + setInsets(getActivity(), downloadsAvailable); } catch (FilterUtil.InvalidFilterCategoryMappingException e) { // To be honest, there should be no reason you end up here. Log.e(TAG, e.getMessage());