diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AlignmentBottomSheetDialogFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AlignmentBottomSheetDialogFragment.kt index 3beae975..fde577fe 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AlignmentBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AlignmentBottomSheetDialogFragment.kt @@ -8,14 +8,14 @@ import android.view.ViewGroup import android.widget.TextView import androidx.annotation.RequiresApi import androidx.fragment.app.viewModels -import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.github.droidworksstudio.launcher.R import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogAlignmentSettingsBinding import com.github.droidworksstudio.launcher.helper.AppHelper import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.PreferenceHelper import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject @@ -54,6 +54,11 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() { observeClickListener() } + override fun onPause() { + super.onPause() + dismiss() // Close the AlignmentBottomSheetDialogFragment when the home button is pressed. + } + private fun initView() { bottomDialogHelper.setupDialogStyle(dialog) @@ -74,7 +79,7 @@ class AlignmentBottomSheetDialogFragment : BottomSheetDialogFragment() { } } - private fun observeClickListener(){ + private fun observeClickListener() { binding.bottomAlignmentDateView.setOnClickListener { selectedAlignment = REQUEST_KEY_DATE_ALIGNMENT showListDialog(selectedAlignment) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AppInfoBottomSheetFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AppInfoBottomSheetFragment.kt index 082593db..872c62b8 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AppInfoBottomSheetFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/AppInfoBottomSheetFragment.kt @@ -14,15 +14,15 @@ import androidx.fragment.app.viewModels import com.github.droidworksstudio.common.appInfo import com.github.droidworksstudio.common.showLongToast import com.github.droidworksstudio.common.unInstallApp -import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.github.droidworksstudio.launcher.R import com.github.droidworksstudio.launcher.data.entities.AppInfo import com.github.droidworksstudio.launcher.databinding.BottomsheetDialogBinding import com.github.droidworksstudio.launcher.helper.AppHelper -import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.BiometricHelper +import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.listener.OnItemClickedListener import com.github.droidworksstudio.launcher.viewmodel.AppViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject @@ -73,6 +73,11 @@ class AppInfoBottomSheetFragment(private val appInfo: AppInfo) : BottomSheetDial observeClickListener() } + override fun onPause() { + super.onPause() + dismiss() // Close the AppInfoBottomSheetFragment when the home button is pressed. + } + private fun initView() { bottomDialogHelper.setupDialogStyle(dialog) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/ColorBottomSheetDialogFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/ColorBottomSheetDialogFragment.kt index fcf923cd..15054df7 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/ColorBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/ColorBottomSheetDialogFragment.kt @@ -11,11 +11,11 @@ import android.widget.TextView import androidx.annotation.RequiresApi import androidx.fragment.app.viewModels import com.github.droidworksstudio.common.showLongToast -import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogColorSettingsBinding import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.PreferenceHelper import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint import net.mm2d.color.chooser.ColorChooserDialog import javax.inject.Inject @@ -52,6 +52,11 @@ class ColorBottomSheetDialogFragment : BottomSheetDialogFragment() { observeClickListener() } + override fun onPause() { + super.onPause() + dismiss() // Close the ColorBottomSheetDialogFragment when the home button is pressed. + } + private fun initView() { bottomDialogHelper.setupDialogStyle(dialog) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/PaddingBottomSheetDialogFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/PaddingBottomSheetDialogFragment.kt index 2904bdb8..d738dd26 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/PaddingBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/PaddingBottomSheetDialogFragment.kt @@ -8,13 +8,14 @@ import android.view.View import android.view.ViewGroup import androidx.annotation.RequiresApi import androidx.fragment.app.viewModels -import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogPaddingSettingsBinding import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.PreferenceHelper import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject + @AndroidEntryPoint class PaddingBottomSheetDialogFragment : BottomSheetDialogFragment() { @@ -44,13 +45,18 @@ class PaddingBottomSheetDialogFragment : BottomSheetDialogFragment() { initView() } - private fun initView(){ + override fun onPause() { + super.onPause() + dismiss() // Close the PaddingBottomSheetDialogFragment when the home button is pressed. + } + + private fun initView() { bottomDialogHelper.setupDialogStyle(dialog) binding.selectAppPaddingSize.setText(preferenceHelper.homeAppPadding.toString()) } - private fun observeValueChange(){ + private fun observeValueChange() { val appValue = binding.selectAppPaddingSize.text.toString() val appFloatValue = parseFloatValue(appValue, preferenceHelper.homeAppPadding) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/TextBottomSheetDialogFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/TextBottomSheetDialogFragment.kt index 3cbec0da..72796c23 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/TextBottomSheetDialogFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/bottomsheetdialog/TextBottomSheetDialogFragment.kt @@ -8,13 +8,14 @@ import android.view.View import android.view.ViewGroup import androidx.annotation.RequiresApi import androidx.fragment.app.viewModels -import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogTextSettingsBinding import com.github.droidworksstudio.launcher.helper.BottomDialogHelper import com.github.droidworksstudio.launcher.helper.PreferenceHelper import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.bottomsheet.BottomSheetDialogFragment import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject + @AndroidEntryPoint class TextBottomSheetDialogFragment : BottomSheetDialogFragment() { @@ -44,7 +45,12 @@ class TextBottomSheetDialogFragment : BottomSheetDialogFragment() { initView() } - private fun initView(){ + override fun onPause() { + super.onPause() + dismiss() // Close the TextBottomSheetDialogFragment when the home button is pressed. + } + + private fun initView() { bottomDialogHelper.setupDialogStyle(dialog) binding.selectDateTextSize.setText(preferenceHelper.dateTextSize.toString()) @@ -53,7 +59,7 @@ class TextBottomSheetDialogFragment : BottomSheetDialogFragment() { binding.selectBatteryTextSize.setText(preferenceHelper.batteryTextSize.toString()) } - private fun observeValueChange(){ + private fun observeValueChange() { val dateValue = binding.selectDateTextSize.text.toString() val timeValue = binding.selectTimeTextSize.text.toString() val appValue = binding.selectAppTextSize.text.toString()