mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 12:51:49 +01:00
UI improvements 2
This commit is contained in:
parent
89683c24a8
commit
d7f5787ea0
@ -5,7 +5,6 @@ import com.squareup.okhttp.Response;
|
|||||||
|
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.data.database.models.Chapter;
|
import eu.kanade.mangafeed.data.database.models.Chapter;
|
||||||
@ -81,14 +80,6 @@ public abstract class BaseSource {
|
|||||||
|
|
||||||
// Get the URL of the first page that contains a source image and the page list
|
// Get the URL of the first page that contains a source image and the page list
|
||||||
protected String overrideChapterUrl(String defaultPageUrl) {
|
protected String overrideChapterUrl(String defaultPageUrl) {
|
||||||
if(defaultPageUrl.startsWith("http")){
|
|
||||||
try {
|
|
||||||
URI uri = new URI(defaultPageUrl);
|
|
||||||
defaultPageUrl = uri.getPath() + "?" + uri.getQuery();
|
|
||||||
}catch (Exception ignored){
|
|
||||||
return defaultPageUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return defaultPageUrl;
|
return defaultPageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ 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 android.widget.CheckBox;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import java.util.List;
|
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.swipe_refresh) SwipeRefreshLayout swipeRefresh;
|
||||||
@Bind(R.id.toolbar_bottom) Toolbar toolbarBottom;
|
@Bind(R.id.toolbar_bottom) Toolbar toolbarBottom;
|
||||||
|
|
||||||
private MenuItem sortUpBtn;
|
@Bind(R.id.action_sort) ImageView sortBtn;
|
||||||
private MenuItem sortDownBtn;
|
@Bind(R.id.action_next_unread) ImageView nextUnreadBtn;
|
||||||
private CheckBox readCb;
|
@Bind(R.id.action_show_unread) CheckBox readCb;
|
||||||
|
@Bind(R.id.action_show_downloaded) CheckBox downloadedCb;
|
||||||
|
|
||||||
private ChaptersAdapter adapter;
|
private ChaptersAdapter adapter;
|
||||||
|
|
||||||
@ -69,20 +71,11 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
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));
|
readCb.setOnCheckedChangeListener((arg, isCheked) -> getPresenter().setReadFilter(isCheked));
|
||||||
toolbarBottom.setOnMenuItemClickListener(arg0 -> {
|
sortBtn.setOnClickListener(v->getPresenter().revertSortOrder());
|
||||||
switch (arg0.getItemId()) {
|
nextUnreadBtn.setOnClickListener(v->{
|
||||||
case R.id.action_sort_up:
|
getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter());
|
||||||
case R.id.action_sort_down:
|
startActivity(ReaderActivity.newIntent(getActivity()));
|
||||||
getPresenter().revertSortOrder();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -247,8 +240,9 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSortIcon(boolean aToZ) {
|
public void setSortIcon(boolean aToZ) {
|
||||||
if (sortUpBtn != null) sortUpBtn.setVisible(aToZ);
|
if (sortBtn != null) {
|
||||||
if (sortDownBtn != null) sortDownBtn.setVisible(!aToZ);
|
sortBtn.setImageResource(!aToZ ? R.drawable.ic_expand_less_white_36dp : R.drawable.ic_expand_more_white_36dp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReadFilter(boolean onlyUnread) {
|
public void setReadFilter(boolean onlyUnread) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
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;
|
||||||
@ -122,6 +121,14 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
|
|||||||
EventBus.getDefault().postSticky(new SourceMangaChapterEvent(source, manga, chapter));
|
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) {
|
public void markChaptersRead(Observable<Chapter> selectedChapters, boolean read) {
|
||||||
add(markReadSubscription = selectedChapters
|
add(markReadSubscription = selectedChapters
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
@ -43,39 +43,35 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginRight="4dp">
|
android:layout_marginRight="4dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/action_sort"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/action_sort_up"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:src="@drawable/ic_expand_less_white_36dp"
|
|
||||||
android:title="@string/action_sort_up"
|
|
||||||
android:visible="true"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/action_sort_down"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:src="@drawable/ic_expand_more_white_36dp"
|
|
||||||
android:title="@string/action_sort_down"
|
|
||||||
android:visible="true"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="4dp"
|
android:layout_margin="10dp"
|
||||||
android:background="@color/white"/>
|
android:background="@color/white"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/action_show_unread"
|
android:id="@+id/action_show_unread"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
android:text="@string/action_show_unread"
|
android:text="@string/action_show_unread"
|
||||||
android:title="@string/action_show_unread"/>
|
android:title="@string/action_show_unread"/>
|
||||||
@ -84,10 +80,17 @@
|
|||||||
android:id="@+id/action_show_downloaded"
|
android:id="@+id/action_show_downloaded"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
android:text="@string/action_show_downloaded"
|
android:text="@string/action_show_downloaded"
|
||||||
android:title="@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>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -96,9 +99,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="?android:selectableItemBackground"
|
||||||
android:src="@drawable/ic_play_arrow_white_36dp"
|
android:src="@drawable/ic_play_arrow_white_36dp"
|
||||||
android:title="@string/action_next_unread"
|
android:title="@string/action_next_unread"
|
||||||
android:visible="true"/>
|
/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</android.support.v7.widget.Toolbar>
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
android:layout_alignTop="@+id/thumbnail"
|
android:layout_alignTop="@+id/thumbnail"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_marginRight="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:src="@drawable/ic_action_favorite"
|
android:src="@drawable/ic_action_favorite_blue"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
Loading…
Reference in New Issue
Block a user