From 4918e67fdaf1d824e40e45cbaac3d0576b3fa9e5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 25 Jan 2016 12:49:56 +0100 Subject: [PATCH] Show manga source in info panel --- .../ui/manga/info/MangaInfoFragment.java | 15 ++++++++-- .../ui/manga/info/MangaInfoPresenter.java | 3 +- .../main/res/layout/fragment_manga_info.xml | 28 +++++++++++++++++-- app/src/main/res/values/strings.xml | 1 + 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java index 16aaeee9e..236d0a1ad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoFragment.java @@ -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 { @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 { return view; } - public void onNextManga(Manga manga) { + public void onNextManga(Pair 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); diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.java b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.java index 0258f2a40..dbd4410e2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoPresenter.java @@ -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 { } restartableLatestCache(GET_MANGA, - () -> Observable.just(manga), + () -> Observable.just(new Pair<>(manga, source)), MangaInfoFragment::onNextManga); restartableLatestCache(GET_CHAPTER_COUNT, diff --git a/app/src/main/res/layout/fragment_manga_info.xml b/app/src/main/res/layout/fragment_manga_info.xml index 2631044ba..8453985ce 100644 --- a/app/src/main/res/layout/fragment_manga_info.xml +++ b/app/src/main/res/layout/fragment_manga_info.xml @@ -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" /> + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d91187577..7ba24db68 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -144,6 +144,7 @@ Author Chapters Genres + Source Artist Description Status