HapeLee 1 год назад
Родитель
Сommit
2ceee5c158

+ 2 - 2
app/src/main/java/io/legato/kazusa/ui/book/read/config/HttpTtsEditDialog.kt

@@ -7,6 +7,7 @@ import android.view.ViewGroup
 import androidx.appcompat.widget.Toolbar
 import androidx.fragment.app.viewModels
 import io.legato.kazusa.R
+import io.legato.kazusa.base.BaseBottomSheetDialogFragment
 import io.legato.kazusa.base.BaseDialogFragment
 import io.legato.kazusa.data.entities.HttpTTS
 import io.legato.kazusa.databinding.DialogHttpTtsEditBinding
@@ -27,7 +28,7 @@ import io.legato.kazusa.utils.startActivity
 import io.legato.kazusa.utils.toastOnUi
 import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
 
-class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit, true),
+class HttpTtsEditDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_http_tts_edit),
     Toolbar.OnMenuItemClickListener {
 
     constructor(id: Long) : this() {
@@ -41,7 +42,6 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit, tr
 
     override fun onStart() {
         super.onStart()
-        setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
     }
 
     override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {

+ 2 - 1
app/src/main/java/io/legato/kazusa/ui/book/read/config/SpeakEngineDialog.kt

@@ -11,6 +11,7 @@ import androidx.fragment.app.viewModels
 import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
 import io.legato.kazusa.R
+import io.legato.kazusa.base.BaseBottomSheetDialogFragment
 import io.legato.kazusa.base.BaseDialogFragment
 import io.legato.kazusa.base.adapter.ItemViewHolder
 import io.legato.kazusa.base.adapter.RecyclerAdapter
@@ -52,7 +53,7 @@ import kotlinx.coroutines.launch
 /**
  * tts引擎管理
  */
-class SpeakEngineDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
+class SpeakEngineDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_recycler_view),
     Toolbar.OnMenuItemClickListener {
 
     private val binding by viewBinding(DialogRecyclerViewBinding::bind)

+ 2 - 3
app/src/main/java/io/legato/kazusa/ui/config/ThemeConfigFragment.kt

@@ -140,8 +140,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
             //PreferKey.immNavigationBar -> recreateActivities()
 
             PreferKey.themePref -> {
-                ThemeConfig.applyDayNight(requireContext())
-                recreateActivities()
+                //recreateActivities()
             }
 
             PreferKey.cPrimary,
@@ -159,7 +158,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
             }
 
             PreferKey.themeMode -> {
-                recreateActivities()
+                //recreateActivities()
             }
 
             PreferKey.bgImage,

+ 3 - 0
app/src/main/java/io/legato/kazusa/ui/main/explore/ExploreFragment.kt

@@ -6,8 +6,11 @@ import android.view.MenuItem
 import android.view.SubMenu
 import android.view.View
 import android.view.inputmethod.EditorInfo
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowInsetsCompat
 import androidx.core.view.isGone
 import androidx.core.view.isVisible
+import androidx.core.view.updatePadding
 import androidx.core.widget.doAfterTextChanged
 import androidx.fragment.app.viewModels
 import androidx.lifecycle.Lifecycle

+ 2 - 2
app/src/main/java/io/legato/kazusa/ui/rss/article/RssSortActivity.kt

@@ -43,11 +43,11 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
     }
 
     override fun onActivityCreated(savedInstanceState: Bundle?) {
+        setSupportActionBar(binding.topBar)
         binding.viewPager.adapter = adapter
         binding.tabLayout.setupWithViewPager(binding.viewPager)
-        //binding.tabLayout.setSelectedTabIndicatorColor(accentColor)
         viewModel.titleLiveData.observe(this) {
-            binding.titleBar.title = it
+            binding.topBar.setTitle(it)
         }
         viewModel.initData(intent) {
             upFragments()

+ 10 - 7
app/src/main/res/layout/activity_main.xml

@@ -1,22 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.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:id="@+id/coordinator_layout"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
+    android:layout_height="match_parent">
 
     <androidx.viewpager.widget.ViewPager
         android:id="@+id/view_pager_main"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
+        android:layout_height="match_parent"
+        app:layout_behavior="@string/appbar_scrolling_view_behavior"
         tools:ignore="SpeakableTextPresentCheck" />
 
+    <!-- 底部导航栏 -->
     <io.legato.kazusa.lib.theme.view.ThemeBottomNavigationVIew
         android:id="@+id/bottom_navigation_view"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        app:menu="@menu/main_bnv" />
+        android:layout_gravity="bottom"
+        app:menu="@menu/main_bnv"
+        app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
 
-</LinearLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 40 - 13
app/src/main/res/layout/activity_rss_artivles.xml

@@ -1,26 +1,53 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.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"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:orientation="vertical">
+    android:layout_height="match_parent">
 
-    <io.legato.kazusa.ui.widget.TitleBar
+    <com.google.android.material.appbar.AppBarLayout
         android:id="@+id/title_bar"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
-
-    <com.google.android.material.tabs.TabLayout
-        android:id="@+id/tab_layout"
-        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"/>
+        android:fitsSystemWindows="true"
+        app:liftOnScroll="false"
+        android:stateListAnimator="@null">
+
+        <com.google.android.material.appbar.CollapsingToolbarLayout
+            android:layout_width="match_parent"
+            android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
+            style="?attr/collapsingToolbarLayoutLargeSize"
+            app:collapsedTitleTextAppearance="?attr/textAppearanceTitleLarge"
+            app:expandedTitleTextAppearance="?attr/textAppearanceHeadlineLarge"
+            app:titleCollapseMode="scale"
+            app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
+
+            <com.google.android.material.appbar.MaterialToolbar
+                android:id="@+id/top_bar"
+                android:layout_width="match_parent"
+                android:layout_height="?attr/actionBarSize"
+                app:navigationIcon="@drawable/ic_arrow_back"
+                app:layout_collapseMode="pin" />
+
+        </com.google.android.material.appbar.CollapsingToolbarLayout>
+
+        <com.google.android.material.tabs.TabLayout
+            android:id="@+id/tab_layout"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="?attr/colorSurface"
+            android:paddingHorizontal="16dp"
+            app:layout_scrollFlags="scroll|enterAlways"
+            tools:ignore="RtlSymmetry" />
+
+    </com.google.android.material.appbar.AppBarLayout>
 
     <androidx.viewpager.widget.ViewPager
         android:id="@+id/view_pager"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="match_parent"
+        app:layout_behavior="@string/appbar_scrolling_view_behavior"
         tools:ignore="SpeakableTextPresentCheck" />
 
-</LinearLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 26 - 20
app/src/main/res/layout/dialog_http_tts_edit.xml

@@ -3,15 +3,13 @@
     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:padding="16dp">
+    android:layout_height="wrap_content">
 
     <LinearLayout
         android:id="@+id/vw_bg"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
-        android:background="@drawable/shape_card_view"
         android:orientation="vertical"
         tools:ignore="UselessParent">
 
@@ -26,6 +24,7 @@
         <androidx.core.widget.NestedScrollView
             android:layout_width="match_parent"
             android:layout_height="match_parent"
+            android:padding="16dp"
             android:overScrollMode="ifContentScrolls">
 
             <LinearLayout
@@ -33,20 +32,20 @@
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/name">
 
-                    <io.legato.kazusa.lib.theme.view.ThemeEditText
+                    <com.google.android.material.textfield.TextInputEditText
                         android:id="@+id/tv_name"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="url"
@@ -56,11 +55,12 @@
                         android:id="@+id/tv_url"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="Content-Type"
@@ -70,11 +70,12 @@
                         android:id="@+id/tv_content_type"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/concurrent_rate"
@@ -84,11 +85,12 @@
                         android:id="@+id/tv_concurrent_rate"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/login_url"
@@ -98,11 +100,12 @@
                         android:id="@+id/tv_login_url"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/login_ui"
@@ -112,11 +115,12 @@
                         android:id="@+id/tv_login_ui"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/login_check_js"
@@ -126,11 +130,12 @@
                         android:id="@+id/tv_login_check_js"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
-                <io.legato.kazusa.ui.widget.text.TextInputLayout
+                <com.google.android.material.textfield.TextInputLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:hint="@string/source_http_header"
@@ -140,9 +145,10 @@
                         android:id="@+id/tv_headers"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
+                        android:padding="16dp"
                         tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
 
-                </io.legato.kazusa.ui.widget.text.TextInputLayout>
+                </com.google.android.material.textfield.TextInputLayout>
 
             </LinearLayout>
 

+ 4 - 1
app/src/main/res/layout/dialog_recycler_view.xml

@@ -46,6 +46,7 @@
             android:id="@+id/tv_footer_left"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            style="@style/Widget.Material3.Button.TonalButton"
             android:padding="12dp"
             android:visibility="gone"
             tools:ignore="RtlHardcoded" />
@@ -59,11 +60,13 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal">
 
-            <TextView
+            <com.google.android.material.button.MaterialButton
                 android:id="@+id/tv_cancel"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                style="@style/Widget.Material3.Button.OutlinedButton"
                 android:padding="12dp"
+                android:layout_marginEnd="8dp"
                 android:text="@string/cancel"
                 android:visibility="gone"
                 tools:ignore="RtlHardcoded" />

+ 1 - 1
app/src/main/res/layout/fragment_bookshelf1.xml

@@ -2,7 +2,6 @@
 <androidx.coordinatorlayout.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">
 
@@ -40,6 +39,7 @@
             android:layout_height="wrap_content"
             android:background="?attr/colorSurface"
             android:paddingHorizontal="16dp"/>
+
     </com.google.android.material.appbar.AppBarLayout>
 
     <!-- ViewPager -->

+ 29 - 24
app/src/main/res/layout/item_http_tts.xml

@@ -6,52 +6,57 @@
     android:layout_height="wrap_content"
     android:gravity="center"
     android:background="?attr/selectableItemBackground"
-    android:padding="8dp">
+    android:padding="16dp">
 
-    <io.legato.kazusa.lib.theme.view.ThemeRadioButton
+    <com.google.android.material.radiobutton.MaterialRadioButton
         android:id="@+id/cb_name"
-        android:layout_width="0dp"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@id/iv_edit"
         app:layout_constraintTop_toTopOf="parent" />
 
-    <androidx.appcompat.widget.AppCompatImageView
+    <com.google.android.material.card.MaterialCardView
+        android:id="@+id/label_sys"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="8dp"
+        app:strokeWidth="0dp"
+        android:visibility="gone"
+        app:layout_constraintLeft_toRightOf="@id/cb_name"
+        app:layout_constraintTop_toTopOf="@id/cb_name"
+        app:layout_constraintBottom_toBottomOf="@id/cb_name">
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:padding="8dp"
+            android:text="SYS" />
+    </com.google.android.material.card.MaterialCardView>
+
+
+    <com.google.android.material.button.MaterialButton
         android:id="@+id/iv_edit"
         android:layout_width="36dp"
         android:layout_height="36dp"
+        style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
         android:layout_gravity="center"
-        android:background="?android:attr/selectableItemBackgroundBorderless"
         android:contentDescription="@string/edit"
-        android:padding="6dp"
-        android:src="@drawable/ic_edit"
+        app:icon="@drawable/ic_edit"
+        app:iconGravity="textStart"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintRight_toLeftOf="@+id/iv_menu_delete"
         app:layout_constraintTop_toTopOf="parent" />
 
-    <androidx.appcompat.widget.AppCompatImageView
+    <com.google.android.material.button.MaterialButton
         android:id="@+id/iv_menu_delete"
         android:layout_width="36dp"
         android:layout_height="36dp"
-        android:background="?attr/selectableItemBackgroundBorderless"
-        android:padding="6dp"
-        android:src="@drawable/ic_clear_all"
+        style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
+        app:icon="@drawable/ic_clear_all"
+        app:iconGravity="textStart"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="1.0"
         tools:ignore="RtlHardcoded" />
 
-    <io.legato.kazusa.ui.widget.text.BevelLabelView
-        android:id="@+id/label_sys"
-        android:layout_width="36dp"
-        android:layout_height="36dp"
-        android:visibility="gone"
-        app:label_mode="right_top"
-        app:label_length="24dp"
-        app:label_text="SYS"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
app/src/main/res/layout/item_rss_article.xml

@@ -3,6 +3,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
+    android:background="?attr/selectableItemBackground"
     android:layout_height="100dp"
     android:padding="16dp">
 

+ 1 - 1
app/src/main/res/layout/view_search.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<io.legato.kazusa.ui.widget.SearchView
+<androidx.appcompat.widget.SearchView
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/search_view"