diff --git a/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java b/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java index b05e3c792..49e579af8 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java @@ -67,14 +67,15 @@ public class DatabaseHelper { private final String favoriteMangasWithUnreadQuery = String.format( "SELECT %1$s.*, COUNT(C.%4$s) AS %5$s FROM %1$s LEFT JOIN " + "(SELECT %4$s FROM %2$s WHERE %6$s = 0) AS C ON %3$s = C.%4$s " + - "WHERE %7$s = 1 GROUP BY %3$s", + "WHERE %7$s = 1 GROUP BY %3$s ORDER BY %1$s.%8$s", MangaTable.TABLE, ChapterTable.TABLE, MangaTable.TABLE + "." + MangaTable.COLUMN_ID, ChapterTable.COLUMN_MANGA_ID, MangaTable.COLUMN_UNREAD, ChapterTable.COLUMN_READ, - MangaTable.COLUMN_FAVORITE + MangaTable.COLUMN_FAVORITE, + MangaTable.COLUMN_TITLE ); public PreparedGetListOfObjects getMangas() { diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java index f40cfc039..e3b79920e 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java @@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.view.ActionMode; import android.support.v7.widget.LinearLayoutManager; +import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersHolder.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersHolder.java index 1a2859730..753680c71 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersHolder.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersHolder.java @@ -2,7 +2,9 @@ package eu.kanade.mangafeed.ui.manga.chapter; import android.content.Context; import android.support.v4.content.ContextCompat; +import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; +import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -14,14 +16,18 @@ import butterknife.Bind; import butterknife.ButterKnife; import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.data.database.models.Chapter; +import eu.kanade.mangafeed.data.download.DownloadService; +import rx.Observable; public class ChaptersHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ChaptersAdapter adapter; + private Chapter item; @Bind(R.id.chapter_title) TextView title; - @Bind(R.id.chapter_download_image) ImageView download_icon; + @Bind(R.id.download_text) TextView downloadText; + @Bind(R.id.chapter_menu) ImageView chapterMenu; @Bind(R.id.chapter_pages) TextView pages; @Bind(R.id.chapter_date) TextView date; @@ -38,9 +44,11 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements this.adapter = adapter; itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); + chapterMenu.setOnClickListener(v -> v.post(() -> showPopupMenu(v))); } public void onSetValues(Context context, Chapter chapter) { + this.item = chapter; title.setText(chapter.name); if (chapter.read) { @@ -58,10 +66,11 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements if (chapter.downloaded == Chapter.UNKNOWN) { adapter.getMangaChaptersFragment().getPresenter().checkIsChapterDownloaded(chapter); } - if (chapter.downloaded == Chapter.DOWNLOADED) - download_icon.setImageResource(R.drawable.ic_action_delete_36dp); - else if (chapter.downloaded == Chapter.NOT_DOWNLOADED) - download_icon.setImageResource(R.drawable.ic_file_download_black_36dp); + if (chapter.downloaded == Chapter.DOWNLOADED) { + downloadText.setVisibility(View.VISIBLE); + } else if (chapter.downloaded == Chapter.NOT_DOWNLOADED) { + downloadText.setVisibility(View.INVISIBLE); + } date.setText(sdf.format(new Date(chapter.date_upload))); toggleActivation(); @@ -83,4 +92,37 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements toggleActivation(); return true; } + + + private void showPopupMenu(View view) { + // Create a PopupMenu, giving it the clicked view for an anchor + PopupMenu popup = new PopupMenu(adapter.getMangaChaptersFragment().getActivity(), view); + + // Inflate our menu resource into the PopupMenu's Menu + popup.getMenuInflater().inflate(R.menu.chapter_single, popup.getMenu()); + + // Set a listener so we are notified if a menu item is clicked + popup.setOnMenuItemClickListener(menuItem -> { + switch (menuItem.getItemId()) { + case R.id.action_mark_as_read: + adapter.getMangaChaptersFragment().getPresenter().markChaptersRead(Observable.just(item), true); + return true; + case R.id.action_mark_as_unread: + adapter.getMangaChaptersFragment().getPresenter().markChaptersRead(Observable.just(item), false); + return true; + case R.id.action_download: + DownloadService.start(adapter.getMangaChaptersFragment().getActivity()); + adapter.getMangaChaptersFragment().getPresenter().downloadChapters(Observable.just(item)); + return true; + case R.id.action_delete: + adapter.getMangaChaptersFragment().getPresenter().deleteChapters(Observable.just(item)); + return true; + } + return false; + }); + + // Finally show the PopupMenu + popup.show(); + } + } diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersPresenter.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersPresenter.java index dce7a7d88..afdde3f9f 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersPresenter.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersPresenter.java @@ -169,7 +169,7 @@ public class ChaptersPresenter extends BasePresenter { public void initSortIcon() { if (getView() != null) { - getView().setSortIcon(sortOrderAToZ);//TODO do we need save order for manga? + getView().setSortIcon(sortOrderAToZ);//TODO manga.chapter_order } } diff --git a/app/src/main/res/drawable-hdpi/ic_expand_less_white_36dp.png b/app/src/main/res/drawable-hdpi/ic_expand_less_white_36dp.png new file mode 100644 index 000000000..ddd0078f3 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_expand_less_white_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_expand_more_white_36dp.png b/app/src/main/res/drawable-hdpi/ic_expand_more_white_36dp.png new file mode 100644 index 000000000..82e6ac353 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_expand_more_white_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_more_horiz_black_36dp.png b/app/src/main/res/drawable-hdpi/ic_more_horiz_black_36dp.png new file mode 100644 index 000000000..82f5f9221 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_more_horiz_black_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_expand_less_white_36dp.png b/app/src/main/res/drawable-mdpi/ic_expand_less_white_36dp.png new file mode 100644 index 000000000..dea898838 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_expand_less_white_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_expand_more_white_36dp.png b/app/src/main/res/drawable-mdpi/ic_expand_more_white_36dp.png new file mode 100644 index 000000000..022e05799 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_expand_more_white_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_more_horiz_black_36dp.png b/app/src/main/res/drawable-mdpi/ic_more_horiz_black_36dp.png new file mode 100644 index 000000000..97bd428c9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_more_horiz_black_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_more_horiz_black_36dp.png b/app/src/main/res/drawable-xhdpi/ic_more_horiz_black_36dp.png new file mode 100644 index 000000000..091a7c62a Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_more_horiz_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_expand_less_white_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_expand_less_white_36dp.png new file mode 100644 index 000000000..7d0e2c1cc Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_expand_less_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_expand_more_white_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_expand_more_white_36dp.png new file mode 100644 index 000000000..c470ab975 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_expand_more_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_more_horiz_black_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_more_horiz_black_36dp.png new file mode 100644 index 000000000..d08886889 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_more_horiz_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_expand_less_white_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_expand_less_white_36dp.png new file mode 100644 index 000000000..62467ced4 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_expand_less_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_expand_more_white_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_expand_more_white_36dp.png new file mode 100644 index 000000000..131cfec4f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_expand_more_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_more_horiz_black_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_more_horiz_black_36dp.png new file mode 100644 index 000000000..6a45c0cfc Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_more_horiz_black_36dp.png differ diff --git a/app/src/main/res/layout/activity_manga_detail.xml b/app/src/main/res/layout/activity_manga_detail.xml index 000c851c5..bf7fd3409 100644 --- a/app/src/main/res/layout/activity_manga_detail.xml +++ b/app/src/main/res/layout/activity_manga_detail.xml @@ -10,7 +10,7 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:theme="@style/AppTheme.ActionBar"> + android:theme="@style/ThemeOverlay.AppTheme.Dark"> + android:background="@color/colorPrimary" + app:tabIndicatorColor="@color/white" /> @@ -31,6 +32,6 @@ android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1" - android:background="@android:color/white" /> + android:background="@color/white" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_catalogue.xml b/app/src/main/res/layout/fragment_catalogue.xml index ab96b5100..7ae149d6a 100644 --- a/app/src/main/res/layout/fragment_catalogue.xml +++ b/app/src/main/res/layout/fragment_catalogue.xml @@ -13,14 +13,14 @@ android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="center_vertical|center_horizontal" - android:visibility="gone" /> + android:visibility="gone"/> + android:visibility="gone"/> diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 24220562a..7739f760e 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -7,7 +7,7 @@ android:id="@+id/gridView" style="@style/AppTheme.GridView" android:choiceMode="multipleChoiceModal" - android:numColumns="2" + android:columnWidth="140dp" tools:listitem="@layout/item_catalogue" /> diff --git a/app/src/main/res/layout/fragment_manga_chapters.xml b/app/src/main/res/layout/fragment_manga_chapters.xml index 0f0b7cad0..ae5666a54 100644 --- a/app/src/main/res/layout/fragment_manga_chapters.xml +++ b/app/src/main/res/layout/fragment_manga_chapters.xml @@ -1,16 +1,16 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + android:background="@color/colorPrimary" + android:elevation="4dp" + android:gravity="top|start" + android:theme="@style/ThemeOverlay.AppTheme.Dark" + app:popupTheme="@style/AppTheme.Popup"> - + + - \ No newline at end of file diff --git a/app/src/main/res/layout/item_catalogue.xml b/app/src/main/res/layout/item_catalogue.xml index 0ca68a74c..6b0c9f9a7 100644 --- a/app/src/main/res/layout/item_catalogue.xml +++ b/app/src/main/res/layout/item_catalogue.xml @@ -20,7 +20,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end" - android:background="@color/md_red_300" + android:background="@color/manga_unread_bg" android:paddingBottom="1dp" android:paddingLeft="3dp" android:paddingRight="3dp" @@ -59,7 +59,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:ellipsize="middle" + android:ellipsize="end" android:maxLines="1" android:paddingLeft="8dp" android:paddingRight="8dp" diff --git a/app/src/main/res/layout/item_chapter.xml b/app/src/main/res/layout/item_chapter.xml index e8179b77c..74632faae 100644 --- a/app/src/main/res/layout/item_chapter.xml +++ b/app/src/main/res/layout/item_chapter.xml @@ -8,10 +8,11 @@ + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"> + tools:text="Pages: 45" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true"/> - + tools:text="22/02/2016"/> + + + android:layout_alignParentTop="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_toStartOf="@+id/relativeLayout2" + android:layout_toLeftOf="@+id/relativeLayout2"/> - + android:id="@+id/relativeLayout2" + android:layout_above="@+id/relativeLayout"> + + \ No newline at end of file diff --git a/app/src/main/res/layout/reader_menu.xml b/app/src/main/res/layout/reader_menu.xml index 25c311af8..17c79589a 100644 --- a/app/src/main/res/layout/reader_menu.xml +++ b/app/src/main/res/layout/reader_menu.xml @@ -13,8 +13,8 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/reader_menu_background" - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + android:theme="@style/ThemeOverlay.AppTheme.Dark" + app:popupTheme="@style/AppTheme.Popup" android:elevation="4dp" /> + android:layout_gravity="center_vertical" + android:theme="@style/ThemeOverlay.AppTheme.Dark" + /> + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 781721630..52e1beee2 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,34 +1,32 @@ - #FFEA00 - #607D8B - #455A64 - #263238 - #CFD8DC + @color/md_blue_A400 + @color/md_blue_grey_500 + @color/md_blue_grey_700 + @color/md_blue_grey_900 + @color/md_blue_grey_100 - #ECEFF1 + @color/md_blue_grey_50 @color/colorPrimary @color/colorPrimaryDark @color/colorPrimaryLight - #CFD8DC - - #FFFFFF - #DD000000 - #8B000000 - #64000000 - - #FFFFFF + @color/md_light_dividers + @color/md_white_1000 + @color/md_light_primary_text + @color/md_light_secondary + @color/md_light_disabled + @color/md_green_900 @color/colorPrimaryLight - #FAFAFA - #D7D7D7 - #D4D4D4 - #E9E9E9 - #E8E8E8 + @color/colorAccent + + @color/md_grey_50 + @color/md_light_dividers + @color/md_grey_300 #AAE9E9E9 - #333333 + @color/colorPrimarySuperDark \ 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 7ca3fe7a0..19994301c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -85,6 +85,7 @@ Chapters Selected: %1$d No title + DOWNLOADED Downloading… diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d6316b51e..a63e25d9c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -17,21 +17,17 @@ - - - - - @@ -84,6 +80,6 @@