From 87e86f81cfa83dd6e583a82fcf67ad823902e2e8 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 22 Mar 2020 03:15:40 -0400 Subject: [PATCH] Updates to tracking layout --- .../kanade/tachiyomi/ui/category/CategoryController.kt | 4 ---- .../tachiyomi/ui/library/LibraryListController.kt | 3 ++- .../java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 2 ++ .../tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt | 9 +++++++-- .../tachiyomi/ui/manga/track/TrackSearchAdapter.kt | 10 +++++----- app/src/main/res/layout/track_item.xml | 4 ++-- app/src/main/res/values-night/themes.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/themes.xml | 1 + 9 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt index 8b3b7e69e5..9b8e34f94a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryController.kt @@ -4,7 +4,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.view.WindowManager import androidx.recyclerview.widget.LinearLayoutManager import com.afollestad.materialdialogs.MaterialDialog import com.google.android.material.snackbar.BaseTransientBottomBar @@ -77,7 +76,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle), adapter?.isHandleDragEnabled = true adapter?.isPermanentDelete = false - activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) presenter.getCategories() } @@ -90,7 +88,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle), // Manually call callback to delete categories if required snack?.dismiss() view.clearFocus() - activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) confirmDelete() snack = null adapter = null @@ -100,7 +97,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle), override fun handleBack(): Boolean { view?.clearFocus() confirmDelete() - activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) return super.handleBack() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt index 2475cd5029..f4fee3eb01 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListController.kt @@ -14,6 +14,7 @@ import android.view.ViewGroup import androidx.appcompat.view.ActionMode import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.afollestad.materialdialogs.MaterialDialog @@ -551,7 +552,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle), override fun onActionStateChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) { val position = viewHolder?.adapterPosition ?: return - if (actionState == 2) { + if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) { isDragging = true activity?.appbar?.y = 0f if (lastItemPosition != null && position != lastItemPosition && lastItem == adapter.getItem( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 8e21479637..45ba03dc1e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -572,8 +572,10 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { } val onRoot = router.backstackSize == 1 if (onRoot) { + window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN) toolbar.navigationIcon = searchDrawable } else { + window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) toolbar.navigationIcon = drawerArrow } drawerArrow?.progress = 1f diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt index b8571ef561..ef606dd0bd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackChaptersDialog.kt @@ -52,8 +52,13 @@ class SetTrackChaptersDialog : DialogController val np: NumberPicker = view.findViewById(R.id.chapters_picker) // Set initial value np.value = item.track?.last_chapter_read ?: 0 - // Don't allow to go from 0 to 9999 - np.wrapSelectorWheel = false + if (item.track?.total_chapters ?: 0 > 0) { + np.wrapSelectorWheel = true + np.maxValue = item.track?.total_chapters ?: 0 + } else { + // Don't allow to go from 0 to 9999 + np.wrapSelectorWheel = false + } return dialog } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt index 4482aea39d..aeb95f0f41 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt @@ -5,6 +5,7 @@ import android.view.View import android.view.ViewGroup import android.widget.ArrayAdapter import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.track.model.TrackSearch @@ -47,11 +48,10 @@ class TrackSearchAdapter(context: Context) : view.track_search_summary.text = track.summary GlideApp.with(view.context).clear(view.track_search_cover) if (!track.cover_url.isNullOrEmpty()) { - GlideApp.with(view.context) - .load(track.cover_url) - .diskCacheStrategy(DiskCacheStrategy.RESOURCE) - .centerCrop() - .into(view.track_search_cover) + GlideApp.with(view.context).load(track.cover_url) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE).centerCrop() + .transition(DrawableTransitionOptions.withCrossFade()) + .into(view.track_search_cover) } if (track.publishing_status.isNullOrBlank()) { diff --git a/app/src/main/res/layout/track_item.xml b/app/src/main/res/layout/track_item.xml index 757e45606b..2a60d51f49 100644 --- a/app/src/main/res/layout/track_item.xml +++ b/app/src/main/res/layout/track_item.xml @@ -183,11 +183,11 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:letterSpacing="0.0" + android:paddingStart="16dp" + android:paddingEnd="0dp" android:text="@string/add_tracking" android:textAlignment="textStart" android:visibility="gone" - app:icon="@drawable/ic_edit_white_24dp" - app:iconTint="?colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/logo_container" diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index c9706a37ab..3baa1a2874 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -11,6 +11,7 @@ ?colorPrimaryDark ?colorPrimaryDark @color/readerDarkBackground + false diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7ec68a23a0..2f8bbc0778 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -601,6 +601,7 @@ Add Tracking Chapter %1$d of %2$d Chapter %1$d + All chapters read A category with this name already exists! diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 7abe7d1cb2..ea0aa36dac 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -86,6 +86,7 @@ @color/md_white_1000 ?colorPrimaryDark ?colorPrimaryDark + false