diff --git a/app/build.gradle b/app/build.gradle index b732e80f6..b0ebe9e2b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt' +apply plugin: 'me.tatarka.retrolambda' android { compileSdkVersion 23 diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 8e5eebc2b..97b56971d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -15,3 +15,4 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} +-dontwarn java.lang.invoke.* \ No newline at end of file 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 3ddeb5772..36ca43a98 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 @@ -1,42 +1,37 @@ package eu.kanade.mangafeed.ui.activity; import android.os.Bundle; -import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import android.app.Fragment; +import android.app.FragmentTransaction; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; -import android.widget.ProgressBar; +import android.widget.FrameLayout; + +import com.mikepenz.materialdrawer.Drawer; +import com.mikepenz.materialdrawer.DrawerBuilder; +import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import javax.inject.Inject; -import eu.kanade.mangafeed.R; - import butterknife.Bind; import butterknife.ButterKnife; +import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.helpers.DatabaseHelper; +import eu.kanade.mangafeed.ui.fragment.LibraryFragment; import rx.subscriptions.CompositeSubscription; -import timber.log.Timber; -import uk.co.ribot.easyadapter.EasyRecyclerAdapter; public class MainActivity extends BaseActivity { - @Bind(R.id.recycler_characters) - RecyclerView mCharactersRecycler; - @Bind(R.id.toolbar) - Toolbar mToolbar; + Toolbar toolbar; - @Bind(R.id.progress_indicator) - ProgressBar mProgressBar; - - @Bind(R.id.swipe_container) - SwipeRefreshLayout mSwipeRefresh; + @Bind(R.id.drawer_container) + FrameLayout container; @Inject DatabaseHelper mDb; + private Drawer drawer; private CompositeSubscription mSubscriptions; - private EasyRecyclerAdapter mEasyRecycleAdapter; @Override protected void onCreate(Bundle savedInstanceState) { @@ -45,9 +40,49 @@ public class MainActivity extends BaseActivity { setContentView(R.layout.activity_main); ButterKnife.bind(this); mSubscriptions = new CompositeSubscription(); - //mDataManager = App.get(this).getComponent().dataManager(); + setupToolbar(); - setupRecyclerView(); + + drawer = new DrawerBuilder() + .withActivity(this) + .withRootView(container) + .withToolbar(toolbar) + .withActionBarDrawerToggleAnimated(true) + .addDrawerItems( + new PrimaryDrawerItem() + .withName(R.string.library_title) + .withIdentifier(R.id.nav_drawer_library), + new PrimaryDrawerItem() + .withName(R.string.recent_updates_title) + .withIdentifier(R.id.nav_drawer_recent_updates), + new PrimaryDrawerItem() + .withName(R.string.catalogues_title) + .withIdentifier(R.id.nav_drawer_catalogues), + new PrimaryDrawerItem() + .withName(R.string.settings_title) + .withIdentifier(R.id.nav_drawer_settings) + ) + .withSavedInstance(savedInstanceState) + .withOnDrawerItemClickListener( + (view, position, drawerItem) -> { + if (drawerItem != null) { + int identifier = drawerItem.getIdentifier(); + switch (identifier) { + case R.id.nav_drawer_library: + setFragment(LibraryFragment.newInstance()); + break; + case R.id.nav_drawer_catalogues: + case R.id.nav_drawer_recent_updates: + case R.id.nav_drawer_settings: + break; + } + } + return false; + } + ) + .build(); + + drawer.setSelection(R.id.nav_drawer_library); } @Override @@ -73,13 +108,21 @@ public class MainActivity extends BaseActivity { } private void setupToolbar() { - setSupportActionBar(mToolbar); + setSupportActionBar(toolbar); } - private void setupRecyclerView() { - mCharactersRecycler.setLayoutManager(new LinearLayoutManager(this)); - mCharactersRecycler.setAdapter(mEasyRecycleAdapter); + private void setFragment(Fragment fragment) { + try { + if (fragment != null && getSupportFragmentManager() != null) { + FragmentTransaction ft = getFragmentManager().beginTransaction(); + if (ft != null) { + ft.replace(R.id.content_layout, fragment); + ft.commit(); + } + } + } catch (Exception e) { - mSwipeRefresh.setColorSchemeResources(R.color.primary); + } } + } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java new file mode 100644 index 000000000..b3da93d2c --- /dev/null +++ b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java @@ -0,0 +1,55 @@ +package eu.kanade.mangafeed.ui.fragment; + +import android.os.Bundle; +import android.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; + +import java.util.ArrayList; + +import eu.kanade.mangafeed.R; +import eu.kanade.mangafeed.ui.activity.BaseActivity; + +public class LibraryFragment extends Fragment { + + public static LibraryFragment newInstance() { + LibraryFragment fragment = new LibraryFragment(); + Bundle args = new Bundle(); + fragment.setArguments(args); + return fragment; + } + + public LibraryFragment() { + // Required empty public constructor + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.library_title); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + + View view = inflater.inflate(R.layout.fragment_library, container, false); + return view; + } + + + public class LocalManga { + public String name; + public String url; + + public LocalManga(String name, String url) { + this.name = name; + this.url = url; + } + } + +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8442153a0..5c2fccf46 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,55 +1,31 @@ - - + android:layout_height="match_parent"> - + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:elevation="4dp" /> - + + + + - - - - - - - - - - - - - - - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml new file mode 100644 index 000000000..0e4bc495c --- /dev/null +++ b/app/src/main/res/layout/fragment_library.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/app/src/main/res/layout/item_library.xml b/app/src/main/res/layout/item_library.xml new file mode 100644 index 000000000..9890c6b40 --- /dev/null +++ b/app/src/main/res/layout/item_library.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml new file mode 100644 index 000000000..282e172cc --- /dev/null +++ b/app/src/main/res/values/ids.xml @@ -0,0 +1,7 @@ + + + nav_drawer_library + nav_drawer_recent_updates + nav_drawer_catalogues + nav_drawer_settings + \ 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 b87192286..5cc5ab3b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,35 +1,12 @@ - AndroidBoilerPlate + Mangafeed - Boilerplate + Mangafeed View on GitHub - View - Collections - No description available - %d films - - - - - Don\'t underestimate the Force. The Force is strong with this one. I have you now. He is here. \n \n - I suggest you try it again, Luke. This time, let go your conscious self and act on instinct. The more you tighten your grip, Tarkin, the more star systems will slip through your fingers. I\'m trying not to, kid. Red Five standing by.\n \n - I care. So, what do you think of her, Han? Obi-Wan is here. The Force is with him. I\'m surprised you had the courage to take the responsibility yourself. Red Five standing by. I need your help, Luke. She needs your help. I\'m getting too old for this sort of thing.\n \n - What!? All right. Well, take care of yourself, Han. I guess that\'s what you\'re best at, ain\'t it? I don\'t know what you\'re talking about. I am a member of the Imperial Senate on a diplomatic mission to Alderaan, Red Five standing by.\n \n - I suggest you try it again, Luke. This time, let go your conscious self and act on instinct. I want to come with you to Alderaan. There\'s nothing for me here now. I want to learn the ways of the Force and be a Jedi, like my father before me. She must have hidden the plans in the escape pod. Send a detachment down to retrieve them, and see to it personally, Commander. There\'ll be no one to stop us this time! Obi-Wan is here. The Force is with him.\n \n - Hey, Luke! May the Force be with you. Alderaan? I\'m not going to Alderaan. I\'ve got to go home. It\'s late, I\'m in for it as it is. Obi-Wan is here. The Force is with him. Don\'t be too proud of this technological terror you\'ve constructed. The ability to destroy a planet is insignificant next to the power of the Force. She must have hidden the plans in the escape pod. Send a detachment down to retrieve them, and see to it personally, Commander. There\'ll be no one to stop us this time!\n \n - - - - - Films - Vehicles - Species - Starships - No data to display @@ -45,13 +22,9 @@ - - 1 - 2 - 3 - 4 - 5 - 6 - + My library + Recent updates + Catalogues + Settings