Merge pull request #143 from NoodleMage/fab_improvement
Moved edit to cover select and update manga info view
| @@ -4,6 +4,8 @@ import android.view.View; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import com.mikepenz.iconics.view.IconicsImageView; | ||||
|  | ||||
| import butterknife.Bind; | ||||
| import butterknife.ButterKnife; | ||||
| import eu.kanade.tachiyomi.R; | ||||
| @@ -13,7 +15,7 @@ public class CatalogueGridHolder extends CatalogueHolder { | ||||
|  | ||||
|     @Bind(R.id.title) TextView title; | ||||
|     @Bind(R.id.thumbnail) ImageView thumbnail; | ||||
|     @Bind(R.id.favorite_sticker) ImageView favoriteSticker; | ||||
|     @Bind(R.id.favorite_sticker) IconicsImageView favoriteSticker; | ||||
|  | ||||
|     public CatalogueGridHolder(View view, CatalogueAdapter adapter, OnListItemClickListener listener) { | ||||
|         super(view, adapter, listener); | ||||
| @@ -23,7 +25,10 @@ public class CatalogueGridHolder extends CatalogueHolder { | ||||
|     @Override | ||||
|     public void onSetValues(Manga manga, CataloguePresenter presenter) { | ||||
|         title.setText(manga.title); | ||||
|         // Set visibility of in library icon. | ||||
|         favoriteSticker.setVisibility(manga.favorite ? View.VISIBLE : View.GONE); | ||||
|         // Set alpha of thumbnail. | ||||
|         thumbnail.setAlpha(manga.favorite ? 0.3f : 1.0f); | ||||
|         setImage(manga, presenter); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,15 @@ import android.os.Bundle; | ||||
| import android.support.annotation.Nullable; | ||||
| import android.support.v7.widget.LinearLayoutManager; | ||||
| import android.support.v7.widget.RecyclerView; | ||||
| import android.view.*; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuInflater; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import butterknife.Bind; | ||||
| import butterknife.ButterKnife; | ||||
| import eu.kanade.tachiyomi.R; | ||||
| @@ -14,8 +22,6 @@ import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment; | ||||
| import nucleus.factory.RequiresPresenter; | ||||
| import rx.Subscription; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| @RequiresPresenter(DownloadPresenter.class) | ||||
| public class DownloadFragment extends BaseRxFragment<DownloadPresenter> { | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,12 @@ | ||||
| package eu.kanade.tachiyomi.ui.download; | ||||
|  | ||||
| import android.os.Bundle; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| import javax.inject.Inject; | ||||
|  | ||||
| import eu.kanade.tachiyomi.data.download.DownloadManager; | ||||
| import eu.kanade.tachiyomi.data.download.model.Download; | ||||
| import eu.kanade.tachiyomi.data.download.model.DownloadQueue; | ||||
| @@ -12,21 +18,15 @@ import rx.android.schedulers.AndroidSchedulers; | ||||
| import rx.schedulers.Schedulers; | ||||
| import timber.log.Timber; | ||||
|  | ||||
| import javax.inject.Inject; | ||||
| import java.util.HashMap; | ||||
| import java.util.concurrent.TimeUnit; | ||||
|  | ||||
| public class DownloadPresenter extends BasePresenter<DownloadFragment> { | ||||
|  | ||||
|     public final static int GET_DOWNLOAD_QUEUE = 1; | ||||
|     @Inject DownloadManager downloadManager; | ||||
|  | ||||
|     private DownloadQueue downloadQueue; | ||||
|     private Subscription statusSubscription; | ||||
|     private Subscription pageProgressSubscription; | ||||
|     private HashMap<Download, Subscription> progressSubscriptions; | ||||
|  | ||||
|     public final static int GET_DOWNLOAD_QUEUE = 1; | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedState) { | ||||
|         super.onCreate(savedState); | ||||
|   | ||||
| @@ -64,7 +64,6 @@ public class LibraryCategoryAdapter extends FlexibleAdapter<LibraryHolder, Manga | ||||
|         final LibraryPresenter presenter = ((LibraryFragment) fragment.getParentFragment()).getPresenter(); | ||||
|         final Manga manga = getItem(position); | ||||
|         holder.onSetValues(manga, presenter); | ||||
|  | ||||
|         //When user scrolls this bind the correct selection status | ||||
|         holder.itemView.setActivated(isSelected(position)); | ||||
|     } | ||||
|   | ||||
| @@ -47,6 +47,8 @@ public class LibraryCategoryFragment extends BaseFragment | ||||
|         return fragment; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { | ||||
|         // Inflate the layout for this fragment | ||||
| @@ -86,7 +88,10 @@ public class LibraryCategoryFragment extends BaseFragment | ||||
|                     adapter.updateDataSet(); | ||||
|                 }); | ||||
|  | ||||
|  | ||||
|  | ||||
|         return view; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -165,15 +170,16 @@ public class LibraryCategoryFragment extends BaseFragment | ||||
|  | ||||
|     private void toggleSelection(int position) { | ||||
|         LibraryFragment f = getLibraryFragment(); | ||||
|  | ||||
|         adapter.toggleSelection(position, false); | ||||
|         f.getPresenter().setSelection(adapter.getItem(position), adapter.isSelected(position)); | ||||
|  | ||||
|         int count = f.getPresenter().selectedMangas.size(); | ||||
|         if (count == 0) { | ||||
|             f.destroyActionModeIfNeeded(); | ||||
|         } else { | ||||
|         } | ||||
|         else { | ||||
|             f.setContextTitle(count); | ||||
|             f.setVisibilityOfCoverEdit(count); | ||||
|             f.invalidateActionMode(); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| package eu.kanade.tachiyomi.ui.library; | ||||
|  | ||||
| import android.app.Activity; | ||||
| import android.content.Intent; | ||||
| import android.net.Uri; | ||||
| import android.os.Bundle; | ||||
| import android.support.annotation.Nullable; | ||||
| import android.support.design.widget.AppBarLayout; | ||||
| @@ -20,6 +22,8 @@ import com.afollestad.materialdialogs.MaterialDialog; | ||||
|  | ||||
| import org.greenrobot.eventbus.EventBus; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| @@ -30,11 +34,13 @@ import eu.davidea.flexibleadapter.FlexibleAdapter; | ||||
| import eu.kanade.tachiyomi.R; | ||||
| import eu.kanade.tachiyomi.data.database.models.Category; | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga; | ||||
| import eu.kanade.tachiyomi.data.io.IOHandler; | ||||
| import eu.kanade.tachiyomi.data.sync.LibraryUpdateService; | ||||
| import eu.kanade.tachiyomi.event.LibraryMangasEvent; | ||||
| import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment; | ||||
| import eu.kanade.tachiyomi.ui.library.category.CategoryActivity; | ||||
| import eu.kanade.tachiyomi.ui.main.MainActivity; | ||||
| import eu.kanade.tachiyomi.util.ToastUtil; | ||||
| import icepick.State; | ||||
| import nucleus.factory.RequiresPresenter; | ||||
|  | ||||
| @@ -42,17 +48,25 @@ import nucleus.factory.RequiresPresenter; | ||||
| public class LibraryFragment extends BaseRxFragment<LibraryPresenter> | ||||
|         implements ActionMode.Callback { | ||||
|  | ||||
|     @Bind(R.id.view_pager) ViewPager viewPager; | ||||
|     private TabLayout tabs; | ||||
|     private AppBarLayout appBar; | ||||
|  | ||||
|     private static final int REQUEST_IMAGE_OPEN = 101; | ||||
|  | ||||
|     protected LibraryAdapter adapter; | ||||
|  | ||||
|     private ActionMode actionMode; | ||||
|     @Bind(R.id.view_pager) ViewPager viewPager; | ||||
|  | ||||
|     @State int activeCategory; | ||||
|  | ||||
|     @State String query = ""; | ||||
|  | ||||
|     private TabLayout tabs; | ||||
|  | ||||
|     private AppBarLayout appBar; | ||||
|  | ||||
|     private ActionMode actionMode; | ||||
|  | ||||
|     private Manga selectedCoverManga; | ||||
|  | ||||
|     public static LibraryFragment newInstance() { | ||||
|         return new LibraryFragment(); | ||||
|     } | ||||
| @@ -187,6 +201,11 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> | ||||
|         actionMode.setTitle(getString(R.string.label_selected, count)); | ||||
|     } | ||||
|  | ||||
|     public void setVisibilityOfCoverEdit(int count) { | ||||
|         // If count = 1 display edit button | ||||
|         actionMode.getMenu().findItem(R.id.action_edit_cover).setVisible((count == 1)); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onCreateActionMode(ActionMode mode, Menu menu) { | ||||
|         mode.getMenuInflater().inflate(R.menu.library_selection, menu); | ||||
| @@ -202,6 +221,11 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> | ||||
|     @Override | ||||
|     public boolean onActionItemClicked(ActionMode mode, MenuItem item) { | ||||
|         switch (item.getItemId()) { | ||||
|             case R.id.action_edit_cover: | ||||
|                 changeSelectedCover(getPresenter().selectedMangas); | ||||
|                 rebuildAdapter(); | ||||
|                 destroyActionModeIfNeeded(); | ||||
|                 return true; | ||||
|             case R.id.action_move_to_category: | ||||
|                 moveMangasToCategories(getPresenter().selectedMangas); | ||||
|                 return true; | ||||
| @@ -213,6 +237,15 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * TODO workaround. Covers won't refresh any other way. | ||||
|      */ | ||||
|     public void rebuildAdapter() { | ||||
|         adapter = new LibraryAdapter(getChildFragmentManager()); | ||||
|         viewPager.setAdapter(adapter); | ||||
|         tabs.setupWithViewPager(viewPager); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onDestroyActionMode(ActionMode mode) { | ||||
|         adapter.setSelectionMode(FlexibleAdapter.MODE_SINGLE); | ||||
| @@ -226,6 +259,53 @@ public class LibraryFragment extends BaseRxFragment<LibraryPresenter> | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void changeSelectedCover(List<Manga> mangas) { | ||||
|         if (mangas.size() == 1) { | ||||
|             selectedCoverManga = mangas.get(0); | ||||
|             if (selectedCoverManga.favorite) { | ||||
|  | ||||
|                 Intent intent = new Intent(); | ||||
|                 intent.setType("image/*"); | ||||
|                 intent.setAction(Intent.ACTION_GET_CONTENT); | ||||
|                 startActivityForResult(Intent.createChooser(intent, | ||||
|                         getString(R.string.file_select_cover)), REQUEST_IMAGE_OPEN); | ||||
|             } else { | ||||
|                 ToastUtil.showShort(getContext(), R.string.notification_first_add_to_library); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onActivityResult(int requestCode, int resultCode, Intent data) { | ||||
|         if (resultCode == Activity.RESULT_OK) { | ||||
|             switch (requestCode) { | ||||
|                 case (REQUEST_IMAGE_OPEN): | ||||
|                     if (selectedCoverManga != null) { | ||||
|                         // Get the file's content URI from the incoming Intent | ||||
|                         Uri selectedImageUri = data.getData(); | ||||
|  | ||||
|                         // Convert to absolute path to prevent FileNotFoundException | ||||
|                         String result = IOHandler.getFilePath(selectedImageUri, | ||||
|                                 getContext().getContentResolver(), getContext()); | ||||
|  | ||||
|                         // Get file from filepath | ||||
|                         File picture = new File(result != null ? result : ""); | ||||
|  | ||||
|                         try { | ||||
|                             // Update cover to selected file, show error if something went wrong | ||||
|                             if (!getPresenter().editCoverWithLocalFile(picture, selectedCoverManga)) | ||||
|                                 ToastUtil.showShort(getContext(), R.string.notification_manga_update_failed); | ||||
|  | ||||
|                         } catch (IOException e) { | ||||
|                             e.printStackTrace(); | ||||
|                         } | ||||
|                     } | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void moveMangasToCategories(List<Manga> mangas) { | ||||
|         new MaterialDialog.Builder(getActivity()) | ||||
|                 .title(R.string.action_move_category) | ||||
|   | ||||
| @@ -50,4 +50,6 @@ public class LibraryHolder extends FlexibleViewHolder { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,8 @@ import android.util.Pair; | ||||
|  | ||||
| import org.greenrobot.eventbus.EventBus; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| @@ -26,18 +28,15 @@ import rx.subjects.BehaviorSubject; | ||||
|  | ||||
| public class LibraryPresenter extends BasePresenter<LibraryFragment> { | ||||
|  | ||||
|     private static final int GET_LIBRARY = 1; | ||||
|     protected List<Category> categories; | ||||
|     protected List<Manga> selectedMangas; | ||||
|     protected BehaviorSubject<String> searchSubject; | ||||
|     @Inject DatabaseHelper db; | ||||
|     @Inject PreferencesHelper preferences; | ||||
|     @Inject CoverCache coverCache; | ||||
|     @Inject SourceManager sourceManager; | ||||
|  | ||||
|     protected List<Category> categories; | ||||
|     protected List<Manga> selectedMangas; | ||||
|  | ||||
|     protected BehaviorSubject<String> searchSubject; | ||||
|  | ||||
|     private static final int GET_LIBRARY = 1; | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedState) { | ||||
|         super.onCreate(savedState); | ||||
| @@ -141,4 +140,18 @@ public class LibraryPresenter extends BasePresenter<LibraryFragment> { | ||||
|  | ||||
|         db.setMangaCategories(mc, mangas); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Update cover with local file | ||||
|      */ | ||||
|     public boolean editCoverWithLocalFile(File file, Manga manga) throws IOException { | ||||
|         if (!manga.initialized) | ||||
|             return false; | ||||
|  | ||||
|         if (manga.favorite) { | ||||
|             coverCache.copyToLocalCache(manga.thumbnail_url, file); | ||||
|             return true; | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -8,12 +8,22 @@ import android.support.v4.widget.SwipeRefreshLayout; | ||||
| import android.support.v7.view.ActionMode; | ||||
| import android.support.v7.widget.LinearLayoutManager; | ||||
| import android.support.v7.widget.RecyclerView; | ||||
| import android.view.*; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuInflater; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.CheckBox; | ||||
| import android.widget.ImageView; | ||||
|  | ||||
| import com.afollestad.materialdialogs.MaterialDialog; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| import butterknife.Bind; | ||||
| import butterknife.ButterKnife; | ||||
| import com.afollestad.materialdialogs.MaterialDialog; | ||||
| import eu.kanade.tachiyomi.R; | ||||
| import eu.kanade.tachiyomi.data.database.models.Chapter; | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga; | ||||
| @@ -31,9 +41,6 @@ import rx.Subscription; | ||||
| import rx.android.schedulers.AndroidSchedulers; | ||||
| import rx.schedulers.Schedulers; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| @RequiresPresenter(ChaptersPresenter.class) | ||||
| public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implements | ||||
|         ActionMode.Callback, FlexibleViewHolder.OnListItemClickListener { | ||||
|   | ||||
| @@ -7,6 +7,12 @@ import android.view.View; | ||||
| import android.widget.PopupMenu; | ||||
| import android.widget.RelativeLayout; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import java.text.DateFormat; | ||||
| import java.text.DecimalFormat; | ||||
| import java.text.DecimalFormatSymbols; | ||||
| import java.util.Date; | ||||
|  | ||||
| import butterknife.Bind; | ||||
| import butterknife.ButterKnife; | ||||
| import eu.kanade.tachiyomi.R; | ||||
| @@ -16,30 +22,21 @@ import eu.kanade.tachiyomi.data.download.model.Download; | ||||
| import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder; | ||||
| import rx.Observable; | ||||
|  | ||||
| import java.text.DateFormat; | ||||
| import java.text.DecimalFormat; | ||||
| import java.text.DecimalFormatSymbols; | ||||
| import java.util.Date; | ||||
|  | ||||
| public class ChaptersHolder extends FlexibleViewHolder { | ||||
|  | ||||
|     private final ChaptersAdapter adapter; | ||||
|     private final int readColor; | ||||
|     private final int unreadColor; | ||||
|     private final DecimalFormat decimalFormat; | ||||
|     private final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); | ||||
|     @Bind(R.id.chapter_title) TextView title; | ||||
|     @Bind(R.id.download_text) TextView downloadText; | ||||
|     @Bind(R.id.chapter_menu) RelativeLayout chapterMenu; | ||||
|     @Bind(R.id.chapter_pages) TextView pages; | ||||
|     @Bind(R.id.chapter_date) TextView date; | ||||
|  | ||||
|     private Context context; | ||||
|  | ||||
|     private final ChaptersAdapter adapter; | ||||
|     private Chapter item; | ||||
|  | ||||
|     private final int readColor; | ||||
|     private final int unreadColor; | ||||
|  | ||||
|     private final DecimalFormat decimalFormat; | ||||
|     private final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); | ||||
|  | ||||
|     public ChaptersHolder(View view, ChaptersAdapter adapter, OnListItemClickListener listener) { | ||||
|         super(view, adapter, listener); | ||||
|         this.adapter = adapter; | ||||
|   | ||||
| @@ -1,8 +1,5 @@ | ||||
| package eu.kanade.tachiyomi.ui.manga.info; | ||||
|  | ||||
| import android.app.Activity; | ||||
| import android.content.Intent; | ||||
| import android.net.Uri; | ||||
| import android.os.Bundle; | ||||
| import android.support.design.widget.FloatingActionButton; | ||||
| import android.support.v4.content.ContextCompat; | ||||
| @@ -10,32 +7,22 @@ import android.support.v4.widget.SwipeRefreshLayout; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.Button; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import com.bumptech.glide.load.model.LazyHeaders; | ||||
| import com.mikepenz.google_material_typeface_library.GoogleMaterial; | ||||
| import com.mikepenz.iconics.IconicsDrawable; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
|  | ||||
| import butterknife.Bind; | ||||
| 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.io.IOHandler; | ||||
| import eu.kanade.tachiyomi.data.source.base.Source; | ||||
| import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment; | ||||
| import eu.kanade.tachiyomi.util.ToastUtil; | ||||
| import nucleus.factory.RequiresPresenter; | ||||
|  | ||||
| @RequiresPresenter(MangaInfoPresenter.class) | ||||
| public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|  | ||||
|     private static final int REQUEST_IMAGE_OPEN = 101; | ||||
|     @Bind(R.id.swipe_refresh) SwipeRefreshLayout swipeRefresh; | ||||
|     @Bind(R.id.manga_artist) TextView artist; | ||||
|     @Bind(R.id.manga_author) TextView author; | ||||
| @@ -45,8 +32,8 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|     @Bind(R.id.manga_source) TextView source; | ||||
|     @Bind(R.id.manga_summary) TextView description; | ||||
|     @Bind(R.id.manga_cover) ImageView cover; | ||||
|     @Bind(R.id.action_favorite) Button favoriteBtn; | ||||
|     @Bind(R.id.fab_edit) FloatingActionButton fabEdit; | ||||
|     @Bind(R.id.backdrop) ImageView backdrop; | ||||
|     @Bind(R.id.fab_favorite) FloatingActionButton fabFavorite; | ||||
|  | ||||
|     public static MangaInfoFragment newInstance() { | ||||
|         return new MangaInfoFragment(); | ||||
| @@ -65,10 +52,7 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|         View view = inflater.inflate(R.layout.fragment_manga_info, container, false); | ||||
|         ButterKnife.bind(this, view); | ||||
|  | ||||
|         // Set listener. | ||||
|         fabEdit.setOnClickListener(v -> selectImage()); | ||||
|  | ||||
|         favoriteBtn.setOnClickListener(v -> getPresenter().toggleFavorite()); | ||||
|         fabFavorite.setOnClickListener(v -> getPresenter().toggleFavorite()); | ||||
|  | ||||
|         swipeRefresh.setOnRefreshListener(this::fetchMangaFromSource); | ||||
|  | ||||
| @@ -101,7 +85,7 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|         status.setText(manga.getStatus(getActivity())); | ||||
|         description.setText(manga.description); | ||||
|  | ||||
|         setFavoriteText(manga.favorite); | ||||
|         setFavoriteDrawable(manga.favorite); | ||||
|  | ||||
|         CoverCache coverCache = getPresenter().coverCache; | ||||
|         LazyHeaders headers = getPresenter().source.getGlideHeaders(); | ||||
| @@ -112,14 +96,23 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|                 coverCache.loadFromNetwork(cover, manga.thumbnail_url, headers); | ||||
|             } | ||||
|         } | ||||
|         if (manga.thumbnail_url != null && backdrop.getDrawable() == null) { | ||||
|             if (manga.favorite) { | ||||
|                 coverCache.saveOrLoadFromCache(backdrop, manga.thumbnail_url, headers); | ||||
|             } else { | ||||
|                 coverCache.loadFromNetwork(backdrop, manga.thumbnail_url, headers); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setChapterCount(int count) { | ||||
|         chapterCount.setText(String.valueOf(count)); | ||||
|     } | ||||
|  | ||||
|     private void setFavoriteText(boolean isFavorite) { | ||||
|         favoriteBtn.setText(!isFavorite ? R.string.add_to_library : R.string.remove_from_library); | ||||
|     private void setFavoriteDrawable(boolean isFavorite) { | ||||
|         fabFavorite.setImageDrawable(ContextCompat.getDrawable(getContext(), isFavorite ? | ||||
|                 R.drawable.ic_bookmark_white_24dp : | ||||
|                 R.drawable.ic_bookmark_border_white_24dp)); | ||||
|     } | ||||
|  | ||||
|     private void fetchMangaFromSource() { | ||||
| @@ -127,43 +120,6 @@ public class MangaInfoFragment extends BaseRxFragment<MangaInfoPresenter> { | ||||
|         getPresenter().fetchMangaFromSource(); | ||||
|     } | ||||
|  | ||||
|     private void selectImage() { | ||||
|         if (getPresenter().getManga().favorite) { | ||||
|  | ||||
|             Intent intent = new Intent(); | ||||
|             intent.setType("image/*"); | ||||
|             intent.setAction(Intent.ACTION_GET_CONTENT); | ||||
|             startActivityForResult(Intent.createChooser(intent, | ||||
|                     getString(R.string.file_select_cover)), REQUEST_IMAGE_OPEN); | ||||
|         } else { | ||||
|             ToastUtil.showShort(getContext(), R.string.notification_first_add_to_library); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void onActivityResult(int requestCode, int resultCode, Intent data) { | ||||
|         if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_IMAGE_OPEN) { | ||||
|             // Get the file's content URI from the incoming Intent | ||||
|             Uri selectedImageUri = data.getData(); | ||||
|  | ||||
|             // Convert to absolute path to prevent FileNotFoundException | ||||
|             String result = IOHandler.getFilePath(selectedImageUri, | ||||
|                     getContext().getContentResolver(), getContext()); | ||||
|  | ||||
|             // Get file from filepath | ||||
|             File picture = new File(result != null ? result : ""); | ||||
|  | ||||
|             try { | ||||
|                 // Update cover to selected file, show error if something went wrong | ||||
|                 if (!getPresenter().editCoverWithLocalFile(picture, cover)) | ||||
|                     ToastUtil.showShort(getContext(), R.string.notification_manga_update_failed); | ||||
|  | ||||
|             } catch (IOException e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void onFetchMangaDone() { | ||||
|         setRefreshing(false); | ||||
|   | ||||
| @@ -1,14 +1,10 @@ | ||||
| package eu.kanade.tachiyomi.ui.manga.info; | ||||
|  | ||||
| import android.os.Bundle; | ||||
| import android.widget.ImageView; | ||||
|  | ||||
| import org.greenrobot.eventbus.Subscribe; | ||||
| import org.greenrobot.eventbus.ThreadMode; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
|  | ||||
| import javax.inject.Inject; | ||||
|  | ||||
| import eu.kanade.tachiyomi.data.cache.CoverCache; | ||||
| @@ -135,20 +131,7 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> { | ||||
|         refreshManga(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Update cover with local file | ||||
|      */ | ||||
|     public boolean editCoverWithLocalFile(File file, ImageView imageView) throws IOException { | ||||
|         if (!manga.initialized) | ||||
|             return false; | ||||
|  | ||||
|         if (manga.favorite) { | ||||
|             coverCache.copyToLocalCache(manga.thumbnail_url, file); | ||||
|             coverCache.saveOrLoadFromCache(imageView, manga.thumbnail_url, source.getGlideHeaders()); | ||||
|             return true; | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     private void onMangaFavoriteChange(boolean isFavorite) { | ||||
|         if (isFavorite) { | ||||
|   | ||||
| @@ -65,7 +65,6 @@ public class RecentChaptersFragment extends BaseRxFragment<RecentChaptersPresent | ||||
|  | ||||
|     @Override | ||||
|     public void onListItemLongClick(int position) { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     protected void openChapter(MangaChapter chapter) { | ||||
|   | ||||
| @@ -5,6 +5,9 @@ import android.content.res.TypedArray; | ||||
| import android.support.v7.widget.GridLayoutManager; | ||||
| import android.support.v7.widget.RecyclerView; | ||||
| import android.util.AttributeSet; | ||||
| import android.widget.ImageView; | ||||
|  | ||||
| import eu.kanade.tachiyomi.R; | ||||
|  | ||||
| public class AutofitRecyclerView extends RecyclerView { | ||||
|  | ||||
|   | ||||
| Before Width: | Height: | Size: 387 B | 
| Before Width: | Height: | Size: 651 B | 
| Before Width: | Height: | Size: 584 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_bookmark_border_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 239 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_bookmark_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 185 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_favorite_border_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 532 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_favorite_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 358 B | 
| Before Width: | Height: | Size: 262 B | 
| Before Width: | Height: | Size: 449 B | 
| Before Width: | Height: | Size: 378 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_bookmark_border_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 176 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_bookmark_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 139 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_favorite_border_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 349 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_favorite_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 246 B | 
| Before Width: | Height: | Size: 479 B | 
| Before Width: | Height: | Size: 807 B | 
| Before Width: | Height: | Size: 732 B | 
| After Width: | Height: | Size: 273 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/ic_bookmark_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 213 B | 
| After Width: | Height: | Size: 664 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/ic_favorite_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 435 B | 
| Before Width: | Height: | Size: 707 B | 
| Before Width: | Height: | Size: 1.2 KiB | 
| Before Width: | Height: | Size: 1.0 KiB | 
| After Width: | Height: | Size: 370 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/ic_bookmark_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 273 B | 
| After Width: | Height: | Size: 975 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/ic_favorite_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 627 B | 
| Before Width: | Height: | Size: 901 B | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 466 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/ic_bookmark_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 351 B | 
| After Width: | Height: | Size: 1.2 KiB | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/ic_favorite_white_24dp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 799 B | 
| @@ -9,10 +9,10 @@ | ||||
|         android:id="@+id/myanimelist_title_layout" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?android:listPreferredItemHeightSmall" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight" | ||||
|         android:background="?attr/selectableItemBackground" | ||||
|         android:clickable="true"> | ||||
|         android:clickable="true" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight"> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
| @@ -24,8 +24,8 @@ | ||||
|             android:id="@+id/myanimelist_title" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_alignParentRight="true" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:text="Edit..."/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
| @@ -42,23 +42,23 @@ | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?android:listPreferredItemHeightSmall" | ||||
|         android:layout_below="@id/divider1" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight" | ||||
|         android:background="?attr/selectableItemBackground" | ||||
|         android:clickable="true"> | ||||
|         android:clickable="true" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight"> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:text="@string/status"/> | ||||
|             android:text="Status"/> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/myanimelist_status" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_alignParentRight="true" | ||||
|             android:layout_centerVertical="true" | ||||
|             tools:text="Reading"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
| @@ -75,10 +75,10 @@ | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?android:listPreferredItemHeightSmall" | ||||
|         android:layout_below="@id/divider2" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight" | ||||
|         android:background="?attr/selectableItemBackground" | ||||
|         android:clickable="true"> | ||||
|         android:clickable="true" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight"> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
| @@ -90,8 +90,8 @@ | ||||
|             android:id="@+id/myanimelist_chapters" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_alignParentRight="true" | ||||
|             android:layout_centerVertical="true" | ||||
|             tools:text="12/24"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
| @@ -108,10 +108,10 @@ | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="?android:listPreferredItemHeightSmall" | ||||
|         android:layout_below="@id/divider3" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight" | ||||
|         android:background="?attr/selectableItemBackground" | ||||
|         android:clickable="true"> | ||||
|         android:clickable="true" | ||||
|         android:paddingLeft="?android:listPreferredItemPaddingLeft" | ||||
|         android:paddingRight="?android:listPreferredItemPaddingRight"> | ||||
|  | ||||
|         <TextView | ||||
|             android:layout_width="wrap_content" | ||||
| @@ -123,8 +123,8 @@ | ||||
|             android:id="@+id/myanimelist_score" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerVertical="true" | ||||
|             android:layout_alignParentRight="true" | ||||
|             android:layout_centerVertical="true" | ||||
|             tools:text="10"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
|   | ||||
| @@ -1,280 +1,252 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.design.widget.CoordinatorLayout | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|                 xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|                 xmlns:tools="http://schemas.android.com/tools" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:orientation="vertical" | ||||
|                 tools:context="eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment"> | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     tools:context="eu.kanade.tachiyomi.ui.catalogue.CatalogueFragment"> | ||||
|  | ||||
|  | ||||
|     <!-- It seems I have to wrap everything in SwipeRefreshLayout because it always take the entire height | ||||
|          and the description can't be seen. | ||||
|          Maybe with Relative layout it's better. We shouldn't put this layout inside the description layout | ||||
|          because the description should be scrollable and gestures could conflict with this layout. | ||||
|          Leaving it like this for now. | ||||
|     --> | ||||
|     <android.support.v4.widget.SwipeRefreshLayout | ||||
|         android:id="@+id/swipe_refresh" | ||||
|         android:id="@id/swipe_refresh" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:orientation="vertical"> | ||||
|         android:layout_height="match_parent"> | ||||
|  | ||||
|         <android.support.v4.widget.NestedScrollView | ||||
|             android:id="@+id/manga_info_scroll_view" | ||||
|         <LinearLayout | ||||
|             android:id="@+id/global_view" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="match_parent"> | ||||
|             android:layout_height="match_parent" | ||||
|             android:orientation="vertical"> | ||||
|  | ||||
|             <LinearLayout | ||||
|             <RelativeLayout | ||||
|                 android:id="@+id/top_view" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:clickable="true" | ||||
|                 android:orientation="vertical"> | ||||
|                 android:layout_height="0dp" | ||||
|                 android:layout_weight="0.4"> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                 <ImageView | ||||
|                     android:id="@+id/backdrop" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:padding="10dp"> | ||||
|  | ||||
|                     <RelativeLayout | ||||
|                         android:layout_width="wrap_content" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:background="@drawable/bkg_shadow_img" | ||||
|                         android:focusable="false" | ||||
|                         android:focusableInTouchMode="false" | ||||
|                         android:gravity="center" | ||||
|                         android:padding="4dp"> | ||||
|  | ||||
|                         <ImageView | ||||
|                             android:id="@+id/manga_cover" | ||||
|                             android:layout_width="138dp" | ||||
|                             android:layout_height="190dp" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:scaleType="fitXY" | ||||
|                             android:visibility="visible"/> | ||||
|  | ||||
|                     </RelativeLayout> | ||||
|  | ||||
|                     <RelativeLayout | ||||
|                         android:id="@+id/grid_item_description" | ||||
|                         android:layout_width="fill_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:focusable="false" | ||||
|                         android:focusableInTouchMode="false" | ||||
|                         android:paddingLeft="15.0dip"> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_author_label" | ||||
|                             style="@style/manga_detail_label" | ||||
|                             android:layout_width="wrap_content" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignParentLeft="true" | ||||
|                             android:layout_alignRight="@+id/manga_genres_label" | ||||
|                             android:layout_marginTop="5dp" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:text="@string/author"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_author" | ||||
|                             style="@style/manga_detail_text" | ||||
|                             android:layout_width="fill_parent" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignBaseline="@id/manga_author_label" | ||||
|                             android:layout_toRightOf="@id/manga_author_label" | ||||
|                             android:ellipsize="end" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:maxLines="1" | ||||
|                             android:singleLine="true"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_artist_label" | ||||
|                             style="@style/manga_detail_label" | ||||
|                             android:layout_width="wrap_content" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignParentLeft="true" | ||||
|                             android:layout_alignRight="@id/manga_genres_label" | ||||
|                             android:layout_below="@id/manga_author_label" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:text="@string/artist"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_artist" | ||||
|                             style="@style/manga_detail_text" | ||||
|                             android:layout_width="fill_parent" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignBaseline="@id/manga_artist_label" | ||||
|                             android:layout_toRightOf="@id/manga_artist_label" | ||||
|                             android:ellipsize="end" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:maxLines="1" | ||||
|                             android:singleLine="true"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_chapters_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_artist_label" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:text="@string/chapters"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_chapters" | ||||
|                             style="@style/manga_detail_text" | ||||
|                             android:layout_width="fill_parent" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignBaseline="@id/manga_chapters_label" | ||||
|                             android:layout_toRightOf="@id/manga_chapters_label" | ||||
|                             android:ellipsize="end" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:maxLines="1" | ||||
|                             android:singleLine="true"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_status_label" | ||||
|                             style="@style/manga_detail_label" | ||||
|                             android:layout_width="wrap_content" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignParentLeft="true" | ||||
|                             android:layout_alignRight="@id/manga_genres_label" | ||||
|                             android:layout_below="@id/manga_chapters_label" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:text="@string/status"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_status" | ||||
|                             style="@style/manga_detail_text" | ||||
|                             android:layout_width="fill_parent" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_alignBaseline="@id/manga_status_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_label" | ||||
|                             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" | ||||
|                             android:maxLines="1" | ||||
|                             android:singleLine="true"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_genres_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_source_label" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:text="@string/genres"/> | ||||
|  | ||||
|                         <TextView | ||||
|                             android:id="@+id/manga_genres" | ||||
|                             style="@style/manga_detail_text" | ||||
|                             android:layout_width="fill_parent" | ||||
|                             android:layout_height="wrap_content" | ||||
|                             android:layout_below="@id/manga_genres_label" | ||||
|                             android:focusable="false" | ||||
|                             android:focusableInTouchMode="false" | ||||
|                             android:singleLine="false"/> | ||||
|  | ||||
|  | ||||
|                     </RelativeLayout> | ||||
|  | ||||
|                 </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> | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:alpha="0.2" | ||||
|                     android:contentDescription="@string/description_backdrop"/> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:orientation="vertical" | ||||
|                     android:padding="10dp"> | ||||
|                     android:orientation="horizontal"> | ||||
|  | ||||
|                     <ImageView | ||||
|                         android:id="@+id/manga_cover" | ||||
|                         android:layout_width="0dp" | ||||
|                         android:layout_height="match_parent" | ||||
|                         android:layout_margin="@dimen/activity_vertical_margin" | ||||
|                         android:layout_weight="0.35" | ||||
|                         android:contentDescription="@string/description_cover"/> | ||||
|  | ||||
|                     <RelativeLayout | ||||
|                         android:layout_width="0dp" | ||||
|                         android:layout_height="match_parent" | ||||
|                         android:layout_margin="@dimen/activity_vertical_margin" | ||||
|                         android:layout_weight="0.65"> | ||||
|  | ||||
|  | ||||
|                         <android.support.v4.widget.NestedScrollView | ||||
|                             android:layout_width="match_parent" | ||||
|                             android:layout_height="match_parent"> | ||||
|  | ||||
|                             <RelativeLayout | ||||
|                                 android:layout_width="match_parent" | ||||
|                                 android:layout_height="match_parent"> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_author_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:orientation="horizontal"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_author_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_author_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_author" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_artist_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:layout_below="@+id/manga_author_view" | ||||
|                                     android:orientation="horizontal"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_artist_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_artist_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_artist" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_chapters_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:layout_below="@+id/manga_artist_view" | ||||
|                                     android:orientation="horizontal"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_chapters_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_chapters_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_chapters" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_status_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:layout_below="@+id/manga_chapters_view" | ||||
|                                     android:orientation="horizontal"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_status_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_status_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_status" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_source_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:layout_below="@+id/manga_status_view" | ||||
|                                     android:orientation="horizontal"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_source_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_source_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_source" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|  | ||||
|                                 <LinearLayout | ||||
|                                     android:id="@+id/manga_genres_view" | ||||
|                                     android:layout_width="match_parent" | ||||
|                                     android:layout_height="wrap_content" | ||||
|                                     android:layout_below="@+id/manga_source_view" | ||||
|                                     android:orientation="vertical"> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_genres_label" | ||||
|                                         style="@style/manga_detail_label" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:text="@string/manga_info_genres_label" | ||||
|                                         /> | ||||
|  | ||||
|                                     <TextView | ||||
|                                         android:id="@+id/manga_genres" | ||||
|                                         style="@style/manga_detail_text" | ||||
|                                         android:layout_width="wrap_content" | ||||
|                                         android:layout_height="wrap_content" | ||||
|                                         android:singleLine="false" | ||||
|                                         /> | ||||
|                                 </LinearLayout> | ||||
|                             </RelativeLayout> | ||||
|                         </android.support.v4.widget.NestedScrollView> | ||||
|                     </RelativeLayout> | ||||
|  | ||||
|                 </LinearLayout> | ||||
|  | ||||
|             </RelativeLayout> | ||||
|  | ||||
|             <android.support.v4.widget.NestedScrollView | ||||
|                 android:id="@+id/bottom_view" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="0dp" | ||||
|                 android:layout_margin="@dimen/activity_vertical_margin" | ||||
|                 android:layout_weight="0.6"> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:orientation="vertical"> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/manga_summary_label" | ||||
|                         style="@style/manga_detail_label" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:focusable="false" | ||||
|                         android:focusableInTouchMode="false" | ||||
|                         android:singleLine="false" | ||||
|                         android:text="@string/description"/> | ||||
|  | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/manga_summary" | ||||
|                         style="@style/manga_detail_text" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:focusable="false" | ||||
|                         android:focusableInTouchMode="false" | ||||
|                         android:singleLine="false"/> | ||||
|  | ||||
|                         android:singleLine="false" | ||||
|                         /> | ||||
|                 </LinearLayout> | ||||
|  | ||||
|             </android.support.v4.widget.NestedScrollView> | ||||
|  | ||||
|  | ||||
|  | ||||
|             </LinearLayout> | ||||
|  | ||||
|  | ||||
|         </android.support.v4.widget.NestedScrollView> | ||||
|         </LinearLayout> | ||||
|  | ||||
|     </android.support.v4.widget.SwipeRefreshLayout> | ||||
|  | ||||
|     <android.support.design.widget.FloatingActionButton | ||||
|         android:id="@+id/fab_edit" | ||||
|         android:layout_height="@dimen/fab_size" | ||||
|         android:id="@+id/fab_favorite" | ||||
|         android:layout_width="@dimen/fab_size" | ||||
|         android:layout_gravity="bottom|end" | ||||
|         android:layout_height="@dimen/fab_size" | ||||
|         android:layout_margin="@dimen/fab_margin" | ||||
|         android:scaleType="fitCenter" | ||||
|         android:src="@drawable/ic_mode_edit_white_24dp" | ||||
|         android:src="@drawable/ic_bookmark_border_white_24dp" | ||||
|         app:backgroundTint="@color/colorPrimary" | ||||
|         app:layout_anchor="@id/manga_info_scroll_view" | ||||
|         app:layout_anchorGravity="bottom|right|end" | ||||
|         app:layout_behavior="eu.kanade.tachiyomi.ui.base.fab.ScrollAwareFABBehavior"/> | ||||
|         app:layout_anchor="@id/top_view" | ||||
|         app:layout_anchorGravity="bottom|right|end"/> | ||||
|  | ||||
| </android.support.design.widget.CoordinatorLayout> | ||||
| @@ -1,10 +1,10 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <FrameLayout | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="wrap_content" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     android:background="@drawable/selector_chapter_light"> | ||||
|  | ||||
|     <RelativeLayout | ||||
| @@ -13,9 +13,9 @@ | ||||
|         android:background="@drawable/card_background"> | ||||
|  | ||||
|         <android.support.percent.PercentFrameLayout | ||||
|             android:id="@+id/image_container" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="220dp" | ||||
|             android:id="@+id/image_container"> | ||||
|             android:layout_height="220dp"> | ||||
|  | ||||
|             <ImageView | ||||
|                 android:id="@+id/thumbnail" | ||||
| @@ -28,9 +28,9 @@ | ||||
|             <View | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 app:layout_heightPercent="50%" | ||||
|                 android:layout_gravity="bottom" | ||||
|                 android:background="@drawable/gradient_shape"/> | ||||
|                 android:background="@drawable/gradient_shape" | ||||
|                 app:layout_heightPercent="50%"/> | ||||
|  | ||||
|         </android.support.percent.PercentFrameLayout> | ||||
|  | ||||
| @@ -48,35 +48,38 @@ | ||||
|             android:textSize="12sp" | ||||
|             android:visibility="gone"/> | ||||
|  | ||||
|         <ImageView | ||||
|  | ||||
|         <com.mikepenz.iconics.view.IconicsImageView | ||||
|             android:id="@+id/favorite_sticker" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_width="24dp" | ||||
|             android:layout_height="24dp" | ||||
|             android:layout_alignEnd="@+id/image_container" | ||||
|             android:layout_alignRight="@+id/image_container" | ||||
|             android:layout_alignTop="@+id/image_container" | ||||
|             android:layout_marginEnd="5dp" | ||||
|             android:layout_marginRight="5dp" | ||||
|             android:layout_marginTop="5dp" | ||||
|             android:src="@drawable/ic_action_favorite_blue" | ||||
|             android:visibility="invisible"/> | ||||
|             android:visibility="invisible" | ||||
|             app:iiv_color="@color/primary" | ||||
|             app:iiv_icon="gmd_bookmark"/> | ||||
|  | ||||
|         <eu.kanade.tachiyomi.widget.PTSansTextView | ||||
|             android:id="@+id/title" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_alignBottom="@+id/image_container" | ||||
|             android:layout_gravity="center_vertical" | ||||
|             app:typeface="ptsansNarrowBold" | ||||
|             android:lineSpacingExtra="-4dp" | ||||
|             android:ellipsize="end" | ||||
|             android:lineSpacingExtra="-4dp" | ||||
|             android:maxLines="2" | ||||
|             android:padding="8dp" | ||||
|             android:textColor="@color/white" | ||||
|             android:textSize="14sp" | ||||
|             android:shadowColor="@color/primary_text" | ||||
|             android:shadowDx="0" | ||||
|             android:shadowDy="0" | ||||
|             android:shadowColor="@color/primary_text" | ||||
|             android:shadowRadius="4" | ||||
|             android:layout_alignBottom="@+id/image_container" | ||||
|             android:textColor="@color/white" | ||||
|             android:textSize="14sp" | ||||
|             app:typeface="ptsansNarrowBold" | ||||
|             tools:text="Sample name"/> | ||||
|  | ||||
|     </RelativeLayout> | ||||
|   | ||||
| @@ -3,6 +3,11 @@ | ||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|       xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
|  | ||||
|     <item android:id="@+id/action_edit_cover" | ||||
|           android:title="@string/action_edit_cover" | ||||
|           android:icon="@drawable/ic_create" | ||||
|           app:showAsAction="ifRoom"/> | ||||
|  | ||||
|     <item android:id="@+id/action_move_to_category" | ||||
|           android:title="@string/action_move_category" | ||||
|           android:icon="@drawable/ic_label" | ||||
|   | ||||
| @@ -28,6 +28,7 @@ | ||||
|     <string name="action_edit_categories">Edit categories</string> | ||||
|     <string name="action_rename_category">Rename category</string> | ||||
|     <string name="action_move_category">Move to categories</string> | ||||
|     <string name="action_edit_cover">Edit the cover picture</string> | ||||
|     <string name="action_sort_up">Sort up</string> | ||||
|     <string name="action_sort_down">Sort down</string> | ||||
|     <string name="action_show_unread">Unread</string> | ||||
| @@ -161,18 +162,18 @@ | ||||
|  | ||||
|     <!-- Manga info fragment --> | ||||
|     <string name="manga_detail_tab">Info</string> | ||||
|     <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> | ||||
|     <string name="ongoing">Ongoing</string> | ||||
|     <string name="unknown">Unknown</string> | ||||
|     <string name="licensed">Licensed</string> | ||||
|     <string name="add_to_library">Add to library</string> | ||||
|     <string name="remove_from_library">Remove from library</string> | ||||
|     <string name="manga_info_author_label">Author</string> | ||||
|     <string name="manga_info_artist_label">Artist</string> | ||||
|     <string name="manga_info_chapters_label">Chapters</string> | ||||
|     <string name="manga_info_status_label">Status</string> | ||||
|     <string name="manga_info_source_label">Source</string> | ||||
|     <string name="manga_info_genres_label">Genres</string> | ||||
|  | ||||
|     <!-- Manga chapters fragment --> | ||||
|     <string name="manga_chapters_tab">Chapters</string> | ||||
| @@ -198,6 +199,9 @@ | ||||
|     <string name="plan_to_read">Plan to read</string> | ||||
|     <string name="score">Score</string> | ||||
|     <string name="title_hint">Title…</string> | ||||
|     <string name="status">Status</string> | ||||
|     <string name="chapters">Chapters</string> | ||||
|  | ||||
|  | ||||
|     <!-- Reader activity --> | ||||
|     <string name="downloading">Downloading…</string> | ||||
| @@ -233,4 +237,8 @@ | ||||
|     <string name="update_check_download_started">Download Started</string> | ||||
|     <string name="update_check_look_for_updates">Looking for updates</string> | ||||
|  | ||||
|     <!--Content Description--> | ||||
|     <string name="description_backdrop">Backdrop image of selected manga</string> | ||||
|     <string name="description_cover">Cover of selected manga</string> | ||||
|  | ||||
| </resources> | ||||
|   | ||||