Merge pull request #2 from icanit/master

UI improvement Phase 1
This commit is contained in:
inorichi 2015-11-24 20:07:04 +01:00
commit ccd259f263
36 changed files with 556 additions and 400 deletions

View File

@ -15,7 +15,7 @@
android:theme="@style/AppTheme" > android:theme="@style/AppTheme" >
<activity <activity
android:name=".ui.main.MainActivity" android:name=".ui.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar" > android:theme="@style/AppTheme" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -156,14 +156,23 @@ public class DatabaseHelper {
.prepare(); .prepare();
} }
public PreparedGetListOfObjects<Chapter> getChapters(long manga_id) { public PreparedGetListOfObjects<Chapter> getChapters(long manga_id, boolean sortAToZ, boolean onlyUnread) {
Query.CompleteBuilder query = Query.builder()
.table(ChaptersTable.TABLE)
.orderBy(ChaptersTable.COLUMN_CHAPTER_NUMBER + (sortAToZ ? " ASC" : " DESC"));
if (onlyUnread) {
query = query.where(ChaptersTable.COLUMN_MANGA_ID + "=? AND " + ChaptersTable.COLUMN_READ + "=?")
.whereArgs(manga_id, 0);
} else {
query = query.where(ChaptersTable.COLUMN_MANGA_ID + "=?")
.whereArgs(manga_id);
}
return db.get() return db.get()
.listOfObjects(Chapter.class) .listOfObjects(Chapter.class)
.withQuery(Query.builder() .withQuery(query.build())
.table(ChaptersTable.TABLE)
.where(ChaptersTable.COLUMN_MANGA_ID + "=?")
.whereArgs(manga_id)
.build())
.prepare(); .prepare();
} }
@ -236,7 +245,7 @@ public class DatabaseHelper {
.filter(c -> !chapters.contains(c)) .filter(c -> !chapters.contains(c))
.toList() .toList()
.flatMap(deletedChapters -> deleteChapters(deletedChapters).createObservable()) .flatMap(deletedChapters -> deleteChapters(deletedChapters).createObservable())
.map( d -> d.results().size() )); .map(d -> d.results().size()));
return Observable.zip(newChaptersObs, deletedChaptersObs, return Observable.zip(newChaptersObs, deletedChaptersObs,
(insertions, deletions) -> new PostResult(0, insertions, deletions) (insertions, deletions) -> new PostResult(0, insertions, deletions)

View File

@ -32,14 +32,11 @@ import uk.co.ribot.easyadapter.EasyAdapter;
@RequiresPresenter(CataloguePresenter.class) @RequiresPresenter(CataloguePresenter.class)
public class CatalogueFragment extends BaseRxFragment<CataloguePresenter> { public class CatalogueFragment extends BaseRxFragment<CataloguePresenter> {
@Bind(R.id.gridView) @Bind(R.id.gridView) GridView manga_list;
GridView manga_list;
@Bind(R.id.progress) @Bind(R.id.progress) ProgressBar progress;
ProgressBar progress;
@Bind(R.id.progress_grid) @Bind(R.id.progress_grid) ProgressBar progress_grid;
ProgressBar progress_grid;
private EasyAdapter<Manga> adapter; private EasyAdapter<Manga> adapter;
private EndlessScrollListener scroll_listener; private EndlessScrollListener scroll_listener;

View File

@ -7,6 +7,8 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.util.Objects;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.database.models.Manga; import eu.kanade.mangafeed.data.database.models.Manga;
import uk.co.ribot.easyadapter.ItemViewHolder; import uk.co.ribot.easyadapter.ItemViewHolder;
@ -17,11 +19,11 @@ import uk.co.ribot.easyadapter.annotations.ViewId;
@LayoutId(R.layout.item_catalogue) @LayoutId(R.layout.item_catalogue)
public class CatalogueHolder extends ItemViewHolder<Manga> { public class CatalogueHolder extends ItemViewHolder<Manga> {
@ViewId(R.id.catalogue_title) @ViewId(R.id.title) TextView title;
TextView title;
@ViewId(R.id.catalogue_thumbnail) @ViewId(R.id.author) TextView author;
ImageView image;
@ViewId(R.id.thumbnail) ImageView thumbnail;
public CatalogueHolder(View view) { public CatalogueHolder(View view) {
super(view); super(view);
@ -30,15 +32,16 @@ public class CatalogueHolder extends ItemViewHolder<Manga> {
@Override @Override
public void onSetValues(Manga manga, PositionInfo positionInfo) { public void onSetValues(Manga manga, PositionInfo positionInfo) {
title.setText(manga.title); title.setText(manga.title);
author.setText(manga.author);
if (manga.thumbnail_url != null) { if (manga.thumbnail_url != null) {
Glide.with(getContext()) Glide.with(getContext())
.load(manga.thumbnail_url) .load(manga.thumbnail_url)
.diskCacheStrategy(DiskCacheStrategy.RESULT) .diskCacheStrategy(DiskCacheStrategy.RESULT)
.centerCrop() .centerCrop()
.into(image); .into(thumbnail);
} else { } else {
image.setImageResource(android.R.color.transparent); thumbnail.setImageResource(android.R.color.transparent);
} }
} }
} }

View File

@ -0,0 +1,77 @@
package eu.kanade.mangafeed.ui.decoration;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
public class DividerItemDecoration extends RecyclerView.ItemDecoration {
private Drawable mDivider;
public DividerItemDecoration(Context context, AttributeSet attrs) {
final TypedArray a = context.obtainStyledAttributes(attrs, new int [] { android.R.attr.listDivider });
mDivider = a.getDrawable(0);
a.recycle();
}
public DividerItemDecoration(Drawable divider) { mDivider = divider; }
@Override
public void getItemOffsets (Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
if (mDivider == null) return;
if (parent.getChildPosition(view) < 1) return;
if (getOrientation(parent) == LinearLayoutManager.VERTICAL) outRect.top = mDivider.getIntrinsicHeight();
else outRect.left = mDivider.getIntrinsicWidth();
}
@Override
public void onDrawOver(Canvas c, RecyclerView parent) {
if (mDivider == null) { super.onDrawOver(c, parent); return; }
if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
for (int i=1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int size = mDivider.getIntrinsicHeight();
final int top = child.getTop() - params.topMargin;
final int bottom = top + size;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
} else { //horizontal
final int top = parent.getPaddingTop();
final int bottom = parent.getHeight() - parent.getPaddingBottom();
final int childCount = parent.getChildCount();
for (int i=1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int size = mDivider.getIntrinsicWidth();
final int left = child.getLeft() - params.leftMargin;
final int right = left + size;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
}
private int getOrientation(RecyclerView parent) {
if (parent.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) parent.getLayoutManager();
return layoutManager.getOrientation();
} else throw new IllegalStateException("DividerItemDecoration can only be used with a LinearLayoutManager.");
}
}

View File

@ -7,6 +7,8 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.util.Objects;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.database.models.Manga; import eu.kanade.mangafeed.data.database.models.Manga;
import uk.co.ribot.easyadapter.ItemViewHolder; import uk.co.ribot.easyadapter.ItemViewHolder;
@ -15,30 +17,30 @@ import uk.co.ribot.easyadapter.annotations.LayoutId;
import uk.co.ribot.easyadapter.annotations.ViewId; import uk.co.ribot.easyadapter.annotations.ViewId;
@LayoutId(R.layout.item_library) @LayoutId(R.layout.item_catalogue)
public class LibraryHolder extends ItemViewHolder<Manga> { public class LibraryHolder extends ItemViewHolder<Manga> {
@ViewId(R.id.thumbnailImage) @ViewId(R.id.thumbnail) ImageView thumbnail;
ImageView mThumbImage;
@ViewId(R.id.titleText) @ViewId(R.id.title) TextView title;
TextView mTitleText;
@ViewId(R.id.unreadText) @ViewId(R.id.author) TextView author;
TextView mUnreadText;
@ViewId(R.id.unreadText) TextView unreadText;
public LibraryHolder(View view) { public LibraryHolder(View view) {
super(view); super(view);
} }
public void onSetValues(Manga manga, PositionInfo positionInfo) { public void onSetValues(Manga manga, PositionInfo positionInfo) {
mTitleText.setText(manga.title); title.setText(manga.title);
author.setText(manga.author);
if (manga.unread > 0) { if (manga.unread > 0) {
mUnreadText.setVisibility(View.VISIBLE); unreadText.setVisibility(View.VISIBLE);
mUnreadText.setText(Integer.toString(manga.unread)); unreadText.setText(Integer.toString(manga.unread));
} } else {
else { unreadText.setVisibility(View.GONE);
mUnreadText.setVisibility(View.GONE);
} }
String thumbnail; String thumbnail;
@ -51,7 +53,7 @@ public class LibraryHolder extends ItemViewHolder<Manga> {
.load(thumbnail) .load(thumbnail)
.diskCacheStrategy(DiskCacheStrategy.RESULT) .diskCacheStrategy(DiskCacheStrategy.RESULT)
.centerCrop() .centerCrop()
.into(mThumbImage); .into(this.thumbnail);
} }
} }

View File

@ -22,11 +22,9 @@ import nucleus.view.ViewWithPresenter;
public class MainActivity extends BaseActivity { public class MainActivity extends BaseActivity {
@Bind(R.id.toolbar) @Bind(R.id.toolbar) Toolbar toolbar;
Toolbar toolbar;
@Bind(R.id.drawer_container) @Bind(R.id.drawer_container) FrameLayout container;
FrameLayout container;
private Drawer drawer; private Drawer drawer;
private FragmentStack fragmentStack; private FragmentStack fragmentStack;

View File

@ -2,16 +2,19 @@ package eu.kanade.mangafeed.ui.manga.chapter;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox;
import java.util.List; import java.util.List;
@ -20,6 +23,7 @@ import butterknife.ButterKnife;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
import eu.kanade.mangafeed.data.database.models.Chapter; import eu.kanade.mangafeed.data.database.models.Chapter;
import eu.kanade.mangafeed.data.download.DownloadService; import eu.kanade.mangafeed.data.download.DownloadService;
import eu.kanade.mangafeed.ui.decoration.DividerItemDecoration;
import eu.kanade.mangafeed.ui.manga.MangaActivity; import eu.kanade.mangafeed.ui.manga.MangaActivity;
import eu.kanade.mangafeed.ui.reader.ReaderActivity; import eu.kanade.mangafeed.ui.reader.ReaderActivity;
import eu.kanade.mangafeed.ui.base.activity.BaseActivity; import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
@ -33,6 +37,11 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
@Bind(R.id.chapter_list) RecyclerView chapters; @Bind(R.id.chapter_list) RecyclerView chapters;
@Bind(R.id.swipe_refresh) SwipeRefreshLayout swipeRefresh; @Bind(R.id.swipe_refresh) SwipeRefreshLayout swipeRefresh;
@Bind(R.id.toolbar_bottom) Toolbar toolbarBottom;
private MenuItem sortUpBtn;
private MenuItem sortDownBtn;
private CheckBox readCb;
private ChaptersAdapter adapter; private ChaptersAdapter adapter;
@ -56,9 +65,25 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
chapters.setLayoutManager(new LinearLayoutManager(getActivity())); chapters.setLayoutManager(new LinearLayoutManager(getActivity()));
chapters.addItemDecoration(new DividerItemDecoration(ContextCompat.getDrawable(this.getContext(), R.drawable.line_divider)));
createAdapter(); createAdapter();
setSwipeRefreshListener(); 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;
});
return view; return view;
} }
@ -66,6 +91,9 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.chapters, menu); inflater.inflate(R.menu.chapters, menu);
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
getPresenter().initSortIcon();
getPresenter().initReadCb();
} }
@Override @Override
@ -101,7 +129,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
} }
public boolean isOnlineManga() { public boolean isOnlineManga() {
return ((MangaActivity)getActivity()).isOnlineManga(); return ((MangaActivity) getActivity()).isOnlineManga();
} }
@Override @Override
@ -174,7 +202,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
@Override @Override
public void onListItemLongClick(int position) { public void onListItemLongClick(int position) {
if (actionMode == null) if (actionMode == null)
actionMode = ((BaseActivity)getActivity()).startSupportActionMode(this); actionMode = ((BaseActivity) getActivity()).startSupportActionMode(this);
toggleSelection(position); toggleSelection(position);
} }
@ -196,4 +224,12 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
actionMode.setTitle(getString(R.string.selected_chapters_title, count)); actionMode.setTitle(getString(R.string.selected_chapters_title, count));
} }
public void setSortIcon(boolean aToZ) {
if (sortUpBtn != null) sortUpBtn.setVisible(aToZ);
if (sortDownBtn != null) sortDownBtn.setVisible(!aToZ);
}
public void setReadFilter(boolean onlyUnread) {
if (readCb != null) readCb.setChecked(onlyUnread);
}
} }

