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