From b04d6c67ae0324cfaa12c3d17b2815fe08936658 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sat, 17 May 2014 01:37:44 -0400 Subject: [PATCH] Add in the ProgressWheel! Also make sure it gets put in the proper package to make sure the author gets credit. --- MinimalBible/res/layout/list_download_items.xml | 12 +++++++++++- .../components/progressbar}/ProgressWheel.java | 4 +++- .../activities/downloader/BookListAdapter.java | 14 ++++++++++---- .../activities/downloader/BookListFragment.java | 3 +++ 4 files changed, 27 insertions(+), 6 deletions(-) rename MinimalBible/src/{org/bspeice/minimalbible => com/todddavies/components/progressbar}/ProgressWheel.java (99%) diff --git a/MinimalBible/res/layout/list_download_items.xml b/MinimalBible/res/layout/list_download_items.xml index 451e950..0f5c5fc 100644 --- a/MinimalBible/res/layout/list_download_items.xml +++ b/MinimalBible/res/layout/list_download_items.xml @@ -1,9 +1,10 @@ + android:padding="8dp"> + + \ No newline at end of file diff --git a/MinimalBible/src/org/bspeice/minimalbible/ProgressWheel.java b/MinimalBible/src/com/todddavies/components/progressbar/ProgressWheel.java similarity index 99% rename from MinimalBible/src/org/bspeice/minimalbible/ProgressWheel.java rename to MinimalBible/src/com/todddavies/components/progressbar/ProgressWheel.java index 409b336..224d212 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/ProgressWheel.java +++ b/MinimalBible/src/com/todddavies/components/progressbar/ProgressWheel.java @@ -1,4 +1,4 @@ -package org.bspeice.minimalbible; +package com.todddavies.components.progressbar; import android.content.Context; import android.content.res.TypedArray; @@ -12,6 +12,8 @@ import android.os.Message; import android.util.AttributeSet; import android.view.View; +import org.bspeice.minimalbible.R; + /** * An indicator of progress, similar to Android's ProgressBar. diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java index 259317a..6c76414 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListAdapter.java @@ -5,15 +5,12 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.IconButton; -import android.widget.IconTextView; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; -import com.joanzapata.android.iconify.Iconify; - +import com.todddavies.components.progressbar.ProgressWheel; import org.bspeice.minimalbible.R; import org.crosswire.jsword.book.Book; @@ -21,6 +18,7 @@ import java.util.List; import butterknife.ButterKnife; import butterknife.InjectView; +import butterknife.OnClick; /** * Adapter to inflate list_download_items.xml @@ -69,6 +67,7 @@ public class BookListAdapter extends BaseAdapter { @InjectView(R.id.download_txt_item_acronym) TextView acronym; @InjectView(R.id.txt_download_item_name) TextView itemName; @InjectView(R.id.download_ibtn_download) ImageButton isDownloaded; + @InjectView(R.id.download_prg_download) ProgressWheel downloadProgress; public BookItemView (Context ctx) { super(ctx); @@ -80,5 +79,12 @@ public class BookListAdapter extends BaseAdapter { acronym.setText(b.getInitials()); itemName.setText(b.getName()); } + + @OnClick(R.id.download_ibtn_download) + public void onDownloadItem(View v) { + isDownloaded.setVisibility(View.GONE); + downloadProgress.setVisibility(View.VISIBLE); + downloadProgress.setProgress(75); // Out of 360 + } } } diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java index e3b847b..9abf0c4 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/BookListFragment.java @@ -12,6 +12,8 @@ import android.view.ViewGroup; import android.widget.ListView; import android.widget.Toast; +import com.f2prateek.dart.InjectExtra; + import org.bspeice.minimalbible.MinimalBible; import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.activities.BaseFragment; @@ -38,6 +40,7 @@ import butterknife.InjectView; public class BookListFragment extends BaseFragment { /** * The fragment argument representing the section number for this fragment. + * Not a candidate for Dart (yet) because I would have to write a Parcelable around it. */ private static final String ARG_BOOK_CATEGORY = "book_category";