增加了一个白色猫猫头图标喵 #79
This commit is contained in:
@@ -34,6 +34,17 @@
|
||||
android:theme="@style/Base.AppTheme"
|
||||
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnusedAttribute">
|
||||
<!-- 图标0 -->
|
||||
<activity-alias
|
||||
android:name=".Launcherw"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/launcherw"
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:name=".Launcher0"
|
||||
android:enabled="false"
|
||||
@@ -54,7 +65,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@@ -67,7 +77,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@@ -80,7 +89,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@@ -93,7 +101,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@@ -106,7 +113,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
@@ -119,7 +125,6 @@
|
||||
android:targetActivity=".ui.main.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
|
||||
@@ -13,6 +13,7 @@ import splitties.init.appCtx
|
||||
object LauncherIconHelp {
|
||||
private val packageManager: PackageManager = appCtx.packageManager
|
||||
private val componentNames = arrayListOf(
|
||||
ComponentName(appCtx.packageName, "${appCtx.packageName}.Launcherw"),
|
||||
ComponentName(appCtx.packageName, "${appCtx.packageName}.Launcher0"),
|
||||
ComponentName(appCtx.packageName, "${appCtx.packageName}.Launcher1"),
|
||||
ComponentName(appCtx.packageName, "${appCtx.packageName}.Launcher2"),
|
||||
|
||||
@@ -11,15 +11,15 @@ import android.widget.ImageView
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
||||
import io.legato.kazusa.base.adapter.ItemViewHolder
|
||||
import io.legato.kazusa.base.adapter.RecyclerAdapter
|
||||
import io.legato.kazusa.databinding.DialogRecyclerViewBinding
|
||||
import io.legato.kazusa.databinding.ItemIconPreferenceBinding
|
||||
//import io.legado.app.lib.theme.primaryColor
|
||||
import io.legato.kazusa.utils.getCompatDrawable
|
||||
import io.legato.kazusa.utils.themeColor
|
||||
import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
//binding.toolBar.setBackgroundColor(primaryColor)
|
||||
binding.toolBar.setTitle(R.string.change_icon)
|
||||
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.recyclerView.layoutManager = GridLayoutManager(requireContext(), 3)
|
||||
val adapter = Adapter(requireContext())
|
||||
binding.recyclerView.adapter = adapter
|
||||
arguments?.let {
|
||||
@@ -164,23 +164,21 @@ class IconListPreference(context: Context, attrs: AttributeSet) : ListPreference
|
||||
) {
|
||||
binding.run {
|
||||
val index = findIndexOfValue(item.toString())
|
||||
dialogEntries?.let {
|
||||
label.text = it[index]
|
||||
}
|
||||
dialogIconNames?.let {
|
||||
val resId = context.resources
|
||||
.getIdentifier(it[index].toString(), "mipmap", context.packageName)
|
||||
val d = try {
|
||||
context.getCompatDrawable(resId)
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
d?.let {
|
||||
icon.setImageDrawable(d)
|
||||
}
|
||||
val resId = context.resources.getIdentifier(it[index].toString(), "mipmap", context.packageName)
|
||||
val d = context.getCompatDrawable(resId)
|
||||
d?.let { icon.setImageDrawable(it) }
|
||||
}
|
||||
label.isChecked = item.toString() == dialogValue
|
||||
root.setOnClickListener {
|
||||
|
||||
val isSelected = item.toString() == dialogValue
|
||||
|
||||
if (isSelected) {
|
||||
card.setCardBackgroundColor(context.themeColor(com.google.android.material.R.attr.colorSecondaryContainer))
|
||||
} else {
|
||||
card.setCardBackgroundColor(context.themeColor(com.google.android.material.R.attr.colorSurfaceContainer))
|
||||
}
|
||||
|
||||
card.setOnClickListener {
|
||||
onChanged?.invoke(item.toString())
|
||||
this@IconDialog.dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:scrollbars="none"
|
||||
tools:ignore="SpeakableTextPresentCheck" />
|
||||
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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:background="?attr/selectableItemBackground"
|
||||
android:padding="16dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="ICON"
|
||||
tools:ignore="HardcodedText" />
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/card"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:cardBackgroundColor="?attr/colorSurfaceContainerHighest"
|
||||
app:strokeWidth="0dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginHorizontal="10dp">
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:paddingStart="8dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toRightOf="@+id/icon"
|
||||
android:checkMark="?android:attr/listChoiceIndicatorSingle"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorAlertDialogListItem"
|
||||
android:textIsSelectable="false"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry" />
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="ICON"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</RelativeLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background_w" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher4" />
|
||||
</adaptive-icon>
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
<string-array name="icon_names">
|
||||
<item>iconMain</item>
|
||||
<item>iconWhite</item>
|
||||
<item>icon0</item>
|
||||
<item>icon1</item>
|
||||
<item>icon2</item>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
<string-array name="icon_names">
|
||||
<item>iconMain</item>
|
||||
<item>iconWhite</item>
|
||||
<item>icon0</item>
|
||||
<item>icon1</item>
|
||||
<item>icon2</item>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<string-array name="icons">
|
||||
<item>ic_launcher</item>
|
||||
<item>launcherw</item>
|
||||
<item>launcher0</item>
|
||||
<item>launcher1</item>
|
||||
<item>launcher2</item>
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
|
||||
<string-array name="icon_names" tools:ignore="Typos">
|
||||
<item>iconMain</item>
|
||||
<item>iconWhite</item>
|
||||
<item>icon0</item>
|
||||
<item>icon1</item>
|
||||
<item>icon2</item>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#2E2D3D</color>
|
||||
<color name="ic_launcher_background_w">#F2F1F6</color>
|
||||
|
||||
<!-- GR Theme-->
|
||||
<color name="gr_theme_primary">#4C662B</color>
|
||||
<color name="gr_theme_onPrimary">#FFFFFF</color>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#2E2D3D</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user