Feature: Added a new App Group Padding setting

This commit is contained in:
HeCodes2Much
2024-11-26 17:56:39 +00:00
parent 3468c40040
commit a5397afbc6
14 changed files with 378 additions and 266 deletions

View File

@@ -123,6 +123,10 @@ class PreferenceHelper @Inject constructor(@ApplicationContext context: Context)
get() = prefs.getInt(Constants.HOME_APP_ALIGNMENT, Gravity.START) get() = prefs.getInt(Constants.HOME_APP_ALIGNMENT, Gravity.START)
set(value) = prefs.edit().putInt(Constants.HOME_APP_ALIGNMENT, value).apply() set(value) = prefs.edit().putInt(Constants.HOME_APP_ALIGNMENT, value).apply()
var homeAppsPadding: Float
get() = prefs.getFloat(Constants.APPS_PADDING, 128f)
set(value) = prefs.edit().putFloat(Constants.APPS_PADDING, value).apply()
var homeAppPadding: Float var homeAppPadding: Float
get() = prefs.getFloat(Constants.APP_TEXT_PADDING, 10f) get() = prefs.getFloat(Constants.APP_TEXT_PADDING, 10f)
set(value) = prefs.edit().putFloat(Constants.APP_TEXT_PADDING, value).apply() set(value) = prefs.edit().putFloat(Constants.APP_TEXT_PADDING, value).apply()

View File

@@ -62,52 +62,57 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
private fun initView() { private fun initView() {
bottomDialogHelper.setupDialogStyle(dialog) bottomDialogHelper.setupDialogStyle(dialog)
binding.selectDateTextSize.apply { binding.apply {
text = appHelper.gravityToString(preferenceHelper.homeDateAlignment) selectDateTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeDateAlignment)
}
selectTimeTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeTimeAlignment)
}
selectAppTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeAppAlignment)
}
selectWordTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeDailyWordAlignment)
}
selectAlarmClockTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeAlarmClockAlignment)
}
} }
binding.selectTimeTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeTimeAlignment)
}
binding.selectAppTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeAppAlignment)
}
binding.selectWordTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeDailyWordAlignment)
}
binding.selectAlarmClockTextSize.apply {
text = appHelper.gravityToString(preferenceHelper.homeAlarmClockAlignment)
}
} }
@RequiresApi(Build.VERSION_CODES.Q) @RequiresApi(Build.VERSION_CODES.Q)
private fun observeClickListener() { private fun observeClickListener() {
binding.bottomAlignmentDateView.setOnClickListener { binding.apply {
selectedAlignment = REQUEST_KEY_DATE_ALIGNMENT bottomAlignmentDateView.setOnClickListener {
showListDialog(selectedAlignment) selectedAlignment = REQUEST_KEY_DATE_ALIGNMENT
} showListDialog(selectedAlignment)
}
binding.bottomAlignmentTimeView.setOnClickListener { bottomAlignmentTimeView.setOnClickListener {
selectedAlignment = REQUEST_KEY_TIME_ALIGNMENT selectedAlignment = REQUEST_KEY_TIME_ALIGNMENT
showListDialog(selectedAlignment) showListDialog(selectedAlignment)
} }
binding.bottomAlignmentAppView.setOnClickListener { bottomAlignmentAppView.setOnClickListener {
selectedAlignment = REQUEST_KEY_APP_ALIGNMENT selectedAlignment = REQUEST_KEY_APP_ALIGNMENT
showListDialog(selectedAlignment) showListDialog(selectedAlignment)
} }
binding.bottomAlignmentWordView.setOnClickListener { bottomAlignmentWordView.setOnClickListener {
selectedAlignment = REQUEST_KEY_WORD_ALIGNMENT selectedAlignment = REQUEST_KEY_WORD_ALIGNMENT
showListDialog(selectedAlignment) showListDialog(selectedAlignment)
} }
binding.bottomAlignmentAlarmClockView.setOnClickListener { bottomAlignmentAlarmClockView.setOnClickListener {
selectedAlignment = REQUEST_KEY_ALARM_CLOCK_ALIGNMENT selectedAlignment = REQUEST_KEY_ALARM_CLOCK_ALIGNMENT
showListDialog(selectedAlignment) showListDialog(selectedAlignment)
}
} }
} }
@@ -123,45 +128,47 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() {
val selectedItem = index val selectedItem = index
val gravity = appHelper.getGravityFromSelectedItem(selectedItem) val gravity = appHelper.getGravityFromSelectedItem(selectedItem)
when (selectedAlignment) { binding.apply {
REQUEST_KEY_APP_ALIGNMENT -> { when (selectedAlignment) {
setAlignment( REQUEST_KEY_APP_ALIGNMENT -> {
selectedAlignment, setAlignment(
gravity, selectedAlignment,
binding.selectAppTextSize gravity,
) selectAppTextSize
} )
}
REQUEST_KEY_TIME_ALIGNMENT -> { REQUEST_KEY_TIME_ALIGNMENT -> {
setAlignment( setAlignment(
selectedAlignment, selectedAlignment,
gravity, gravity,
binding.selectTimeTextSize selectTimeTextSize
) )
} }
REQUEST_KEY_DATE_ALIGNMENT -> { REQUEST_KEY_DATE_ALIGNMENT -> {
setAlignment( setAlignment(
selectedAlignment, selectedAlignment,
gravity, gravity,
binding.selectDateTextSize selectDateTextSize
) )
} }
REQUEST_KEY_WORD_ALIGNMENT -> { REQUEST_KEY_WORD_ALIGNMENT -> {
setAlignment( setAlignment(
selectedAlignment, selectedAlignment,
gravity, gravity,
binding.selectWordTextSize selectWordTextSize
) )
} }
REQUEST_KEY_ALARM_CLOCK_ALIGNMENT -> { REQUEST_KEY_ALARM_CLOCK_ALIGNMENT -> {
setAlignment( setAlignment(
selectedAlignment, selectedAlignment,
gravity, gravity,
binding.selectAlarmClockTextSize selectAlarmClockTextSize
) )
}
} }
} }
} }

