Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/src/main/java/com/leanbitlab/lwidget/SettingsAccordion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

package com.leanbitlab.lwidget

import com.google.android.material.textfield.MaterialAutoCompleteTextView
import android.content.Context
import android.view.View
import android.widget.AutoCompleteTextView
import android.widget.ImageView
import android.widget.ListView
import android.widget.TextView
Expand Down Expand Up @@ -213,12 +213,11 @@ internal fun MainActivity.bindFoldedSection(
// Selector row setup (the world clock time zone uses bindTimezoneSearch instead)
if (selectorRowId != null && selectorOptions != null && prefSelectorKey != null) {
val selectorRowInner = findViewById<View>(selectorRowId)
val autoCompleteTextView = selectorRowInner.findViewById<AutoCompleteTextView>(R.id.row_value)
val autoCompleteTextView = selectorRowInner.findViewById<MaterialAutoCompleteTextView>(R.id.row_value)
val selectorLabel = selectorRowInner.findViewById<TextView>(R.id.row_label)
selectorLabel.text = title

val adapter = android.widget.ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, selectorOptions)
autoCompleteTextView.setAdapter(adapter)
autoCompleteTextView.setSimpleItems(selectorOptions.toTypedArray())

val currentIdx = prefs.getInt(prefSelectorKey, defSelectorIdx)
autoCompleteTextView.setText(selectorOptions.getOrElse(currentIdx) { selectorOptions[defSelectorIdx] }, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package com.leanbitlab.lwidget

import com.google.android.material.textfield.MaterialAutoCompleteTextView
import android.view.View
import android.widget.AutoCompleteTextView
import android.widget.TextView

private data class LanguageOption(val code: String, val displayName: String)
Expand Down Expand Up @@ -159,11 +159,10 @@ internal fun MainActivity.setupLanguageSection() {

val row = findViewById<View>(R.id.row_app_language) ?: return
val tvTitle = row.findViewById<TextView>(R.id.row_label)
val autoCompleteTextView = row.findViewById<AutoCompleteTextView>(R.id.row_value)
val autoCompleteTextView = row.findViewById<MaterialAutoCompleteTextView>(R.id.row_value)

tvTitle.text = getString(R.string.section_app_language)
val adapter = android.widget.ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, languageLabels)
autoCompleteTextView.setAdapter(adapter)
autoCompleteTextView.setSimpleItems(languageLabels.toTypedArray())
autoCompleteTextView.setText(languageLabels[currentIdx], false)

autoCompleteTextView.setOnItemClickListener { _, _, position, _ ->
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/leanbitlab/lwidget/SettingsBinders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

package com.leanbitlab.lwidget

import com.google.android.material.textfield.MaterialAutoCompleteTextView
import android.view.View
import android.widget.AutoCompleteTextView
import android.widget.TextView
import android.view.ViewGroup
import com.google.android.material.slider.Slider
Expand Down Expand Up @@ -89,12 +89,11 @@ internal fun MainActivity.bindSelector(
) {
val row = findViewById<View>(viewId)
val tvTitle = row.findViewById<TextView>(R.id.row_label)
val autoCompleteTextView = row.findViewById<AutoCompleteTextView>(R.id.row_value)
val autoCompleteTextView = row.findViewById<MaterialAutoCompleteTextView>(R.id.row_value)

tvTitle.text = title

val adapter = android.widget.ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, options)
autoCompleteTextView.setAdapter(adapter)
autoCompleteTextView.setSimpleItems(options.toTypedArray())

if (prefKey == "clock_app_package" || prefKey == "calendar_app_package") {
val appPackages = if (prefKey == "clock_app_package") clockAppPackages else calendarAppPackages
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/bg_dropdown_popup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorSurfaceContainer" />
<corners android:radius="12dp" />
<padding android:top="8dp" android:bottom="8dp" />
</shape>
31 changes: 19 additions & 12 deletions app/src/main/res/layout/settings_selector_row.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
Expand All @@ -12,6 +13,7 @@

<TextView
android:id="@+id/row_label"
android:labelFor="@+id/row_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
Expand All @@ -21,27 +23,32 @@

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/row_input_layout"
android:saveEnabled="false"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="200dp"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="208dp"
android:layout_height="wrap_content"
android:saveEnabled="false"
app:boxBackgroundColor="?attr/colorSurface"
app:boxCornerRadiusBottomEnd="12dp"
app:boxCornerRadiusBottomStart="12dp"
app:boxCornerRadiusTopEnd="12dp"
app:boxCornerRadiusTopStart="12dp"
app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"
app:endIconMode="dropdown_menu">
app:hintEnabled="false">

<AutoCompleteTextView
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/row_value"
android:saveEnabled="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:text="Default"
android:hint="Select"
android:textSize="14sp"
android:textColor="?attr/colorOnSurface"
android:background="@null"
android:minHeight="48dp"
android:popupBackground="@drawable/bg_dropdown_popup"
android:paddingStart="12dp"
android:paddingTop="12dp"
android:paddingBottom="12dp" />
android:paddingBottom="12dp"
android:saveEnabled="false"
android:textSize="14sp"
tools:text="Default" />

</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
Loading