View File

@ -1,13 +1,19 @@
package eu.kanade.mangafeed.ui.manga.chapter; package eu.kanade.mangafeed.ui.manga.chapter;
import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import eu.kanade.mangafeed.R; import eu.kanade.mangafeed.R;
@ -21,6 +27,9 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements
@Bind(R.id.chapter_title) TextView title; @Bind(R.id.chapter_title) TextView title;
@Bind(R.id.chapter_download_image) ImageView download_icon; @Bind(R.id.chapter_download_image) ImageView download_icon;
@Bind(R.id.chapter_pages) TextView pages; @Bind(R.id.chapter_pages) TextView pages;
@Bind(R.id.chapter_date) TextView date;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
public ChaptersHolder(View view) { public ChaptersHolder(View view) {
super(view); super(view);
@ -38,11 +47,10 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements
public void onSetValues(Context context, Chapter chapter) { public void onSetValues(Context context, Chapter chapter) {
title.setText(chapter.name); title.setText(chapter.name);
if (chapter.read) { if (chapter.read) {
title.setTextColor(ContextCompat.getColor(context, R.color.chapter_read_text)); title.setTextColor(ContextCompat.getColor(context, R.color.hint_text));
} else { } else {
title.setTextColor(Color.BLACK); title.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
} }
if (chapter.last_page_read > 0 && !chapter.read) { if (chapter.last_page_read > 0 && !chapter.read) {
@ -59,6 +67,7 @@ public class ChaptersHolder extends RecyclerView.ViewHolder implements
else if (chapter.downloaded == Chapter.NOT_DOWNLOADED) else if (chapter.downloaded == Chapter.NOT_DOWNLOADED)
download_icon.setImageResource(R.drawable.ic_file_download_black_36dp); download_icon.setImageResource(R.drawable.ic_file_download_black_36dp);
date.setText(sdf.format(new Date(chapter.date_fetch)));
toggleActivation(); toggleActivation();
} }

View File

@ -1,6 +1,7 @@
package eu.kanade.mangafeed.ui.manga.chapter; package eu.kanade.mangafeed.ui.manga.chapter;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
@ -36,6 +37,8 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
private Manga manga; private Manga manga;
private Source source; private Source source;
private boolean sortOrderAToZ = true;
private boolean onlyUnread = true;
private static final int DB_CHAPTERS = 1; private static final int DB_CHAPTERS = 1;
private static final int ONLINE_CHAPTERS = 2; private static final int ONLINE_CHAPTERS = 2;
@ -52,7 +55,7 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
this::getDbChaptersObs, this::getDbChaptersObs,
(view, chapters) -> { (view, chapters) -> {
view.onNextChapters(chapters); view.onNextChapters(chapters);
EventBus.getDefault().postSticky( new ChapterCountEvent(chapters.size()) ); EventBus.getDefault().postSticky(new ChapterCountEvent(chapters.size()));
} }
); );
@ -102,7 +105,7 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
} }
private Observable<List<Chapter>> getDbChaptersObs() { private Observable<List<Chapter>> getDbChaptersObs() {
return db.getChapters(manga.id).createObservable() return db.getChapters(manga.id, sortOrderAToZ, onlyUnread).createObservable()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()); .observeOn(AndroidSchedulers.mainThread());
} }
@ -146,7 +149,7 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
public void deleteChapters(Observable<Chapter> selectedChapters) { public void deleteChapters(Observable<Chapter> selectedChapters) {
deleteSubscription = selectedChapters deleteSubscription = selectedChapters
.doOnCompleted( () -> remove(deleteSubscription) ) .doOnCompleted(() -> remove(deleteSubscription))
.subscribe(chapter -> { .subscribe(chapter -> {
downloadManager.deleteChapter(source, manga, chapter); downloadManager.deleteChapter(source, manga, chapter);
chapter.downloaded = Chapter.NOT_DOWNLOADED; chapter.downloaded = Chapter.NOT_DOWNLOADED;
@ -164,4 +167,27 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
} }
} }
public void initSortIcon() {
if (getView() != null) {
getView().setSortIcon(sortOrderAToZ);//TODO do we need save order for manga?
}
}
public void initReadCb() {
if (getView() != null) {
getView().setReadFilter(onlyUnread);//TODO do we need save filter for manga?
}
}
public void revertSortOrder() {
sortOrderAToZ = !sortOrderAToZ;
initSortIcon();
start(DB_CHAPTERS);
}
public void setReadFilter(boolean onlyUnread) {
this.onlyUnread = onlyUnread;
initReadCb();
start(DB_CHAPTERS);
}
} }