View File

@@ -97,64 +97,77 @@ class AppInfoBottomSheetFragment(private val appInfo: AppInfo) : BottomSheetDial
val applicationInfo = packageManager?.getApplicationInfo(packageName, 0) val applicationInfo = packageManager?.getApplicationInfo(packageName, 0)
val appName = applicationInfo?.let { packageManager.getApplicationLabel(it).toString() } val appName = applicationInfo?.let { packageManager.getApplicationLabel(it).toString() }
binding.bottomSheetFavHidden.setOnClickListener { binding.apply {
appStateClickListener?.onAppStateClicked(appInfo) bottomSheetFavHidden.setOnClickListener {
appStateClickListener?.onAppStateClicked(appInfo)
appInfo.favorite = !appInfo.favorite appInfo.favorite = !appInfo.favorite
viewModel.updateAppInfoFavorite(appInfo) viewModel.updateAppInfoFavorite(appInfo)
Log.d("Tag", "${appInfo.appName} : Bottom Favorite: ${appInfo.favorite}") Log.d("Tag", "${appInfo.appName} : Bottom Favorite: ${appInfo.favorite}")
Log.d("Tag", "${appInfo.appName} : Bottom Order: ${appInfo.appOrder}") Log.d("Tag", "${appInfo.appName} : Bottom Order: ${appInfo.appOrder}")
dismiss() dismiss()
}
binding.bottomSheetRename.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
} }
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { bottomSheetRename.addTextChangedListener(object : TextWatcher {
appInfo.appName = s.toString()
if (s.isNullOrEmpty()) { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
viewModel.updateAppInfoAppName(appInfo, appName.toString())
} else {
viewModel.updateAppInfoAppName(appInfo, s.toString())
} }
}
override fun afterTextChanged(s: Editable?) { override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (s.isNullOrEmpty()) {
binding.bottomSheetRename.setHintTextColor(
ContextCompat.getColor(
requireContext(),
R.color.white
)
)
binding.bottomSheetRename.hint = appName
appInfo.appName = appName ?: ""
} else {
appInfo.appName = s.toString() appInfo.appName = s.toString()
if (s.isNullOrEmpty()) {
viewModel.updateAppInfoAppName(appInfo, appName.toString())
} else {
viewModel.updateAppInfoAppName(appInfo, s.toString())
}
} }
override fun afterTextChanged(s: Editable?) {
if (s.isNullOrEmpty()) {
bottomSheetRename.setHintTextColor(
ContextCompat.getColor(
requireContext(),
R.color.white
)
)
binding.bottomSheetRename.hint = appName
appInfo.appName = appName ?: ""
} else {
appInfo.appName = s.toString()
}
}
})
bottomSheetRenameDone.setOnClickListener {
appStateClickListener?.onAppStateClicked(appInfo)
viewModel.updateAppInfoAppName(appInfo, appInfo.appName)
dismiss()
Log.d("Tag", "${appInfo.appName} Bottom State: ${appInfo.appName}")
} }
})
binding.bottomSheetRenameDone.setOnClickListener { bottomSheetHidden.setOnClickListener {
appStateClickListener?.onAppStateClicked(appInfo) appStateClickListener?.onAppStateClicked(appInfo)
viewModel.updateAppInfoAppName(appInfo, appInfo.appName) appInfo.hidden = !appInfo.hidden
dismiss()
Log.d("Tag", "${appInfo.appName} Bottom State: ${appInfo.appName}")
}
binding.bottomSheetHidden.setOnClickListener { viewModel.updateAppHidden(appInfo, appInfo.hidden)
appStateClickListener?.onAppStateClicked(appInfo) dismiss()
appInfo.hidden = !appInfo.hidden }
viewModel.updateAppHidden(appInfo, appInfo.hidden) bottomSheetUninstall.setOnClickListener {
dismiss() appStateClickListener?.onAppStateClicked(appInfo)
requireContext().unInstallApp(appInfo)
dismiss()
}
bottomSheetInfo.setOnClickListener {
requireContext().appInfo(appInfo)
dismiss()
}
} }
binding.bottomSheetLock.setOnClickListener { binding.bottomSheetLock.setOnClickListener {
@@ -166,17 +179,6 @@ class AppInfoBottomSheetFragment(private val appInfo: AppInfo) : BottomSheetDial
dismiss() dismiss()
} }
} }
binding.bottomSheetUninstall.setOnClickListener {
appStateClickListener?.onAppStateClicked(appInfo)
requireContext().unInstallApp(appInfo)
dismiss()
}
binding.bottomSheetInfo.setOnClickListener {
requireContext().appInfo(appInfo)
dismiss()
}
} }
override fun onAuthenticationSucceeded(appInfo: AppInfo) { override fun onAuthenticationSucceeded(appInfo: AppInfo) {

View File

@@ -64,112 +64,116 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() {
private fun initView() { private fun initView() {
bottomDialogHelper.setupDialogStyle(dialog) bottomDialogHelper.setupDialogStyle(dialog)
binding.selectDateTextColor.apply { binding.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.dateColor) selectDateTextColor.apply {
setTextColor(preferenceHelper.dateColor) text = bottomDialogHelper.getColorText(preferenceHelper.dateColor)
} setTextColor(preferenceHelper.dateColor)
}
binding.selectTimeTextColor.apply { selectTimeTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.timeColor) text = bottomDialogHelper.getColorText(preferenceHelper.timeColor)
setTextColor(preferenceHelper.timeColor) setTextColor(preferenceHelper.timeColor)
} }
binding.selectAppTextColor.apply { selectAppTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.appColor) text = bottomDialogHelper.getColorText(preferenceHelper.appColor)
setTextColor(preferenceHelper.appColor) setTextColor(preferenceHelper.appColor)
} }
binding.selectBatteryTextColor.apply { selectBatteryTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.batteryColor) text = bottomDialogHelper.getColorText(preferenceHelper.batteryColor)
setTextColor(preferenceHelper.batteryColor) setTextColor(preferenceHelper.batteryColor)
} }
binding.selectAlarmClockTextColor.apply { selectAlarmClockTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.alarmClockColor) text = bottomDialogHelper.getColorText(preferenceHelper.alarmClockColor)
setTextColor(preferenceHelper.alarmClockColor) setTextColor(preferenceHelper.alarmClockColor)
} }
binding.selectWordTextColor.apply { selectWordTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.dailyWordColor) text = bottomDialogHelper.getColorText(preferenceHelper.dailyWordColor)
setTextColor(preferenceHelper.dailyWordColor) setTextColor(preferenceHelper.dailyWordColor)
} }
binding.selectWidgetBackgroundColor.apply { selectWidgetBackgroundColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.widgetBackgroundColor) text = bottomDialogHelper.getColorText(preferenceHelper.widgetBackgroundColor)
setTextColor(preferenceHelper.widgetBackgroundColor) setTextColor(preferenceHelper.widgetBackgroundColor)
} }
binding.selectWidgetTextColor.apply { selectWidgetTextColor.apply {
text = bottomDialogHelper.getColorText(preferenceHelper.widgetTextColor) text = bottomDialogHelper.getColorText(preferenceHelper.widgetTextColor)
setTextColor(preferenceHelper.widgetTextColor) setTextColor(preferenceHelper.widgetTextColor)
}
} }
} }
@RequiresApi(Build.VERSION_CODES.Q) @RequiresApi(Build.VERSION_CODES.Q)
private fun observeClickListener() { private fun observeClickListener() {
binding.bottomColorDateView.setOnClickListener { binding.apply {
showColorPickerDialog( bottomColorDateView.setOnClickListener {
binding.selectDateTextColor, showColorPickerDialog(
REQUEST_KEY_DATE_COLOR, binding.selectDateTextColor,
preferenceHelper.dateColor REQUEST_KEY_DATE_COLOR,
) preferenceHelper.dateColor
} )
}
binding.bottomColorTimeView.setOnClickListener { bottomColorTimeView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectTimeTextColor, binding.selectTimeTextColor,
REQUEST_KEY_TIME_COLOR, REQUEST_KEY_TIME_COLOR,
preferenceHelper.timeColor preferenceHelper.timeColor
) )
} }
binding.bottomColorAppView.setOnClickListener { bottomColorAppView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectAppTextColor, binding.selectAppTextColor,
REQUEST_KEY_APP_COLOR, REQUEST_KEY_APP_COLOR,
preferenceHelper.appColor preferenceHelper.appColor
) )
} }
binding.bottomColorBatteryView.setOnClickListener { bottomColorBatteryView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectBatteryTextColor, binding.selectBatteryTextColor,
REQUEST_KEY_BATTERY_COLOR, REQUEST_KEY_BATTERY_COLOR,
preferenceHelper.batteryColor preferenceHelper.batteryColor
) )
} }
binding.bottomColorWordView.setOnClickListener { bottomColorWordView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectWordTextColor, binding.selectWordTextColor,
REQUEST_KEY_DAILY_WORD_COLOR, REQUEST_KEY_DAILY_WORD_COLOR,
preferenceHelper.dailyWordColor preferenceHelper.dailyWordColor
) )
} }
binding.bottomColorAlarmClockView.setOnClickListener { bottomColorAlarmClockView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectAlarmClockTextColor, binding.selectAlarmClockTextColor,
REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR, REQUEST_KEY_DAILY_ALARM_CLOCK_COLOR,
preferenceHelper.alarmClockColor preferenceHelper.alarmClockColor
) )
} }
binding.bottomColorWidgetBackgroundView.setOnClickListener { bottomColorWidgetBackgroundView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectWidgetBackgroundColor, binding.selectWidgetBackgroundColor,
REQUEST_KEY_WIDGET_BACKGROUND_COLOR, REQUEST_KEY_WIDGET_BACKGROUND_COLOR,
preferenceHelper.widgetBackgroundColor preferenceHelper.widgetBackgroundColor
) )
} }
binding.bottomColorWidgetTextView.setOnClickListener { bottomColorWidgetTextView.setOnClickListener {
showColorPickerDialog( showColorPickerDialog(
binding.selectWidgetTextColor, binding.selectWidgetTextColor,
REQUEST_KEY_WIDGET_TEXT_COLOR, REQUEST_KEY_WIDGET_TEXT_COLOR,
preferenceHelper.widgetTextColor preferenceHelper.widgetTextColor
) )
}
} }
} }

