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