View File

@ -1,12 +1,15 @@
package eu.kanade.mangafeed.ui.manga.info; package eu.kanade.mangafeed.ui.manga.info;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -31,8 +34,8 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
@Bind(R.id.manga_summary) TextView mDescription; @Bind(R.id.manga_summary) TextView mDescription;
@Bind(R.id.manga_cover) ImageView mCover; @Bind(R.id.manga_cover) ImageView mCover;
private MenuItem favoriteBtn; @Bind(R.id.action_favorite) Button favoriteBtn;
private MenuItem removeFavoriteBtn;
public static MangaInfoFragment newInstance() { public static MangaInfoFragment newInstance() {
return new MangaInfoFragment(); return new MangaInfoFragment();
@ -50,27 +53,27 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_manga_info, container, false); View view = inflater.inflate(R.layout.fragment_manga_info, container, false);
ButterKnife.bind(this, view); ButterKnife.bind(this, view);
favoriteBtn.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
getPresenter().toggleFavorite();
return true;
}
return false;
});
getPresenter().initFavoriteText();
return view; return view;
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.manga_info, menu);
favoriteBtn = menu.findItem(R.id.action_favorite);
removeFavoriteBtn = menu.findItem(R.id.action_remove_favorite);
getPresenter().initFavoriteIcon();
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_favorite:
case R.id.action_remove_favorite:
getPresenter().toggleFavorite();
break;
}
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@ -81,7 +84,7 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
mStatus.setText("Ongoing"); //TODO mStatus.setText("Ongoing"); //TODO
mDescription.setText(manga.description); mDescription.setText(manga.description);
setFavoriteIcon(manga.favorite); setFavoriteText(manga.favorite);
Glide.with(getActivity()) Glide.with(getActivity())
.load(manga.thumbnail_url) .load(manga.thumbnail_url)
@ -94,9 +97,8 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
mChapters.setText(String.valueOf(count)); mChapters.setText(String.valueOf(count));
} }
public void setFavoriteIcon(boolean isFavorite) { public void setFavoriteText(boolean isFavorite) {
if (favoriteBtn != null) favoriteBtn.setVisible(!isFavorite); favoriteBtn.setText(!isFavorite ? R.string.add_to_library : R.string.remove_from_library);
if (removeFavoriteBtn != null) removeFavoriteBtn.setVisible(isFavorite);
} }
} }

