mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Moving settings to a better method
This commit is contained in:
parent
0079c060b1
commit
f602ae569f
9 changed files with 648 additions and 546 deletions
|
|
@ -48,4 +48,5 @@ dependencies {
|
|||
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation("androidx.preference:preference:1.2.1")
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package eu.ottop.yamlauncher
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("eu.ottop.yamlauncher", appContext.packageName)
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package eu.ottop.yamlauncher
|
|||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.LauncherActivityInfo
|
||||
import android.content.pm.LauncherApps
|
||||
import android.os.Build
|
||||
|
|
@ -24,6 +25,7 @@ import android.widget.TextClock
|
|||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -31,6 +33,7 @@ import androidx.constraintlayout.widget.ConstraintSet
|
|||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.marginLeft
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
|
@ -43,7 +46,7 @@ import kotlin.math.abs
|
|||
import java.lang.reflect.Method
|
||||
|
||||
|
||||
class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, AppMenuAdapter.OnShortcutListener, AppMenuAdapter.OnItemLongClickListener {
|
||||
class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceChangeListener, AppMenuAdapter.OnItemClickListener, AppMenuAdapter.OnShortcutListener, AppMenuAdapter.OnItemLongClickListener {
|
||||
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
private lateinit var gestureDetector: GestureDetector
|
||||
|
|
@ -78,6 +81,8 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
private var cameraSwipeEnabled = true
|
||||
private var contactsSwipeEnabled = true
|
||||
|
||||
private lateinit var preferences: SharedPreferences
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
@ -85,6 +90,10 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
setContentView(binding.root)
|
||||
setSupportActionBar(null)
|
||||
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
|
||||
preferences.registerOnSharedPreferenceChangeListener(this)
|
||||
|
||||
searchView = findViewById(R.id.searchView)
|
||||
|
||||
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
|
|
@ -98,8 +107,12 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
|
||||
constraintLayout = findViewById(R.id.clock_layout)
|
||||
|
||||
setClockAlignment(preferences.getString("clockAlignment", "left"), clock.id, clockMargin)
|
||||
|
||||
setupApps()
|
||||
|
||||
setShortcutAlignment(preferences.getString("shortcutAlignment", "left"), binding.homeView)
|
||||
|
||||
dateText = findViewById(R.id.text_date)
|
||||
|
||||
batteryReceiver = BatteryReceiver.register(this, dateText)
|
||||
|
|
@ -115,6 +128,20 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
backToHome()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(preferences: SharedPreferences?, key: String?) {
|
||||
|
||||
when (key) {
|
||||
"clockAlignment" -> {
|
||||
setClockAlignment(preferences?.getString(key, "left"), clock.id, clockMargin)
|
||||
}
|
||||
|
||||
"shortcutAlignment" -> {
|
||||
setShortcutAlignment(preferences?.getString("shortcutAlignment", "left"), binding.homeView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
|
|
@ -131,6 +158,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
super.onDestroy()
|
||||
job?.cancel()
|
||||
unregisterReceiver(batteryReceiver)
|
||||
preferences.unregisterOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
|
@ -145,9 +173,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
setTextSizes()
|
||||
|
||||
setClockAlignment()
|
||||
setShortCutAlignment()
|
||||
setSearchAlignment()
|
||||
|
||||
setGestures()
|
||||
|
|
@ -456,8 +481,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
shortcutView.setCompoundDrawablesWithIntrinsicBounds(ResourcesCompat.getDrawable(resources, R.drawable.ic_empty, null),null,null,null)
|
||||
}
|
||||
|
||||
setShortCutAlignment()
|
||||
|
||||
shortcutView.text = textView.text.toString()
|
||||
shortcutView.setOnClickListener {
|
||||
val mainActivity = launcherApps.getActivityList(appInfo.applicationInfo.packageName, userHandle).firstOrNull()
|
||||
|
|
@ -540,29 +563,20 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
return true
|
||||
}
|
||||
|
||||
private fun setClockAlignment() {
|
||||
setConstraintAlignment(sharedPreferenceManager.getClockAlignment(this@MainActivity), clock.id, clockMargin)
|
||||
}
|
||||
|
||||
private fun setConstraintAlignment(alignment: Int, widgetId: Int, margin: Int) {
|
||||
private fun setClockAlignment(alignment: String?, widgetId: Int, margin: Int) {
|
||||
|
||||
val constraintSet = ConstraintSet()
|
||||
constraintSet.clone(constraintLayout)
|
||||
println(alignment)
|
||||
|
||||
/*
|
||||
0 = left
|
||||
1 = center
|
||||
2 = right
|
||||
*/
|
||||
if (alignment == 2) {
|
||||
if (alignment == "right") {
|
||||
constraintSet.clear(widgetId, ConstraintSet.START)
|
||||
}
|
||||
else if (alignment == 0) {
|
||||
else if (alignment == "left") {
|
||||
constraintSet.clear(widgetId, ConstraintSet.END)
|
||||
}
|
||||
|
||||
if (alignment == 1 || alignment == 0) {
|
||||
if (alignment == "center" || alignment == "left") {
|
||||
constraintSet.connect(
|
||||
widgetId,
|
||||
ConstraintSet.START,
|
||||
|
|
@ -573,7 +587,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
|
||||
}
|
||||
|
||||
if (alignment != 0) {
|
||||
if (alignment != "left") {
|
||||
constraintSet.connect(
|
||||
widgetId,
|
||||
ConstraintSet.END,
|
||||
|
|
@ -586,8 +600,49 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
constraintSet.applyTo(constraintLayout)
|
||||
}
|
||||
|
||||
private fun setShortCutAlignment() {
|
||||
setLinearAlignment(binding.homeView)
|
||||
private fun setShortcutAlignment(alignment: String?, shortcuts: LinearLayout) {
|
||||
shortcuts.children.forEach {
|
||||
|
||||
if (it is TextView) {
|
||||
|
||||
|
||||
when (alignment) {
|
||||
"left" -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(it.compoundDrawables.filterNotNull().first(),null, null, null)
|
||||
it.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
||||
}
|
||||
"center" -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(it.compoundDrawables.filterNotNull().first(),null,it.compoundDrawables.filterNotNull().first(), null)
|
||||
it.gravity = Gravity.CENTER
|
||||
}
|
||||
"right" -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(null,null, it.compoundDrawables.filterNotNull().first(), null)
|
||||
it.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setSearchAlignment() {
|
||||
|
||||
/*
|
||||
0 = left
|
||||
1 = center
|
||||
2 = right
|
||||
*/
|
||||
when (sharedPreferenceManager.getSearchAlignment(this@MainActivity)) {
|
||||
0 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||
}
|
||||
1 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
}
|
||||
2 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_VIEW_END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setShortcutSize(shortcuts: LinearLayout) {
|
||||
|
|
@ -632,56 +687,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
|||
}
|
||||
}
|
||||
|
||||
private fun setLinearAlignment(shortcuts: LinearLayout) {
|
||||
shortcuts.children.forEach {
|
||||
|
||||
if (it is TextView) {
|
||||
|
||||
/*
|
||||
0 = left
|
||||
1 = center
|
||||
2 = right
|
||||
*/
|
||||
|
||||
when (sharedPreferenceManager.getHomeAppAlignment(this@MainActivity)) {
|
||||
0 -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(it.compoundDrawables.filterNotNull().first(),null, null, null)
|
||||
it.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
||||
}
|
||||
1 -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(it.compoundDrawables.filterNotNull().first(),null,it.compoundDrawables.filterNotNull().first(), null)
|
||||
it.gravity = Gravity.CENTER
|
||||
}
|
||||
2 -> {
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(null,null, it.compoundDrawables.filterNotNull().first(), null)
|
||||
it.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setSearchAlignment() {
|
||||
|
||||
/*
|
||||
0 = left
|
||||
1 = center
|
||||
2 = right
|
||||
*/
|
||||
when (sharedPreferenceManager.getSearchAlignment(this@MainActivity)) {
|
||||
0 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||
}
|
||||
1 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
}
|
||||
2 -> {
|
||||
searchView.textAlignment = View.TEXT_ALIGNMENT_VIEW_END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextSizes() {
|
||||
setShortcutSize(binding.homeView)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,21 @@ import android.widget.AdapterView
|
|||
import eu.ottop.yamlauncher.databinding.ActivitySettingsBinding
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.settingsLayout, SettingsFragment())
|
||||
.commit()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
|
@ -136,4 +150,6 @@ class SettingsActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
11
app/src/main/java/eu/ottop/yamlauncher/SettingsFragment.kt
Normal file
11
app/src/main/java/eu/ottop/yamlauncher/SettingsFragment.kt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package eu.ottop.yamlauncher
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
|
||||
class SettingsFragment : PreferenceFragmentCompat() {
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<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:id="@+id/linearLayout"
|
||||
android:id="@+id/settingsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".SettingsActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/clock_alignment_label"
|
||||
android:layout_width="250dp"
|
||||
|
|
@ -22,12 +28,7 @@
|
|||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/clock_alignment"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
android:visibility="visible" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/clock_alignment"
|
||||
|
|
@ -35,18 +36,14 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/h_alignment_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/clock_alignment_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/clock_alignment_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/clock_alignment_label"
|
||||
app:layout_constraintVertical_bias="0.1" />
|
||||
tools:layout_editor_absoluteX="250dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/clock_alignment_label" />
|
||||
tools:layout_editor_absoluteY="66dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/home_app_alignment_label"
|
||||
|
|
@ -63,12 +60,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/clock_alignment"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider2"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteY="67dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/home_app_alignment"
|
||||
|
|
@ -76,17 +68,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/h_alignment_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/home_app_alignment_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/home_app_alignment_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/home_app_alignment_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="67dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/home_app_alignment_label" />
|
||||
tools:layout_editor_absoluteY="134dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_alignment_label"
|
||||
|
|
@ -103,12 +93,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/clock_alignment"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider3"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteY="135dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/app_alignment"
|
||||
|
|
@ -116,19 +101,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/h_alignment_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/app_alignment_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/app_alignment_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/app_alignment_label"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="135dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label" />
|
||||
tools:layout_editor_absoluteY="202dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_alignment_label"
|
||||
|
|
@ -145,12 +126,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteY="202dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/search_alignment"
|
||||
|
|
@ -158,18 +134,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/h_alignment_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/search_alignment_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/search_alignment_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="202dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_alignment_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="270dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/clock_size_label"
|
||||
|
|
@ -186,10 +159,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_alignment_label" />
|
||||
tools:layout_editor_absoluteY="270dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/clock_size"
|
||||
|
|
@ -197,24 +167,20 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/size_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/clock_size_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_alignment_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="270dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider7"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clock_size_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="337dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date_size_label"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="188dp"
|
||||
android:clickable="false"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="20dp"
|
||||
|
|
@ -226,12 +192,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clock_size_label"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteY="337dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/date_size"
|
||||
|
|
@ -239,18 +200,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/size_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/date_size_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/date_size_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="337dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider8"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/date_size_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="405dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shortcut_size_label"
|
||||
|
|
@ -267,12 +225,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/date_size_label"
|
||||
app:layout_constraintVertical_bias="0.0" />
|
||||
tools:layout_editor_absoluteY="405dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/shortcut_size"
|
||||
|
|
@ -280,18 +233,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/size_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/shortcut_size_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="405dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/shortcut_size_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="472dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_size_label"
|
||||
|
|
@ -308,10 +258,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/shortcut_size_label" />
|
||||
tools:layout_editor_absoluteY="472dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/app_size"
|
||||
|
|
@ -319,18 +266,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/size_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/app_size_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toTopOf="@+id/app_size_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="472dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider6"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/app_size_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="539dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_size_label"
|
||||
|
|
@ -347,10 +291,7 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/app_size_label" />
|
||||
tools:layout_editor_absoluteY="539dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/search_size"
|
||||
|
|
@ -358,18 +299,15 @@
|
|||
android:layout_height="0dp"
|
||||
android:entries="@array/size_options"
|
||||
android:spinnerMode="dropdown"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/search_size_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||
app:layout_constraintTop_toBottomOf="@+id/app_size_label" />
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="539dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider9"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_size_label"
|
||||
tools:layout_editor_absoluteX="46dp" />
|
||||
tools:layout_editor_absoluteY="607dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/camera_label"
|
||||
|
|
@ -386,29 +324,22 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_size_label" />
|
||||
tools:layout_editor_absoluteY="607dp" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/camera_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.08"
|
||||
app:layout_constraintStart_toEndOf="@+id/camera_label"
|
||||
app:layout_constraintTop_toBottomOf="@+id/search_size_label" />
|
||||
tools:layout_editor_absoluteX="260dp"
|
||||
tools:layout_editor_absoluteY="627dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/camera_label"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
tools:layout_editor_absoluteY="674dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contacts_label"
|
||||
|
|
@ -425,28 +356,97 @@
|
|||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/camera_label" />
|
||||
tools:layout_editor_absoluteY="674dp" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/contacts_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.08"
|
||||
app:layout_constraintStart_toEndOf="@+id/camera_label"
|
||||
app:layout_constraintTop_toBottomOf="@+id/camera_label" />
|
||||
tools:layout_editor_absoluteX="260dp"
|
||||
tools:layout_editor_absoluteY="694dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider11"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/contacts_label"
|
||||
tools:layout_editor_absoluteX="0dp" />
|
||||
tools:layout_editor_absoluteY="742dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hidden_apps"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:text="Hidden Apps"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
tools:layout_editor_absoluteY="743dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider12"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
tools:layout_editor_absoluteY="810dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/weather_location"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="false"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:text="Weather Location"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||
android:textColor="#F3F3F3"
|
||||
android:textSize="20sp"
|
||||
android:visibility="visible"
|
||||
tools:layout_editor_absoluteY="810dp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/manual_city"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.3"
|
||||
android:background="#89000000"
|
||||
android:gravity="center"
|
||||
android:insetTop="0dp"
|
||||
android:insetBottom="0dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:text="Set Manually"
|
||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||
android:textColor="#F3F3F3"
|
||||
android:textSize="16sp"
|
||||
tools:layout_editor_absoluteX="250dp"
|
||||
tools:layout_editor_absoluteY="810dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:paddingVertical="15dp"
|
||||
app:srcCompat="@android:drawable/ic_menu_mylocation"
|
||||
tools:layout_editor_absoluteX="382dp"
|
||||
tools:layout_editor_absoluteY="810dp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider13"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
tools:layout_editor_absoluteY="810dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
30
app/src/main/res/values/arrays.xml
Normal file
30
app/src/main/res/values/arrays.xml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<resources>
|
||||
<!-- Reply Preference -->
|
||||
<string-array name="reply_entries">
|
||||
<item>Reply</item>
|
||||
<item>Reply to all</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="reply_values">
|
||||
<item>reply</item>
|
||||
<item>reply_all</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="h_alignment_options">
|
||||
<item>Left</item>
|
||||
<item>Center</item>
|
||||
<item>Right</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="h_alignment_values">
|
||||
<item>left</item>
|
||||
<item>center</item>
|
||||
<item>right</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="size_options">
|
||||
<item>Small</item>
|
||||
<item>Medium</item>
|
||||
<item>Large</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
|
@ -49,15 +49,20 @@
|
|||
<string name="search">Search…</string>
|
||||
<string name="app">App</string>
|
||||
<string name="shortcut_default">App</string>
|
||||
<string-array name="h_alignment_options">
|
||||
<item>Left</item>
|
||||
<item>Center</item>
|
||||
<item>Right</item>
|
||||
</string-array>
|
||||
<string-array name="size_options">
|
||||
<item>Small</item>
|
||||
<item>Medium</item>
|
||||
<item>Large</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Preference Titles -->
|
||||
<string name="messages_header">Messages</string>
|
||||
<string name="sync_header">Sync</string>
|
||||
|
||||
<!-- Messages Preferences -->
|
||||
<string name="signature_title">Your signature</string>
|
||||
<string name="reply_title">Default reply action</string>
|
||||
|
||||
<!-- Sync Preferences -->
|
||||
<string name="sync_title">Sync email periodically</string>
|
||||
<string name="attachment_title">Download incoming attachments</string>
|
||||
<string name="attachment_summary_on">Automatically download attachments for incoming emails
|
||||
</string>
|
||||
<string name="attachment_summary_off">Only download attachments when manually requested</string>
|
||||
|
||||
</resources>
|
||||
58
app/src/main/res/xml/root_preferences.xml
Normal file
58
app/src/main/res/xml/root_preferences.xml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="Alignment">
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="left"
|
||||
app:entries="@array/h_alignment_options"
|
||||
app:entryValues="@array/h_alignment_values"
|
||||
app:key="clockAlignment"
|
||||
app:title="Clock Alignment"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:defaultValue="left"
|
||||
app:entries="@array/h_alignment_options"
|
||||
app:entryValues="@array/h_alignment_values"
|
||||
app:key="shortcutAlignment"
|
||||
app:title="Home App Alignment"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:defaultValue="left"
|
||||
app:entries="@array/h_alignment_options"
|
||||
app:entryValues="@array/h_alignment_values"
|
||||
app:key="aappMenuAlignment"
|
||||
app:title="App Menu Alignment"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:defaultValue="left"
|
||||
app:entries="@array/h_alignment_options"
|
||||
app:entryValues="@array/h_alignment_values"
|
||||
app:key="searchAlignment"
|
||||
app:title="Search Alignment"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/sync_header">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="sync"
|
||||
app:title="@string/sync_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:dependency="sync"
|
||||
app:key="attachment"
|
||||
app:summaryOff="@string/attachment_summary_off"
|
||||
app:summaryOn="@string/attachment_summary_on"
|
||||
app:title="@string/attachment_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
Loading…
Add table
Add a link
Reference in a new issue