diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39627b74c..7ecbaca6a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,6 @@ - + + + diff --git a/app/src/main/java/eu/kanade/mangafeed/presenter/CataloguePresenter.java b/app/src/main/java/eu/kanade/mangafeed/presenter/CataloguePresenter.java index 296570e2e..2fa2f4703 100644 --- a/app/src/main/java/eu/kanade/mangafeed/presenter/CataloguePresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/presenter/CataloguePresenter.java @@ -1,10 +1,13 @@ package eu.kanade.mangafeed.presenter; +import android.content.Intent; + import javax.inject.Inject; import eu.kanade.mangafeed.App; import eu.kanade.mangafeed.data.helpers.SourceManager; import eu.kanade.mangafeed.sources.Source; +import eu.kanade.mangafeed.ui.activity.CatalogueListActivity; import eu.kanade.mangafeed.ui.adapter.SourceHolder; import eu.kanade.mangafeed.view.CatalogueView; import uk.co.ribot.easyadapter.EasyAdapter; @@ -24,7 +27,7 @@ public class CataloguePresenter { } public void initializeSources() { - adapter = new EasyAdapter( + adapter = new EasyAdapter<>( view.getActivity(), SourceHolder.class, sourceManager.getSources()); @@ -34,6 +37,8 @@ public class CataloguePresenter { } public void onSourceClick(int position) { - + Intent intent = new Intent(view.getActivity(), CatalogueListActivity.class); + intent.putExtra(Intent.EXTRA_UID, adapter.getItem(position).getSource()); + view.startActivity(intent); } } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/BaseActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/BaseActivity.java index f652151ea..ebefe83ff 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/BaseActivity.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/BaseActivity.java @@ -1,32 +1,14 @@ package eu.kanade.mangafeed.ui.activity; -import android.app.FragmentManager; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.view.MenuItem; import eu.kanade.mangafeed.App; import eu.kanade.mangafeed.AppComponent; public class BaseActivity extends AppCompatActivity { - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - FragmentManager fm = getFragmentManager(); - if (fm.getBackStackEntryCount() > 0) { - fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); - } else { - finish(); - } - return true; - default: - return super.onOptionsItemSelected(item); - } - } - protected void setupToolbar(Toolbar toolbar) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java new file mode 100644 index 000000000..37e4429f2 --- /dev/null +++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/CatalogueListActivity.java @@ -0,0 +1,30 @@ +package eu.kanade.mangafeed.ui.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; + +import butterknife.Bind; +import butterknife.ButterKnife; +import eu.kanade.mangafeed.R; +import eu.kanade.mangafeed.sources.Source; + +public class CatalogueListActivity extends BaseActivity { + + @Bind(R.id.toolbar) + Toolbar toolbar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_catalogue_list); + ButterKnife.bind(this); + + setupToolbar(toolbar); + } + +} diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java b/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java index 984dddded..d6bb7ab7c 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/activity/MainActivity.java @@ -26,14 +26,12 @@ public class MainActivity extends BaseActivity { FrameLayout container; private Drawer drawer; - private CompositeSubscription mSubscriptions; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); - mSubscriptions = new CompositeSubscription(); setupToolbar(toolbar); @@ -82,12 +80,6 @@ public class MainActivity extends BaseActivity { drawer.setSelection(R.id.nav_drawer_library); } - @Override - protected void onDestroy() { - super.onDestroy(); - mSubscriptions.unsubscribe(); - } - private void setFragment(Fragment fragment) { try { if (fragment != null && getSupportFragmentManager() != null) { diff --git a/app/src/main/java/eu/kanade/mangafeed/view/BaseView.java b/app/src/main/java/eu/kanade/mangafeed/view/BaseView.java index 019d18786..ef322c429 100644 --- a/app/src/main/java/eu/kanade/mangafeed/view/BaseView.java +++ b/app/src/main/java/eu/kanade/mangafeed/view/BaseView.java @@ -1,7 +1,9 @@ package eu.kanade.mangafeed.view; import android.content.Context; +import android.content.Intent; public interface BaseView { Context getActivity(); + void startActivity(Intent intent); } diff --git a/app/src/main/java/eu/kanade/mangafeed/view/CatalogueView.java b/app/src/main/java/eu/kanade/mangafeed/view/CatalogueView.java index cd6405c92..8b15f4217 100644 --- a/app/src/main/java/eu/kanade/mangafeed/view/CatalogueView.java +++ b/app/src/main/java/eu/kanade/mangafeed/view/CatalogueView.java @@ -2,9 +2,6 @@ package eu.kanade.mangafeed.view; import uk.co.ribot.easyadapter.EasyAdapter; -/** - * Created by len on 10/10/2015. - */ public interface CatalogueView extends BaseView { void setAdapter(EasyAdapter adapter); void setSourceClickListener(); diff --git a/app/src/main/java/eu/kanade/mangafeed/view/LibraryView.java b/app/src/main/java/eu/kanade/mangafeed/view/LibraryView.java index 4863c5a13..8b29e5c78 100644 --- a/app/src/main/java/eu/kanade/mangafeed/view/LibraryView.java +++ b/app/src/main/java/eu/kanade/mangafeed/view/LibraryView.java @@ -3,7 +3,6 @@ package eu.kanade.mangafeed.view; import uk.co.ribot.easyadapter.EasyAdapter; public interface LibraryView extends BaseView { - void setAdapter(EasyAdapter mangas); void setMangaClickListener(); } diff --git a/app/src/main/java/eu/kanade/mangafeed/view/MangaDetailView.java b/app/src/main/java/eu/kanade/mangafeed/view/MangaDetailView.java index f016a03f4..fe310a6fa 100644 --- a/app/src/main/java/eu/kanade/mangafeed/view/MangaDetailView.java +++ b/app/src/main/java/eu/kanade/mangafeed/view/MangaDetailView.java @@ -6,7 +6,6 @@ import eu.kanade.mangafeed.data.models.Chapter; import eu.kanade.mangafeed.data.models.Manga; public interface MangaDetailView extends BaseView { - void loadManga(Manga manga); void setChapters(List chapters); } diff --git a/app/src/main/res/layout/activity_catalogue_list.xml b/app/src/main/res/layout/activity_catalogue_list.xml new file mode 100644 index 000000000..b74ed09a6 --- /dev/null +++ b/app/src/main/res/layout/activity_catalogue_list.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/app/src/main/res/layout/item_source.xml b/app/src/main/res/layout/item_source.xml index d489d61ba..76db7079c 100644 --- a/app/src/main/res/layout/item_source.xml +++ b/app/src/main/res/layout/item_source.xml @@ -1,11 +1,15 @@ + android:layout_width="match_parent" + android:layout_height="40dp" + tools:text="New Text" + android:id="@+id/source_name" + android:gravity="center_vertical" /> + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e3d145ae8..2ca0265fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -35,5 +35,6 @@ Title or author... Delete Selected + CatalogueList