mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-25 22:55:59 +03:00
Remove successful downloads from queue
This commit is contained in:
parent
c6dc5d344d
commit
6412ec1d9b
5 changed files with 13 additions and 22 deletions
|
@ -296,6 +296,10 @@ public class DownloadManager {
|
|||
}
|
||||
download.totalProgress = actualProgress;
|
||||
download.setStatus(status);
|
||||
// Delete successful downloads from queue after notifying
|
||||
if (status == Download.DOWNLOADED) {
|
||||
queue.remove(download);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the page list from the chapter's directory if it exists, null otherwise
|
||||
|
|
|
@ -42,14 +42,6 @@ public class DownloadQueue {
|
|||
return queue;
|
||||
}
|
||||
|
||||
public void clearSuccessfulDownloads() {
|
||||
for (Download download : queue) {
|
||||
if (download.getStatus() == Download.DOWNLOADED) {
|
||||
remove(download);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Observable<Download> getActiveDownloads() {
|
||||
return Observable.from(queue)
|
||||
.filter(download -> download.getStatus() == Download.DOWNLOADING);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.mangafeed.ui.base.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
|
@ -35,6 +36,11 @@ public class BaseActivity extends AppCompatActivity {
|
|||
getSupportActionBar().setSubtitle(getString(titleResource));
|
||||
}
|
||||
|
||||
public void setToolbarElevation(int elevation) {
|
||||
if (getSupportActionBar() != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
getSupportActionBar().setElevation(elevation);
|
||||
}
|
||||
|
||||
public Context getActivity() {
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package eu.kanade.mangafeed.ui.manga;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -17,8 +16,8 @@ import butterknife.Bind;
|
|||
import butterknife.ButterKnife;
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.data.mangasync.MangaSyncManager;
|
||||
import eu.kanade.mangafeed.data.database.models.Manga;
|
||||
import eu.kanade.mangafeed.data.mangasync.MangaSyncManager;
|
||||
import eu.kanade.mangafeed.data.preference.PreferencesHelper;
|
||||
import eu.kanade.mangafeed.ui.base.activity.BaseRxActivity;
|
||||
import eu.kanade.mangafeed.ui.manga.chapter.ChaptersFragment;
|
||||
|
@ -57,7 +56,7 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||
ButterKnife.bind(this);
|
||||
|
||||
setupToolbar(toolbar);
|
||||
disableToolbarElevation();
|
||||
setToolbarElevation(0);
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
|
@ -70,12 +69,6 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||
getPresenter().queryManga(manga_id);
|
||||
}
|
||||
|
||||
private void disableToolbarElevation() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
toolbar.setElevation(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupViewPager() {
|
||||
adapter = new MangaDetailAdapter(
|
||||
getSupportFragmentManager(),
|
||||
|
@ -100,7 +93,6 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||
|
||||
private int pageCount;
|
||||
private String tabTitles[];
|
||||
private Context context;
|
||||
|
||||
final static int INFO_FRAGMENT = 0;
|
||||
final static int CHAPTERS_FRAGMENT = 1;
|
||||
|
@ -108,7 +100,6 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||
|
||||
public MangaDetailAdapter(FragmentManager fm, Context context) {
|
||||
super(fm);
|
||||
this.context = context;
|
||||
tabTitles = new String[]{
|
||||
context.getString(R.string.manga_detail_tab),
|
||||
context.getString(R.string.manga_chapters_tab),
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:theme="@style/ThemeOverlay.AppTheme.Dark">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
layout="@layout/toolbar" />
|
||||
<include layout="@layout/toolbar" />
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
|
|
Loading…
Reference in a new issue