更新界面
This commit is contained in:
@@ -48,8 +48,6 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
|
||||
payloads: MutableList<Any>
|
||||
) {
|
||||
binding.run {
|
||||
// 移除了 padding 设置
|
||||
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.bookSourceName
|
||||
}
|
||||
|
||||
@@ -7,12 +7,14 @@ import android.view.SubMenu
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.transition.TransitionManager
|
||||
import com.google.android.material.search.SearchBar
|
||||
import com.google.android.material.search.SearchView
|
||||
import io.legato.kazusa.R
|
||||
@@ -208,6 +210,10 @@ class ExploreFragment() : VMBaseFragment<ExploreViewModel>(R.layout.fragment_exp
|
||||
val query = "group:${item.title}"
|
||||
searchView.setText(query)
|
||||
upExploreData(query)
|
||||
}else if (item.itemId == R.id.menu_exp_search) {
|
||||
TransitionManager.beginDelayedTransition(binding.rootView)
|
||||
binding.searchBar.visibility =
|
||||
if (binding.searchBar.isVisible) View.GONE else View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package io.legato.kazusa.ui.main.rss
|
||||
|
||||
import android.os.Bundle
|
||||
import android.transition.TransitionManager
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.SubMenu
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@@ -89,6 +91,11 @@ class RssFragment() : VMBaseFragment<RssViewModel>(R.layout.fragment_rss),
|
||||
when (item.itemId) {
|
||||
R.id.menu_rss_config -> startActivity<RssSourceActivity>()
|
||||
R.id.menu_rss_star -> startActivity<RssFavoritesActivity>()
|
||||
R.id.menu_rss_search -> {
|
||||
TransitionManager.beginDelayedTransition(binding.rootView)
|
||||
binding.searchBar.visibility =
|
||||
if (binding.searchBar.isVisible) View.GONE else View.VISIBLE
|
||||
}
|
||||
else -> if (item.groupId == R.id.menu_group_text) {
|
||||
searchView.setText("group:${item.title}")
|
||||
upRssFlowJob("group:${item.title}")
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
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/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -33,10 +34,9 @@
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorSurface"
|
||||
android:visibility="gone"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:hint="@string/search_rss_source"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:hint="@string/search_rss_source" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<io.legato.kazusa.ui.widget.recycler.RecyclerViewAtPager2
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_find"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
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/root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@@ -33,9 +34,9 @@
|
||||
android:id="@+id/search_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:hint="@string/search_rss_source"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:hint="@string/search_rss_source" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
@@ -45,20 +46,18 @@
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<io.legato.kazusa.ui.widget.recycler.RecyclerViewAtPager2
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:spanCount="4"
|
||||
tools:listitem="@layout/item_rss" />
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_empty_msg"
|
||||
|
||||
@@ -1,97 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<io.legato.kazusa.lib.theme.view.ThemeCheckBox
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:gravity="center_vertical" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:paddingBottom="2dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/book_name"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toEndOf="@id/checkbox"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/checkbox"
|
||||
app:layout_constraintBottom_toBottomOf="@id/checkbox"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/book_name"
|
||||
android:textSize="20sp" />
|
||||
<TextView
|
||||
android:id="@+id/tv_author"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/author"
|
||||
android:textSize="12sp"
|
||||
tools:ignore="RtlHardcoded"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_name"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/author"
|
||||
android:textSize="12sp"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/tv_origin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="12sp"
|
||||
tools:text="@string/book_source"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_author" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_group_s"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/ungroup"
|
||||
android:layout_marginStart="8dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_origin"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/tv_origin" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="4dp">
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tv_group"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="40dp"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:padding="0dp"
|
||||
android:text="@string/group"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_group_s"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_group_s"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_origin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
tools:text="@string/book_source" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tv_delete"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
style="@style/Widget.Material3.Button.IconButton.Outlined"
|
||||
app:icon="@drawable/ic_clear_all"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_group_s"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_group_s"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_group_s"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/ungroup"
|
||||
android:layout_marginStart="8dp"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 按钮横向排列 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="end"
|
||||
android:layout_marginTop="4dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tv_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:padding="2dp"
|
||||
android:text="@string/group" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tv_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.Material3.Button.IconButton.Outlined"
|
||||
app:icon="@drawable/ic_clear_all"
|
||||
android:layout_marginStart="8dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -40,11 +40,11 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/iv_download"
|
||||
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:contentDescription="@string/start"
|
||||
app:icon="@drawable/ic_play_24dp"
|
||||
android:padding="4dp"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_download"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_export"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_name" />
|
||||
@@ -52,7 +52,7 @@
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/tv_export"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_height="40dp"
|
||||
style="@style/Widget.Material3.Button.TonalButton"
|
||||
android:textSize="12sp"
|
||||
android:padding="0dp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:theme="?attr/actionBarStyle"
|
||||
android:background="@drawable/bg_searchview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:imeOptions="actionSearch"
|
||||
|
||||
@@ -2,14 +2,19 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_exp_search"
|
||||
android:title="@string/search"
|
||||
android:icon="@drawable/ic_search"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_group"
|
||||
android:title="@string/group"
|
||||
android:icon="@drawable/ic_groups"
|
||||
app:showAsAction="always">
|
||||
|
||||
<menu />
|
||||
|
||||
</item>
|
||||
|
||||
|
||||
</menu>
|
||||
Reference in New Issue
Block a user