diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseBottomSheet.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseBottomSheet.kt index 75503afc5..7378b5acf 100644 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseBottomSheet.kt +++ b/app/src/main/java/org/koitharu/kotatsu/base/ui/BaseBottomSheet.kt @@ -2,11 +2,11 @@ package org.koitharu.kotatsu.base.ui import android.app.Dialog import android.os.Bundle +import android.util.DisplayMetrics import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.ViewGroup.LayoutParams -import androidx.appcompat.app.AppCompatDialog import androidx.core.view.updateLayoutParams import androidx.viewbinding.ViewBinding import com.google.android.material.bottomsheet.BottomSheetBehavior @@ -14,6 +14,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment import org.koitharu.kotatsu.R import org.koitharu.kotatsu.base.ui.dialog.AppBottomSheetDialog +import org.koitharu.kotatsu.utils.ext.displayCompat import com.google.android.material.R as materialR abstract class BaseBottomSheet : BottomSheetDialogFragment() { @@ -33,6 +34,20 @@ abstract class BaseBottomSheet : BottomSheetDialogFragment() { ): View { val binding = onInflateView(inflater, container) viewBinding = binding + + // Enforce max width for tablets + val width = resources.getDimensionPixelSize(R.dimen.bottom_sheet_width) + if (width > 0) { + behavior?.maxWidth = width + } + + // Set peek height to 50% display height + requireContext().displayCompat?.let { + val metrics = DisplayMetrics() + it.getRealMetrics(metrics) + behavior?.peekHeight = metrics.heightPixels / 2 + } + return binding.root } @@ -42,11 +57,7 @@ abstract class BaseBottomSheet : BottomSheetDialogFragment() { } override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - return if (resources.getBoolean(R.bool.is_tablet)) { - AppCompatDialog(context, R.style.Theme_Kotatsu_Dialog) - } else { - AppBottomSheetDialog(requireContext(), theme) - } + return AppBottomSheetDialog(requireContext(), theme) } protected abstract fun onInflateView(inflater: LayoutInflater, container: ViewGroup?): B diff --git a/app/src/main/java/org/koitharu/kotatsu/base/ui/dialog/AppBottomSheetDialog.kt b/app/src/main/java/org/koitharu/kotatsu/base/ui/dialog/AppBottomSheetDialog.kt index d3b911ace..8b6da8d3d 100644 --- a/app/src/main/java/org/koitharu/kotatsu/base/ui/dialog/AppBottomSheetDialog.kt +++ b/app/src/main/java/org/koitharu/kotatsu/base/ui/dialog/AppBottomSheetDialog.kt @@ -21,7 +21,7 @@ class AppBottomSheetDialog(context: Context, theme: Int) : BottomSheetDialog(con if (drawEdgeToEdge) { // Copied from super.onAttachedToWindow: val edgeToEdgeFlags = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_STABLE - // Fix super-class's window flag bug by respecting the intial system UI visibility: + // Fix super-class's window flag bug by respecting the initial system UI visibility: window.decorView.systemUiVisibility = edgeToEdgeFlags or initialSystemUiVisibility } } diff --git a/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt b/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt index e11527071..55cd36559 100644 --- a/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt +++ b/app/src/main/java/org/koitharu/kotatsu/main/ui/MainActivity.kt @@ -233,6 +233,8 @@ class MainActivity : } binding.toolbarCard.updateLayoutParams { topMargin = insets.top + bottomMargin + leftMargin = insets.left + rightMargin = insets.right } binding.root.updatePadding( left = insets.left, diff --git a/app/src/main/java/org/koitharu/kotatsu/utils/ext/DisplayExt.kt b/app/src/main/java/org/koitharu/kotatsu/utils/ext/DisplayExt.kt new file mode 100644 index 000000000..205b98968 --- /dev/null +++ b/app/src/main/java/org/koitharu/kotatsu/utils/ext/DisplayExt.kt @@ -0,0 +1,15 @@ +package org.koitharu.kotatsu.utils.ext + +import android.content.Context +import android.os.Build +import android.view.Display +import android.view.WindowManager +import androidx.core.content.getSystemService + +val Context.displayCompat: Display? + get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + display + } else { + @Suppress("DEPRECATION") + getSystemService()?.defaultDisplay + } diff --git a/app/src/main/res/anim/bottom_sheet_slide_in.xml b/app/src/main/res/anim/bottom_sheet_slide_in.xml new file mode 100644 index 000000000..20c7c0d4e --- /dev/null +++ b/app/src/main/res/anim/bottom_sheet_slide_in.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/bottom_sheet_slide_out.xml b/app/src/main/res/anim/bottom_sheet_slide_out.xml new file mode 100644 index 000000000..ffa0e816b --- /dev/null +++ b/app/src/main/res/anim/bottom_sheet_slide_out.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sheet_toolbar_background.xml b/app/src/main/res/drawable/sheet_toolbar_background.xml new file mode 100644 index 000000000..a4ea123d2 --- /dev/null +++ b/app/src/main/res/drawable/sheet_toolbar_background.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-v23/item_loading_footer.xml b/app/src/main/res/layout-v23/item_loading_footer.xml index 0af71b68f..99a165524 100644 --- a/app/src/main/res/layout-v23/item_loading_footer.xml +++ b/app/src/main/res/layout-v23/item_loading_footer.xml @@ -11,6 +11,6 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:indeterminate="true" - app:indicatorSize="@dimen/list_footer_height_inner" /> + app:indicatorSize="24dp"/> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_category_edit.xml b/app/src/main/res/layout/activity_category_edit.xml index e8b9d8eab..c8c2fa22a 100644 --- a/app/src/main/res/layout/activity_category_edit.xml +++ b/app/src/main/res/layout/activity_category_edit.xml @@ -10,7 +10,7 @@ + android:layout_height="?attr/actionBarSize" /> + android:indeterminate="true" + android:padding="8dp"/> \ No newline at end of file diff --git a/app/src/main/res/layout/sheet_chapters.xml b/app/src/main/res/layout/sheet_chapters.xml index 4e17b4c76..e1932e31e 100644 --- a/app/src/main/res/layout/sheet_chapters.xml +++ b/app/src/main/res/layout/sheet_chapters.xml @@ -10,7 +10,8 @@ + android:layout_height="?attr/actionBarSize" + android:background="@drawable/sheet_toolbar_background"> + android:layout_height="?attr/actionBarSize" + android:background="@drawable/sheet_toolbar_background"> + android:layout_height="?attr/actionBarSize" + android:background="@drawable/sheet_toolbar_background"> #FFDAD4 #66FFFFFF #29FFFFFF + #1FFFFFFF \ No newline at end of file diff --git a/app/src/main/res/values-uk/plurals.xml b/app/src/main/res/values-uk/plurals.xml index 0ced943b7..1b47f743e 100644 --- a/app/src/main/res/values-uk/plurals.xml +++ b/app/src/main/res/values-uk/plurals.xml @@ -2,7 +2,7 @@ %1$d новий розділ - %1$d нових розділи + %1$d нові розділи %1$d нових розділів %1$d нових розділів diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 9fd8db95a..b26c58fd1 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -64,7 +64,7 @@ Кеш Б|кБ|МБ|ГБ|ТБ Стандартний - Манхва + Вебтун Режим читання Розмір сітки Пошук по %s @@ -290,4 +290,8 @@ Додано закладку Скасувати Видалено з історії + DNS через HTTPS + Типовий режим + Автоматично визначати, чи є манга вебтуном + Автовизначення режиму читання \ No newline at end of file diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml deleted file mode 100644 index 370045cf3..000000000 --- a/app/src/main/res/values-v27/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-w600dp/dimens.xml b/app/src/main/res/values-w600dp/dimens.xml index 044349fc7..cff6a860c 100644 --- a/app/src/main/res/values-w600dp/dimens.xml +++ b/app/src/main/res/values-w600dp/dimens.xml @@ -3,4 +3,5 @@ 6dp 2dp 140dp + 420dp \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 1c8b7fb98..f4bae8418 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -20,5 +20,6 @@ #99000000 #66000000 #29000000 + #1F000000 \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 20debe81b..c03a20dc3 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -26,4 +26,7 @@ 124dp 4dp + + 0dp + 8dp \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7f96a0bef..b44b1c1e5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -22,9 +22,26 @@ - + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 69f2615b7..16b847cc8 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -35,6 +35,8 @@ @color/errorContainer @color/onErrorContainer + @color/divider_default + ?attr/colorSurfaceVariant