mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 01:59:19 +01:00
Organize ui by feature instead of layer
This commit is contained in:
parent
e74f81d41a
commit
4f604e828b
@ -14,7 +14,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.MainActivity"
|
android:name=".ui.main.MainActivity"
|
||||||
android:label="@string/label_main"
|
android:label="@string/label_main"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/AppTheme.NoActionBar" >
|
android:theme="@style/AppTheme.NoActionBar" >
|
||||||
@ -25,23 +25,23 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.MangaDetailActivity"
|
android:name=".ui.manga.MangaActivity"
|
||||||
android:label="@string/title_activity_manga_detail"
|
android:label="@string/title_activity_manga_detail"
|
||||||
android:parentActivityName=".ui.activity.MainActivity" >
|
android:parentActivityName=".ui.main.MainActivity" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.ReaderActivity"
|
android:name=".ui.reader.ReaderActivity"
|
||||||
android:label="@string/title_activity_viewer"
|
android:label="@string/title_activity_viewer"
|
||||||
android:parentActivityName=".ui.activity.MangaDetailActivity"
|
android:parentActivityName=".ui.manga.MangaActivity"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="eu.kanade.mangafeed.ui.activity.MangaDetailActivity" />
|
android:value=".ui.manga.MangaActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.SettingsActivity"
|
android:name=".ui.preference.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:parentActivityName=".ui.activity.MainActivity" >
|
android:parentActivityName=".ui.main.MainActivity" >
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service android:name=".data.services.LibraryUpdateService"
|
<service android:name=".data.services.LibraryUpdateService"
|
||||||
|
@ -9,18 +9,18 @@ import eu.kanade.mangafeed.data.services.DownloadService;
|
|||||||
import eu.kanade.mangafeed.data.services.LibraryUpdateService;
|
import eu.kanade.mangafeed.data.services.LibraryUpdateService;
|
||||||
import eu.kanade.mangafeed.injection.module.AppModule;
|
import eu.kanade.mangafeed.injection.module.AppModule;
|
||||||
import eu.kanade.mangafeed.injection.module.DataModule;
|
import eu.kanade.mangafeed.injection.module.DataModule;
|
||||||
import eu.kanade.mangafeed.presenter.CataloguePresenter;
|
import eu.kanade.mangafeed.ui.catalogue.CataloguePresenter;
|
||||||
import eu.kanade.mangafeed.presenter.DownloadQueuePresenter;
|
import eu.kanade.mangafeed.ui.download.DownloadPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.LibraryPresenter;
|
import eu.kanade.mangafeed.ui.library.LibraryPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.MangaChaptersPresenter;
|
import eu.kanade.mangafeed.ui.manga.MangaPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.MangaDetailPresenter;
|
import eu.kanade.mangafeed.ui.manga.chapter.ChaptersPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.MangaInfoPresenter;
|
import eu.kanade.mangafeed.ui.manga.info.MangaInfoPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.ReaderPresenter;
|
import eu.kanade.mangafeed.ui.reader.ReaderPresenter;
|
||||||
import eu.kanade.mangafeed.presenter.SourcePresenter;
|
import eu.kanade.mangafeed.ui.catalogue.SourcePresenter;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.fragment.SettingsAccountsFragment;
|
import eu.kanade.mangafeed.ui.preference.SettingsAccountsFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.SettingsDownloadsFragment;
|
import eu.kanade.mangafeed.ui.preference.SettingsDownloadsFragment;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Component(
|
@Component(
|
||||||
@ -32,13 +32,13 @@ import eu.kanade.mangafeed.ui.fragment.SettingsDownloadsFragment;
|
|||||||
public interface AppComponent {
|
public interface AppComponent {
|
||||||
|
|
||||||
void inject(LibraryPresenter libraryPresenter);
|
void inject(LibraryPresenter libraryPresenter);
|
||||||
void inject(MangaDetailPresenter mangaDetailPresenter);
|
void inject(MangaPresenter mangaPresenter);
|
||||||
void inject(SourcePresenter sourcePresenter);
|
void inject(SourcePresenter sourcePresenter);
|
||||||
void inject(CataloguePresenter cataloguePresenter);
|
void inject(CataloguePresenter cataloguePresenter);
|
||||||
void inject(MangaInfoPresenter mangaInfoPresenter);
|
void inject(MangaInfoPresenter mangaInfoPresenter);
|
||||||
void inject(MangaChaptersPresenter mangaChaptersPresenter);
|
void inject(ChaptersPresenter chaptersPresenter);
|
||||||
void inject(ReaderPresenter readerPresenter);
|
void inject(ReaderPresenter readerPresenter);
|
||||||
void inject(DownloadQueuePresenter downloadQueuePresenter);
|
void inject(DownloadPresenter downloadPresenter);
|
||||||
|
|
||||||
void inject(ReaderActivity readerActivity);
|
void inject(ReaderActivity readerActivity);
|
||||||
void inject(SettingsAccountsFragment settingsAccountsFragment);
|
void inject(SettingsAccountsFragment settingsAccountsFragment);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity.base;
|
package eu.kanade.mangafeed.ui.base.activity;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
@ -1,9 +1,10 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity.base;
|
package eu.kanade.mangafeed.ui.base.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import nucleus.factory.PresenterFactory;
|
import nucleus.factory.PresenterFactory;
|
||||||
import nucleus.factory.ReflectionPresenterFactory;
|
import nucleus.factory.ReflectionPresenterFactory;
|
||||||
import nucleus.presenter.Presenter;
|
import nucleus.presenter.Presenter;
|
@ -1,8 +1,8 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment.base;
|
package eu.kanade.mangafeed.ui.base.fragment;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
|
|
||||||
public class BaseFragment extends Fragment {
|
public class BaseFragment extends Fragment {
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment.base;
|
package eu.kanade.mangafeed.ui.base.fragment;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
|
import eu.kanade.mangafeed.ui.base.fragment.BaseFragment;
|
||||||
import nucleus.factory.PresenterFactory;
|
import nucleus.factory.PresenterFactory;
|
||||||
import nucleus.factory.ReflectionPresenterFactory;
|
import nucleus.factory.ReflectionPresenterFactory;
|
||||||
import nucleus.presenter.Presenter;
|
import nucleus.presenter.Presenter;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.base.presenter;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -22,10 +22,8 @@ import butterknife.ButterKnife;
|
|||||||
import butterknife.OnItemClick;
|
import butterknife.OnItemClick;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.presenter.CataloguePresenter;
|
import eu.kanade.mangafeed.ui.manga.MangaActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.holder.CatalogueHolder;
|
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import eu.kanade.mangafeed.util.PageBundle;
|
import eu.kanade.mangafeed.util.PageBundle;
|
||||||
import eu.kanade.mangafeed.widget.EndlessScrollListener;
|
import eu.kanade.mangafeed.widget.EndlessScrollListener;
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
@ -125,8 +123,8 @@ public class CatalogueFragment extends BaseRxFragment<CataloguePresenter> {
|
|||||||
public void onMangaClick(int position) {
|
public void onMangaClick(int position) {
|
||||||
Manga selectedManga = adapter.getItem(position);
|
Manga selectedManga = adapter.getItem(position);
|
||||||
|
|
||||||
Intent intent = MangaDetailActivity.newIntent(getActivity(), selectedManga);
|
Intent intent = MangaActivity.newIntent(getActivity(), selectedManga);
|
||||||
intent.putExtra(MangaDetailActivity.MANGA_ONLINE, true);
|
intent.putExtra(MangaActivity.MANGA_ONLINE, true);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.holder;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
|||||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.fragment.CatalogueFragment;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.mangafeed.util.PageBundle;
|
import eu.kanade.mangafeed.util.PageBundle;
|
||||||
import eu.kanade.mangafeed.util.RxPager;
|
import eu.kanade.mangafeed.util.RxPager;
|
||||||
import icepick.State;
|
import icepick.State;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -13,11 +13,9 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnItemClick;
|
import butterknife.OnItemClick;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.presenter.SourcePresenter;
|
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.activity.MainActivity;
|
import eu.kanade.mangafeed.ui.main.MainActivity;
|
||||||
import eu.kanade.mangafeed.ui.holder.SourceHolder;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.holder;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
@ -1,11 +1,11 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.catalogue;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.fragment.SourceFragment;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
|
|
||||||
|
|
||||||
public class SourcePresenter extends BasePresenter<SourceFragment> {
|
public class SourcePresenter extends BasePresenter<SourceFragment> {
|
@ -1,9 +1,8 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.download;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Download;
|
import eu.kanade.mangafeed.data.models.Download;
|
||||||
import eu.kanade.mangafeed.ui.holder.DownloadHolder;
|
|
||||||
import uk.co.ribot.easyadapter.EasyRecyclerAdapter;
|
import uk.co.ribot.easyadapter.EasyRecyclerAdapter;
|
||||||
|
|
||||||
public class DownloadAdapter extends EasyRecyclerAdapter<Download> {
|
public class DownloadAdapter extends EasyRecyclerAdapter<Download> {
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.download;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
@ -15,20 +15,18 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Download;
|
import eu.kanade.mangafeed.data.models.Download;
|
||||||
import eu.kanade.mangafeed.presenter.DownloadQueuePresenter;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.adapter.DownloadAdapter;
|
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
|
|
||||||
@RequiresPresenter(DownloadQueuePresenter.class)
|
@RequiresPresenter(DownloadPresenter.class)
|
||||||
public class DownloadQueueFragment extends BaseRxFragment<DownloadQueuePresenter> {
|
public class DownloadFragment extends BaseRxFragment<DownloadPresenter> {
|
||||||
|
|
||||||
@Bind(R.id.download_list) RecyclerView downloadList;
|
@Bind(R.id.download_list) RecyclerView downloadList;
|
||||||
private LinearLayoutManager downloadListLayout;
|
private LinearLayoutManager downloadListLayout;
|
||||||
private DownloadAdapter adapter;
|
private DownloadAdapter adapter;
|
||||||
|
|
||||||
public static DownloadQueueFragment newInstance() {
|
public static DownloadFragment newInstance() {
|
||||||
return new DownloadQueueFragment();
|
return new DownloadFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.holder;
|
package eu.kanade.mangafeed.ui.download;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.download;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import eu.kanade.mangafeed.data.helpers.DownloadManager;
|
|||||||
import eu.kanade.mangafeed.data.models.Download;
|
import eu.kanade.mangafeed.data.models.Download;
|
||||||
import eu.kanade.mangafeed.data.models.DownloadQueue;
|
import eu.kanade.mangafeed.data.models.DownloadQueue;
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.fragment.DownloadQueueFragment;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Subscription;
|
import rx.Subscription;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
@ -19,7 +19,7 @@ import rx.schedulers.Schedulers;
|
|||||||
import rx.subjects.PublishSubject;
|
import rx.subjects.PublishSubject;
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment> {
|
public class DownloadPresenter extends BasePresenter<DownloadFragment> {
|
||||||
|
|
||||||
@Inject DownloadManager downloadManager;
|
@Inject DownloadManager downloadManager;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment>
|
|||||||
|
|
||||||
restartableLatestCache(GET_DOWNLOAD_QUEUE,
|
restartableLatestCache(GET_DOWNLOAD_QUEUE,
|
||||||
() -> Observable.just(downloadQueue.get()),
|
() -> Observable.just(downloadQueue.get()),
|
||||||
DownloadQueueFragment::onNextDownloads,
|
DownloadFragment::onNextDownloads,
|
||||||
(view, error) -> Timber.e(error.getMessage()));
|
(view, error) -> Timber.e(error.getMessage()));
|
||||||
|
|
||||||
if (savedState == null)
|
if (savedState == null)
|
||||||
@ -48,7 +48,7 @@ public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTakeView(DownloadQueueFragment view) {
|
protected void onTakeView(DownloadFragment view) {
|
||||||
super.onTakeView(view);
|
super.onTakeView(view);
|
||||||
|
|
||||||
add(statusSubscription = downloadQueue.getStatusObservable()
|
add(statusSubscription = downloadQueue.getStatusObservable()
|
||||||
@ -65,7 +65,7 @@ public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment>
|
|||||||
super.onDropView();
|
super.onDropView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processStatus(Download download, DownloadQueueFragment view) {
|
private void processStatus(Download download, DownloadFragment view) {
|
||||||
switch (download.getStatus()) {
|
switch (download.getStatus()) {
|
||||||
case Download.DOWNLOADING:
|
case Download.DOWNLOADING:
|
||||||
observeProgress(download, view);
|
observeProgress(download, view);
|
||||||
@ -84,7 +84,7 @@ public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void observeProgress(Download download, DownloadQueueFragment view) {
|
private void observeProgress(Download download, DownloadFragment view) {
|
||||||
Subscription subscription = Observable.interval(50, TimeUnit.MILLISECONDS, Schedulers.newThread())
|
Subscription subscription = Observable.interval(50, TimeUnit.MILLISECONDS, Schedulers.newThread())
|
||||||
.flatMap(tick -> Observable.from(download.pages)
|
.flatMap(tick -> Observable.from(download.pages)
|
||||||
.map(Page::getProgress)
|
.map(Page::getProgress)
|
||||||
@ -104,7 +104,7 @@ public class DownloadQueuePresenter extends BasePresenter<DownloadQueueFragment>
|
|||||||
progressSubscriptions.put(download, subscription);
|
progressSubscriptions.put(download, subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void observePagesStatus(Download download, DownloadQueueFragment view) {
|
private void observePagesStatus(Download download, DownloadFragment view) {
|
||||||
PublishSubject<Integer> pageStatusSubject = PublishSubject.create();
|
PublishSubject<Integer> pageStatusSubject = PublishSubject.create();
|
||||||
for (Page page : download.pages) {
|
for (Page page : download.pages) {
|
||||||
if (page.getStatus() != Page.READY)
|
if (page.getStatus() != Page.READY)
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.library;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.widget.Filter;
|
import android.widget.Filter;
|
||||||
@ -7,7 +7,7 @@ import android.widget.Filterable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.ui.holder.LibraryHolder;
|
import eu.kanade.mangafeed.ui.library.LibraryHolder;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import uk.co.ribot.easyadapter.EasyAdapter;
|
import uk.co.ribot.easyadapter.EasyAdapter;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.library;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -20,10 +20,8 @@ import butterknife.OnItemClick;
|
|||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.data.services.LibraryUpdateService;
|
import eu.kanade.mangafeed.data.services.LibraryUpdateService;
|
||||||
import eu.kanade.mangafeed.presenter.LibraryPresenter;
|
import eu.kanade.mangafeed.ui.manga.MangaActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.adapter.LibraryAdapter;
|
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
|
|
||||||
@RequiresPresenter(LibraryPresenter.class)
|
@RequiresPresenter(LibraryPresenter.class)
|
||||||
@ -107,7 +105,7 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> {
|
|||||||
|
|
||||||
@OnItemClick(R.id.gridView)
|
@OnItemClick(R.id.gridView)
|
||||||
protected void onMangaClick(int position) {
|
protected void onMangaClick(int position) {
|
||||||
Intent intent = MangaDetailActivity.newIntent(
|
Intent intent = MangaActivity.newIntent(
|
||||||
getActivity(),
|
getActivity(),
|
||||||
adapter.getItem(position)
|
adapter.getItem(position)
|
||||||
);
|
);
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.holder;
|
package eu.kanade.mangafeed.ui.library;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.library;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
@ -7,8 +7,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||||
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.ui.adapter.LibraryAdapter;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.mangafeed.ui.fragment.LibraryFragment;
|
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Subscription;
|
import rx.Subscription;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity;
|
package eu.kanade.mangafeed.ui.main;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -14,10 +14,11 @@ import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
|||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.preference.SettingsActivity;
|
||||||
import eu.kanade.mangafeed.ui.fragment.DownloadQueueFragment;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import eu.kanade.mangafeed.ui.fragment.LibraryFragment;
|
import eu.kanade.mangafeed.ui.download.DownloadFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.SourceFragment;
|
import eu.kanade.mangafeed.ui.library.LibraryFragment;
|
||||||
|
import eu.kanade.mangafeed.ui.catalogue.SourceFragment;
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity {
|
public class MainActivity extends BaseActivity {
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
setFragment(SourceFragment.newInstance());
|
setFragment(SourceFragment.newInstance());
|
||||||
break;
|
break;
|
||||||
case R.id.nav_drawer_downloads:
|
case R.id.nav_drawer_downloads:
|
||||||
setFragment(DownloadQueueFragment.newInstance());
|
setFragment(DownloadFragment.newInstance());
|
||||||
break;
|
break;
|
||||||
case R.id.nav_drawer_settings:
|
case R.id.nav_drawer_settings:
|
||||||
startActivity(new Intent(this, SettingsActivity.class));
|
startActivity(new Intent(this, SettingsActivity.class));
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity;
|
package eu.kanade.mangafeed.ui.manga;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -16,14 +16,13 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.presenter.MangaDetailPresenter;
|
import eu.kanade.mangafeed.ui.base.activity.BaseRxActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseRxActivity;
|
import eu.kanade.mangafeed.ui.manga.chapter.ChaptersFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.MangaChaptersFragment;
|
import eu.kanade.mangafeed.ui.manga.info.MangaInfoFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.MangaInfoFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
|
|
||||||
@RequiresPresenter(MangaDetailPresenter.class)
|
@RequiresPresenter(MangaPresenter.class)
|
||||||
public class MangaDetailActivity extends BaseRxActivity<MangaDetailPresenter> {
|
public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
||||||
|
|
||||||
@Bind(R.id.toolbar) Toolbar toolbar;
|
@Bind(R.id.toolbar) Toolbar toolbar;
|
||||||
@Bind(R.id.tabs) TabLayout tabs;
|
@Bind(R.id.tabs) TabLayout tabs;
|
||||||
@ -37,7 +36,7 @@ public class MangaDetailActivity extends BaseRxActivity<MangaDetailPresenter> {
|
|||||||
public final static String MANGA_ONLINE = "manga_online";
|
public final static String MANGA_ONLINE = "manga_online";
|
||||||
|
|
||||||
public static Intent newIntent(Context context, Manga manga) {
|
public static Intent newIntent(Context context, Manga manga) {
|
||||||
Intent intent = new Intent(context, MangaDetailActivity.class);
|
Intent intent = new Intent(context, MangaActivity.class);
|
||||||
intent.putExtra(MANGA_ID, manga.id);
|
intent.putExtra(MANGA_ID, manga.id);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
@ -127,7 +126,7 @@ public class MangaDetailActivity extends BaseRxActivity<MangaDetailPresenter> {
|
|||||||
case INFO_FRAGMENT:
|
case INFO_FRAGMENT:
|
||||||
return MangaInfoFragment.newInstance();
|
return MangaInfoFragment.newInstance();
|
||||||
case CHAPTERS_FRAGMENT:
|
case CHAPTERS_FRAGMENT:
|
||||||
return MangaChaptersFragment.newInstance();
|
return ChaptersFragment.newInstance();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.manga;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -7,12 +7,12 @@ import javax.inject.Inject;
|
|||||||
import de.greenrobot.event.EventBus;
|
import de.greenrobot.event.EventBus;
|
||||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.schedulers.Schedulers;
|
import rx.schedulers.Schedulers;
|
||||||
|
|
||||||
public class MangaDetailPresenter extends BasePresenter<MangaDetailActivity> {
|
public class MangaPresenter extends BasePresenter<MangaActivity> {
|
||||||
|
|
||||||
@Inject DatabaseHelper db;
|
@Inject DatabaseHelper db;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.manga.chapter;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -10,9 +10,7 @@ import java.util.List;
|
|||||||
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Chapter;
|
import eu.kanade.mangafeed.data.models.Chapter;
|
||||||
import eu.kanade.mangafeed.ui.fragment.MangaChaptersFragment;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseFragment;
|
|
||||||
import eu.kanade.mangafeed.ui.holder.ChaptersHolder;
|
|
||||||
|
|
||||||
public class ChaptersAdapter extends FlexibleAdapter<ChaptersHolder, Chapter> {
|
public class ChaptersAdapter extends FlexibleAdapter<ChaptersHolder, Chapter> {
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ public class ChaptersAdapter extends FlexibleAdapter<ChaptersHolder, Chapter> {
|
|||||||
void onListItemLongClick(int position);
|
void onListItemLongClick(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MangaChaptersFragment getMangaChaptersFragment() {
|
public ChaptersFragment getMangaChaptersFragment() {
|
||||||
return (MangaChaptersFragment) fragment;
|
return (ChaptersFragment) fragment;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.manga.chapter;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -20,17 +20,15 @@ import butterknife.ButterKnife;
|
|||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Chapter;
|
import eu.kanade.mangafeed.data.models.Chapter;
|
||||||
import eu.kanade.mangafeed.data.services.DownloadService;
|
import eu.kanade.mangafeed.data.services.DownloadService;
|
||||||
import eu.kanade.mangafeed.presenter.MangaChaptersPresenter;
|
import eu.kanade.mangafeed.ui.manga.MangaActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.adapter.ChaptersAdapter;
|
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
|
|
||||||
@RequiresPresenter(MangaChaptersPresenter.class)
|
@RequiresPresenter(ChaptersPresenter.class)
|
||||||
public class MangaChaptersFragment extends BaseRxFragment<MangaChaptersPresenter> implements
|
public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implements
|
||||||
ActionMode.Callback, ChaptersAdapter.OnItemClickListener {
|
ActionMode.Callback, ChaptersAdapter.OnItemClickListener {
|
||||||
|
|
||||||
@Bind(R.id.chapter_list) RecyclerView chapters;
|
@Bind(R.id.chapter_list) RecyclerView chapters;
|
||||||
@ -40,8 +38,8 @@ public class MangaChaptersFragment extends BaseRxFragment<MangaChaptersPresenter
|
|||||||
|
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
|
|
||||||
public static MangaChaptersFragment newInstance() {
|
public static ChaptersFragment newInstance() {
|
||||||
return new MangaChaptersFragment();
|
return new ChaptersFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -103,7 +101,7 @@ public class MangaChaptersFragment extends BaseRxFragment<MangaChaptersPresenter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnlineManga() {
|
public boolean isOnlineManga() {
|
||||||
return ((MangaDetailActivity)getActivity()).isOnlineManga();
|
return ((MangaActivity)getActivity()).isOnlineManga();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.holder;
|
package eu.kanade.mangafeed.ui.manga.chapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
@ -12,7 +12,7 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Chapter;
|
import eu.kanade.mangafeed.data.models.Chapter;
|
||||||
import eu.kanade.mangafeed.ui.adapter.ChaptersAdapter;
|
import eu.kanade.mangafeed.ui.manga.chapter.ChaptersAdapter;
|
||||||
|
|
||||||
public class ChaptersHolder extends RecyclerView.ViewHolder implements
|
public class ChaptersHolder extends RecyclerView.ViewHolder implements
|
||||||
View.OnClickListener, View.OnLongClickListener {
|
View.OnClickListener, View.OnLongClickListener {
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.manga.chapter;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ import eu.kanade.mangafeed.events.ChapterCountEvent;
|
|||||||
import eu.kanade.mangafeed.events.DownloadChaptersEvent;
|
import eu.kanade.mangafeed.events.DownloadChaptersEvent;
|
||||||
import eu.kanade.mangafeed.events.SourceMangaChapterEvent;
|
import eu.kanade.mangafeed.events.SourceMangaChapterEvent;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.fragment.MangaChaptersFragment;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.mangafeed.util.EventBusHook;
|
import eu.kanade.mangafeed.util.EventBusHook;
|
||||||
import eu.kanade.mangafeed.util.PostResult;
|
import eu.kanade.mangafeed.util.PostResult;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
@ -26,7 +26,7 @@ import rx.Subscription;
|
|||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.schedulers.Schedulers;
|
import rx.schedulers.Schedulers;
|
||||||
|
|
||||||
public class MangaChaptersPresenter extends BasePresenter<MangaChaptersFragment> {
|
public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
|
||||||
|
|
||||||
@Inject DatabaseHelper db;
|
@Inject DatabaseHelper db;
|
||||||
@Inject SourceManager sourceManager;
|
@Inject SourceManager sourceManager;
|
||||||
@ -62,7 +62,7 @@ public class MangaChaptersPresenter extends BasePresenter<MangaChaptersFragment>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTakeView(MangaChaptersFragment view) {
|
protected void onTakeView(ChaptersFragment view) {
|
||||||
super.onTakeView(view);
|
super.onTakeView(view);
|
||||||
registerForStickyEvents();
|
registerForStickyEvents();
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.manga.info;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -17,8 +17,7 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.presenter.MangaInfoPresenter;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseRxFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseRxFragment;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
|
|
||||||
@RequiresPresenter(MangaInfoPresenter.class)
|
@RequiresPresenter(MangaInfoPresenter.class)
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.manga.info;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ import javax.inject.Inject;
|
|||||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.events.ChapterCountEvent;
|
import eu.kanade.mangafeed.events.ChapterCountEvent;
|
||||||
import eu.kanade.mangafeed.ui.fragment.MangaInfoFragment;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.mangafeed.util.EventBusHook;
|
import eu.kanade.mangafeed.util.EventBusHook;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.dialog;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
@ -13,8 +13,7 @@ import eu.kanade.mangafeed.R;
|
|||||||
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
import eu.kanade.mangafeed.data.helpers.SourceManager;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import eu.kanade.mangafeed.ui.dialog.LoginDialogPreference;
|
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
|
|
||||||
public class SettingsAccountsFragment extends PreferenceFragment {
|
public class SettingsAccountsFragment extends PreferenceFragment {
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
@ -7,8 +7,7 @@ import android.view.MenuItem;
|
|||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import eu.kanade.mangafeed.ui.fragment.SettingsMainFragment;
|
|
||||||
|
|
||||||
public class SettingsActivity extends BaseActivity {
|
public class SettingsActivity extends BaseActivity {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
@ -10,7 +10,7 @@ import javax.inject.Inject;
|
|||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
import eu.kanade.mangafeed.util.DiskUtils;
|
import eu.kanade.mangafeed.util.DiskUtils;
|
||||||
|
|
||||||
public class SettingsDownloadsFragment extends PreferenceFragment {
|
public class SettingsDownloadsFragment extends PreferenceFragment {
|
@ -1,10 +1,10 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
|
|
||||||
public class SettingsMainFragment extends PreferenceFragment {
|
public class SettingsMainFragment extends PreferenceFragment {
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.preference;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseActivity;
|
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||||
|
|
||||||
public class SettingsNestedFragment extends PreferenceFragment {
|
public class SettingsNestedFragment extends PreferenceFragment {
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.activity;
|
package eu.kanade.mangafeed.ui.reader;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -20,13 +20,12 @@ import eu.kanade.mangafeed.App;
|
|||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.presenter.ReaderPresenter;
|
import eu.kanade.mangafeed.ui.base.activity.BaseRxActivity;
|
||||||
import eu.kanade.mangafeed.ui.activity.base.BaseRxActivity;
|
import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.LeftToRightViewer;
|
import eu.kanade.mangafeed.ui.reader.viewer.horizontal.LeftToRightReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.RightToLeftViewer;
|
import eu.kanade.mangafeed.ui.reader.viewer.horizontal.RightToLeftReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.VerticalViewer;
|
import eu.kanade.mangafeed.ui.reader.viewer.vertical.VerticalReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.WebtoonViewer;
|
import eu.kanade.mangafeed.ui.reader.viewer.webtoon.WebtoonReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.base.BaseViewer;
|
|
||||||
import nucleus.factory.RequiresPresenter;
|
import nucleus.factory.RequiresPresenter;
|
||||||
|
|
||||||
@RequiresPresenter(ReaderPresenter.class)
|
@RequiresPresenter(ReaderPresenter.class)
|
||||||
@ -37,7 +36,7 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
|
|||||||
|
|
||||||
@Inject PreferencesHelper prefs;
|
@Inject PreferencesHelper prefs;
|
||||||
|
|
||||||
private BaseViewer viewer;
|
private BaseReader viewer;
|
||||||
private boolean isFullscreen;
|
private boolean isFullscreen;
|
||||||
|
|
||||||
private static final int LEFT_TO_RIGHT = 1;
|
private static final int LEFT_TO_RIGHT = 1;
|
||||||
@ -146,16 +145,16 @@ public class ReaderActivity extends BaseRxActivity<ReaderPresenter> {
|
|||||||
enableFullScreen();
|
enableFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BaseViewer getViewer() {
|
private BaseReader getViewer() {
|
||||||
switch (prefs.getDefaultViewer()) {
|
switch (prefs.getDefaultViewer()) {
|
||||||
case LEFT_TO_RIGHT: default:
|
case LEFT_TO_RIGHT: default:
|
||||||
return new LeftToRightViewer(this, container);
|
return new LeftToRightReader(this, container);
|
||||||
case RIGHT_TO_LEFT:
|
case RIGHT_TO_LEFT:
|
||||||
return new RightToLeftViewer(this, container);
|
return new RightToLeftReader(this, container);
|
||||||
case VERTICAL:
|
case VERTICAL:
|
||||||
return new VerticalViewer(this, container);
|
return new VerticalReader(this, container);
|
||||||
case WEBTOON:
|
case WEBTOON:
|
||||||
return new WebtoonViewer(this, container);
|
return new WebtoonReader(this, container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.presenter;
|
package eu.kanade.mangafeed.ui.reader;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ import eu.kanade.mangafeed.data.models.Manga;
|
|||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.events.SourceMangaChapterEvent;
|
import eu.kanade.mangafeed.events.SourceMangaChapterEvent;
|
||||||
import eu.kanade.mangafeed.sources.base.Source;
|
import eu.kanade.mangafeed.sources.base.Source;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.mangafeed.util.EventBusHook;
|
import eu.kanade.mangafeed.util.EventBusHook;
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer.base;
|
package eu.kanade.mangafeed.ui.reader.viewer.base;
|
||||||
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@ -6,15 +6,15 @@ import android.widget.FrameLayout;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
|
|
||||||
public abstract class BaseViewer {
|
public abstract class BaseReader {
|
||||||
|
|
||||||
protected ReaderActivity activity;
|
protected ReaderActivity activity;
|
||||||
protected FrameLayout container;
|
protected FrameLayout container;
|
||||||
protected int currentPosition;
|
protected int currentPosition;
|
||||||
|
|
||||||
public BaseViewer(ReaderActivity activity, FrameLayout container) {
|
public BaseReader(ReaderActivity activity, FrameLayout container) {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
this.container = container;
|
this.container = container;
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.reader.viewer.common;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.reader.viewer.common;
|
||||||
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
@ -6,13 +6,12 @@ import android.support.v4.app.FragmentManager;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.fragment.ReaderPageFragment;
|
|
||||||
|
|
||||||
public class ViewerPagerAdapter extends SmartFragmentStatePagerAdapter {
|
public class ViewPagerReaderAdapter extends SmartFragmentStatePagerAdapter {
|
||||||
|
|
||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
|
|
||||||
public ViewerPagerAdapter(FragmentManager fragmentManager) {
|
public ViewPagerReaderAdapter(FragmentManager fragmentManager) {
|
||||||
super(fragmentManager);
|
super(fragmentManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ public class ViewerPagerAdapter extends SmartFragmentStatePagerAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
return ReaderPageFragment.newInstance(pages.get(position));
|
return ViewPagerReaderFragment.newInstance(pages.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Page> getPages() {
|
public List<Page> getPages() {
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.fragment;
|
package eu.kanade.mangafeed.ui.reader.viewer.common;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -19,15 +19,15 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.base.fragment.BaseFragment;
|
||||||
import eu.kanade.mangafeed.ui.fragment.base.BaseFragment;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.Subscription;
|
import rx.Subscription;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.schedulers.Schedulers;
|
import rx.schedulers.Schedulers;
|
||||||
import rx.subjects.PublishSubject;
|
import rx.subjects.PublishSubject;
|
||||||
|
|
||||||
public class ReaderPageFragment extends BaseFragment {
|
public class ViewPagerReaderFragment extends BaseFragment {
|
||||||
|
|
||||||
@Bind(R.id.page_image_view) SubsamplingScaleImageView imageView;
|
@Bind(R.id.page_image_view) SubsamplingScaleImageView imageView;
|
||||||
@Bind(R.id.progress_container) LinearLayout progressContainer;
|
@Bind(R.id.progress_container) LinearLayout progressContainer;
|
||||||
@ -39,8 +39,8 @@ public class ReaderPageFragment extends BaseFragment {
|
|||||||
private Subscription progressSubscription;
|
private Subscription progressSubscription;
|
||||||
private Subscription statusSubscription;
|
private Subscription statusSubscription;
|
||||||
|
|
||||||
public static ReaderPageFragment newInstance(Page page) {
|
public static ViewPagerReaderFragment newInstance(Page page) {
|
||||||
ReaderPageFragment fragment = new ReaderPageFragment();
|
ViewPagerReaderFragment fragment = new ViewPagerReaderFragment();
|
||||||
fragment.setPage(page);
|
fragment.setPage(page);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer.base;
|
package eu.kanade.mangafeed.ui.reader.viewer.horizontal;
|
||||||
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
@ -9,39 +9,30 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter;
|
import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader;
|
||||||
import eu.kanade.mangafeed.widget.HorizontalViewPager;
|
import eu.kanade.mangafeed.ui.reader.viewer.common.ViewPagerReaderAdapter;
|
||||||
|
|
||||||
public abstract class ViewPagerViewer extends BaseViewer {
|
public abstract class HorizontalReader extends BaseReader {
|
||||||
|
|
||||||
@Bind(R.id.view_pager) HorizontalViewPager viewPager;
|
@Bind(R.id.view_pager) HorizontalViewPager viewPager;
|
||||||
protected ViewerPagerAdapter adapter;
|
|
||||||
|
|
||||||
public ViewPagerViewer(ReaderActivity activity, FrameLayout container) {
|
protected ViewPagerReaderAdapter adapter;
|
||||||
|
|
||||||
|
public HorizontalReader(ReaderActivity activity, FrameLayout container) {
|
||||||
super(activity, container);
|
super(activity, container);
|
||||||
activity.getLayoutInflater().inflate(R.layout.viewer_viewpager, container);
|
activity.getLayoutInflater().inflate(R.layout.reader_horizontal, container);
|
||||||
ButterKnife.bind(this, container);
|
ButterKnife.bind(this, container);
|
||||||
|
|
||||||
adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager());
|
adapter = new ViewPagerReaderAdapter(activity.getSupportFragmentManager());
|
||||||
viewPager.setAdapter(adapter);
|
viewPager.setAdapter(adapter);
|
||||||
viewPager.setOffscreenPageLimit(3);
|
viewPager.setOffscreenPageLimit(3);
|
||||||
viewPager.addOnPageChangeListener(new HorizontalViewPager.OnPageChangeListener() {
|
viewPager.addOnPageChangeListener(new HorizontalViewPager.SimpleOnPageChangeListener() {
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
currentPosition = position;
|
currentPosition = position;
|
||||||
updatePageNumber();
|
updatePageNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
viewPager.setOnChapterBoundariesOutListener(new HorizontalViewPager.OnChapterBoundariesOutListener() {
|
viewPager.setOnChapterBoundariesOutListener(new HorizontalViewPager.OnChapterBoundariesOutListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -57,10 +48,6 @@ public abstract class ViewPagerViewer extends BaseViewer {
|
|||||||
viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap);
|
viewPager.setOnChapterSingleTapListener(activity::onCenterSingleTap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HorizontalViewPager getViewPager() {
|
|
||||||
return viewPager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalPages() {
|
public int getTotalPages() {
|
||||||
return adapter.getCount();
|
return adapter.getCount();
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.widget;
|
package eu.kanade.mangafeed.ui.reader.viewer.horizontal;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
@ -84,13 +84,13 @@ public class HorizontalViewPager extends ViewPager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface OnChapterBoundariesOutListener {
|
public interface OnChapterBoundariesOutListener {
|
||||||
public void onFirstPageOutEvent();
|
void onFirstPageOutEvent();
|
||||||
|
|
||||||
public void onLastPageOutEvent();
|
void onLastPageOutEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnChapterSingleTapListener {
|
public interface OnChapterSingleTapListener {
|
||||||
public void onSingleTap();
|
void onSingleTap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnChapterBoundariesOutListener(OnChapterBoundariesOutListener onChapterBoundariesOutListener) {
|
public void setOnChapterBoundariesOutListener(OnChapterBoundariesOutListener onChapterBoundariesOutListener) {
|
@ -0,0 +1,23 @@
|
|||||||
|
package eu.kanade.mangafeed.ui.reader.viewer.horizontal;
|
||||||
|
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
|
|
||||||
|
public class LeftToRightReader extends HorizontalReader {
|
||||||
|
|
||||||
|
public LeftToRightReader(ReaderActivity activity, FrameLayout container) {
|
||||||
|
super(activity, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFirstPageOut() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLastPageOut() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer;
|
package eu.kanade.mangafeed.ui.reader.viewer.horizontal;
|
||||||
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
@ -7,12 +7,11 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.viewer.base.ViewPagerViewer;
|
|
||||||
|
|
||||||
public class RightToLeftViewer extends ViewPagerViewer {
|
public class RightToLeftReader extends HorizontalReader {
|
||||||
|
|
||||||
public RightToLeftViewer(ReaderActivity activity, FrameLayout container) {
|
public RightToLeftReader(ReaderActivity activity, FrameLayout container) {
|
||||||
super(activity, container);
|
super(activity, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ public class RightToLeftViewer extends ViewPagerViewer {
|
|||||||
ArrayList<Page> inversedPages = new ArrayList<>(pages);
|
ArrayList<Page> inversedPages = new ArrayList<>(pages);
|
||||||
Collections.reverse(inversedPages);
|
Collections.reverse(inversedPages);
|
||||||
adapter.setPages(inversedPages);
|
adapter.setPages(inversedPages);
|
||||||
getViewPager().setCurrentItem(adapter.getCount()-1, false);
|
viewPager.setCurrentItem(adapter.getCount()-1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,12 +30,12 @@ public class RightToLeftViewer extends ViewPagerViewer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFirstPageOut() {
|
public void onFirstPageOut() {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLastPageOut() {
|
public void onLastPageOut() {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer;
|
package eu.kanade.mangafeed.ui.reader.viewer.vertical;
|
||||||
|
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@ -10,40 +10,30 @@ import butterknife.Bind;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.adapter.ViewerPagerAdapter;
|
import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.base.BaseViewer;
|
import eu.kanade.mangafeed.ui.reader.viewer.common.ViewPagerReaderAdapter;
|
||||||
import fr.castorflex.android.verticalviewpager.VerticalViewPager;
|
|
||||||
|
|
||||||
public class VerticalViewer extends BaseViewer {
|
public class VerticalReader extends BaseReader {
|
||||||
|
|
||||||
@Bind(R.id.view_pager) VerticalViewPager viewPager;
|
@Bind(R.id.view_pager) VerticalViewPager viewPager;
|
||||||
private ViewerPagerAdapter adapter;
|
|
||||||
|
|
||||||
public VerticalViewer(ReaderActivity activity, FrameLayout container) {
|
private ViewPagerReaderAdapter adapter;
|
||||||
|
|
||||||
|
public VerticalReader(ReaderActivity activity, FrameLayout container) {
|
||||||
super(activity, container);
|
super(activity, container);
|
||||||
activity.getLayoutInflater().inflate(R.layout.viewer_verticalviewpager, container);
|
activity.getLayoutInflater().inflate(R.layout.reader_vertical, container);
|
||||||
ButterKnife.bind(this, container);
|
ButterKnife.bind(this, container);
|
||||||
|
|
||||||
adapter = new ViewerPagerAdapter(activity.getSupportFragmentManager());
|
adapter = new ViewPagerReaderAdapter(activity.getSupportFragmentManager());
|
||||||
viewPager.setAdapter(adapter);
|
viewPager.setAdapter(adapter);
|
||||||
viewPager.setOffscreenPageLimit(3);
|
viewPager.setOffscreenPageLimit(3);
|
||||||
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||||
@Override
|
|
||||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
currentPosition = position;
|
currentPosition = position;
|
||||||
updatePageNumber();
|
updatePageNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageScrollStateChanged(int state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package eu.kanade.mangafeed.ui.reader.viewer.vertical;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.GestureDetector;
|
||||||
|
|
||||||
|
public class VerticalViewPager extends fr.castorflex.android.verticalviewpager.VerticalViewPager {
|
||||||
|
|
||||||
|
private GestureDetector gestureDetector;
|
||||||
|
|
||||||
|
public VerticalViewPager(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
gestureDetector = new GestureDetector(getContext(), new ReaderViewGestureListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ReaderViewGestureListener extends GestureDetector.SimpleOnGestureListener {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.reader.viewer.webtoon;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -47,7 +47,7 @@ public class WebtoonAdapter extends BaseEasyRecyclerAdapter<Page> {
|
|||||||
notifyItemChanged(page.getPageNumber());
|
notifyItemChanged(page.getPageNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@LayoutId(R.layout.item_webtoon_viewer)
|
@LayoutId(R.layout.item_webtoon_reader)
|
||||||
static class ImageViewHolder extends ItemViewHolder<Page> {
|
static class ImageViewHolder extends ItemViewHolder<Page> {
|
||||||
|
|
||||||
@ViewId(R.id.page_image_view) SubsamplingScaleImageView imageView;
|
@ViewId(R.id.page_image_view) SubsamplingScaleImageView imageView;
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer;
|
package eu.kanade.mangafeed.ui.reader.viewer.webtoon;
|
||||||
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
@ -8,14 +8,13 @@ import android.widget.FrameLayout;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.models.Page;
|
import eu.kanade.mangafeed.data.models.Page;
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
import eu.kanade.mangafeed.ui.reader.ReaderActivity;
|
||||||
import eu.kanade.mangafeed.ui.adapter.WebtoonAdapter;
|
import eu.kanade.mangafeed.ui.reader.viewer.base.BaseReader;
|
||||||
import eu.kanade.mangafeed.ui.viewer.base.BaseViewer;
|
|
||||||
import rx.Subscription;
|
import rx.Subscription;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
import rx.android.schedulers.AndroidSchedulers;
|
||||||
import rx.subjects.PublishSubject;
|
import rx.subjects.PublishSubject;
|
||||||
|
|
||||||
public class WebtoonViewer extends BaseViewer {
|
public class WebtoonReader extends BaseReader {
|
||||||
|
|
||||||
private RecyclerView recycler;
|
private RecyclerView recycler;
|
||||||
private LinearLayoutManager layoutManager;
|
private LinearLayoutManager layoutManager;
|
||||||
@ -23,7 +22,7 @@ public class WebtoonViewer extends BaseViewer {
|
|||||||
private List<Page> pages;
|
private List<Page> pages;
|
||||||
private Subscription subscription;
|
private Subscription subscription;
|
||||||
|
|
||||||
public WebtoonViewer(ReaderActivity activity, FrameLayout container) {
|
public WebtoonReader(ReaderActivity activity, FrameLayout container) {
|
||||||
super(activity, container);
|
super(activity, container);
|
||||||
|
|
||||||
recycler = new RecyclerView(activity);
|
recycler = new RecyclerView(activity);
|
@ -1,24 +0,0 @@
|
|||||||
package eu.kanade.mangafeed.ui.viewer;
|
|
||||||
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
|
|
||||||
import eu.kanade.mangafeed.ui.activity.ReaderActivity;
|
|
||||||
import eu.kanade.mangafeed.ui.viewer.base.ViewPagerViewer;
|
|
||||||
|
|
||||||
public class LeftToRightViewer extends ViewPagerViewer {
|
|
||||||
|
|
||||||
public LeftToRightViewer(ReaderActivity activity, FrameLayout container) {
|
|
||||||
super(activity, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFirstPageOut() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLastPageOut() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -4,7 +4,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity"
|
tools:context="eu.kanade.mangafeed.ui.manga.MangaActivity"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
||||||
tools:context="eu.kanade.mangafeed.ui.fragment.CatalogueFragment">
|
tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
||||||
tools:context="eu.kanade.mangafeed.ui.fragment.CatalogueFragment">
|
tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="eu.kanade.mangafeed.ui.fragment.SourceFragment">
|
tools:context="eu.kanade.mangafeed.ui.catalogue.SourceFragment">
|
||||||
|
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<eu.kanade.mangafeed.widget.HorizontalViewPager
|
<eu.kanade.mangafeed.ui.reader.viewer.horizontal.HorizontalViewPager
|
||||||
android:id="@+id/view_pager"
|
android:id="@+id/view_pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
</eu.kanade.mangafeed.widget.HorizontalViewPager>
|
</eu.kanade.mangafeed.ui.reader.viewer.horizontal.HorizontalViewPager>
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<fr.castorflex.android.verticalviewpager.VerticalViewPager
|
<eu.kanade.mangafeed.ui.reader.viewer.vertical.VerticalViewPager
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/view_pager"
|
android:id="@+id/view_pager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
</fr.castorflex.android.verticalviewpager.VerticalViewPager>
|
</eu.kanade.mangafeed.ui.reader.viewer.vertical.VerticalViewPager>
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.v7.widget.RecyclerView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
</android.support.v7.widget.RecyclerView>
|
|
@ -1,7 +1,7 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity">
|
tools:context="eu.kanade.mangafeed.ui.manga.MangaActivity">
|
||||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -13,7 +13,7 @@ import org.robolectric.Robolectric;
|
|||||||
import org.robolectric.RobolectricGradleTestRunner;
|
import org.robolectric.RobolectricGradleTestRunner;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.ui.activity.MainActivity;
|
import eu.kanade.mangafeed.ui.main.MainActivity;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
|
Loading…
Reference in New Issue
Block a user