mirror of
https://github.com/MinimalBible/MinimalBible-Legacy
synced 2024-11-14 12:08:51 -05:00
Progress is working fine for most books
Still seeing some strange issues, need to do some investigation...
This commit is contained in:
parent
6191943d3f
commit
7558fc7f20
@ -52,12 +52,12 @@ public class BookItemHolder {
|
||||
if (dlProgressEvent != null) {
|
||||
displayProgress((int) dlProgressEvent.toCircular());
|
||||
}
|
||||
downloadManager.getDownloadBus().register(this);
|
||||
// TODO: Display a remove icon if the book has been downloaded.
|
||||
}
|
||||
|
||||
@OnClick(R.id.download_ibtn_download)
|
||||
public void onDownloadItem(View v) {
|
||||
downloadManager.getDownloadBus().register(this);
|
||||
bookDownloadManager.installBook(this.b);
|
||||
}
|
||||
|
||||
@ -117,4 +117,8 @@ public class BookItemHolder {
|
||||
downloadProgress.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void onScrollOffscreen() {
|
||||
downloadManager.getDownloadBus().unregister(this);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package org.bspeice.minimalbible.activities.downloader;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import org.bspeice.minimalbible.R;
|
||||
@ -13,7 +14,7 @@ import java.util.List;
|
||||
/**
|
||||
* Adapter to inflate list_download_items.xml
|
||||
*/
|
||||
public class BookListAdapter extends BaseAdapter {
|
||||
public class BookListAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
|
||||
private List<Book> bookList;
|
||||
|
||||
private LayoutInflater inflater;
|
||||
@ -53,4 +54,11 @@ public class BookListAdapter extends BaseAdapter {
|
||||
viewHolder.bindHolder();
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMovedToScrapHeap(View view) {
|
||||
BookItemHolder holder = (BookItemHolder) view.getTag();
|
||||
holder.onScrollOffscreen();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import org.bspeice.minimalbible.MinimalBible;
|
||||
import org.bspeice.minimalbible.MinimalBibleModules;
|
||||
import org.bspeice.minimalbible.R;
|
||||
import org.bspeice.minimalbible.activities.downloader.BookItemHolder;
|
||||
import org.bspeice.minimalbible.activities.downloader.manager.DLProgressEvent;
|
||||
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
|
||||
import org.bspeice.minimalbible.activities.downloader.manager.DownloadProgressEvent;
|
||||
import org.crosswire.jsword.book.Book;
|
||||
import org.crosswire.jsword.book.install.Installer;
|
||||
|
||||
@ -54,7 +54,7 @@ public class DownloadActivityTest extends InstrumentationTestCase {
|
||||
BookItemHolder holder = new BookItemHolder(dummyView, testBook);
|
||||
|
||||
dm.getDownloadBus().register(new Object() {
|
||||
public void onEvent(DownloadProgressEvent event) {
|
||||
public void onEvent(DLProgressEvent event) {
|
||||
Log.d("testInitial", Integer.toString(event.getProgress()));
|
||||
if (event.getProgress() == 0) {
|
||||
signal.countDown();
|
||||
|
Loading…
Reference in New Issue
Block a user