View File

@ -60,9 +60,9 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
} }
} }
public void initFavoriteIcon() { public void initFavoriteText() {
if (getView() != null) if (getView() != null)
getView().setFavoriteIcon(manga.favorite); getView().setFavoriteText(manga.favorite);
} }
public void toggleFavorite() { public void toggleFavorite() {

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/primary_text_disabled_material_dark" />
<item android:color="@color/primary_text_default_material_dark" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">>
<item android:drawable="@color/line_grey" android:state_pressed="true"/>
<item android:drawable="@color/line_grey" android:state_selected="true"/>
<item android:drawable="@color/line_grey" android:state_activated="true"/>
<item android:drawable="@color/library_text_background"/>
</selector>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp" />
<solid android:color="@color/divider" />
</shape>

View File

@ -1,18 +1,18 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:gravity="center">
<include <include
android:id="@+id/toolbar" android:id="@+id/toolbar"
layout="@layout/toolbar"/> layout="@layout/toolbar" />
<!-- the layout which will contain (host) the drawerLayout --> <!-- the layout which will contain (host) the drawerLayout -->
<FrameLayout <FrameLayout
android:layout_below="@id/toolbar"
android:id="@+id/drawer_container" android:id="@+id/drawer_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_below="@id/toolbar">
<!-- the layout which will be the content of the activity (which will be hosted inside the drawer (NOT the list of the drawer)) --> <!-- the layout which will be the content of the activity (which will be hosted inside the drawer (NOT the list of the drawer)) -->
<FrameLayout <FrameLayout

View File

@ -1,18 +1,16 @@
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:context="eu.kanade.mangafeed.ui.manga.MangaActivity" android:orientation="vertical"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" tools:context="eu.kanade.mangafeed.ui.manga.MangaActivity">
android:orientation="vertical">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> android:theme="@style/AppTheme.ActionBar">
<include <include
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -22,8 +20,9 @@
android:id="@+id/tabs" android:id="@+id/tabs"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:tabIndicatorColor="@android:color/white" android:theme="@style/AppTheme.TabLayout"
app:tabGravity="fill" /> app:tabGravity="fill"
app:tabIndicatorColor="@color/accent" />
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>

View File

@ -15,7 +15,7 @@
android:padding="4dp" android:padding="4dp"
android:layout_gravity="bottom|left" android:layout_gravity="bottom|left"
android:background="@color/page_number_background" android:background="@color/page_number_background"
android:textColor="@color/black_87pc" android:textColor="@color/primary_text"
android:textSize="12sp" android:textSize="12sp"
android:id="@+id/page_number"/> android:id="@+id/page_number"/>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true" android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment"> tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment">
<ProgressBar <ProgressBar
@ -16,18 +16,11 @@
android:visibility="gone" /> android:visibility="gone" />
<GridView <GridView
android:layout_width="match_parent" android:id="@+id/gridView"
style="@style/AppTheme.GridView"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:id="@+id/gridView" android:numColumns="2"
android:padding="10dp"
android:clipToPadding="false"
android:verticalSpacing="8dp"
android:horizontalSpacing="8dp"
android:columnWidth="96dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:fastScrollEnabled="true"
tools:listitem="@layout/item_catalogue" /> tools:listitem="@layout/item_catalogue" />
<ProgressBar <ProgressBar

View File

@ -1,22 +1,13 @@
<FrameLayout <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<GridView <GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/gridView" android:id="@+id/gridView"
android:padding="10dp" style="@style/AppTheme.GridView"
android:clipToPadding="false"
android:verticalSpacing="8dp"
android:horizontalSpacing="8dp"
android:columnWidth="96dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:fastScrollEnabled="true"
android:choiceMode="multipleChoiceModal" android:choiceMode="multipleChoiceModal"
tools:listitem="@layout/item_library" /> android:numColumns="2"
tools:listitem="@layout/item_catalogue" />
</FrameLayout> </FrameLayout>

View File

@ -1,20 +1,47 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"> xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh" android:id="@+id/swipe_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_above="@id/appbar_bottom"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:layout_width="match_parent" android:id="@+id/chapter_list"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:id="@+id/chapter_list"> android:layout_height="fill_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:listitem="@layout/item_chapter">
</android.support.v7.widget.RecyclerView> </android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout> <android.support.design.widget.AppBarLayout
android:id="@+id/appbar_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:theme="@style/AppTheme.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_bottom"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:gravity="top|start"
android:theme="@style/ThemeOverlay.AppTheme.Dark"
app:popupTheme="@style/AppTheme.Popup" />
</android.support.design.widget.AppBarLayout>
</RelativeLayout>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true" android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment"> tools:context="eu.kanade.mangafeed.ui.catalogue.CatalogueFragment">
<LinearLayout <LinearLayout
@ -96,7 +96,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignRight="@id/manga_genres_label"
android:layout_below="@id/manga_artist_label" android:layout_below="@id/manga_artist_label"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
@ -157,21 +156,33 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/manga_genres_label" android:layout_below="@id/manga_genres_label"
android:singleLine="false"
android:focusable="false" android:focusable="false"
android:focusableInTouchMode="false" android:focusableInTouchMode="false"
/> android:singleLine="false" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<Button
android:id="@+id/action_favorite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/add_to_library" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="10dp" android:orientation="vertical"
android:orientation="vertical"> android:padding="10dp">
<TextView <TextView
android:id="@+id/manga_summary_label" android:id="@+id/manga_summary_label"

View File

@ -1,64 +1,71 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="@drawable/library_item_background" android:background="@drawable/card_background"
> android:orientation="vertical">
<FrameLayout <ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="220dp"
android:background="@color/white"
<ImageView tools:background="@color/md_red_100"
android:layout_width="match_parent" tools:src="@mipmap/ic_launcher"
android:layout_height="144dp" />
android:id="@+id/catalogue_thumbnail"
tools:src="@mipmap/ic_launcher"
tools:background="@color/md_red_100"/>
<eu.kanade.mangafeed.widget.PTSansTextView
android:id="@+id/unreadText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123"
app:typeface="ptsansNarrowBold"
android:background="@color/md_red_300"
android:layout_gravity="right"
android:textSize="12sp"
android:visibility="gone"
android:textColor="@color/white"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="1dp" />
</FrameLayout>
<TextView
android:id="@+id/unreadText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@color/md_red_300"
android:paddingBottom="1dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:textColor="@color/white"
android:textSize="12sp"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:orientation="horizontal" android:id="@+id/footerLinearLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:id="@+id/footerLinearLayout" android:background="@color/white"
> android:orientation="vertical"
android:layout_alignBottom="@+id/thumbnail"
android:layout_alignLeft="@+id/unreadText"
android:layout_alignStart="@+id/unreadText">
<eu.kanade.mangafeed.widget.PTSansTextView <TextView
android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
app:typeface="ptsansNarrowBold"
android:ellipsize="middle" android:ellipsize="middle"
android:maxLines="2" android:maxLines="1"
android:textColor="@color/black_87pc"
android:textSize="13sp"
android:id="@+id/catalogue_title"
android:paddingRight="8dp"
android:paddingLeft="8dp" android:paddingLeft="8dp"
tools:text="Sample name"/> android:paddingRight="8dp"
android:textColor="@color/primary_text"
android:textSize="13sp"
tools:text="Sample name"
android:textStyle="bold" />
<TextView
tools:text="Sample name"
android:id="@+id/author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="middle"
android:maxLines="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textColor="@color/hint_text"
android:textSize="13sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </RelativeLayout>

View File

@ -1,53 +1,60 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_height="40dp" android:padding="6dip"
android:background="?attr/selectableItemBackground"> android:background="@drawable/selector_chapter_light">
<ImageView <RelativeLayout
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="20dp"
android:id="@+id/chapter_download_image" android:layout_alignParentBottom="true"
tools:src="@mipmap/ic_launcher"/> android:layout_toLeftOf="@+id/chapter_download_image"
android:layout_toStartOf="@+id/chapter_download_image">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1">
<TextView <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chapter_title"
tools:text="Chapter 32"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:gravity="center"
android:textStyle="bold"
android:textSize="16sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chapter_pages" android:id="@+id/chapter_pages"
tools:text="Pages: 45" android:layout_width="wrap_content"
android:layout_weight="1" android:layout_height="fill_parent"
android:gravity="center" android:ellipsize="marquee"
android:textSize="12sp"/> android:singleLine="true"
android:textSize="12sp"
tools:text="Pages: 45" />
</LinearLayout> <TextView
android:id="@+id/chapter_date"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:ellipsize="marquee"
android:singleLine="true"
android:textSize="12sp"
tools:text="22/02/2016"
android:layout_alignParentRight="true" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/chapter_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:textSize="20sp"
tools:text="Title"
android:layout_toLeftOf="@+id/chapter_download_image"
android:layout_toStartOf="@+id/chapter_download_image" />
<ImageView
android:id="@+id/chapter_download_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/chapter_date" android:layout_gravity="center_vertical"
tools:text="22/02/2016" android:gravity="center"
android:layout_gravity="bottom" android:layout_alignParentRight="true"
android:layout_marginBottom="2dp" tools:src="@drawable/ic_file_download_black_48dp"
android:textSize="12sp" />
android:paddingRight="5dp"/>
</LinearLayout>
</RelativeLayout>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/library_item_background"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="144dp"
android:id="@+id/thumbnailImage"
tools:src="@mipmap/ic_launcher"
tools:background="@color/md_red_100"/>
<eu.kanade.mangafeed.widget.PTSansTextView
android:id="@+id/unreadText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123"
app:typeface="ptsansNarrowBold"
android:background="@color/md_red_300"
android:layout_gravity="right"
android:textSize="12sp"
android:visibility="gone"
android:textColor="@color/white"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="1dp"
android:paddingBottom="1dp" />
</FrameLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="36dp"
android:id="@+id/footerLinearLayout"
>
<eu.kanade.mangafeed.widget.PTSansTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
app:typeface="ptsansNarrowBold"
android:ellipsize="middle"
android:maxLines="2"
android:textColor="@color/black_87pc"
android:textSize="13sp"
android:id="@+id/titleText"
android:paddingRight="8dp"
android:paddingLeft="8dp"
tools:text="Sample name"/>
</LinearLayout>
</LinearLayout>

View File

@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:elevation="4dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" android:theme="@style/ThemeOverlay.AppTheme.Dark"
android:elevation="4dp" /> app:popupTheme="@style/AppTheme.Popup" />

View File

@ -0,0 +1,27 @@
<?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

@ -1,10 +1,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MangaDetailActivity"> xmlns:tools="http://schemas.android.com/tools"
tools:context=".MangaDetailActivity">
<!--I am not sure wee need it, so for a while it will be not visible-->
<item <item
android:id="@+id/action_refresh" android:id="@+id/action_refresh"
android:title="@string/action_refresh"
android:icon="@drawable/ic_action_refresh" android:icon="@drawable/ic_action_refresh"
android:orderInCategory="1" android:orderInCategory="1"
android:title="@string/action_refresh"
android:visible="false"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
</menu> </menu>

View File

@ -1,18 +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_favorite"
android:title="@string/action_favorite"
android:icon="@drawable/ic_action_favorite"
android:visible="false"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_remove_favorite"
android:title="@string/action_remove_favorite"
android:icon="@drawable/ic_action_favorite_border"
android:visible="false"
app:showAsAction="ifRoom" />
</menu>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorBackground">@color/colorBackgroundLight</item>
<item name="android:colorForeground">@color/colorPrimary</item>
<item name="colorAccent">@color/accent</item>
</style>
</resources>

View File

@ -1,22 +1,34 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="primary">#607D8B</color> <color name="colorAccent">#FFEA00</color>
<color name="primary_dark">#455A64</color> <color name="colorPrimary">#607D8B</color>
<color name="primary_light">#CFD8DC</color> <color name="colorPrimaryDark">#455A64</color>
<color name="accent">#009688</color> <color name="colorPrimarySuperDark">#263238</color>
<color name="primary_text">#212121</color> <color name="colorPrimaryLight">#CFD8DC</color>
<color name="secondary_text">#727272</color>
<color name="icons">#FFFFFF</color> <color name="colorBackgroundLight">#ECEFF1</color>
<color name="divider">#B6B6B6</color>
<color name="primary">@color/colorPrimary</color>
<color name="primary_dark">@color/colorPrimaryDark</color>
<color name="primary_light">@color/colorPrimaryLight</color>
<color name="divider">#CFD8DC</color>
<color name="white">#FFFFFF</color> <color name="white">#FFFFFF</color>
<color name="primary_text">#DD000000</color>
<color name="secondary_text">#8B000000</color>
<color name="hint_text">#64000000</color>
<color name="icons">#FFFFFF</color>
<color name="list_choice_pressed_bg_light">@color/colorPrimaryLight</color>
<color name="super_light_grey">#FAFAFA</color> <color name="super_light_grey">#FAFAFA</color>
<color name="line_grey">#D7D7D7</color> <color name="line_grey">#D7D7D7</color>
<color name="light_grey">#D4D4D4</color> <color name="light_grey">#D4D4D4</color>
<color name="bg_light_grey">#E9E9E9</color> <color name="bg_light_grey">#E9E9E9</color>
<color name="black_87pc">#DD000000</color>
<color name="library_text_background">#E8E8E8</color> <color name="library_text_background">#E8E8E8</color>
<color name="chapter_read_text">#909090</color>
<color name="list_choice_pressed_bg_light">#607D8B</color>
<color name="page_number_background">#AAE9E9E9</color> <color name="page_number_background">#AAE9E9E9</color>
<color name="reader_menu_background">#333333</color> <color name="reader_menu_background">#333333</color>
</resources> </resources>

View File

@ -17,8 +17,9 @@
<string name="action_mark_as_unread">Mark as unread</string> <string name="action_mark_as_unread">Mark as unread</string>
<string name="action_download">Download</string> <string name="action_download">Download</string>
<string name="action_delete">Delete</string> <string name="action_delete">Delete</string>
<string name="action_favorite">Add to favorites</string> <string name="action_sort_up">Sort up</string>
<string name="action_remove_favorite">Remove from favorites</string> <string name="action_sort_down">Sort down</string>
<string name="action_show_unread">Show unread</string>
<!-- Preferences --> <!-- Preferences -->
<!-- Subsections --> <!-- Subsections -->
@ -70,10 +71,13 @@
<string name="artist">Artist</string> <string name="artist">Artist</string>
<string name="status">Status</string> <string name="status">Status</string>
<string name="description">Description</string> <string name="description">Description</string>
<string name="add_to_library">Add to library</string>
<string name="remove_from_library">Remove from library</string>
<!-- Manga chapters fragment --> <!-- Manga chapters fragment -->
<string name="manga_chapters_tab">Chapters</string> <string name="manga_chapters_tab">Chapters</string>
<string name="selected_chapters_title">Selected chapters: %1$d</string> <string name="selected_chapters_title">Selected: %1$d</string>
<string name="manga_chapter_no_title">No title</string>
<!-- Reader activity --> <!-- Reader activity -->
<string name="downloading">Downloading…</string> <string name="downloading">Downloading…</string>

View File

@ -1,85 +1,57 @@
<resources> <resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="AppTheme" parent="AppTheme.Base">
<item name="colorPrimary">@color/primary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/primary_dark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/accent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="alertDialogTheme">@style/AlertDialogStyle</item> <item name="colorButtonNormal">@color/colorPrimary</item>
<item name="android:itemTextAppearance">@style/OptionsMenuTextColor</item>
<item name="android:textColorPrimary">@color/black_87pc</item>
<item name="android:textColor">@color/black_87pc</item>
<item name="colorControlNormal">@color/white</item>
<item name="windowActionModeOverlay">true</item>
<item name="actionModeStyle">@style/Widget.ActionMode</item>
<item name="selectableItemBackground">@drawable/selector_chapter_light</item>
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme"> <item name="android:background">@color/white</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppTheme.ActionBar" parent="AppTheme">
<item name="android:textColorPrimary">@color/white</item>
<item name="drawerArrowStyle">@style/HamburgerIconStyle</item>
<item name="android:itemTextAppearance">@style/OptionsMenuTextColor</item>
</style>
<style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode">
<item name="background">@color/primary</item>
</style>
<style name="AlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:windowTitleStyle">@style/DialogTitleText</item>
<item name="colorAccent">@color/primary</item>
</style>
<style name="DialogTitleText">
<item name="android:textColor">@color/black_87pc</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
</style>
<style name="HamburgerIconStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@color/icons</item>
</style>
<style name="OptionsMenuTextColor" parent="@android:style/TextAppearance.Widget.IconMenu.Item">
<item name="android:textColor">@android:color/black</item>
</style>
<style name="TitleTextStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@color/primary</item>
<item name="android:textSize">@dimen/text_body</item>
<item name="android:textStyle">bold</item>
</style>
<style name="CardButtonTextStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:padding">16dp</item>
<item name="android:textSize">@dimen/text_small_body</item>
<item name="android:textStyle">bold</item>
<item name="android:background">@drawable/touchable_background_white</item>
</style>
<style name="ErrorTextStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">4dp</item>
<item name="android:textColor">@android:color/holo_red_light</item>
<item name="android:textSize">@dimen/text_small_body</item>
<item name="android:visibility">invisible</item>
</style>
<style name="EmptyListTextStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_centerInParent">true</item>
<item name="android:textColor">@color/primary_text</item> <item name="android:textColor">@color/primary_text</item>
<item name="android:textSize">@dimen/text_small_body</item>
<item name="android:visibility">gone</item> </style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionModeOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="ThemeOverlay.AppTheme.Dark" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:windowActionModeOverlay">true</item>
<item name="windowActionModeOverlay">true</item>
</style>
<style name="AppTheme.Popup" parent="@style/ThemeOverlay.AppTheme.Dark">
<item name="android:background">@color/colorPrimary</item>
<item name="android:textColor">@color/white</item>
</style>
<style name="AppTheme.ActionBar" parent="@style/ThemeOverlay.AppTheme.Dark">
<item name="android:actionModeBackground">@color/colorPrimarySuperDark</item>
<item name="actionModeBackground">@color/colorPrimarySuperDark</item>
</style>
<style name="AppTheme.TabLayout" parent="@style/ThemeOverlay.AppTheme.Dark">
<item name="android:background">@color/colorPrimary</item>
<item name="android:textColor">@color/white</item>
</style>
<style name="AppTheme.GridView" parent="AppTheme">
<item name="android:layout_width">match_parent</item>
<item name="android:padding">10dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:clipToPadding">false</item>
<item name="android:gravity">top|left</item>
<item name="android:smoothScrollbar">true</item>
<item name="android:cacheColorHint">#00000000</item>
<item name="android:fastScrollEnabled">true</item>
<item name="android:horizontalSpacing">0dp</item>
<item name="android:verticalSpacing">0dp</item>
<item name="android:numColumns">auto_fit</item>
<item name="android:stretchMode">columnWidth</item>
<item name="android:scrollbarStyle">outsideOverlay</item>
<item name="android:background">#e5e5e5</item>
</style> </style>
<style name="manga_detail_label"> <style name="manga_detail_label">
@ -91,6 +63,7 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
<item name="android:textIsSelectable">false</item> <item name="android:textIsSelectable">false</item>
</style> </style>
<style name="manga_detail_text"> <style name="manga_detail_text">
<item name="android:textSize">15sp</item> <item name="android:textSize">15sp</item>
<item name="android:textStyle">normal</item> <item name="android:textStyle">normal</item>
@ -99,14 +72,17 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
<item name="android:textIsSelectable">false</item> <item name="android:textIsSelectable">false</item>
</style> </style>
<style name="reader_settings_popup_animation"> <style name="reader_settings_popup_animation">
<item name="android:windowEnterAnimation">@anim/enter_from_right</item> <item name="android:windowEnterAnimation">@anim/enter_from_right</item>
<item name="android:windowExitAnimation">@anim/exit_to_right</item> <item name="android:windowExitAnimation">@anim/exit_to_right</item>
</style> </style>
<style name="reader_brightness_popup_animation"> <style name="reader_brightness_popup_animation">
<item name="android:windowEnterAnimation">@anim/enter_from_left</item> <item name="android:windowEnterAnimation">@anim/enter_from_left</item>
<item name="android:windowExitAnimation">@anim/exit_to_left</item> <item name="android:windowExitAnimation">@anim/exit_to_left</item>
</style> </style>
<style name="grey_text"> <style name="grey_text">
<item name="android:textColor">#e0e0e0</item> <item name="android:textColor">#e0e0e0</item>
</style> </style>