Icon update; re-wrote text font dropdown so it looks a bit better

This commit is contained in:
denizk0461
2023-05-17 09:54:15 +02:00
parent c9c325ddf0
commit 5636f1e679
18 changed files with 25 additions and 51 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 14 KiB

@@ -8,8 +8,8 @@ import android.os.Bundle
import android.util.TypedValue import android.util.TypedValue
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.ImageButton import android.widget.ImageButton
import android.widget.PopupMenu
import android.widget.TextView import android.widget.TextView
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.annotation.StringRes import androidx.annotation.StringRes
@@ -41,58 +41,22 @@ class SettingsNewFragment : BaseFragment(R.layout.fragment_settings_new) {
storage = QuoteStorage.getInstance(context) storage = QuoteStorage.getInstance(context)
// --- text font --- // // --- text font --- //
// binding.autoCompleteFont.setOnClickListener { val fontAdapter = ArrayAdapter.createFromResource(
// // Create menu for selecting a new canteen context,
// PopupMenu(binding.root.context, binding.textLayoutFont).apply { R.array.text_fonts,
// setOnMenuItemClickListener { item -> R.layout.item_dropdown,
// item?.itemId?.let { id -> )
// storage.setTypefaceStyle(id)
// }
//
// // Update the preview
// updatePreview()
// true
// }
// menu.add(0, 0, 0, getString(R.string.sansserif))
// menu.add(1, 1, 1, getString(R.string.serif))
// menu.add(2, 2, 2, getString(R.string.monospace))
// show()
// }
// }
// val fontAdapter = ArrayAdapter( binding.autoCompleteFont.setAdapter(fontAdapter)
// context, binding.autoCompleteFont.setText(
// R.layout.item_dropdown_menu, fontAdapter.getItem(storage.getTypefaceIndex()).toString(),
// resources.getStringArray(R.array.text_fonts), false,
// ) )
//
// binding.autoCompleteFont.setAdapter(fontAdapter)
binding.autoCompleteFont binding.autoCompleteFont.setOnItemClickListener { _, _, position, _ ->
.setText(context.resources.getStringArray(R.array.text_fonts)[storage.getTypefaceIndex()]) storage.setTypefaceIndex(position)
binding.autoCompleteFont.setText(fontAdapter.getItem(position), false)
binding.autoCompleteFont.setOnClickListener { updatePreview()
PopupMenu(binding.root.context, binding.autoCompleteFont).apply {
setOnMenuItemClickListener { item ->
item?.itemId?.let { id ->
val index = when (id) {
R.id.serif -> 1
R.id.monospace -> 2
else -> 0 // sans-serif
}
storage.setTypefaceIndex(index)
binding.autoCompleteFont
.setText(context.resources.getStringArray(R.array.text_fonts)[index])
}
// Refresh the canteen menu for the newly selected canteen
updatePreview()
true
}
inflate(R.menu.list_fonts)
show()
}
} }
// --- font style --- // // --- font style --- //
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
xmlns:android="http://schemas.android.com/apk/res/android" />
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB