Updates to tracking layout

This commit is contained in:
Jay 2020-03-22 03:15:40 -04:00
parent ff948ea4d9
commit 87e86f81cf
9 changed files with 21 additions and 14 deletions

View File

@ -4,7 +4,6 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.BaseTransientBottomBar
@ -77,7 +76,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle),
adapter?.isHandleDragEnabled = true adapter?.isHandleDragEnabled = true
adapter?.isPermanentDelete = false adapter?.isPermanentDelete = false
activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
presenter.getCategories() presenter.getCategories()
} }
@ -90,7 +88,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle),
// Manually call callback to delete categories if required // Manually call callback to delete categories if required
snack?.dismiss() snack?.dismiss()
view.clearFocus() view.clearFocus()
activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
confirmDelete() confirmDelete()
snack = null snack = null
adapter = null adapter = null
@ -100,7 +97,6 @@ class CategoryController(bundle: Bundle? = null) : BaseController(bundle),
override fun handleBack(): Boolean { override fun handleBack(): Boolean {
view?.clearFocus() view?.clearFocus()
confirmDelete() confirmDelete()
activity?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
return super.handleBack() return super.handleBack()
} }

View File

@ -14,6 +14,7 @@ import android.view.ViewGroup
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
@ -551,7 +552,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
override fun onActionStateChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) { override fun onActionStateChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
val position = viewHolder?.adapterPosition ?: return val position = viewHolder?.adapterPosition ?: return
if (actionState == 2) { if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
isDragging = true isDragging = true
activity?.appbar?.y = 0f activity?.appbar?.y = 0f
if (lastItemPosition != null && position != lastItemPosition && lastItem == adapter.getItem( if (lastItemPosition != null && position != lastItemPosition && lastItem == adapter.getItem(

View File

@ -572,8 +572,10 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
val onRoot = router.backstackSize == 1 val onRoot = router.backstackSize == 1
if (onRoot) { if (onRoot) {
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)
toolbar.navigationIcon = searchDrawable toolbar.navigationIcon = searchDrawable
} else { } else {
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
toolbar.navigationIcon = drawerArrow toolbar.navigationIcon = drawerArrow
} }
drawerArrow?.progress = 1f drawerArrow?.progress = 1f

View File

@ -52,8 +52,13 @@ class SetTrackChaptersDialog<T> : DialogController
val np: NumberPicker = view.findViewById(R.id.chapters_picker) val np: NumberPicker = view.findViewById(R.id.chapters_picker)
// Set initial value // Set initial value
np.value = item.track?.last_chapter_read ?: 0 np.value = item.track?.last_chapter_read ?: 0
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 // Don't allow to go from 0 to 9999
np.wrapSelectorWheel = false np.wrapSelectorWheel = false
}
return dialog return dialog
} }

View File

@ -5,6 +5,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.data.track.model.TrackSearch
@ -47,10 +48,9 @@ class TrackSearchAdapter(context: Context) :
view.track_search_summary.text = track.summary view.track_search_summary.text = track.summary
GlideApp.with(view.context).clear(view.track_search_cover) GlideApp.with(view.context).clear(view.track_search_cover)
if (!track.cover_url.isNullOrEmpty()) { if (!track.cover_url.isNullOrEmpty()) {
GlideApp.with(view.context) GlideApp.with(view.context).load(track.cover_url)
.load(track.cover_url) .diskCacheStrategy(DiskCacheStrategy.RESOURCE).centerCrop()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .transition(DrawableTransitionOptions.withCrossFade())
.centerCrop()
.into(view.track_search_cover) .into(view.track_search_cover)
} }

View File

@ -183,11 +183,11 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:letterSpacing="0.0" android:letterSpacing="0.0"
android:paddingStart="16dp"
android:paddingEnd="0dp"
android:text="@string/add_tracking" android:text="@string/add_tracking"
android:textAlignment="textStart" android:textAlignment="textStart"
android:visibility="gone" android:visibility="gone"
app:icon="@drawable/ic_edit_white_24dp"
app:iconTint="?colorAccent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/logo_container" app:layout_constraintStart_toEndOf="@id/logo_container"

View File

@ -11,6 +11,7 @@
<item name="android:statusBarColor">?colorPrimaryDark</item> <item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item> <item name="android:navigationBarColor">?colorPrimaryDark</item>
<item name="android:colorBackground">@color/readerDarkBackground</item> <item name="android:colorBackground">@color/readerDarkBackground</item>
<item name="android:windowLightStatusBar">false</item>
</style> </style>
<!--==============--> <!--==============-->

View File

@ -601,6 +601,7 @@
<string name="add_tracking">Add Tracking</string> <string name="add_tracking">Add Tracking</string>
<string name="chapter_x_of_y">Chapter %1$d of %2$d</string> <string name="chapter_x_of_y">Chapter %1$d of %2$d</string>
<string name="chapter_x">Chapter %1$d</string> <string name="chapter_x">Chapter %1$d</string>
<string name="all_chapters_read">All chapters read</string>
<!-- Category activity --> <!-- Category activity -->
<string name="error_category_exists">A category with this name already exists!</string> <string name="error_category_exists">A category with this name already exists!</string>

View File

@ -86,6 +86,7 @@
<item name="actionBarTintColor">@color/md_white_1000</item> <item name="actionBarTintColor">@color/md_white_1000</item>
<item name="android:statusBarColor">?colorPrimaryDark</item> <item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item> <item name="android:navigationBarColor">?colorPrimaryDark</item>
<item name="android:windowLightStatusBar">false</item>
</style> </style>
<style name="Theme.Base.Reader.Dark" parent="Theme.MaterialComponents.NoActionBar"> <style name="Theme.Base.Reader.Dark" parent="Theme.MaterialComponents.NoActionBar">