mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Clock, date and search can now be resized and the renaming window has been updated to use the correct text size.
This commit is contained in:
parent
e8935608a7
commit
5dbb033993
7 changed files with 446 additions and 35 deletions
|
|
@ -20,12 +20,10 @@ import eu.ottop.yamlauncher.databinding.ActivityMainBinding
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
|
|
||||||
class AppActionMenu {
|
class AppActionMenu {
|
||||||
|
|
||||||
private val sharedPreferenceManager = SharedPreferenceManager()
|
private val sharedPreferenceManager = SharedPreferenceManager()
|
||||||
private val appUtils = AppUtils()
|
|
||||||
private val animations = Animations()
|
private val animations = Animations()
|
||||||
|
|
||||||
fun setActionListeners(
|
fun setActionListeners(
|
||||||
|
|
@ -39,8 +37,7 @@ class AppActionMenu {
|
||||||
userHandle: UserHandle,
|
userHandle: UserHandle,
|
||||||
workProfile: Int,
|
workProfile: Int,
|
||||||
launcherApps: LauncherApps,
|
launcherApps: LauncherApps,
|
||||||
mainActivity: LauncherActivityInfo?,
|
mainActivity: LauncherActivityInfo?
|
||||||
position: Int
|
|
||||||
){
|
){
|
||||||
|
|
||||||
actionMenu.findViewById<TextView>(R.id.info).setOnClickListener {
|
actionMenu.findViewById<TextView>(R.id.info).setOnClickListener {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.pm.ApplicationInfo
|
||||||
import android.content.pm.LauncherActivityInfo
|
import android.content.pm.LauncherActivityInfo
|
||||||
import android.os.UserHandle
|
import android.os.UserHandle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
|
|
@ -12,9 +13,11 @@ import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.Space
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.widget.AppCompatButton
|
import androidx.appcompat.widget.AppCompatButton
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
|
import androidx.core.view.marginLeft
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
|
||||||
|
|
@ -55,8 +58,9 @@ class AppMenuAdapter(
|
||||||
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
inner class AppViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||||
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
private val listItem: FrameLayout = itemView.findViewById(R.id.list_item)
|
||||||
val textView: TextView = listItem.findViewById(R.id.app_name)
|
val textView: TextView = listItem.findViewById(R.id.app_name)
|
||||||
private val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
val actionMenuLayout: LinearLayout = listItem.findViewById(R.id.action_menu)
|
||||||
val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
private val editView: LinearLayout = listItem.findViewById(R.id.rename_view)
|
||||||
|
val editText: EditText = editView.findViewById(R.id.app_name_edit)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actionMenuLayout.visibility = View.INVISIBLE
|
actionMenuLayout.visibility = View.INVISIBLE
|
||||||
|
|
@ -116,7 +120,6 @@ class AppMenuAdapter(
|
||||||
1 = center
|
1 = center
|
||||||
2 = right
|
2 = right
|
||||||
*/
|
*/
|
||||||
|
|
||||||
when (sharedPreferenceManager.getAppMenuAlignment(activity)) {
|
when (sharedPreferenceManager.getAppMenuAlignment(activity)) {
|
||||||
0 -> {
|
0 -> {
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, null, null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, null, null)
|
||||||
|
|
@ -125,6 +128,7 @@ class AppMenuAdapter(
|
||||||
1 -> {
|
1 -> {
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
||||||
holder.textView.gravity = Gravity.CENTER
|
holder.textView.gravity = Gravity.CENTER
|
||||||
|
|
||||||
}
|
}
|
||||||
2 -> {
|
2 -> {
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(null,null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
holder.textView.setCompoundDrawablesWithIntrinsicBounds(null,null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
||||||
|
|
@ -132,28 +136,42 @@ class AppMenuAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
0 = small
|
||||||
|
1 = medium
|
||||||
|
2 = large
|
||||||
|
|
||||||
|
Text sizes hardcoded because code returns 77 instead of 28
|
||||||
|
*/
|
||||||
|
when (sharedPreferenceManager.getAppSize(activity)) {
|
||||||
|
0 -> {
|
||||||
|
holder.textView.textSize = 24F
|
||||||
|
holder.editText.textSize = 24F
|
||||||
|
}
|
||||||
|
|
||||||
|
1 -> {
|
||||||
|
holder.textView.textSize = 26F
|
||||||
|
holder.editText.textSize = 26F
|
||||||
|
}
|
||||||
|
|
||||||
|
2 -> {
|
||||||
|
holder.textView.textSize = 28F
|
||||||
|
holder.editText.textSize = 28F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val appInfo = app.first.activityInfo.applicationInfo
|
val appInfo = app.first.activityInfo.applicationInfo
|
||||||
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
holder.textView.text = sharedPreferenceManager.getAppName(activity, app.first.applicationInfo.packageName,app.second.second, holder.itemView.context.packageManager.getApplicationLabel(appInfo))
|
||||||
holder.editView.findViewById<EditText>(R.id.app_name_edit).setText(holder.textView.text)
|
holder.editText.setText(holder.textView.text)
|
||||||
holder.textView.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewAttachedToWindow(holder: AppViewHolder) {
|
if (appInfo.flags and ApplicationInfo.FLAG_SYSTEM != 0) {
|
||||||
super.onViewAttachedToWindow(holder)
|
holder.actionMenuLayout.findViewById<TextView>(R.id.uninstall).visibility = View.GONE
|
||||||
when (sharedPreferenceManager.getAppMenuAlignment(activity)) {
|
|
||||||
0 -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null, null, null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.START
|
|
||||||
}
|
|
||||||
1 -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(holder.textView.compoundDrawables.filterNotNull().first(),null,holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER
|
|
||||||
}
|
|
||||||
2 -> {
|
|
||||||
holder.textView.setCompoundDrawablesWithIntrinsicBounds(null,null, holder.textView.compoundDrawables.filterNotNull().first(), null)
|
|
||||||
holder.textView.gravity = Gravity.CENTER_VERTICAL or Gravity.END
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
holder.actionMenuLayout.findViewById<TextView>(R.id.uninstall).visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.textView.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import android.view.GestureDetector
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewTreeObserver
|
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
|
|
@ -83,6 +82,8 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
setSupportActionBar(null)
|
setSupportActionBar(null)
|
||||||
|
|
||||||
|
searchView = findViewById(R.id.searchView)
|
||||||
|
|
||||||
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
|
|
||||||
gestureDetector = GestureDetector(this, GestureListener())
|
gestureDetector = GestureDetector(this, GestureListener())
|
||||||
|
|
@ -131,14 +132,16 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
setShortcutSize(binding.homeView)
|
setTextSizes()
|
||||||
super.onStart()
|
super.onStart()
|
||||||
startTask()
|
startTask()
|
||||||
|
|
||||||
// Keyboard is sometimes open when going back to the app, so close it.
|
// Keyboard is sometimes open when going back to the app, so close it.
|
||||||
closeKeyboard()
|
closeKeyboard()
|
||||||
|
|
||||||
setClockAlignment()
|
setClockAlignment()
|
||||||
setShortCutAlignment()
|
setShortCutAlignment()
|
||||||
|
setSearchAlignment()
|
||||||
|
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
|
|
@ -207,7 +210,6 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
|
|
||||||
setupRecyclerView(newApps)
|
setupRecyclerView(newApps)
|
||||||
|
|
||||||
searchView = findViewById(R.id.searchView)
|
|
||||||
setupSearch()
|
setupSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -489,8 +491,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
userHandle,
|
userHandle,
|
||||||
userProfile,
|
userProfile,
|
||||||
launcherApps,
|
launcherApps,
|
||||||
mainActivity,
|
mainActivity
|
||||||
position
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -595,7 +596,7 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
1 = medium
|
1 = medium
|
||||||
2 = large
|
2 = large
|
||||||
*/
|
*/
|
||||||
when (sharedPreferenceManager.getAppSize(this@MainActivity)) {
|
when (sharedPreferenceManager.getShortcutSize(this@MainActivity)) {
|
||||||
0 -> {
|
0 -> {
|
||||||
it.setPadding(
|
it.setPadding(
|
||||||
it.paddingLeft,
|
it.paddingLeft,
|
||||||
|
|
@ -608,9 +609,9 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
1 -> {
|
1 -> {
|
||||||
it.setPadding(
|
it.setPadding(
|
||||||
it.paddingLeft,
|
it.paddingLeft,
|
||||||
it.height / 5,
|
(it.height / 4.5).toInt(),
|
||||||
it.paddingRight,
|
it.paddingRight,
|
||||||
it.height / 5
|
(it.height / 4.5).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -655,6 +656,72 @@ class MainActivity : AppCompatActivity(), AppMenuAdapter.OnItemClickListener, Ap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
/*
|
||||||
|
0 = small
|
||||||
|
1 = medium
|
||||||
|
2 = large
|
||||||
|
*/
|
||||||
|
|
||||||
|
when (sharedPreferenceManager.getClockSize(this@MainActivity)) {
|
||||||
|
0 -> {
|
||||||
|
clock.textSize = 48F
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
clock.textSize = 58F
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
clock.textSize = 68F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (sharedPreferenceManager.getDateSize(this@MainActivity)) {
|
||||||
|
0 -> {
|
||||||
|
dateText.textSize = 17F
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
dateText.textSize = 20F
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
dateText.textSize = 23F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (sharedPreferenceManager.getSearchSize(this@MainActivity)) {
|
||||||
|
0 -> {
|
||||||
|
searchView.textSize = 21F
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
searchView.textSize = 23F
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
searchView.textSize = 25F
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun isJobActive(): Boolean {
|
fun isJobActive(): Boolean {
|
||||||
return if (job != null) {
|
return if (job != null) {
|
||||||
job!!.isActive
|
job!!.isActive
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,54 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.searchAlignment.setSelection(sharedPreferenceManager.getSearchAlignment(this@SettingsActivity))
|
||||||
|
|
||||||
|
binding.searchAlignment.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
|
// Get the selected item
|
||||||
|
sharedPreferenceManager.setSearchAlignment(this@SettingsActivity, position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.clockSize.setSelection(sharedPreferenceManager.getClockSize(this@SettingsActivity))
|
||||||
|
|
||||||
|
binding.clockSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
|
// Get the selected item
|
||||||
|
sharedPreferenceManager.setClockSize(this@SettingsActivity, position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.dateSize.setSelection(sharedPreferenceManager.getDateSize(this@SettingsActivity))
|
||||||
|
|
||||||
|
binding.dateSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
|
// Get the selected item
|
||||||
|
sharedPreferenceManager.setDateSize(this@SettingsActivity, position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.shortcutSize.setSelection(sharedPreferenceManager.getShortcutSize(this@SettingsActivity))
|
||||||
|
|
||||||
|
binding.shortcutSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
|
// Get the selected item
|
||||||
|
sharedPreferenceManager.setShortcutSize(this@SettingsActivity, position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.appSize.setSelection(sharedPreferenceManager.getAppSize(this@SettingsActivity))
|
binding.appSize.setSelection(sharedPreferenceManager.getAppSize(this@SettingsActivity))
|
||||||
|
|
||||||
binding.appSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
binding.appSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
|
@ -62,5 +110,17 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
override fun onNothingSelected(parent: AdapterView<*>) {
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.searchSize.setSelection(sharedPreferenceManager.getSearchSize(this@SettingsActivity))
|
||||||
|
|
||||||
|
binding.searchSize.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {
|
||||||
|
// Get the selected item
|
||||||
|
sharedPreferenceManager.setSearchSize(this@SettingsActivity, position)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,6 +112,58 @@ class SharedPreferenceManager {
|
||||||
return sharedPreferences.getInt(key, 0)
|
return sharedPreferences.getInt(key, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setSearchAlignment(cont: Context, alignment: Int) {
|
||||||
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
|
val key = "search_alignment"
|
||||||
|
editor.putInt(key, alignment)
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSearchAlignment(cont: Context) : Int {
|
||||||
|
val sharedPreferences = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE)
|
||||||
|
val key = "search_alignment"
|
||||||
|
return sharedPreferences.getInt(key, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setClockSize(cont: Context, alignment: Int) {
|
||||||
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
|
val key = "clock_size"
|
||||||
|
editor.putInt(key, alignment)
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getClockSize(cont: Context) : Int {
|
||||||
|
val sharedPreferences = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE)
|
||||||
|
val key = "clock_size"
|
||||||
|
return sharedPreferences.getInt(key, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDateSize(cont: Context, alignment: Int) {
|
||||||
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
|
val key = "date_size"
|
||||||
|
editor.putInt(key, alignment)
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDateSize(cont: Context) : Int {
|
||||||
|
val sharedPreferences = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE)
|
||||||
|
val key = "date_size"
|
||||||
|
return sharedPreferences.getInt(key, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setShortcutSize(cont: Context, alignment: Int) {
|
||||||
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
|
val key = "shortcut_size"
|
||||||
|
editor.putInt(key, alignment)
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getShortcutSize(cont: Context) : Int {
|
||||||
|
val sharedPreferences = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE)
|
||||||
|
val key = "shortcut_size"
|
||||||
|
return sharedPreferences.getInt(key, 2)
|
||||||
|
}
|
||||||
|
|
||||||
fun setAppSize(cont: Context, alignment: Int) {
|
fun setAppSize(cont: Context, alignment: Int) {
|
||||||
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
val key = "app_size"
|
val key = "app_size"
|
||||||
|
|
@ -124,4 +176,17 @@ class SharedPreferenceManager {
|
||||||
val key = "app_size"
|
val key = "app_size"
|
||||||
return sharedPreferences.getInt(key, 2)
|
return sharedPreferences.getInt(key, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setSearchSize(cont: Context, alignment: Int) {
|
||||||
|
val editor = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE).edit()
|
||||||
|
val key = "search_size"
|
||||||
|
editor.putInt(key, alignment)
|
||||||
|
editor.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSearchSize(cont: Context) : Int {
|
||||||
|
val sharedPreferences = cont.getSharedPreferences("preferences", AppCompatActivity.MODE_PRIVATE)
|
||||||
|
val key = "search_size"
|
||||||
|
return sharedPreferences.getInt(key, 2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
android:editTextColor="#f3f3f3"
|
android:editTextColor="#f3f3f3"
|
||||||
android:hint="@string/search"
|
android:hint="@string/search"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
android:textSize="25sp" />
|
android:textSize="25sp" />
|
||||||
|
|
||||||
|
|
@ -92,13 +93,16 @@
|
||||||
android:layout_marginHorizontal="32dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:layout_marginStart="32dp"
|
android:layout_marginStart="32dp"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="40dp"
|
||||||
|
android:layout_marginBottom="27dp"
|
||||||
android:fontFamily="@null"
|
android:fontFamily="@null"
|
||||||
android:format12Hour="hh:mm a"
|
android:format12Hour="hh:mm a"
|
||||||
android:format24Hour="HH:mm"
|
android:format24Hour="HH:mm"
|
||||||
|
android:gravity="bottom"
|
||||||
android:textAlignment="textStart"
|
android:textAlignment="textStart"
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
android:textColor="#F3F3F3"
|
android:textColor="#F3F3F3"
|
||||||
android:textSize="68sp"
|
android:textSize="68sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
@ -122,7 +126,7 @@
|
||||||
<Space
|
<Space
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="0.23" />
|
android:layout_weight="0.25" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app1"
|
android:id="@+id/app1"
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label" />
|
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_size_label"
|
android:id="@+id/search_alignment_label"
|
||||||
android:layout_width="250dp"
|
android:layout_width="250dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="20dp"
|
||||||
android:paddingRight="20dp"
|
android:paddingRight="20dp"
|
||||||
android:paddingBottom="20dp"
|
android:paddingBottom="20dp"
|
||||||
android:text="App Title Size"
|
android:text="Search Bar Alignment"
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
android:textColor="#F3F3F3"
|
android:textColor="#F3F3F3"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
|
@ -152,6 +152,167 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label"
|
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label"
|
||||||
app:layout_constraintVertical_bias="0.0" />
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/search_alignment"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/clock_size_label"
|
||||||
|
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="Clock Size"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/clock_size"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<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"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:text="Date Size"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/date_size"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shortcut_size_label"
|
||||||
|
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="Shortcut Title Size"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/shortcut_size"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/app_size_label"
|
||||||
|
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="App Menu Title Size"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
|
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" />
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/app_size"
|
android:id="@+id/app_size"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
@ -160,15 +321,54 @@
|
||||||
android:spinnerMode="dropdown"
|
android:spinnerMode="dropdown"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/app_size_label"
|
app:layout_constraintBottom_toBottomOf="@+id/app_size_label"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/app_size_label"
|
app:layout_constraintStart_toEndOf="@+id/shortcut_size_label"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/app_alignment_label" />
|
app:layout_constraintTop_toTopOf="@+id/app_size_label" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider4"
|
android:id="@+id/divider6"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="?android:attr/listDivider"
|
android:background="?android:attr/listDivider"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/app_size_label"
|
app:layout_constraintTop_toBottomOf="@+id/app_size_label"
|
||||||
tools:layout_editor_absoluteX="46dp" />
|
tools:layout_editor_absoluteX="46dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/search_size_label"
|
||||||
|
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="Search Bar Size"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/search_size"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue