更新界面
This commit is contained in:
@@ -8,13 +8,7 @@ import android.widget.FrameLayout
|
||||
import androidx.annotation.MenuRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.databinding.ViewSelectActionBarBinding
|
||||
//import io.legado.app.lib.theme.accentColor
|
||||
//import io.legado.app.lib.theme.bottomBackground
|
||||
//import io.legado.app.lib.theme.getPrimaryTextColor
|
||||
//import io.legado.app.lib.theme.getSecondaryDisabledTextColor
|
||||
import io.legato.kazusa.utils.applyNavigationBarPadding
|
||||
import io.legato.kazusa.utils.visible
|
||||
|
||||
|
||||
@@ -24,10 +18,6 @@ class SelectActionBar @JvmOverloads constructor(
|
||||
attrs: AttributeSet? = null
|
||||
) : FrameLayout(context, attrs) {
|
||||
|
||||
// private val bgIsLight = ColorUtils.isColorLight(context.bottomBackground)
|
||||
// private val primaryTextColor = context.getPrimaryTextColor(bgIsLight)
|
||||
// private val disabledColor = context.getSecondaryDisabledTextColor(bgIsLight)
|
||||
|
||||
private var callBack: CallBack? = null
|
||||
private var selMenu: PopupMenu? = null
|
||||
private val binding = ViewSelectActionBarBinding
|
||||
@@ -35,12 +25,7 @@ class SelectActionBar @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
if (!isInEditMode) {
|
||||
// setBackgroundColor(context.bottomBackground)
|
||||
// //elevation = context.elevation
|
||||
// binding.cbSelectedAll.setTextColor(primaryTextColor)
|
||||
// TintHelper.setTint(binding.cbSelectedAll, context.accentColor, !bgIsLight)
|
||||
// binding.ivMenuMore.setColorFilter(disabledColor, PorterDuff.Mode.SRC_IN)
|
||||
binding.cbSelectedAll.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
binding.cbSelectedAll.addOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if (buttonView.isPressed) {
|
||||
callBack?.selectAll(isChecked)
|
||||
}
|
||||
@@ -52,7 +37,6 @@ class SelectActionBar @JvmOverloads constructor(
|
||||
selMenu?.show()
|
||||
}
|
||||
}
|
||||
applyNavigationBarPadding()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,19 +78,9 @@ class SelectActionBar @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
//重置全选的文字
|
||||
if (cbSelectedAll.isChecked) {
|
||||
cbSelectedAll.text = context.getString(
|
||||
R.string.select_cancel_count,
|
||||
selectCount,
|
||||
allCount
|
||||
)
|
||||
} else {
|
||||
cbSelectedAll.text = context.getString(
|
||||
R.string.select_all_count,
|
||||
selectCount,
|
||||
allCount
|
||||
)
|
||||
}
|
||||
tvCount.text = selectCount.toString()
|
||||
tvCountAll.text = allCount.toString()
|
||||
|
||||
setMenuClickable(selectCount > 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,54 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<com.google.android.material.dockedtoolbar.DockedToolbarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="8dp"
|
||||
android:paddingVertical="8dp"
|
||||
tools:ignore="RtlHardcoded">
|
||||
|
||||
<io.legato.kazusa.lib.theme.view.ThemeCheckBox
|
||||
android:id="@+id/cb_selected_all"
|
||||
android:layout_width="0dp"
|
||||
android:layout_gravity="bottom">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/select_all" />
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_revert_selection"
|
||||
style="@style/Widget.Material3Expressive.Button.TonalButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/revert_selection" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.button.MaterialSplitButton
|
||||
android:id="@+id/btn_split"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/tv_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/colorSecondary"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_count_all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_select_action_main"
|
||||
style="?attr/materialSplitButtonLeadingFilledStyle"
|
||||
android:id="@+id/cb_selected_all"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:text="@string/app_name"
|
||||
android:visibility="visible" />
|
||||
android:checkable="true"
|
||||
android:focusable="true"
|
||||
app:icon="@drawable/ic_select_all"
|
||||
style="@style/Widget.Material3Expressive.Button.IconButton.Outlined" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/iv_menu_more"
|
||||
style="?attr/materialSplitButtonIconFilledStyle"
|
||||
android:id="@+id/btn_revert_selection"
|
||||
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/more_menu"
|
||||
app:icon="@drawable/m3_split_button_chevron_avd"/>
|
||||
app:icon="@drawable/ic_select_invert"
|
||||
android:layout_marginEnd="4dp" />
|
||||
|
||||
</com.google.android.material.button.MaterialSplitButton>
|
||||
<com.google.android.material.button.MaterialSplitButton
|
||||
android:id="@+id/btn_split"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="0dp">
|
||||
|
||||
</LinearLayout>
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_select_action_main"
|
||||
style="?attr/materialSplitButtonLeadingFilledStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:text="@string/app_name"
|
||||
android:visibility="visible" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/iv_menu_more"
|
||||
style="?attr/materialSplitButtonIconFilledStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/more_menu"
|
||||
app:icon="@drawable/m3_split_button_chevron_avd"/>
|
||||
|
||||
</com.google.android.material.button.MaterialSplitButton>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.dockedtoolbar.DockedToolbarLayout>
|
||||
Reference in New Issue
Block a user