Show manga source in info panel

This commit is contained in:
Robin Appelman 2016-01-25 12:49:56 +01:00
parent b174adbab0
commit 4918e67fda
4 changed files with 41 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.manga.info;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -16,6 +17,7 @@ import butterknife.ButterKnife;
import eu.kanade.tachiyomi.R;
import eu.kanade.tachiyomi.data.cache.CoverCache;
import eu.kanade.tachiyomi.data.database.models.Manga;
import eu.kanade.tachiyomi.data.source.base.Source;
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment;
import nucleus.factory.RequiresPresenter;
@ -29,6 +31,7 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
@Bind(R.id.manga_chapters) TextView chapterCount;
@Bind(R.id.manga_genres) TextView genres;
@Bind(R.id.manga_status) TextView status;
@Bind(R.id.manga_source) TextView source;
@Bind(R.id.manga_summary) TextView description;
@Bind(R.id.manga_cover) ImageView cover;
@ -60,18 +63,24 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> {
return view;
}
public void onNextManga(Manga manga) {
public void onNextManga(Pair<Manga,Source> info) {
Manga manga = info.first;
Source source = info.second;
if (manga.initialized) {
setMangaInfo(manga);
setMangaInfo(manga, source);
} else {
// Initialize manga
fetchMangaFromSource();
}
}
private void setMangaInfo(Manga manga) {
private void setMangaInfo(Manga manga, Source mangaSource) {
artist.setText(manga.artist);
author.setText(manga.author);
if (mangaSource != null) {
source.setText(mangaSource.getName());
}
genres.setText(manga.genre);
status.setText(manga.getStatus(getActivity()));
description.setText(manga.description);

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.ui.manga.info;
import android.os.Bundle;
import android.util.Pair;
import javax.inject.Inject;
@ -40,7 +41,7 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
}
restartableLatestCache(GET_MANGA,
() -> Observable.just(manga),
() -> Observable.just(new Pair<>(manga, source)),
MangaInfoFragment::onNextManga);
restartableLatestCache(GET_CHAPTER_COUNT,

View File

@ -154,7 +154,31 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/manga_status_label"
android:layout_toRightOf="@id/manga_chapters_label"
android:layout_toRightOf="@id/manga_status_label"
android:ellipsize="end"
android:focusable="false"
android:focusableInTouchMode="false"
android:maxLines="1"
android:singleLine="true" />
<TextView
android:id="@+id/manga_source_label"
style="@style/manga_detail_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/manga_status"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/source" />
<TextView
android:id="@+id/manga_source"
style="@style/manga_detail_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/manga_source_label"
android:layout_toRightOf="@id/manga_source_label"
android:ellipsize="end"
android:focusable="false"
android:focusableInTouchMode="false"
@ -167,7 +191,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/manga_status_label"
android:layout_below="@id/manga_source_label"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/genres" />

View File

@ -144,6 +144,7 @@
<string name="author">Author</string>
<string name="chapters">Chapters</string>
<string name="genres">Genres</string>
<string name="source">Source</string>
<string name="artist">Artist</string>
<string name="description">Description</string>
<string name="status">Status</string>