View File

@@ -3,15 +3,19 @@ package com.github.droidworksstudio.launcher.ui.bottomsheetdialog
import android.content.DialogInterface import android.content.DialogInterface
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.widget.AppCompatEditText
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogPaddingSettingsBinding import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogPaddingSettingsBinding
import com.github.droidworksstudio.launcher.helper.AppHelper import com.github.droidworksstudio.launcher.helper.AppHelper
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
import com.github.droidworksstudio.launcher.helper.PreferenceHelper import com.github.droidworksstudio.launcher.helper.PreferenceHelper
import com.github.droidworksstudio.launcher.utils.Constants
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@@ -57,19 +61,78 @@ class PaddingBottomSheetDialogFragment : BottomSheetDialogFragment() {
private fun initView() { private fun initView() {
bottomDialogHelper.setupDialogStyle(dialog) bottomDialogHelper.setupDialogStyle(dialog)
binding.selectAppPaddingSize.setText("${preferenceHelper.homeAppPadding}") binding.apply {
selectAppPaddingSize.setText("${preferenceHelper.homeAppPadding}")
selectAppGroupPaddingSize.setText("${preferenceHelper.homeAppsPadding}")
addMinMaxConstraint(selectAppPaddingSize, Constants.APP_PADDING_MIN, Constants.APP_PADDING_MAX)
addMinMaxConstraint(selectAppGroupPaddingSize, Constants.APP_GROUP_PADDING_MIN, Constants.APP_GROUP_PADDING_MAX)
}
} }
@RequiresApi(Build.VERSION_CODES.Q) @RequiresApi(Build.VERSION_CODES.Q)
private fun observeValueChange() { private fun observeValueChange() {
val appValue = binding.selectAppPaddingSize.text.toString() binding.apply {
val appPaddingValue = selectAppPaddingSize.text.toString()
val appGroupPaddingValue = selectAppGroupPaddingSize.text.toString()
val appFloatValue = parseFloatValue(appValue, preferenceHelper.homeAppPadding) val appPaddingFloatValue = parseFloatValue(appPaddingValue, preferenceHelper.homeAppPadding)
dismiss() val appGroupPaddingFloatValue = parseFloatValue(appGroupPaddingValue, preferenceHelper.homeAppsPadding)
dismiss()
preferenceViewModel.setAppPaddingSize(appFloatValue) preferenceViewModel.setAppPaddingSize(appPaddingFloatValue)
val feedbackType = "select" preferenceViewModel.setAppGroupPaddingSize(appGroupPaddingFloatValue)
appHelper.triggerHapticFeedback(context, feedbackType)
val feedbackType = "select"
appHelper.triggerHapticFeedback(context, feedbackType)
}
}
fun addMinMaxConstraint(
editText: AppCompatEditText,
minValue: Double,
maxValue: Double
) {
editText.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
// No action needed here
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
try {
val input = s.toString()
if (input.isNotEmpty()) {
val value = input.toDouble()
// Check if the value is out of bounds
when {
value < minValue -> {
editText.setText(formatValue(minValue))
editText.setSelection(editText.text?.length ?: 0)
}
value > maxValue -> {
editText.setText(formatValue(maxValue))
editText.setSelection(editText.text?.length ?: 0)
}
}
}
} catch (_: NumberFormatException) {
}
}
override fun afterTextChanged(s: Editable?) {
// No action needed here
}
})
}
fun formatValue(value: Double): String {
return if (value % 1 == 0.0) {
value.toInt().toString() // Convert to Int if no decimal part
} else {
value.toString() // Keep as Double if there's a decimal part
}
} }
private fun parseFloatValue(text: String, defaultValue: Float): Float { private fun parseFloatValue(text: String, defaultValue: Float): Float {

View File

@@ -57,37 +57,41 @@ class TextBottomSheetDialogFragment : BottomSheetDialogFragment() {
private fun initView() { private fun initView() {
bottomDialogHelper.setupDialogStyle(dialog) bottomDialogHelper.setupDialogStyle(dialog)
binding.selectDateTextSize.setText("${preferenceHelper.dateTextSize}") binding.apply {
binding.selectTimeTextSize.setText("${preferenceHelper.timeTextSize}") selectDateTextSize.setText("${preferenceHelper.dateTextSize}")
binding.selectAppTextSize.setText("${preferenceHelper.appTextSize}") selectTimeTextSize.setText("${preferenceHelper.timeTextSize}")
binding.selectBatteryTextSize.setText("${preferenceHelper.batteryTextSize}") selectAppTextSize.setText("${preferenceHelper.appTextSize}")
binding.selectAlarmClockTextSize.setText("${preferenceHelper.alarmClockTextSize}") selectBatteryTextSize.setText("${preferenceHelper.batteryTextSize}")
binding.selectDailyWordTextSize.setText("${preferenceHelper.dailyWordTextSize}") selectAlarmClockTextSize.setText("${preferenceHelper.alarmClockTextSize}")
selectDailyWordTextSize.setText("${preferenceHelper.dailyWordTextSize}")
}
} }
@RequiresApi(Build.VERSION_CODES.Q) @RequiresApi(Build.VERSION_CODES.Q)
private fun observeValueChange() { private fun observeValueChange() {
val dateValue = binding.selectDateTextSize.text.toString() binding.apply {
val timeValue = binding.selectTimeTextSize.text.toString() val dateValue = selectDateTextSize.text.toString()
val appValue = binding.selectAppTextSize.text.toString() val timeValue = selectTimeTextSize.text.toString()
val batteryValue = binding.selectBatteryTextSize.text.toString() val appValue = selectAppTextSize.text.toString()
val alarmValue = binding.selectAlarmClockTextSize.text.toString() val batteryValue = selectBatteryTextSize.text.toString()
val wordValue = binding.selectDailyWordTextSize.text.toString() val alarmValue = selectAlarmClockTextSize.text.toString()
val wordValue = selectDailyWordTextSize.text.toString()
val dateFloatValue = parseFloatValue(dateValue, preferenceHelper.dateTextSize) val dateFloatValue = parseFloatValue(dateValue, preferenceHelper.dateTextSize)
val timeFloatValue = parseFloatValue(timeValue, preferenceHelper.timeTextSize) val timeFloatValue = parseFloatValue(timeValue, preferenceHelper.timeTextSize)
val appFloatValue = parseFloatValue(appValue, preferenceHelper.appTextSize) val appFloatValue = parseFloatValue(appValue, preferenceHelper.appTextSize)
val batteryFloatValue = parseFloatValue(batteryValue, preferenceHelper.batteryTextSize) val batteryFloatValue = parseFloatValue(batteryValue, preferenceHelper.batteryTextSize)
val alarmFloatValue = parseFloatValue(alarmValue, preferenceHelper.alarmClockTextSize) val alarmFloatValue = parseFloatValue(alarmValue, preferenceHelper.alarmClockTextSize)
val wordFloatValue = parseFloatValue(wordValue, preferenceHelper.dailyWordTextSize) val wordFloatValue = parseFloatValue(wordValue, preferenceHelper.dailyWordTextSize)
dismiss() dismiss()
preferenceViewModel.setDateTextSize(dateFloatValue) preferenceViewModel.setDateTextSize(dateFloatValue)
preferenceViewModel.setTimeTextSize(timeFloatValue) preferenceViewModel.setTimeTextSize(timeFloatValue)
preferenceViewModel.setAppTextSize(appFloatValue) preferenceViewModel.setAppTextSize(appFloatValue)
preferenceViewModel.setBatteryTextSize(batteryFloatValue) preferenceViewModel.setBatteryTextSize(batteryFloatValue)
preferenceViewModel.setAlarmClockTextSize(alarmFloatValue) preferenceViewModel.setAlarmClockTextSize(alarmFloatValue)
preferenceViewModel.setDailyWordTextSize(wordFloatValue) preferenceViewModel.setDailyWordTextSize(wordFloatValue)
}
val feedbackType = "save" val feedbackType = "save"
appHelper.triggerHapticFeedback(context, feedbackType) appHelper.triggerHapticFeedback(context, feedbackType)

View File

@@ -182,7 +182,7 @@ class HomeFragment : Fragment(),
} }
private fun setupRecyclerView() { private fun setupRecyclerView() {
val marginInPixels = 128 val marginInPixels = preferenceHelper.homeAppsPadding
// Ensure correct type for layout params // Ensure correct type for layout params
val layoutParams = (binding.appListAdapter.layoutParams as? LinearLayout.LayoutParams) val layoutParams = (binding.appListAdapter.layoutParams as? LinearLayout.LayoutParams)
@@ -192,8 +192,7 @@ class HomeFragment : Fragment(),
) )
// Set the bottom margin instead of top // Set the bottom margin instead of top
layoutParams.bottomMargin = marginInPixels layoutParams.topMargin = marginInPixels.toInt()
layoutParams.topMargin = marginInPixels
// Set gravity to align RecyclerView to the bottom // Set gravity to align RecyclerView to the bottom
layoutParams.gravity = when (preferenceHelper.homeAppAlignment) { layoutParams.gravity = when (preferenceHelper.homeAppAlignment) {

View File

@@ -53,6 +53,7 @@ object Constants {
const val ALARM_CLOCK_TEXT_SIZE = "ALARM_CLOCK_TEXT_SIZE" const val ALARM_CLOCK_TEXT_SIZE = "ALARM_CLOCK_TEXT_SIZE"
const val DAILY_WORD_TEXT_SIZE = "DAILY_WORD_TEXT_SIZE" const val DAILY_WORD_TEXT_SIZE = "DAILY_WORD_TEXT_SIZE"
const val APPS_PADDING = "APPS_PADDING"
const val APP_TEXT_PADDING = "APP_TEXT_PADDING" const val APP_TEXT_PADDING = "APP_TEXT_PADDING"
const val SHOW_APP_ICON = "SHOW_APP_ICON" const val SHOW_APP_ICON = "SHOW_APP_ICON"
@@ -96,6 +97,12 @@ object Constants {
const val FILTER_STRENGTH_MIN = 0 const val FILTER_STRENGTH_MIN = 0
const val FILTER_STRENGTH_MAX = 100 const val FILTER_STRENGTH_MAX = 100
const val APP_GROUP_PADDING_MIN = 0.0
const val APP_GROUP_PADDING_MAX = 1000.0
const val APP_PADDING_MIN = 0.0
const val APP_PADDING_MAX = 100.0
const val BACKUP_WRITE = 987 const val BACKUP_WRITE = 987
const val BACKUP_READ = 876 const val BACKUP_READ = 876

View File

@@ -47,6 +47,7 @@ class PreferenceViewModel @Inject constructor(
private val searchFromStartLiveData: MutableLiveData<Boolean> = MutableLiveData() private val searchFromStartLiveData: MutableLiveData<Boolean> = MutableLiveData()
private val autoKeyboardLiveData: MutableLiveData<Boolean> = MutableLiveData() private val autoKeyboardLiveData: MutableLiveData<Boolean> = MutableLiveData()
private val lockSettingsLiveData: MutableLiveData<Boolean> = MutableLiveData() private val lockSettingsLiveData: MutableLiveData<Boolean> = MutableLiveData()
private val appGroupPaddingSizeLiveData: MutableLiveData<Float> = MutableLiveData()
private val appPaddingSizeLiveData: MutableLiveData<Float> = MutableLiveData() private val appPaddingSizeLiveData: MutableLiveData<Float> = MutableLiveData()
private val weatherOrderNumberLiveData: MutableLiveData<Int> = MutableLiveData() private val weatherOrderNumberLiveData: MutableLiveData<Int> = MutableLiveData()
@@ -232,6 +233,11 @@ class PreferenceViewModel @Inject constructor(
appPaddingSizeLiveData.postValue(preferenceHelper.homeAppPadding) appPaddingSizeLiveData.postValue(preferenceHelper.homeAppPadding)
} }
fun setAppGroupPaddingSize(appPaddingSize: Float) {
preferenceHelper.homeAppsPadding = appPaddingSize
appGroupPaddingSizeLiveData.postValue(preferenceHelper.homeAppsPadding)
}
fun setDoubleTap(action: Constants.Action) { fun setDoubleTap(action: Constants.Action) {
preferenceHelper.doubleTapAction = action preferenceHelper.doubleTapAction = action
doubleTapActionLiveData.postValue((preferenceHelper.doubleTapAction)) doubleTapActionLiveData.postValue((preferenceHelper.doubleTapAction))

View File

@@ -38,7 +38,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_date" android:text="@string/appearance_bottom_dialog_desc_date"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -75,7 +74,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_time" android:text="@string/appearance_bottom_dialog_desc_time"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -111,7 +109,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_app" android:text="@string/appearance_bottom_dialog_desc_app"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -147,7 +144,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_alarm" android:text="@string/appearance_bottom_dialog_desc_alarm"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -183,7 +179,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_word" android:text="@string/appearance_bottom_dialog_desc_word"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -38,7 +38,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_date" android:text="@string/appearance_bottom_dialog_desc_date"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -75,7 +74,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_time" android:text="@string/appearance_bottom_dialog_desc_time"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -111,7 +109,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_app" android:text="@string/appearance_bottom_dialog_desc_app"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -147,7 +144,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_battery" android:text="@string/appearance_bottom_dialog_desc_battery"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -183,7 +179,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_alarm" android:text="@string/appearance_bottom_dialog_desc_alarm"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -219,7 +214,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_word" android:text="@string/appearance_bottom_dialog_desc_word"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -255,7 +249,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_widget_background" android:text="@string/appearance_bottom_dialog_desc_widget_background"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -291,7 +284,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="number"
android:text="@string/appearance_bottom_dialog_desc_widget_text" android:text="@string/appearance_bottom_dialog_desc_widget_text"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -25,6 +25,41 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/select_app_group_title"
style="@style/TextDefaultStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginVertical="20dp"
android:background="@android:color/transparent"
android:gravity="left|center"
android:text="@string/appearance_bottom_dialog_desc_app_group"
android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded,TouchTargetSizeCheck" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/select_app_group_padding_size"
style="@style/TextDefaultStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="20dp"
android:background="@android:color/transparent"
android:gravity="left|center"
android:inputType="numberDecimal"
android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="RtlHardcoded,SpeakableTextPresentCheck,TouchTargetSizeCheck,VisualLintTextFieldSize" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -38,7 +73,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_app" android:text="@string/appearance_bottom_dialog_desc_app"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -38,7 +38,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_date" android:text="@string/appearance_bottom_dialog_desc_date"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -75,7 +74,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_time" android:text="@string/appearance_bottom_dialog_desc_time"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -111,7 +109,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_app" android:text="@string/appearance_bottom_dialog_desc_app"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -147,7 +144,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_battery" android:text="@string/appearance_bottom_dialog_desc_battery"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -183,7 +179,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_word" android:text="@string/appearance_bottom_dialog_desc_word"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -219,7 +214,6 @@
android:layout_marginVertical="20dp" android:layout_marginVertical="20dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:gravity="left|center" android:gravity="left|center"
android:inputType="numberDecimal"
android:text="@string/appearance_bottom_dialog_desc_alarm" android:text="@string/appearance_bottom_dialog_desc_alarm"
android:textSize="@dimen/text_large" android:textSize="@dimen/text_large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@@ -116,7 +116,8 @@
<string name="appearance_bottom_dialog_alignment_title">Alignment</string> <string name="appearance_bottom_dialog_alignment_title">Alignment</string>
<string name="appearance_bottom_dialog_desc_date">Date\u0020:\u0020</string> <string name="appearance_bottom_dialog_desc_date">Date\u0020:\u0020</string>
<string name="appearance_bottom_dialog_desc_time">Time\u0020:\u0020 </string> <string name="appearance_bottom_dialog_desc_time">Time\u0020:\u0020 </string>
<string name="appearance_bottom_dialog_desc_app">App\u0020:\u0020</string> <string name="appearance_bottom_dialog_desc_app">Apps\u0020:\u0020</string>
<string name="appearance_bottom_dialog_desc_app_group">Apps Group\u0020:\u0020</string>
<string name="appearance_bottom_dialog_desc_alarm">Alarm\u0020:\u0020</string> <string name="appearance_bottom_dialog_desc_alarm">Alarm\u0020:\u0020</string>
<string name="appearance_bottom_dialog_desc_word">Word\u0020:\u0020</string> <string name="appearance_bottom_dialog_desc_word">Word\u0020:\u0020</string>
<string name="appearance_bottom_dialog_desc_battery">Battery\u0020:\u0020 </string> <string name="appearance_bottom_dialog_desc_battery">Battery\u0020:\u0020 </string>