mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 18:25:09 +01:00
Rename classes
This commit is contained in:
parent
fbf141aad8
commit
684c5e98d3
@ -31,7 +31,7 @@
|
||||
android:value="eu.kanade.mangafeed.ui.activity.MainActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activity.CatalogueListActivity"
|
||||
android:name=".ui.activity.CatalogueActivity"
|
||||
android:label="@string/title_activity_catalogue_list"
|
||||
android:parentActivityName=".ui.activity.MainActivity"
|
||||
android:theme="@style/AppTheme" >
|
||||
|
@ -6,8 +6,8 @@ import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
import eu.kanade.mangafeed.data.DataModule;
|
||||
import eu.kanade.mangafeed.presenter.CatalogueListPresenter;
|
||||
import eu.kanade.mangafeed.presenter.CataloguePresenter;
|
||||
import eu.kanade.mangafeed.presenter.SourcePresenter;
|
||||
import eu.kanade.mangafeed.presenter.LibraryPresenter;
|
||||
import eu.kanade.mangafeed.presenter.MangaDetailPresenter;
|
||||
|
||||
@ -22,8 +22,8 @@ public interface AppComponent {
|
||||
|
||||
void inject(LibraryPresenter libraryPresenter);
|
||||
void inject(MangaDetailPresenter mangaDetailPresenter);
|
||||
void inject(SourcePresenter sourcePresenter);
|
||||
void inject(CataloguePresenter cataloguePresenter);
|
||||
void inject(CatalogueListPresenter catalogueListPresenter);
|
||||
|
||||
Application application();
|
||||
}
|
||||
|
@ -1,227 +0,0 @@
|
||||
package eu.kanade.mangafeed.presenter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||
import eu.kanade.mangafeed.data.models.Manga;
|
||||
import eu.kanade.mangafeed.sources.Source;
|
||||
import eu.kanade.mangafeed.ui.adapter.CatalogueListHolder;
|
||||
import eu.kanade.mangafeed.view.CatalogueListView;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import rx.subjects.PublishSubject;
|
||||
import timber.log.Timber;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public class CatalogueListPresenter extends BasePresenter {
|
||||
|
||||
CatalogueListView view;
|
||||
EasyAdapter<Manga> adapter;
|
||||
Source selectedSource;
|
||||
|
||||
@Inject SourceManager sourceManager;
|
||||
@Inject DatabaseHelper db;
|
||||
|
||||
private String mSearchName;
|
||||
private boolean mSearchMode;
|
||||
private final int SEARCH_TIMEOUT = 1000;
|
||||
|
||||
private Subscription mMangaFetchSubscription;
|
||||
private Subscription mMangaSearchSubscription;
|
||||
private Subscription mSearchViewSubscription;
|
||||
private Subscription mMangaDetailFetchSubscription;
|
||||
private PublishSubject<Observable<String>> mSearchViewPublishSubject;
|
||||
private PublishSubject<Observable<List<Manga>>> mMangaDetailPublishSubject;
|
||||
|
||||
|
||||
public CatalogueListPresenter(CatalogueListView view) {
|
||||
this.view = view;
|
||||
App.getComponent(view.getActivity()).inject(this);
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
initializeSource();
|
||||
initializeAdapter();
|
||||
initializeSearch();
|
||||
initializeMangaDetailsLoader();
|
||||
|
||||
view.showProgressBar();
|
||||
getMangasFromSource(1);
|
||||
}
|
||||
|
||||
private void initializeSource() {
|
||||
int sourceId = view.getIntent().getIntExtra(Intent.EXTRA_UID, -1);
|
||||
selectedSource = sourceManager.get(sourceId);
|
||||
view.setSourceTitle(selectedSource.getName());
|
||||
}
|
||||
|
||||
private void initializeAdapter() {
|
||||
adapter = new EasyAdapter<>(view.getActivity(), CatalogueListHolder.class);
|
||||
view.setAdapter(adapter);
|
||||
view.setScrollListener();
|
||||
}
|
||||
|
||||
private void initializeSearch() {
|
||||
mSearchName = "";
|
||||
mSearchMode = false;
|
||||
mSearchViewPublishSubject = PublishSubject.create();
|
||||
|
||||
mSearchViewSubscription = Observable.switchOnNext(mSearchViewPublishSubject)
|
||||
.debounce(SEARCH_TIMEOUT, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
this::queryFromSearch,
|
||||
error -> Timber.e(error.getCause(), error.getMessage()));
|
||||
|
||||
subscriptions.add(mSearchViewSubscription);
|
||||
}
|
||||
|
||||
private void initializeMangaDetailsLoader() {
|
||||
mMangaDetailPublishSubject = PublishSubject.create();
|
||||
|
||||
mMangaDetailFetchSubscription = Observable.switchOnNext(mMangaDetailPublishSubject)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.flatMap(Observable::from)
|
||||
.filter(manga -> !manga.initialized)
|
||||
.buffer(3)
|
||||
.concatMap(localMangas -> {
|
||||
List<Observable<Manga>> mangaObservables = new ArrayList<>();
|
||||
for (Manga manga : localMangas) {
|
||||
Observable<Manga> tempObs = selectedSource.pullMangaFromNetwork(manga.url)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.flatMap(networkManga -> {
|
||||
Manga.copyFromNetwork(manga, networkManga);
|
||||
db.insertMangaBlock(manga);
|
||||
return Observable.just(manga);
|
||||
});
|
||||
mangaObservables.add(tempObs);
|
||||
}
|
||||
return Observable.merge(mangaObservables);
|
||||
})
|
||||
.filter(manga -> manga.initialized)
|
||||
.onBackpressureBuffer()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(manga -> {
|
||||
// Get manga index in the adapter
|
||||
int index = getMangaIndex(manga);
|
||||
// Get the image view associated with the manga.
|
||||
// If it's null (not visible in the screen) there's no need to update the image.
|
||||
ImageView imageView = view.getImageView(index);
|
||||
if (imageView != null) {
|
||||
updateImage(imageView, manga.thumbnail_url);
|
||||
}
|
||||
});
|
||||
|
||||
subscriptions.add(mMangaDetailFetchSubscription);
|
||||
}
|
||||
|
||||
public void getMangasFromSource(int page) {
|
||||
subscriptions.remove(mMangaFetchSubscription);
|
||||
|
||||
mMangaFetchSubscription = getMangasSubscriber(
|
||||
selectedSource.pullPopularMangasFromNetwork(page));
|
||||
|
||||
subscriptions.add(mMangaFetchSubscription);
|
||||
}
|
||||
|
||||
public void getMangasFromSearch(int page) {
|
||||
subscriptions.remove(mMangaSearchSubscription);
|
||||
|
||||
mMangaSearchSubscription = getMangasSubscriber(
|
||||
selectedSource.searchMangasFromNetwork(mSearchName, page));
|
||||
|
||||
subscriptions.add(mMangaSearchSubscription);
|
||||
}
|
||||
|
||||
private Subscription getMangasSubscriber(Observable<List<Manga>> mangas) {
|
||||
return mangas
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(Observable::from)
|
||||
.map(this::networkToLocalManga)
|
||||
.toList()
|
||||
.subscribe(newMangas -> {
|
||||
view.hideProgressBar();
|
||||
adapter.addItems(newMangas);
|
||||
if (mMangaDetailPublishSubject != null)
|
||||
mMangaDetailPublishSubject.onNext(Observable.just(newMangas));
|
||||
});
|
||||
}
|
||||
|
||||
private Manga networkToLocalManga(Manga networkManga) {
|
||||
Manga localManga = db.getMangaBlock(networkManga.url);
|
||||
if (localManga == null) {
|
||||
db.insertMangaBlock(networkManga);
|
||||
localManga = db.getMangaBlock(networkManga.url);
|
||||
}
|
||||
return localManga;
|
||||
}
|
||||
|
||||
public void onQueryTextChange(String query) {
|
||||
if (mSearchViewPublishSubject != null)
|
||||
mSearchViewPublishSubject.onNext(Observable.just(query));
|
||||
}
|
||||
|
||||
private void queryFromSearch(String query) {
|
||||
// If search button clicked
|
||||
if (mSearchName.equals("") && query.equals("")) {
|
||||
return;
|
||||
}
|
||||
// If going to search mode
|
||||
else if (mSearchName.equals("") && !query.equals("")) {
|
||||
mSearchMode = true;
|
||||
}
|
||||
// If going to normal mode
|
||||
else if (!mSearchName.equals("") && query.equals("")) {
|
||||
mSearchMode = false;
|
||||
}
|
||||
|
||||
mSearchName = query;
|
||||
adapter.getItems().clear();
|
||||
view.showProgressBar();
|
||||
view.resetScrollListener();
|
||||
loadMoreMangas(1);
|
||||
}
|
||||
|
||||
public void loadMoreMangas(int page) {
|
||||
if (page > 1) {
|
||||
view.showGridProgressBar();
|
||||
}
|
||||
if (mSearchMode) {
|
||||
getMangasFromSearch(page);
|
||||
} else {
|
||||
getMangasFromSource(page);
|
||||
}
|
||||
}
|
||||
|
||||
private int getMangaIndex(Manga manga) {
|
||||
for (int i = 0; i < adapter.getCount(); i++) {
|
||||
if (manga.id == adapter.getItem(i).id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void updateImage(ImageView imageView, String thumbnail) {
|
||||
Glide.with(view.getActivity())
|
||||
.load(thumbnail)
|
||||
.centerCrop()
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +1,227 @@
|
||||
package eu.kanade.mangafeed.presenter;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||
import eu.kanade.mangafeed.data.models.Manga;
|
||||
import eu.kanade.mangafeed.sources.Source;
|
||||
import eu.kanade.mangafeed.ui.activity.CatalogueListActivity;
|
||||
import eu.kanade.mangafeed.ui.adapter.SourceHolder;
|
||||
import eu.kanade.mangafeed.ui.adapter.CatalogueHolder;
|
||||
import eu.kanade.mangafeed.view.CatalogueView;
|
||||
import rx.Observable;
|
||||
import rx.Subscription;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
import rx.subjects.PublishSubject;
|
||||
import timber.log.Timber;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public class CataloguePresenter extends BasePresenter {
|
||||
|
||||
public class CataloguePresenter {
|
||||
|
||||
private CatalogueView view;
|
||||
CatalogueView view;
|
||||
EasyAdapter<Manga> adapter;
|
||||
Source selectedSource;
|
||||
|
||||
@Inject SourceManager sourceManager;
|
||||
@Inject DatabaseHelper db;
|
||||
|
||||
private String mSearchName;
|
||||
private boolean mSearchMode;
|
||||
private final int SEARCH_TIMEOUT = 1000;
|
||||
|
||||
private Subscription mMangaFetchSubscription;
|
||||
private Subscription mMangaSearchSubscription;
|
||||
private Subscription mSearchViewSubscription;
|
||||
private Subscription mMangaDetailFetchSubscription;
|
||||
private PublishSubject<Observable<String>> mSearchViewPublishSubject;
|
||||
private PublishSubject<Observable<List<Manga>>> mMangaDetailPublishSubject;
|
||||
|
||||
EasyAdapter<Source> adapter;
|
||||
|
||||
public CataloguePresenter(CatalogueView view) {
|
||||
this.view = view;
|
||||
App.getComponent(view.getActivity()).inject(this);
|
||||
}
|
||||
|
||||
public void initializeSources() {
|
||||
adapter = new EasyAdapter<>(
|
||||
view.getActivity(),
|
||||
SourceHolder.class,
|
||||
sourceManager.getSources());
|
||||
public void initialize() {
|
||||
initializeSource();
|
||||
initializeAdapter();
|
||||
initializeSearch();
|
||||
initializeMangaDetailsLoader();
|
||||
|
||||
view.showProgressBar();
|
||||
getMangasFromSource(1);
|
||||
}
|
||||
|
||||
private void initializeSource() {
|
||||
int sourceId = view.getIntent().getIntExtra(Intent.EXTRA_UID, -1);
|
||||
selectedSource = sourceManager.get(sourceId);
|
||||
view.setSourceTitle(selectedSource.getName());
|
||||
}
|
||||
|
||||
private void initializeAdapter() {
|
||||
adapter = new EasyAdapter<>(view.getActivity(), CatalogueHolder.class);
|
||||
view.setAdapter(adapter);
|
||||
view.setSourceClickListener();
|
||||
view.setScrollListener();
|
||||
}
|
||||
|
||||
public void onSourceClick(int position) {
|
||||
Intent intent = new Intent(view.getActivity(), CatalogueListActivity.class);
|
||||
intent.putExtra(Intent.EXTRA_UID, adapter.getItem(position).getSource());
|
||||
view.getActivity().startActivity(intent);
|
||||
private void initializeSearch() {
|
||||
mSearchName = "";
|
||||
mSearchMode = false;
|
||||
mSearchViewPublishSubject = PublishSubject.create();
|
||||
|
||||
mSearchViewSubscription = Observable.switchOnNext(mSearchViewPublishSubject)
|
||||
.debounce(SEARCH_TIMEOUT, TimeUnit.MILLISECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
this::queryFromSearch,
|
||||
error -> Timber.e(error.getCause(), error.getMessage()));
|
||||
|
||||
subscriptions.add(mSearchViewSubscription);
|
||||
}
|
||||
|
||||
private void initializeMangaDetailsLoader() {
|
||||
mMangaDetailPublishSubject = PublishSubject.create();
|
||||
|
||||
mMangaDetailFetchSubscription = Observable.switchOnNext(mMangaDetailPublishSubject)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.flatMap(Observable::from)
|
||||
.filter(manga -> !manga.initialized)
|
||||
.buffer(3)
|
||||
.concatMap(localMangas -> {
|
||||
List<Observable<Manga>> mangaObservables = new ArrayList<>();
|
||||
for (Manga manga : localMangas) {
|
||||
Observable<Manga> tempObs = selectedSource.pullMangaFromNetwork(manga.url)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.flatMap(networkManga -> {
|
||||
Manga.copyFromNetwork(manga, networkManga);
|
||||
db.insertMangaBlock(manga);
|
||||
return Observable.just(manga);
|
||||
});
|
||||
mangaObservables.add(tempObs);
|
||||
}
|
||||
return Observable.merge(mangaObservables);
|
||||
})
|
||||
.filter(manga -> manga.initialized)
|
||||
.onBackpressureBuffer()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(manga -> {
|
||||
// Get manga index in the adapter
|
||||
int index = getMangaIndex(manga);
|
||||
// Get the image view associated with the manga.
|
||||
// If it's null (not visible in the screen) there's no need to update the image.
|
||||
ImageView imageView = view.getImageView(index);
|
||||
if (imageView != null) {
|
||||
updateImage(imageView, manga.thumbnail_url);
|
||||
}
|
||||
});
|
||||
|
||||
subscriptions.add(mMangaDetailFetchSubscription);
|
||||
}
|
||||
|
||||
public void getMangasFromSource(int page) {
|
||||
subscriptions.remove(mMangaFetchSubscription);
|
||||
|
||||
mMangaFetchSubscription = getMangasSubscriber(
|
||||
selectedSource.pullPopularMangasFromNetwork(page));
|
||||
|
||||
subscriptions.add(mMangaFetchSubscription);
|
||||
}
|
||||
|
||||
public void getMangasFromSearch(int page) {
|
||||
subscriptions.remove(mMangaSearchSubscription);
|
||||
|
||||
mMangaSearchSubscription = getMangasSubscriber(
|
||||
selectedSource.searchMangasFromNetwork(mSearchName, page));
|
||||
|
||||
subscriptions.add(mMangaSearchSubscription);
|
||||
}
|
||||
|
||||
private Subscription getMangasSubscriber(Observable<List<Manga>> mangas) {
|
||||
return mangas
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(Observable::from)
|
||||
.map(this::networkToLocalManga)
|
||||
.toList()
|
||||
.subscribe(newMangas -> {
|
||||
view.hideProgressBar();
|
||||
adapter.addItems(newMangas);
|
||||
if (mMangaDetailPublishSubject != null)
|
||||
mMangaDetailPublishSubject.onNext(Observable.just(newMangas));
|
||||
});
|
||||
}
|
||||
|
||||
private Manga networkToLocalManga(Manga networkManga) {
|
||||
Manga localManga = db.getMangaBlock(networkManga.url);
|
||||
if (localManga == null) {
|
||||
db.insertMangaBlock(networkManga);
|
||||
localManga = db.getMangaBlock(networkManga.url);
|
||||
}
|
||||
return localManga;
|
||||
}
|
||||
|
||||
public void onQueryTextChange(String query) {
|
||||
if (mSearchViewPublishSubject != null)
|
||||
mSearchViewPublishSubject.onNext(Observable.just(query));
|
||||
}
|
||||
|
||||
private void queryFromSearch(String query) {
|
||||
// If search button clicked
|
||||
if (mSearchName.equals("") && query.equals("")) {
|
||||
return;
|
||||
}
|
||||
// If going to search mode
|
||||
else if (mSearchName.equals("") && !query.equals("")) {
|
||||
mSearchMode = true;
|
||||
}
|
||||
// If going to normal mode
|
||||
else if (!mSearchName.equals("") && query.equals("")) {
|
||||
mSearchMode = false;
|
||||
}
|
||||
|
||||
mSearchName = query;
|
||||
adapter.getItems().clear();
|
||||
view.showProgressBar();
|
||||
view.resetScrollListener();
|
||||
loadMoreMangas(1);
|
||||
}
|
||||
|
||||
public void loadMoreMangas(int page) {
|
||||
if (page > 1) {
|
||||
view.showGridProgressBar();
|
||||
}
|
||||
if (mSearchMode) {
|
||||
getMangasFromSearch(page);
|
||||
} else {
|
||||
getMangasFromSource(page);
|
||||
}
|
||||
}
|
||||
|
||||
private int getMangaIndex(Manga manga) {
|
||||
for (int i = 0; i < adapter.getCount(); i++) {
|
||||
if (manga.id == adapter.getItem(i).id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void updateImage(ImageView imageView, String thumbnail) {
|
||||
Glide.with(view.getActivity())
|
||||
.load(thumbnail)
|
||||
.centerCrop()
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package eu.kanade.mangafeed.presenter;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||
import eu.kanade.mangafeed.sources.Source;
|
||||
import eu.kanade.mangafeed.ui.activity.CatalogueActivity;
|
||||
import eu.kanade.mangafeed.ui.adapter.SourceHolder;
|
||||
import eu.kanade.mangafeed.view.SourceView;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
|
||||
public class SourcePresenter {
|
||||
|
||||
private SourceView view;
|
||||
|
||||
@Inject SourceManager sourceManager;
|
||||
|
||||
EasyAdapter<Source> adapter;
|
||||
|
||||
public SourcePresenter(SourceView view) {
|
||||
this.view = view;
|
||||
App.getComponent(view.getActivity()).inject(this);
|
||||
}
|
||||
|
||||
public void initializeSources() {
|
||||
adapter = new EasyAdapter<>(
|
||||
view.getActivity(),
|
||||
SourceHolder.class,
|
||||
sourceManager.getSources());
|
||||
|
||||
view.setAdapter(adapter);
|
||||
view.setSourceClickListener();
|
||||
}
|
||||
|
||||
public void onSourceClick(int position) {
|
||||
Intent intent = new Intent(view.getActivity(), CatalogueActivity.class);
|
||||
intent.putExtra(Intent.EXTRA_UID, adapter.getItem(position).getSource());
|
||||
view.getActivity().startActivity(intent);
|
||||
}
|
||||
}
|
@ -12,12 +12,12 @@ import android.widget.ProgressBar;
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.presenter.CatalogueListPresenter;
|
||||
import eu.kanade.mangafeed.view.CatalogueListView;
|
||||
import eu.kanade.mangafeed.presenter.CataloguePresenter;
|
||||
import eu.kanade.mangafeed.view.CatalogueView;
|
||||
import eu.kanade.mangafeed.widget.EndlessScrollListener;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public class CatalogueListActivity extends BaseActivity implements CatalogueListView {
|
||||
public class CatalogueActivity extends BaseActivity implements CatalogueView {
|
||||
|
||||
@Bind(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@ -31,7 +31,7 @@ public class CatalogueListActivity extends BaseActivity implements CatalogueList
|
||||
@Bind(R.id.progress_grid)
|
||||
ProgressBar progress_grid;
|
||||
|
||||
private CatalogueListPresenter presenter;
|
||||
private CataloguePresenter presenter;
|
||||
|
||||
private EndlessScrollListener scrollListener;
|
||||
|
||||
@ -43,7 +43,7 @@ public class CatalogueListActivity extends BaseActivity implements CatalogueList
|
||||
|
||||
setupToolbar(toolbar);
|
||||
|
||||
presenter = new CatalogueListPresenter(this);
|
||||
presenter = new CataloguePresenter(this);
|
||||
presenter.initialize();
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class CatalogueListActivity extends BaseActivity implements CatalogueList
|
||||
});
|
||||
}
|
||||
|
||||
// CatalogueListView
|
||||
// CatalogueView
|
||||
|
||||
@Override
|
||||
public void setSourceTitle(String title) {
|
@ -13,7 +13,7 @@ import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.ui.fragment.CatalogueFragment;
|
||||
import eu.kanade.mangafeed.ui.fragment.SourceFragment;
|
||||
import eu.kanade.mangafeed.ui.fragment.LibraryFragment;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
@ -65,7 +65,7 @@ public class MainActivity extends BaseActivity {
|
||||
case R.id.nav_drawer_recent_updates:
|
||||
break;
|
||||
case R.id.nav_drawer_catalogues:
|
||||
setFragment(CatalogueFragment.newInstance());
|
||||
setFragment(SourceFragment.newInstance());
|
||||
break;
|
||||
case R.id.nav_drawer_settings:
|
||||
break;
|
||||
|
@ -15,7 +15,7 @@ import uk.co.ribot.easyadapter.annotations.LayoutId;
|
||||
import uk.co.ribot.easyadapter.annotations.ViewId;
|
||||
|
||||
@LayoutId(R.layout.item_catalogue)
|
||||
public class CatalogueListHolder extends ItemViewHolder<Manga> {
|
||||
public class CatalogueHolder extends ItemViewHolder<Manga> {
|
||||
|
||||
@ViewId(R.id.catalogue_title)
|
||||
TextView title;
|
||||
@ -23,7 +23,7 @@ public class CatalogueListHolder extends ItemViewHolder<Manga> {
|
||||
@ViewId(R.id.catalogue_thumbnail)
|
||||
ImageView image;
|
||||
|
||||
public CatalogueListHolder(View view) {
|
||||
public CatalogueHolder(View view) {
|
||||
super(view);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class LibraryAdapter<T> extends EasyAdapter<T> implements Filterable {
|
||||
|
||||
public LibraryAdapter(Context context) {
|
||||
super(context, LibraryHolder.class);
|
||||
filter = new CatalogueFilter();
|
||||
filter = new LibraryFilter();
|
||||
}
|
||||
|
||||
public void setNewItems(List<T> list) {
|
||||
@ -30,7 +30,7 @@ public class LibraryAdapter<T> extends EasyAdapter<T> implements Filterable {
|
||||
return filter;
|
||||
}
|
||||
|
||||
private class CatalogueFilter extends Filter {
|
||||
private class LibraryFilter extends Filter {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence charSequence) {
|
||||
FilterResults results = new FilterResults();
|
||||
|
@ -9,22 +9,22 @@ import android.widget.ListView;
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.presenter.CataloguePresenter;
|
||||
import eu.kanade.mangafeed.presenter.SourcePresenter;
|
||||
import eu.kanade.mangafeed.ui.activity.MainActivity;
|
||||
import eu.kanade.mangafeed.view.CatalogueView;
|
||||
import eu.kanade.mangafeed.view.SourceView;
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
|
||||
public class CatalogueFragment extends BaseFragment implements CatalogueView {
|
||||
public class SourceFragment extends BaseFragment implements SourceView {
|
||||
|
||||
private CataloguePresenter presenter;
|
||||
private SourcePresenter presenter;
|
||||
private MainActivity activity;
|
||||
|
||||
@Bind(R.id.catalogue_list)
|
||||
ListView source_list;
|
||||
|
||||
public static CatalogueFragment newInstance() {
|
||||
CatalogueFragment fragment = new CatalogueFragment();
|
||||
public static SourceFragment newInstance() {
|
||||
SourceFragment fragment = new SourceFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
@ -34,7 +34,7 @@ public class CatalogueFragment extends BaseFragment implements CatalogueView {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
presenter = new CataloguePresenter(this);
|
||||
presenter = new SourcePresenter(this);
|
||||
activity = (MainActivity)getActivity();
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ public class CatalogueFragment extends BaseFragment implements CatalogueView {
|
||||
return view;
|
||||
}
|
||||
|
||||
// CatalogueView
|
||||
// SourceView
|
||||
|
||||
@Override
|
||||
public void setAdapter(EasyAdapter adapter) {
|
@ -1,18 +0,0 @@
|
||||
package eu.kanade.mangafeed.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public interface CatalogueListView extends BaseView {
|
||||
Intent getIntent();
|
||||
void setSourceTitle(String title);
|
||||
void setAdapter(EasyAdapter adapter);
|
||||
void setScrollListener();
|
||||
void resetScrollListener();
|
||||
void showProgressBar();
|
||||
void showGridProgressBar();
|
||||
void hideProgressBar();
|
||||
ImageView getImageView(int position);
|
||||
}
|
@ -1,8 +1,18 @@
|
||||
package eu.kanade.mangafeed.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public interface CatalogueView extends BaseView {
|
||||
Intent getIntent();
|
||||
void setSourceTitle(String title);
|
||||
void setAdapter(EasyAdapter adapter);
|
||||
void setSourceClickListener();
|
||||
void setScrollListener();
|
||||
void resetScrollListener();
|
||||
void showProgressBar();
|
||||
void showGridProgressBar();
|
||||
void hideProgressBar();
|
||||
ImageView getImageView(int position);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package eu.kanade.mangafeed.view;
|
||||
|
||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||
|
||||
public interface SourceView extends BaseView {
|
||||
void setAdapter(EasyAdapter adapter);
|
||||
void setSourceClickListener();
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
||||
tools:context="eu.kanade.mangafeed.ui.activity.CatalogueListActivity">
|
||||
tools:context="eu.kanade.mangafeed.ui.activity.CatalogueActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar"
|
||||
|
@ -2,7 +2,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="eu.kanade.mangafeed.ui.fragment.CatalogueFragment">
|
||||
tools:context="eu.kanade.mangafeed.ui.fragment.SourceFragment">
|
||||
|
||||
|
||||
<ListView
|
||||
|
Loading…
Reference in New Issue
Block a user