mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 06:52:57 +00:00
adjust background of re-order dialogs
This commit is contained in:
parent
1df82d9b84
commit
f093319436
3 changed files with 6 additions and 40 deletions
|
@ -3,11 +3,13 @@ package org.dslul.openboard.inputmethod.latin.utils
|
|||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Configuration
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.SwitchCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -110,9 +112,13 @@ fun reorderMoreKeysDialog(context: Context, key: String, defaultSetting: String,
|
|||
override fun areItemsTheSame(p0: Pair<String, Boolean>, p1: Pair<String, Boolean>) = p0 == p1
|
||||
override fun areContentsTheSame(p0: Pair<String, Boolean>, p1: Pair<String, Boolean>) = p0 == p1
|
||||
}
|
||||
val bgColor = if (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_NO)
|
||||
ContextCompat.getColor(context, androidx.appcompat.R.color.background_floating_material_light)
|
||||
else ContextCompat.getColor(context, androidx.appcompat.R.color.background_floating_material_dark)
|
||||
val adapter = object : ListAdapter<Pair<String, Boolean>, RecyclerView.ViewHolder>(callback) {
|
||||
override fun onCreateViewHolder(p0: ViewGroup, p1: Int): RecyclerView.ViewHolder {
|
||||
val b = LayoutInflater.from(context).inflate(R.layout.morekeys_list_item, rv, false)
|
||||
b.setBackgroundColor(bgColor)
|
||||
return object : RecyclerView.ViewHolder(b) { }
|
||||
}
|
||||
override fun onBindViewHolder(p0: RecyclerView.ViewHolder, p1: Int) {
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
-->
|
||||
<!--
|
||||
why is the android resource system sometimes so horrible to work with?
|
||||
setting colorBackgroundFloating in code sets an empty background
|
||||
using a color that's colorBackground, but colorBackgroundFloating in v23 crashes
|
||||
with Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x1010031 a=3 r=0x7f06008c}
|
||||
it seems to be absolutely necessary to clone the layout... wtf?
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:paddingHorizontal="10dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/colorBackgroundFloating"
|
||||
android:minHeight="48dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<TextView
|
||||
android:id="@+id/morekeys_type"
|
||||
style="@style/PreferenceTitleText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content" />
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/morekeys_switch"
|
||||
android:padding="6dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<ImageView
|
||||
android:paddingEnd="10dp"
|
||||
android:src="@drawable/ic_drag_indicator"
|
||||
app:tint="@color/foreground_weak"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
|
@ -7,7 +7,6 @@
|
|||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="4dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:minHeight="48dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue