Merge pull request #6 from icanit/master

UI Impovements
This commit is contained in:
inorichi 2015-12-01 20:46:50 +01:00
commit 8b6f7fc860
18 changed files with 128 additions and 69 deletions

View file

@ -49,6 +49,7 @@ public class CatalogueAdapter extends ArrayAdapter<Manga> {
@Bind(R.id.title) TextView title;
@Bind(R.id.author) TextView author;
@Bind(R.id.thumbnail) ImageView thumbnail;
@Bind(R.id.favorite_sticker) ImageView favorite_sticker;
CatalogueFragment fragment;
@ -73,6 +74,12 @@ public class CatalogueAdapter extends ArrayAdapter<Manga> {
} else {
thumbnail.setImageResource(android.R.color.transparent);
}
if(manga.favorite){
favorite_sticker.setVisibility(View.VISIBLE);
}else{
favorite_sticker.setVisibility(View.INVISIBLE);
}
}
}
}

View file

@ -15,6 +15,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import java.util.List;
@ -39,9 +40,10 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
@Bind(R.id.swipe_refresh) SwipeRefreshLayout swipeRefresh;
@Bind(R.id.toolbar_bottom) Toolbar toolbarBottom;
private MenuItem sortUpBtn;
private MenuItem sortDownBtn;
private CheckBox readCb;
@Bind(R.id.action_sort) ImageView sortBtn;
@Bind(R.id.action_next_unread) ImageView nextUnreadBtn;
@Bind(R.id.action_show_unread) CheckBox readCb;
@Bind(R.id.action_show_downloaded) CheckBox downloadedCb;
private ChaptersAdapter adapter;
@ -69,20 +71,11 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
createAdapter();
setSwipeRefreshListener();
toolbarBottom.inflateMenu(R.menu.chapter_filter);
sortUpBtn = toolbarBottom.getMenu().findItem(R.id.action_sort_up);
sortDownBtn = toolbarBottom.getMenu().findItem(R.id.action_sort_down);
readCb = (CheckBox) toolbarBottom.findViewById(R.id.action_show_unread);
readCb.setOnCheckedChangeListener((arg, isCheked) -> getPresenter().setReadFilter(isCheked));
toolbarBottom.setOnMenuItemClickListener(arg0 -> {
switch (arg0.getItemId()) {
case R.id.action_sort_up:
case R.id.action_sort_down:
getPresenter().revertSortOrder();
return true;
}
return false;
sortBtn.setOnClickListener(v->getPresenter().revertSortOrder());
nextUnreadBtn.setOnClickListener(v->{
getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter());
startActivity(ReaderActivity.newIntent(getActivity()));
});
return view;
}
@ -247,8 +240,9 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
}
public void setSortIcon(boolean aToZ) {
if (sortUpBtn != null) sortUpBtn.setVisible(aToZ);
if (sortDownBtn != null) sortDownBtn.setVisible(!aToZ);
if (sortBtn != null) {
sortBtn.setImageResource(!aToZ ? R.drawable.ic_expand_less_white_36dp : R.drawable.ic_expand_more_white_36dp);
}
}
public void setReadFilter(boolean onlyUnread) {

View file

@ -1,7 +1,6 @@
package eu.kanade.mangafeed.ui.manga.chapter;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import java.io.File;
import java.util.List;
@ -122,6 +121,14 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
EventBus.getDefault().postSticky(new SourceMangaChapterEvent(source, manga, chapter));
}
public Chapter getNextUnreadChapter() {
List<Chapter> chapters = db.getNextUnreadChapter(manga).executeAsBlocking();
if(chapters.size() < 1){
return null;
}
return chapters.get(0);
}
public void markChaptersRead(Observable<Chapter> selectedChapters, boolean read) {
add(markReadSubscription = selectedChapters
.subscribeOn(Schedulers.io())

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

View file

@ -19,6 +19,7 @@
android:layout_height="fill_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:descendantFocusability="blocksDescendants"
tools:listitem="@layout/item_chapter">
</android.support.v7.widget.RecyclerView>
@ -37,10 +38,72 @@
android:theme="@style/ThemeOverlay.AppTheme.Dark"
app:popupTheme="@style/AppTheme.Popup">
<android.support.v7.widget.ActionMenuView
android:id="@+id/bottom_menu"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="4dp">
<ImageView
android:id="@+id/action_sort"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"/>
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="?android:selectableItemBackground"
android:title="@string/action_sort_up"
tools:src="@drawable/ic_expand_less_white_36dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toEndOf="@+id/action_sort"
android:layout_toLeftOf="@+id/action_next_unread"
android:layout_toRightOf="@+id/action_sort"
android:gravity="center_vertical">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="@color/white"/>
<CheckBox
android:id="@+id/action_show_unread"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:checkable="true"
android:text="@string/action_show_unread"
android:title="@string/action_show_unread"/>
<CheckBox
android:id="@+id/action_show_downloaded"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:checkable="true"
android:text="@string/action_show_downloaded"
android:title="@string/action_show_downloaded"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:background="@color/white"/>
</LinearLayout>
<ImageView
android:id="@+id/action_next_unread"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:background="?android:selectableItemBackground"
android:src="@drawable/ic_play_arrow_white_36dp"
android:title="@string/action_next_unread"
/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>

View file

@ -29,15 +29,27 @@
android:textSize="12sp"
android:visibility="gone"/>
<ImageView
android:id="@+id/favorite_sticker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/thumbnail"
android:layout_alignRight="@+id/thumbnail"
android:layout_alignTop="@+id/thumbnail"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:src="@drawable/ic_action_favorite_blue"
android:visibility="invisible"/>
<LinearLayout
android:id="@+id/footerLinearLayout"
android:layout_width="match_parent"
android:layout_height="36dp"
android:background="@color/white"
android:orientation="vertical"
android:layout_alignBottom="@+id/thumbnail"
android:layout_alignLeft="@+id/unreadText"
android:layout_alignStart="@+id/unreadText">
android:layout_alignStart="@+id/unreadText"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/title"
@ -50,11 +62,10 @@
android:paddingRight="8dp"
android:textColor="@color/primary_text"
android:textSize="13sp"
tools:text="Sample name"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="Sample name"/>
<TextView
tools:text="Sample name"
android:id="@+id/author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -64,7 +75,8 @@
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textColor="@color/hint_text"
android:textSize="13sp" />
android:textSize="13sp"
tools:text="Sample name"/>
</LinearLayout>

View file

@ -64,7 +64,8 @@
android:layout_above="@+id/relativeLayout"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"/>
android:layout_alignParentTop="true"
android:layout_marginRight="30dp"/>
<RelativeLayout
android:id="@+id/chapter_menu"
@ -72,10 +73,10 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center|end"
android:layout_alignRight="@+id/chapter_title"
android:layout_alignEnd="@+id/chapter_title"
android:layout_alignBottom="@+id/relativeLayout"
android:paddingBottom="18dp">
android:paddingBottom="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"

View file

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_sort_up"
android:title="@string/action_sort_up"
android:icon="@drawable/ic_expand_less_white_36dp"
android:visible="true"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_sort_down"
android:title="@string/action_sort_down"
android:icon="@drawable/ic_expand_more_white_36dp"
android:visible="true"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_show_unread"
android:checkable="true"
android:title="@string/action_show_unread"
android:text="@string/action_show_unread"
app:actionViewClass="android.widget.CheckBox"
app:showAsAction="ifRoom|withText" />
</menu>

View file

@ -21,10 +21,12 @@
<string name="action_edit">Edit</string>
<string name="action_sort_up">Sort up</string>
<string name="action_sort_down">Sort down</string>
<string name="action_show_unread">Show unread</string>
<string name="action_show_unread">Unread</string>
<string name="action_show_downloaded">Downloaded</string>
<string name="action_next_unread">Next unread</string>
<!-- Buttons -->
<string name="button_ok">Ok</string>
<string name="button_ok">OK</string>
<string name="button_cancel">Cancel</string>