From 6b72000c6033f68499ae76a0865b7109c7a464c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=B4=87C=E1=B4=8F=E1=B4=85=E1=B4=87s2=E1=B4=8D=E1=B4=9C?= =?UTF-8?q?=E1=B4=84=CA=9C?= Date: Fri, 27 Sep 2024 20:40:22 +0100 Subject: [PATCH] Feat: Added the base for the new settings screen (#130) * Feat: Added the base for the new settings screen * Fix: Removed junk from Home * Fix: Cleanup Setting * Fix: Bit more advanced settings Signed-off-by: HeCodes2Much --- app/build.gradle.kts | 56 +- .../launcher/helper/AppHelper.kt | 22 +- .../launcher/ui/activities/MainActivity.kt | 37 +- .../ui/settings/SettingsAdvancedFragment.kt | 173 +++ .../ui/settings/SettingsFeaturesFragment.kt | 340 ++++++ .../launcher/ui/settings/SettingsFragment.kt | 451 +------ .../ui/settings/SettingsLookFeelFragment.kt | 213 ++++ app/src/main/res/drawable/ic_advanced.xml | 10 + app/src/main/res/drawable/ic_app_info.xml | 21 + .../main/res/drawable/ic_backup_restore.xml | 63 + .../drawable/ic_change_default_launcher.xml | 49 + app/src/main/res/drawable/ic_community.xml | 28 + app/src/main/res/drawable/ic_favorite.xml | 10 + app/src/main/res/drawable/ic_feature.xml | 14 + .../main/res/drawable/ic_help_feedback.xml | 17 + app/src/main/res/drawable/ic_hidden.xml | 14 + app/src/main/res/drawable/ic_look_feel.xml | 23 + app/src/main/res/drawable/ic_restart.xml | 19 + app/src/main/res/drawable/ic_share_app.xml | 27 + app/src/main/res/drawable/icon_refresh.xml | 2 +- .../layout/bottom_sheet_alignment_dialog.xml | 2 +- app/src/main/res/layout/fragment_settings.xml | 1054 ++--------------- .../res/layout/fragment_settings_advanced.xml | 273 +++++ .../res/layout/fragment_settings_features.xml | 385 ++++++ .../layout/fragment_settings_look_feel.xml | 436 +++++++ app/src/main/res/navigation/nav_graph.xml | 40 +- app/src/main/res/values-night/colors.xml | 6 +- app/src/main/res/values-night/styles.xml | 8 +- app/src/main/res/values/colors.xml | 6 +- app/src/main/res/values/strings.xml | 84 +- app/src/main/res/values/styles.xml | 8 +- gradle/wrapper/gradle-wrapper.properties | 6 +- 32 files changed, 2449 insertions(+), 1448 deletions(-) create mode 100644 app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsAdvancedFragment.kt create mode 100644 app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFeaturesFragment.kt create mode 100644 app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsLookFeelFragment.kt create mode 100644 app/src/main/res/drawable/ic_advanced.xml create mode 100644 app/src/main/res/drawable/ic_app_info.xml create mode 100644 app/src/main/res/drawable/ic_backup_restore.xml create mode 100644 app/src/main/res/drawable/ic_change_default_launcher.xml create mode 100644 app/src/main/res/drawable/ic_community.xml create mode 100644 app/src/main/res/drawable/ic_favorite.xml create mode 100644 app/src/main/res/drawable/ic_feature.xml create mode 100644 app/src/main/res/drawable/ic_help_feedback.xml create mode 100644 app/src/main/res/drawable/ic_hidden.xml create mode 100644 app/src/main/res/drawable/ic_look_feel.xml create mode 100644 app/src/main/res/drawable/ic_restart.xml create mode 100644 app/src/main/res/drawable/ic_share_app.xml create mode 100644 app/src/main/res/layout/fragment_settings_advanced.xml create mode 100644 app/src/main/res/layout/fragment_settings_features.xml create mode 100644 app/src/main/res/layout/fragment_settings_look_feel.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index fcc8bd4a..a8529414 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -78,14 +78,25 @@ android { manifestPlaceholders["coarseLocationPermission"] = "android.permission.ACCESS_COARSE_LOCATION" val weatherFile = project.rootProject.file("weather.properties") - val properties = Properties() - properties.load(weatherFile.inputStream()) - val apiKey = properties.getProperty("WEATHER_API_KEY") ?: "" - buildConfigField( - type = "String", - name = "API_KEY", - value = "\"$apiKey\"" - ) + if (weatherFile.exists()) { + val properties = Properties() + weatherFile.inputStream().use { inputStream -> + properties.load(inputStream) + } + val apiKey = properties.getProperty("WEATHER_API_KEY") ?: "" + buildConfigField( + type = "String", + name = "API_KEY", + value = "\"$apiKey\"" + ) + } else { + buildConfigField( + type = "String", + name = "API_KEY", + value = "\"REMOVE\"" + ) + println("weather.properties file not found.") + } } create("withoutInternet") { @@ -105,16 +116,27 @@ android { applicationIdSuffix = ".nightly" versionNameSuffix = "-nightly" manifestPlaceholders["internetPermission"] = "android.permission.INTERNET" - val weatherFile = project.rootProject.file("weather.properties") - val properties = Properties() - properties.load(weatherFile.inputStream()) - val apiKey = properties.getProperty("WEATHER_API_KEY") ?: "" - buildConfigField( - type = "String", - name = "API_KEY", - value = "\"$apiKey\"" - ) resValue("string", "app_name", "Easy Launcher (Nightly)") + val weatherFile = project.rootProject.file("weather.properties") + if (weatherFile.exists()) { + val properties = Properties() + weatherFile.inputStream().use { inputStream -> + properties.load(inputStream) + } + val apiKey = properties.getProperty("WEATHER_API_KEY") ?: "" + buildConfigField( + type = "String", + name = "API_KEY", + value = "\"$apiKey\"" + ) + } else { + buildConfigField( + type = "String", + name = "API_KEY", + value = "\"REMOVE\"" + ) + println("weather.properties file not found.") + } } create("withoutInternetNightly") { diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt b/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt index dcf6e1a9..b9c55ac7 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt @@ -10,6 +10,7 @@ import android.content.res.Configuration import android.content.res.Resources import android.net.Uri import android.os.Build +import android.util.Log import android.view.Gravity import android.view.View import android.view.Window @@ -19,10 +20,10 @@ import androidx.appcompat.widget.LinearLayoutCompat import androidx.navigation.NavOptions import com.github.droidworksstudio.common.showLongToast import com.github.droidworksstudio.launcher.BuildConfig -import com.github.droidworksstudio.launcher.utils.Constants import com.github.droidworksstudio.launcher.R import com.github.droidworksstudio.launcher.accessibility.ActionService import com.github.droidworksstudio.launcher.helper.weather.WeatherResponse +import com.github.droidworksstudio.launcher.utils.Constants import com.github.droidworksstudio.launcher.utils.WeatherApiService import com.google.gson.Gson import retrofit2.Retrofit @@ -115,6 +116,7 @@ class AppHelper @Inject constructor() { // Digital Wellbeing app is not installed or cannot be opened // Handle this case as needed context.showLongToast("Digital Wellbeing is not available on this device.") + Log.e("AppHelper", "Digital Wellbeing app not found or cannot be opened.", e) } } @@ -170,27 +172,34 @@ class AppHelper @Inject constructor() { return dailyWordsArray[wordIndex] } - fun shareAppButton(context: Context) { + fun shareApplicationButton(context: Context) { val shareIntent = Intent(Intent.ACTION_SEND) + val description = context.getString(R.string.advanced_settings_share_application_description, context.getString(R.string.app_name)) shareIntent.type = "text/plain" shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share Application") shareIntent.putExtra( Intent.EXTRA_TEXT, - "https://f-droid.org/packages/" + context.packageName + "$description https://f-droid.org/packages/${context.packageName}" ) context.startActivity(Intent.createChooser(shareIntent, "Share Application")) } - fun githubButton(context: Context) { + fun helpFeedbackButton(context: Context) { val uri = Uri.parse("https://github.com/DroidWorksStudio/EasyLauncher") val intent = Intent(Intent.ACTION_VIEW, uri) context.startActivity(intent) } - fun feedbackButton(context: Context) { + fun communitySupportButton(context: Context) { + val uri = Uri.parse("https://t.me/DroidWorksStudio/") + val intent = Intent(Intent.ACTION_VIEW, uri) + context.startActivity(intent) + } + + fun emailButton(context: Context) { val emailIntent = Intent(Intent.ACTION_SENDTO) emailIntent.data = Uri.parse("mailto:droidworksstuido@063240.xyz") - emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Easy Launcher") + emailIntent.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name) context.startActivity(Intent.createChooser(emailIntent, "Choose Mail Application")) } @@ -307,6 +316,7 @@ class AppHelper @Inject constructor() { return WeatherResult.Failure("Failed to fetch weather data: ${response.errorBody()}") } } catch (e: UnknownHostException) { + Log.e("AppHelper", "Unknown Host.", e) return WeatherResult.Failure("Unknown Host : $baseURL") } catch (e: Exception) { return WeatherResult.Failure("${e.message}") diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/activities/MainActivity.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/activities/MainActivity.kt index 84602ad7..553de48f 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/activities/MainActivity.kt @@ -2,8 +2,6 @@ package com.github.droidworksstudio.launcher.ui.activities import android.Manifest import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context import android.content.Intent import android.content.SharedPreferences import android.content.pm.ActivityInfo @@ -24,6 +22,7 @@ import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import androidx.fragment.app.FragmentManager import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController import androidx.navigation.findNavController @@ -33,6 +32,7 @@ import androidx.navigation.ui.navigateUp import com.github.droidworksstudio.common.hasInternetPermission import com.github.droidworksstudio.common.isTablet import com.github.droidworksstudio.common.showLongToast +import com.github.droidworksstudio.common.showShortToast import com.github.droidworksstudio.launcher.R import com.github.droidworksstudio.launcher.databinding.ActivityMainBinding import com.github.droidworksstudio.launcher.helper.AppHelper @@ -89,7 +89,7 @@ class MainActivity : AppCompatActivity() { setContentView(binding.root) locationManager = getSystemService(LOCATION_SERVICE) as LocationManager - sharedPreferences = getSharedPreferences(Constants.WEATHER_PREFS, Context.MODE_PRIVATE) + sharedPreferences = getSharedPreferences(Constants.WEATHER_PREFS, MODE_PRIVATE) handler = Handler(Looper.getMainLooper()) initializeDependencies() @@ -218,7 +218,7 @@ class MainActivity : AppCompatActivity() { onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { - backToHomeScreen() + goBackToSettings() } }) } @@ -268,8 +268,29 @@ class MainActivity : AppCompatActivity() { private fun backToHomeScreen() { navController = findNavController(R.id.nav_host_fragment_content_main) - if (navController.currentDestination?.id != R.id.HomeFragment) - navController.navigate(R.id.HomeFragment) + when (navController.currentDestination?.id) { + R.id.HomeFragment -> return + else -> navController.navigate(R.id.HomeFragment) + } + } + + private fun goBackToSettings() { + navController = findNavController(R.id.nav_host_fragment_content_main) + val fragmentManager: FragmentManager = supportFragmentManager + when (navController.currentDestination?.id) { + R.id.SettingsFragment, + R.id.SettingsFeaturesFragment, + R.id.SettingsLookFeelFragment, + R.id.FavoriteFragment, + R.id.HiddenFragment, + R.id.SettingsAdvancedFragment -> { + fragmentManager.popBackStack() + } + + else -> { + navController.navigate(R.id.HomeFragment) + } + } } @@ -296,7 +317,7 @@ class MainActivity : AppCompatActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) - if (resultCode != Activity.RESULT_OK) { + if (resultCode != RESULT_OK) { applicationContext.showLongToast("Intent Error") return } @@ -320,6 +341,7 @@ class MainActivity : AppCompatActivity() { prefs.loadFromString(string) } } + applicationContext.showShortToast(getString(R.string.settings_reload_app_restore)) Handler(Looper.getMainLooper()).postDelayed({ AppReloader.restartApp(applicationContext) }, 500) @@ -335,6 +357,7 @@ class MainActivity : AppCompatActivity() { } } } + applicationContext.showShortToast(getString(R.string.settings_reload_app_backup)) } } } diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsAdvancedFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsAdvancedFragment.kt new file mode 100644 index 00000000..d44fa921 --- /dev/null +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsAdvancedFragment.kt @@ -0,0 +1,173 @@ +package com.github.droidworksstudio.launcher.ui.settings + +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.os.Handler +import android.os.Looper +import android.provider.Settings +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.Fragment +import androidx.navigation.NavController +import androidx.navigation.fragment.findNavController +import com.github.droidworksstudio.common.resetDefaultLauncher +import com.github.droidworksstudio.launcher.R +import com.github.droidworksstudio.launcher.databinding.FragmentSettingsAdvancedBinding +import com.github.droidworksstudio.launcher.helper.AppHelper +import com.github.droidworksstudio.launcher.helper.AppReloader +import com.github.droidworksstudio.launcher.helper.PreferenceHelper +import com.github.droidworksstudio.launcher.listener.ScrollEventListener +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject + +@AndroidEntryPoint +class SettingsAdvancedFragment : Fragment(), + ScrollEventListener { + + private var _binding: FragmentSettingsAdvancedBinding? = null + private val binding get() = _binding!! + + @Inject + lateinit var preferenceHelper: PreferenceHelper + + @Inject + lateinit var appHelper: AppHelper + + private lateinit var navController: NavController + + private lateinit var context: Context + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + // Inflate the layout for this fragment + _binding = FragmentSettingsAdvancedBinding.inflate(inflater, container, false) + _binding = binding + + return binding.root + } + + // Called after the fragment view is created + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + navController = findNavController() + // Set according to the system theme mode + appHelper.dayNightMod(requireContext(), binding.nestScrollView) + super.onViewCreated(view, savedInstanceState) + + context = requireContext() + + initializeInjectedDependencies() + observeClickListener() + } + + override fun onStop() { + super.onStop() + dismissDialogs() + } + + private fun initializeInjectedDependencies() { + binding.nestScrollView.scrollEventListener = this + + val packageInfo = + requireContext().packageManager.getPackageInfo(requireContext().packageName, 0) + + binding.apply { + appInfoDescription.text = getString(R.string.advanced_settings_app_info_description).format(packageInfo.versionName) + } + } + + private fun observeClickListener() { + binding.apply { + appInfo.setOnClickListener { + val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply { + data = Uri.parse("package:${context.packageName}") + } + context.startActivity(intent) + } + + setDefaultLauncher.setOnClickListener { + requireContext().resetDefaultLauncher() + } + + restartLauncher.setOnClickListener { + Handler(Looper.getMainLooper()).postDelayed({ + AppReloader.restartApp(context) + }, 500) + } + + backupRestore.setOnClickListener { + showBackupRestoreDialog() + } + + helpFeedback.setOnClickListener { + appHelper.helpFeedbackButton(requireContext()) + } + + communitySupport.setOnClickListener { + appHelper.communitySupportButton(requireContext()) + } + + shareApplication.setOnClickListener { + appHelper.shareApplicationButton(requireContext()) + } + } + } + + private var backupRestoreDialog: AlertDialog? = null + + private fun showBackupRestoreDialog() { + // Dismiss any existing dialog to prevent multiple dialogs open simultaneously + backupRestoreDialog?.dismiss() + + // Define the items for the dialog (Backup, Restore, Clear Data) + val items = arrayOf( + getString(R.string.advanced_settings_backup_restore_backup), + getString(R.string.advanced_settings_backup_restore_restore), + getString(R.string.advanced_settings_backup_restore_clear) + ) + + val dialogBuilder = MaterialAlertDialogBuilder(context) + dialogBuilder.setTitle(getString(R.string.advanced_settings_backup_restore_title)) + dialogBuilder.setItems(items) { _, which -> + when (which) { + 0 -> appHelper.storeFile(requireActivity()) + 1 -> appHelper.loadFile(requireActivity()) + else -> confirmClearData() + } + } + + // Assign the created dialog to backupRestoreDialog + backupRestoreDialog = dialogBuilder.create() + backupRestoreDialog?.show() + } + + // Function to handle the Clear Data action, with a confirmation dialog + private fun confirmClearData() { + MaterialAlertDialogBuilder(context) + .setTitle(getString(R.string.advanced_settings_backup_restore_clear_title)) + .setMessage(getString(R.string.advanced_settings_backup_restore_clear_description)) + .setPositiveButton(getString(R.string.advanced_settings_backup_restore_clear_yes)) { _, _ -> + clearData() + } + .setNegativeButton(getString(R.string.advanced_settings_backup_restore_clear_no), null) + .show() + } + + private fun clearData() { + preferenceHelper.clearAll(context) + Handler(Looper.getMainLooper()).postDelayed({ + AppReloader.restartApp(context) + }, 500) + } + + private fun dismissDialogs() { + backupRestoreDialog?.dismiss() + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFeaturesFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFeaturesFragment.kt new file mode 100644 index 00000000..ab59a187 --- /dev/null +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFeaturesFragment.kt @@ -0,0 +1,340 @@ +package com.github.droidworksstudio.launcher.ui.settings + +import android.content.Context +import android.os.Bundle +import android.util.Log +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels +import androidx.lifecycle.lifecycleScope +import androidx.navigation.NavController +import androidx.navigation.fragment.findNavController +import com.github.droidworksstudio.common.getAppNameFromPackageName +import com.github.droidworksstudio.launcher.R +import com.github.droidworksstudio.launcher.databinding.FragmentSettingsFeaturesBinding +import com.github.droidworksstudio.launcher.helper.AppHelper +import com.github.droidworksstudio.launcher.helper.PreferenceHelper +import com.github.droidworksstudio.launcher.listener.ScrollEventListener +import com.github.droidworksstudio.launcher.repository.AppInfoRepository +import com.github.droidworksstudio.launcher.utils.Constants +import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import dagger.hilt.android.AndroidEntryPoint +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import javax.inject.Inject + +@AndroidEntryPoint +class SettingsFeaturesFragment : Fragment(), + ScrollEventListener { + + private var _binding: FragmentSettingsFeaturesBinding? = null + private val binding get() = _binding!! + + private val preferenceViewModel: PreferenceViewModel by viewModels() + + @Inject + lateinit var preferenceHelper: PreferenceHelper + + @Inject + lateinit var appInfoRepository: AppInfoRepository + + @Inject + lateinit var appHelper: AppHelper + + private lateinit var navController: NavController + + private lateinit var context: Context + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + // Inflate the layout for this fragment + _binding = FragmentSettingsFeaturesBinding.inflate(inflater, container, false) + _binding = binding + + return binding.root + } + + // Called after the fragment view is created + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + navController = findNavController() + // Set according to the system theme mode + appHelper.dayNightMod(requireContext(), binding.nestScrollView) + super.onViewCreated(view, savedInstanceState) + + context = requireContext() + + initializeInjectedDependencies() + observeClickListener() + + binding.apply { + miscellaneousSearchEngineControl.text = preferenceHelper.searchEngines.getString(context) + } + + val actions = listOf( + Triple(preferenceHelper.doubleTapAction, preferenceHelper.doubleTapApp, binding.gesturesDoubleTapControl), + Triple(preferenceHelper.swipeUpAction, preferenceHelper.swipeUpApp, binding.gesturesSwipeUpControl), + Triple(preferenceHelper.swipeDownAction, preferenceHelper.swipeDownApp, binding.gesturesSwipeDownControl), + Triple(preferenceHelper.swipeLeftAction, preferenceHelper.swipeLeftApp, binding.gesturesSwipeLeftControl), + Triple(preferenceHelper.swipeRightAction, preferenceHelper.swipeRightApp, binding.gesturesSwipeRightControl) + ) + + actions.forEach { (action, app, control) -> + updateGestureControlText(context, action, app, control) + } + } + + // Function to update UI text based on action and app name + private fun updateGestureControlText( + context: Context, + action: Constants.Action, + appPackageName: String?, + textView: TextView + ) { + val actionText = if (action == Constants.Action.OpenApp) { + val appName = appPackageName?.let { context.getAppNameFromPackageName(it) } + context.getString(R.string.settings_actions_open_app_run, appName) + } else { + action.getString(context) + } + textView.text = actionText + } + + override fun onStop() { + super.onStop() + dismissDialogs() + } + + private fun initializeInjectedDependencies() { + binding.nestScrollView.scrollEventListener = this + + // Set initial values and listeners for switches + binding.apply { + automaticKeyboardSwitchCompat.isChecked = preferenceHelper.automaticKeyboard + automaticOpenAppSwitchCompat.isChecked = preferenceHelper.automaticOpenApp + lockSettingsSwitchCompat.isChecked = preferenceHelper.settingsLock + } + } + + private fun observeClickListener() { + setupSwitchListeners() + + binding.apply { + gesturesDoubleTapControl.setOnClickListener { + swipeActionClickEvent(Constants.Swipe.DoubleTap) + } + + gesturesSwipeUpControl.setOnClickListener { + swipeActionClickEvent(Constants.Swipe.Up) + } + + gesturesSwipeDownControl.setOnClickListener { + swipeActionClickEvent(Constants.Swipe.Down) + } + + gesturesSwipeLeftControl.setOnClickListener { + swipeActionClickEvent(Constants.Swipe.Left) + } + + gesturesSwipeRightControl.setOnClickListener { + swipeActionClickEvent(Constants.Swipe.Right) + } + + miscellaneousSearchEngineControl.setOnClickListener { + showSearchEngineDialog() + } + } + } + + private var searchEngineDialog: AlertDialog? = null + + private fun showSearchEngineDialog() { + // Dismiss any existing dialog to prevent multiple dialogs open simultaneously + searchEngineDialog?.dismiss() + // Get the array of SearchEngines enum values + val items = Constants.SearchEngines.entries.toTypedArray() + + // Map the enum values to their string representations + val itemStrings = items.map { it.getString(context) }.toTypedArray() + + val dialogBuilder = MaterialAlertDialogBuilder(context) + + dialogBuilder.setTitle(getString(R.string.settings_select_search_engine)) + dialogBuilder.setItems(itemStrings) { _, which -> + val selectedItem = items[which] + preferenceViewModel.setSearchEngine(selectedItem) + binding.miscellaneousSearchEngineControl.text = preferenceHelper.searchEngines.name + } + // Assign the created dialog to launcherFontDialog + searchEngineDialog = dialogBuilder.create() + searchEngineDialog?.show() + } + + private var appSelectionDialog: AlertDialog? = null + + private fun showAppSelectionDialog(swipeType: Constants.Swipe) { + // Make sure this method is called within a lifecycle owner scope + lifecycleScope.launch(Dispatchers.Main) { + // Dismiss any existing dialog to prevent multiple dialogs open simultaneously + appSelectionDialog?.dismiss() + + // Collect the flow of installed apps + appInfoRepository.getDrawApps().collect { installedApps -> + // Extract app names and package names + val appNames = installedApps.map { it.appName }.toTypedArray() + val packageNames = installedApps.map { it.packageName } + + // Build and display the dialog + val dialogBuilder = MaterialAlertDialogBuilder(context) + dialogBuilder.setTitle("Select an App") + dialogBuilder.setItems(appNames) { _, which -> + val selectedPackageName = packageNames[which] + when (swipeType) { + Constants.Swipe.DoubleTap, + Constants.Swipe.Up, + Constants.Swipe.Down, + Constants.Swipe.Left, + Constants.Swipe.Right -> handleSwipeAction(swipeType, selectedPackageName) + } + + } + + // Assign the created dialog to launcherFontDialog + appSelectionDialog = dialogBuilder.create() + appSelectionDialog?.show() + } + } + } + + private fun setupSwitchListeners() { + binding.apply { + automaticKeyboardSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setAutoKeyboard(isChecked) + } + + automaticOpenAppSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setAutoOpenApp(isChecked) + } + + lockSettingsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setLockSettings(isChecked) + } + } + + } + + private fun swipeActionClickEvent(swipe: Constants.Swipe) { + // Get the array of Action enum values + val actions = Constants.Action.entries.toTypedArray() + // Map the enum values to their string representations + val actionStrings = actions.map { it.getString(context) }.toTypedArray() + + val dialog = MaterialAlertDialogBuilder(context) + + dialog.setTitle("Select a Action") + dialog.setItems(actionStrings) { _, which -> + val selectedAction = actions[which] + when (swipe) { + Constants.Swipe.DoubleTap -> handleSwipeAction(context, Constants.Swipe.DoubleTap, selectedAction, binding) + Constants.Swipe.Up -> handleSwipeAction(context, Constants.Swipe.Up, selectedAction, binding) + Constants.Swipe.Down -> handleSwipeAction(context, Constants.Swipe.Down, selectedAction, binding) + Constants.Swipe.Left -> handleSwipeAction(context, Constants.Swipe.Left, selectedAction, binding) + Constants.Swipe.Right -> handleSwipeAction(context, Constants.Swipe.Right, selectedAction, binding) + } + } + dialog.show() + } + + private fun handleSwipeAction(swipeType: Constants.Swipe, selectedPackageName: String) { + val selectedApp = context.getAppNameFromPackageName(selectedPackageName) + + when (swipeType) { + Constants.Swipe.DoubleTap -> { + binding.gesturesDoubleTapControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + preferenceHelper.doubleTapApp = selectedPackageName + } + + Constants.Swipe.Up -> { + binding.gesturesSwipeUpControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + preferenceHelper.swipeUpApp = selectedPackageName + } + + Constants.Swipe.Down -> { + binding.gesturesSwipeDownControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + preferenceHelper.swipeDownApp = selectedPackageName + } + + Constants.Swipe.Left -> { + binding.gesturesSwipeLeftControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + preferenceHelper.swipeLeftApp = selectedPackageName + } + + Constants.Swipe.Right -> { + binding.gesturesSwipeRightControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + preferenceHelper.swipeRightApp = selectedPackageName + } + } + } + + // Function to handle setting action and updating UI + private fun handleSwipeAction(context: Context, swipe: Constants.Swipe, action: Constants.Action, binding: FragmentSettingsFeaturesBinding) { + preferenceViewModel.setSwipeAction(swipe, action) + + when (action) { + Constants.Action.OpenApp -> { + val selectedApp = when (swipe) { + Constants.Swipe.DoubleTap -> context.getAppNameFromPackageName(preferenceHelper.doubleTapApp) + Constants.Swipe.Up -> context.getAppNameFromPackageName(preferenceHelper.swipeUpApp) + Constants.Swipe.Down -> context.getAppNameFromPackageName(preferenceHelper.swipeDownApp) + Constants.Swipe.Left -> context.getAppNameFromPackageName(preferenceHelper.swipeLeftApp) + Constants.Swipe.Right -> context.getAppNameFromPackageName(preferenceHelper.swipeRightApp) + } + binding.apply { + when (swipe) { + Constants.Swipe.DoubleTap -> gesturesDoubleTapControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + Constants.Swipe.Up -> gesturesSwipeUpControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + Constants.Swipe.Down -> gesturesSwipeDownControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + Constants.Swipe.Left -> gesturesSwipeLeftControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + Constants.Swipe.Right -> gesturesSwipeRightControl.text = getString(R.string.settings_actions_open_app_run, selectedApp) + } + } + showAppSelectionDialog(swipe) + } + + else -> { + Log.d("doubleTapAction", preferenceHelper.doubleTapAction.getString(context)) + binding.apply { + when (swipe) { + Constants.Swipe.DoubleTap -> gesturesDoubleTapControl.text = preferenceHelper.doubleTapAction.getString(context) + Constants.Swipe.Up -> gesturesSwipeUpControl.text = preferenceHelper.swipeUpAction.getString(context) + Constants.Swipe.Down -> gesturesSwipeDownControl.text = preferenceHelper.swipeDownAction.getString(context) + Constants.Swipe.Left -> gesturesSwipeLeftControl.text = preferenceHelper.swipeLeftAction.getString(context) + Constants.Swipe.Right -> gesturesSwipeRightControl.text = preferenceHelper.swipeRightAction.getString(context) + } + } + } + } + } + + // Extension function to set swipe action in ViewModel + private fun PreferenceViewModel.setSwipeAction(swipe: Constants.Swipe, action: Constants.Action) { + when (swipe) { + Constants.Swipe.DoubleTap -> setDoubleTap(action) + Constants.Swipe.Up -> setSwipeUp(action) + Constants.Swipe.Down -> setSwipeDown(action) + Constants.Swipe.Left -> setSwipeLeft(action) + Constants.Swipe.Right -> setSwipeRight(action) + } + } + + private fun dismissDialogs() { + searchEngineDialog?.dismiss() + appSelectionDialog?.dismiss() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt index 85ce5033..a4d9fc72 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt @@ -2,42 +2,20 @@ package com.github.droidworksstudio.launcher.ui.settings import android.annotation.SuppressLint import android.content.Context -import android.content.Intent import android.os.Bundle -import android.os.Handler -import android.os.Looper -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.TextView -import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment -import androidx.fragment.app.viewModels -import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController import androidx.navigation.fragment.findNavController -import com.github.droidworksstudio.common.getAppNameFromPackageName -import com.github.droidworksstudio.common.resetDefaultLauncher import com.github.droidworksstudio.launcher.R -import com.github.droidworksstudio.launcher.adapter.font.FontAdapter import com.github.droidworksstudio.launcher.databinding.FragmentSettingsBinding import com.github.droidworksstudio.launcher.helper.AppHelper -import com.github.droidworksstudio.launcher.helper.AppReloader import com.github.droidworksstudio.launcher.helper.PreferenceHelper -import com.github.droidworksstudio.launcher.listener.OnSwipeTouchListener import com.github.droidworksstudio.launcher.listener.ScrollEventListener import com.github.droidworksstudio.launcher.repository.AppInfoRepository -import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AlignmentBottomSheetDialogFragment -import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.ColorBottomSheetDialogFragment -import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.PaddingBottomSheetDialogFragment -import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.TextBottomSheetDialogFragment -import com.github.droidworksstudio.launcher.utils.Constants -import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel -import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch import javax.inject.Inject @AndroidEntryPoint @@ -47,8 +25,6 @@ class SettingsFragment : Fragment(), private var _binding: FragmentSettingsBinding? = null private val binding get() = _binding!! - private val preferenceViewModel: PreferenceViewModel by viewModels() - @Inject lateinit var preferenceHelper: PreferenceHelper @@ -84,442 +60,35 @@ class SettingsFragment : Fragment(), initializeInjectedDependencies() observeClickListener() - observeSwipeTouchListener() - - val packageInfo = - requireContext().packageManager.getPackageInfo(requireContext().packageName, 0) - binding.versionInfo.text = getString(R.string.settings_version).format( - getString(R.string.app_name), - packageInfo.versionName - ) - - binding.miscellaneousSearchEngineControl.text = preferenceHelper.searchEngines.getString(context) - binding.miscellaneousLauncherFontsControl.text = preferenceHelper.launcherFont.getString(context) - - val actions = listOf( - Triple(preferenceHelper.doubleTapAction, preferenceHelper.doubleTapApp, binding.gesturesDoubleTapControl), - Triple(preferenceHelper.swipeUpAction, preferenceHelper.swipeUpApp, binding.gesturesSwipeUpControl), - Triple(preferenceHelper.swipeDownAction, preferenceHelper.swipeDownApp, binding.gesturesSwipeDownControl), - Triple(preferenceHelper.swipeLeftAction, preferenceHelper.swipeLeftApp, binding.gesturesSwipeLeftControl), - Triple(preferenceHelper.swipeRightAction, preferenceHelper.swipeRightApp, binding.gesturesSwipeRightControl) - ) - - actions.forEach { (action, app, control) -> - updateGestureControlText(context, action, app, control) - } - - } - - // Function to update UI text based on action and app name - private fun updateGestureControlText( - context: Context, - action: Constants.Action, - appPackageName: String?, - textView: TextView - ) { - val actionText = if (action == Constants.Action.OpenApp) { - val appName = appPackageName?.let { context.getAppNameFromPackageName(it) } - context.getString(R.string.settings_actions_open_app_run, appName) - } else { - action.getString(context) - } - textView.text = actionText } @SuppressLint("SetTextI18n") private fun initializeInjectedDependencies() { binding.nestScrollView.scrollEventListener = this - - // Set initial values and listeners for switches - binding.statueBarSwitchCompat.isChecked = preferenceHelper.showStatusBar - binding.timeSwitchCompat.isChecked = preferenceHelper.showTime - binding.dateSwitchCompat.isChecked = preferenceHelper.showDate - binding.batterySwitchCompat.isChecked = preferenceHelper.showBattery - binding.dailyWordSwitchCompat.isChecked = preferenceHelper.showDailyWord - binding.appIconsSwitchCompat.isChecked = preferenceHelper.showAppIcon - binding.appIconDotsSwitchCompat.isChecked = preferenceHelper.showAppIconAsDots - binding.automaticKeyboardSwitchCompat.isChecked = preferenceHelper.automaticKeyboard - binding.automaticOpenAppSwitchCompat.isChecked = preferenceHelper.automaticOpenApp - binding.lockSettingsSwitchCompat.isChecked = preferenceHelper.settingsLock - - if (!binding.appIconsSwitchCompat.isChecked) { - // Disable and gray out the other setting if appIconsSwitchCompat is checked - binding.appIconDotsSwitchCompat.isEnabled = binding.appIconsSwitchCompat.isChecked - binding.appIconDotsSwitchCompat.isChecked = false - } } private fun observeClickListener() { - setupSwitchListeners() - - // Click listener for reset default launcher - binding.setLauncherSelector.setOnClickListener { - requireContext().resetDefaultLauncher() - } - - binding.favoriteText.setOnClickListener { - findNavController().navigate(R.id.action_SettingsFragment_to_FavoriteFragment) - } - - binding.hiddenText.setOnClickListener { - findNavController().navigate(R.id.action_SettingsFragment_to_HiddenFragment) - } - - binding.setAppWallpaper.setOnClickListener { - val intent = Intent(Intent.ACTION_SET_WALLPAPER) - startActivity(Intent.createChooser(intent, "Select Wallpaper")) - } - - binding.selectAppearanceTextSize.setOnClickListener { - val bottomSheetFragment = TextBottomSheetDialogFragment() - bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") - } - - binding.selectAppearanceAlignment.setOnClickListener { - val bottomSheetFragment = AlignmentBottomSheetDialogFragment() - bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") - } - - binding.selectAppearancePadding.setOnClickListener { - val bottomSheetFragment = PaddingBottomSheetDialogFragment() - bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") - } - - binding.selectAppearanceColor.setOnClickListener { - val bottomSheetFragment = ColorBottomSheetDialogFragment() - bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") - } - - binding.shareView.setOnClickListener { - appHelper.shareAppButton(requireContext()) - } - - binding.githubView.setOnClickListener { - appHelper.githubButton(requireContext()) - - } - - binding.feedbackView.setOnClickListener { - appHelper.feedbackButton(requireContext()) - } - - binding.backupView.setOnClickListener { - appHelper.storeFile(requireActivity()) - } - - binding.clearView.setOnClickListener { - preferenceHelper.clearAll(context) - Handler(Looper.getMainLooper()).postDelayed({ - AppReloader.restartApp(context) - }, 500) - } - - binding.restoreView.setOnClickListener { - appHelper.loadFile(requireActivity()) - } - } - - - private fun setupSwitchListeners() { - binding.statueBarSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowStatusBar(isChecked) - } - - binding.timeSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowTime(isChecked) - } - - binding.dateSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowDate(isChecked) - } - - binding.batterySwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowBattery(isChecked) - } - - binding.dailyWordSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowDailyWord(isChecked) - } - - binding.appIconsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowAppIcons(isChecked) - - // Disable and gray out the other setting if appIconsSwitchCompat is checked - binding.appIconDotsSwitchCompat.isEnabled = isChecked - binding.appIconDotsSwitchCompat.isChecked = false - } - - binding.appIconDotsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setShowAppIconDots(isChecked) - } - - binding.automaticKeyboardSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setAutoKeyboard(isChecked) - } - - binding.automaticOpenAppSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setAutoOpenApp(isChecked) - } - - binding.lockSettingsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> - preferenceViewModel.setLockSettings(isChecked) - } - } - - @SuppressLint("ClickableViewAccessibility") - private fun observeSwipeTouchListener() { binding.apply { - touchArea.setOnTouchListener(getSwipeGestureListener(context)) - - miscellaneousSearchEngineControl.setOnClickListener { - showSearchEngineDialog() + featuresSettings.setOnClickListener { + navController.navigate(R.id.action_SettingsFragment_to_SettingsFeaturesFragment) } - miscellaneousLauncherFontsControl.setOnClickListener { - showLauncherFontDialog() + lookFeelSettings.setOnClickListener { + navController.navigate(R.id.action_SettingsFragment_to_SettingsLookFeelFragment) } - gesturesDoubleTapControl.setOnClickListener { - swipeActionClickEvent(Constants.Swipe.DoubleTap) + favoriteApps.setOnClickListener { + navController.navigate(R.id.action_SettingsFragment_to_FavoriteFragment) } - gesturesSwipeUpControl.setOnClickListener { - swipeActionClickEvent(Constants.Swipe.Up) + hiddenApps.setOnClickListener { + navController.navigate(R.id.action_SettingsFragment_to_HiddenFragment) } - gesturesSwipeDownControl.setOnClickListener { - swipeActionClickEvent(Constants.Swipe.Down) - } - - gesturesSwipeLeftControl.setOnClickListener { - swipeActionClickEvent(Constants.Swipe.Left) - } - - gesturesSwipeRightControl.setOnClickListener { - swipeActionClickEvent(Constants.Swipe.Right) - } - } - } - - private fun getSwipeGestureListener(context: Context): View.OnTouchListener { - return object : OnSwipeTouchListener(context) { - override fun onSwipeLeft() { - super.onSwipeLeft() - findNavController().navigateUp() - } - - override fun onSwipeRight() { - super.onSwipeRight() - findNavController().navigateUp() - } - - } - } - - private var searchEngineDialog: AlertDialog? = null - - private fun showSearchEngineDialog() { - // Dismiss any existing dialog to prevent multiple dialogs open simultaneously - searchEngineDialog?.dismiss() - // Get the array of SearchEngines enum values - val items = Constants.SearchEngines.entries.toTypedArray() - - // Map the enum values to their string representations - val itemStrings = items.map { it.getString(context) }.toTypedArray() - - val dialogBuilder = MaterialAlertDialogBuilder(context) - - dialogBuilder.setTitle(getString(R.string.settings_select_search_engine)) - dialogBuilder.setItems(itemStrings) { _, which -> - val selectedItem = items[which] - preferenceViewModel.setSearchEngine(selectedItem) - binding.miscellaneousSearchEngineControl.text = preferenceHelper.searchEngines.name - } - // Assign the created dialog to launcherFontDialog - searchEngineDialog = dialogBuilder.create() - searchEngineDialog?.show() - } - - private var launcherFontDialog: AlertDialog? = null - - private fun showLauncherFontDialog() { - // Dismiss any existing dialog to prevent multiple dialogs open simultaneously - launcherFontDialog?.dismiss() - - // Get the array of SearchEngines enum values - val items = Constants.Fonts.entries.toTypedArray() - - // Map the enum values to their string representations - val itemStrings = items.map { it.getString(context) }.toTypedArray() - - val dialogBuilder = MaterialAlertDialogBuilder(context) - dialogBuilder.setTitle(getString(R.string.settings_select_launcher_font)) - dialogBuilder.setAdapter(FontAdapter(context, items, itemStrings)) { _, which -> - val selectedItem = items[which] - preferenceViewModel.setLauncherFont(selectedItem) - binding.miscellaneousLauncherFontsControl.text = preferenceHelper.launcherFont.name - - // Delay the restart slightly to ensure preferences are saved - Handler(Looper.getMainLooper()).postDelayed({ - AppReloader.restartApp(context) - }, 500) // Delay in milliseconds (e.g., 500ms) - } - - // Assign the created dialog to launcherFontDialog - launcherFontDialog = dialogBuilder.create() - launcherFontDialog?.show() - } - - private var appSelectionDialog: AlertDialog? = null - - private fun showAppSelectionDialog(swipeType: Constants.Swipe) { - // Make sure this method is called within a lifecycle owner scope - lifecycleScope.launch(Dispatchers.Main) { - // Dismiss any existing dialog to prevent multiple dialogs open simultaneously - appSelectionDialog?.dismiss() - - // Collect the flow of installed apps - appInfoRepository.getDrawApps().collect { installedApps -> - // Extract app names and package names - val appNames = installedApps.map { it.appName }.toTypedArray() - val packageNames = installedApps.map { it.packageName } - - // Build and display the dialog - val dialogBuilder = MaterialAlertDialogBuilder(context) - dialogBuilder.setTitle("Select an App") - dialogBuilder.setItems(appNames) { _, which -> - val selectedPackageName = packageNames[which] - when (swipeType) { - Constants.Swipe.DoubleTap, - Constants.Swipe.Up, - Constants.Swipe.Down, - Constants.Swipe.Left, - Constants.Swipe.Right -> handleSwipeAction(swipeType, selectedPackageName) - } - - } - - // Assign the created dialog to launcherFontDialog - appSelectionDialog = dialogBuilder.create() - appSelectionDialog?.show() - } - } - } - - // Add this function to dismiss the dialog if it's showing - private fun dismissDialogs() { - launcherFontDialog?.dismiss() - searchEngineDialog?.dismiss() - appSelectionDialog?.dismiss() - } - - private fun swipeActionClickEvent(swipe: Constants.Swipe) { - // Get the array of Action enum values - val actions = Constants.Action.entries.toTypedArray() - // Map the enum values to their string representations - val actionStrings = actions.map { it.getString(context) }.toTypedArray() - - val dialog = MaterialAlertDialogBuilder(context) - - dialog.setTitle("Select a Action") - dialog.setItems(actionStrings) { _, which -> - val selectedAction = actions[which] - when (swipe) { - Constants.Swipe.DoubleTap -> handleSwipeAction(context, Constants.Swipe.DoubleTap, selectedAction, binding) - Constants.Swipe.Up -> handleSwipeAction(context, Constants.Swipe.Up, selectedAction, binding) - Constants.Swipe.Down -> handleSwipeAction(context, Constants.Swipe.Down, selectedAction, binding) - Constants.Swipe.Left -> handleSwipeAction(context, Constants.Swipe.Left, selectedAction, binding) - Constants.Swipe.Right -> handleSwipeAction(context, Constants.Swipe.Right, selectedAction, binding) - } - } - dialog.show() - } - - private fun handleSwipeAction(swipeType: Constants.Swipe, selectedPackageName: String) { - val selectedApp = context.getAppNameFromPackageName(selectedPackageName) - - when (swipeType) { - Constants.Swipe.DoubleTap -> { - binding.gesturesDoubleTapControl.text = "Open $selectedApp" - preferenceHelper.doubleTapApp = selectedPackageName - } - - Constants.Swipe.Up -> { - binding.gesturesSwipeUpControl.text = "Open $selectedApp" - preferenceHelper.swipeUpApp = selectedPackageName - } - - Constants.Swipe.Down -> { - binding.gesturesSwipeDownControl.text = "Open $selectedApp" - preferenceHelper.swipeDownApp = selectedPackageName - } - - Constants.Swipe.Left -> { - binding.gesturesSwipeLeftControl.text = "Open $selectedApp" - preferenceHelper.swipeLeftApp = selectedPackageName - } - - Constants.Swipe.Right -> { - binding.gesturesSwipeRightControl.text = "Open $selectedApp" - preferenceHelper.swipeRightApp = selectedPackageName + advancedSettings.setOnClickListener { + navController.navigate(R.id.action_SettingsFragment_to_SettingsAdvancedFragment) } } } - // Function to handle setting action and updating UI - private fun handleSwipeAction(context: Context, swipe: Constants.Swipe, action: Constants.Action, binding: FragmentSettingsBinding) { - preferenceViewModel.setSwipeAction(swipe, action) - - when (action) { - Constants.Action.OpenApp -> { - val selectedApp = when (swipe) { - Constants.Swipe.DoubleTap -> context.getAppNameFromPackageName(preferenceHelper.doubleTapApp) - Constants.Swipe.Up -> context.getAppNameFromPackageName(preferenceHelper.swipeUpApp) - Constants.Swipe.Down -> context.getAppNameFromPackageName(preferenceHelper.swipeDownApp) - Constants.Swipe.Left -> context.getAppNameFromPackageName(preferenceHelper.swipeLeftApp) - Constants.Swipe.Right -> context.getAppNameFromPackageName(preferenceHelper.swipeRightApp) - } - binding.apply { - when (swipe) { - Constants.Swipe.DoubleTap -> gesturesDoubleTapControl.text = "Open $selectedApp" - Constants.Swipe.Up -> gesturesSwipeUpControl.text = "Open $selectedApp" - Constants.Swipe.Down -> gesturesSwipeDownControl.text = "Open $selectedApp" - Constants.Swipe.Left -> gesturesSwipeLeftControl.text = "Open $selectedApp" - Constants.Swipe.Right -> gesturesSwipeRightControl.text = "Open $selectedApp" - } - } - showAppSelectionDialog(swipe) - } - - else -> { - Log.d("doubleTapAction", preferenceHelper.doubleTapAction.getString(context)) - binding.apply { - when (swipe) { - Constants.Swipe.DoubleTap -> gesturesDoubleTapControl.text = preferenceHelper.doubleTapAction.getString(context) - Constants.Swipe.Up -> gesturesSwipeUpControl.text = preferenceHelper.swipeUpAction.getString(context) - Constants.Swipe.Down -> gesturesSwipeDownControl.text = preferenceHelper.swipeDownAction.getString(context) - Constants.Swipe.Left -> gesturesSwipeLeftControl.text = preferenceHelper.swipeLeftAction.getString(context) - Constants.Swipe.Right -> gesturesSwipeRightControl.text = preferenceHelper.swipeRightAction.getString(context) - } - } - } - } - } - - // Extension function to set swipe action in ViewModel - private fun PreferenceViewModel.setSwipeAction(swipe: Constants.Swipe, action: Constants.Action) { - when (swipe) { - Constants.Swipe.DoubleTap -> setDoubleTap(action) - Constants.Swipe.Up -> setSwipeUp(action) - Constants.Swipe.Down -> setSwipeDown(action) - Constants.Swipe.Left -> setSwipeLeft(action) - Constants.Swipe.Right -> setSwipeRight(action) - } - } - - override fun onStop() { - super.onStop() - dismissDialogs() - } - } \ No newline at end of file diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsLookFeelFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsLookFeelFragment.kt new file mode 100644 index 00000000..e8a281e6 --- /dev/null +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsLookFeelFragment.kt @@ -0,0 +1,213 @@ +package com.github.droidworksstudio.launcher.ui.settings + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import android.os.Handler +import android.os.Looper +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.Fragment +import androidx.fragment.app.viewModels +import androidx.navigation.NavController +import androidx.navigation.fragment.findNavController +import com.github.droidworksstudio.launcher.R +import com.github.droidworksstudio.launcher.adapter.font.FontAdapter +import com.github.droidworksstudio.launcher.databinding.FragmentSettingsLookFeelBinding +import com.github.droidworksstudio.launcher.helper.AppHelper +import com.github.droidworksstudio.launcher.helper.AppReloader +import com.github.droidworksstudio.launcher.helper.PreferenceHelper +import com.github.droidworksstudio.launcher.listener.ScrollEventListener +import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AlignmentBottomSheetDialogFragment +import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.ColorBottomSheetDialogFragment +import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.PaddingBottomSheetDialogFragment +import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.TextBottomSheetDialogFragment +import com.github.droidworksstudio.launcher.utils.Constants +import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import dagger.hilt.android.AndroidEntryPoint +import javax.inject.Inject + +@AndroidEntryPoint +class SettingsLookFeelFragment : Fragment(), + ScrollEventListener { + + private var _binding: FragmentSettingsLookFeelBinding? = null + private val binding get() = _binding!! + + private val preferenceViewModel: PreferenceViewModel by viewModels() + + @Inject + lateinit var preferenceHelper: PreferenceHelper + + @Inject + lateinit var appHelper: AppHelper + + private lateinit var navController: NavController + + private lateinit var context: Context + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + // Inflate the layout for this fragment + _binding = FragmentSettingsLookFeelBinding.inflate(inflater, container, false) + _binding = binding + + return binding.root + } + + // Called after the fragment view is created + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + navController = findNavController() + // Set according to the system theme mode + appHelper.dayNightMod(requireContext(), binding.nestScrollView) + super.onViewCreated(view, savedInstanceState) + + context = requireContext() + + initializeInjectedDependencies() + observeClickListener() + + binding.apply { + miscellaneousLauncherFontsControl.text = preferenceHelper.launcherFont.getString(context) + } + } + + override fun onStop() { + super.onStop() + dismissDialogs() + } + + private fun initializeInjectedDependencies() { + binding.nestScrollView.scrollEventListener = this + + // Set initial values and listeners for switches + binding.apply { + statueBarSwitchCompat.isChecked = preferenceHelper.showStatusBar + timeSwitchCompat.isChecked = preferenceHelper.showTime + dateSwitchCompat.isChecked = preferenceHelper.showDate + batterySwitchCompat.isChecked = preferenceHelper.showBattery + dailyWordSwitchCompat.isChecked = preferenceHelper.showDailyWord + appIconsSwitchCompat.isChecked = preferenceHelper.showAppIcon + appIconDotsSwitchCompat.isChecked = preferenceHelper.showAppIconAsDots + } + + if (!binding.appIconsSwitchCompat.isChecked) { + // Disable and gray out the other setting if appIconsSwitchCompat is checked + binding.appIconDotsSwitchCompat.apply { + isEnabled = binding.appIconsSwitchCompat.isChecked + isChecked = false + } + } + } + + private fun observeClickListener() { + setupSwitchListeners() + + binding.apply { + selectAppearanceTextSize.setOnClickListener { + val bottomSheetFragment = TextBottomSheetDialogFragment() + bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") + } + + selectAppearanceColor.setOnClickListener { + val bottomSheetFragment = ColorBottomSheetDialogFragment() + bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") + } + + selectAppearanceAlignment.setOnClickListener { + val bottomSheetFragment = AlignmentBottomSheetDialogFragment() + bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") + } + + selectAppearancePadding.setOnClickListener { + val bottomSheetFragment = PaddingBottomSheetDialogFragment() + bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog") + } + + setAppWallpaper.setOnClickListener { + val intent = Intent(Intent.ACTION_SET_WALLPAPER) + startActivity(Intent.createChooser(intent, "Select Wallpaper")) + } + + miscellaneousLauncherFontsControl.setOnClickListener { + showLauncherFontDialog() + } + } + } + + private fun setupSwitchListeners() { + binding.apply { + statueBarSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowStatusBar(isChecked) + } + + dateSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowDate(isChecked) + } + + timeSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowTime(isChecked) + } + + batterySwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowBattery(isChecked) + } + + dailyWordSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowDailyWord(isChecked) + } + + appIconsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowAppIcons(isChecked) + + // Disable and gray out the other setting if appIconsSwitchCompat is checked + binding.appIconDotsSwitchCompat.isEnabled = isChecked + binding.appIconDotsSwitchCompat.isChecked = false + } + + appIconDotsSwitchCompat.setOnCheckedChangeListener { _, isChecked -> + preferenceViewModel.setShowAppIconDots(isChecked) + } + } + + } + + private var launcherFontDialog: AlertDialog? = null + + private fun showLauncherFontDialog() { + // Dismiss any existing dialog to prevent multiple dialogs open simultaneously + launcherFontDialog?.dismiss() + + // Get the array of SearchEngines enum values + val items = Constants.Fonts.entries.toTypedArray() + + // Map the enum values to their string representations + val itemStrings = items.map { it.getString(context) }.toTypedArray() + + val dialogBuilder = MaterialAlertDialogBuilder(context) + dialogBuilder.setTitle(getString(R.string.settings_select_launcher_font)) + dialogBuilder.setAdapter(FontAdapter(context, items, itemStrings)) { _, which -> + val selectedItem = items[which] + preferenceViewModel.setLauncherFont(selectedItem) + binding.miscellaneousLauncherFontsControl.text = preferenceHelper.launcherFont.name + + // Delay the restart slightly to ensure preferences are saved + Handler(Looper.getMainLooper()).postDelayed({ + AppReloader.restartApp(context) + }, 500) // Delay in milliseconds (e.g., 500ms) + } + + // Assign the created dialog to launcherFontDialog + launcherFontDialog = dialogBuilder.create() + launcherFontDialog?.show() + } + + private fun dismissDialogs() { + launcherFontDialog?.dismiss() + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_advanced.xml b/app/src/main/res/drawable/ic_advanced.xml new file mode 100644 index 00000000..dbefacfb --- /dev/null +++ b/app/src/main/res/drawable/ic_advanced.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_app_info.xml b/app/src/main/res/drawable/ic_app_info.xml new file mode 100644 index 00000000..62dfafbe --- /dev/null +++ b/app/src/main/res/drawable/ic_app_info.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_backup_restore.xml b/app/src/main/res/drawable/ic_backup_restore.xml new file mode 100644 index 00000000..7d1bca4e --- /dev/null +++ b/app/src/main/res/drawable/ic_backup_restore.xml @@ -0,0 +1,63 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_change_default_launcher.xml b/app/src/main/res/drawable/ic_change_default_launcher.xml new file mode 100644 index 00000000..3c71a8fc --- /dev/null +++ b/app/src/main/res/drawable/ic_change_default_launcher.xml @@ -0,0 +1,49 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_community.xml b/app/src/main/res/drawable/ic_community.xml new file mode 100644 index 00000000..9a32a932 --- /dev/null +++ b/app/src/main/res/drawable/ic_community.xml @@ -0,0 +1,28 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_favorite.xml b/app/src/main/res/drawable/ic_favorite.xml new file mode 100644 index 00000000..00cc5911 --- /dev/null +++ b/app/src/main/res/drawable/ic_favorite.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_feature.xml b/app/src/main/res/drawable/ic_feature.xml new file mode 100644 index 00000000..7446c7f0 --- /dev/null +++ b/app/src/main/res/drawable/ic_feature.xml @@ -0,0 +1,14 @@ + + + diff --git a/app/src/main/res/drawable/ic_help_feedback.xml b/app/src/main/res/drawable/ic_help_feedback.xml new file mode 100644 index 00000000..bb44996e --- /dev/null +++ b/app/src/main/res/drawable/ic_help_feedback.xml @@ -0,0 +1,17 @@ + + + + diff --git a/app/src/main/res/drawable/ic_hidden.xml b/app/src/main/res/drawable/ic_hidden.xml new file mode 100644 index 00000000..84ed2964 --- /dev/null +++ b/app/src/main/res/drawable/ic_hidden.xml @@ -0,0 +1,14 @@ + + + diff --git a/app/src/main/res/drawable/ic_look_feel.xml b/app/src/main/res/drawable/ic_look_feel.xml new file mode 100644 index 00000000..46427734 --- /dev/null +++ b/app/src/main/res/drawable/ic_look_feel.xml @@ -0,0 +1,23 @@ + + + + diff --git a/app/src/main/res/drawable/ic_restart.xml b/app/src/main/res/drawable/ic_restart.xml new file mode 100644 index 00000000..a432a35e --- /dev/null +++ b/app/src/main/res/drawable/ic_restart.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_share_app.xml b/app/src/main/res/drawable/ic_share_app.xml new file mode 100644 index 00000000..bfa99c0b --- /dev/null +++ b/app/src/main/res/drawable/ic_share_app.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/icon_refresh.xml b/app/src/main/res/drawable/icon_refresh.xml index 04abe48a..02a5b9df 100644 --- a/app/src/main/res/drawable/icon_refresh.xml +++ b/app/src/main/res/drawable/icon_refresh.xml @@ -5,6 +5,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0"> \ No newline at end of file diff --git a/app/src/main/res/layout/bottom_sheet_alignment_dialog.xml b/app/src/main/res/layout/bottom_sheet_alignment_dialog.xml index 42f0c535..2ee2b8cc 100644 --- a/app/src/main/res/layout/bottom_sheet_alignment_dialog.xml +++ b/app/src/main/res/layout/bottom_sheet_alignment_dialog.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginVertical="12dp" - android:text="@string/bottom_alignment_star" + android:text="@string/bottom_alignment_start" android:textSize="@dimen/text_large"> diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 818af1c1..410c3656 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -6,12 +6,6 @@ android:layout_height="match_parent" tools:context=".ui.settings.SettingsFragment"> - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:textSize="24sp" + android:textStyle="bold" /> - + android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:paddingVertical="16dp"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:orientation="vertical"> - - - - - - - - - + android:text="@string/settings_features_title" + android:textSize="18sp" /> - - - + android:text="@string/settings_features_description" + android:textSize="14sp" /> + + - - - - - - - + - + - - - + android:orientation="vertical"> - + android:text="@string/settings_look_feel_title" + android:textSize="18sp" /> - - - - - - - - - - - + android:text="@string/settings_look_feel_description" + android:textSize="14sp" /> + + - - - - - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingVertical="16dp"> - + - + android:orientation="vertical"> - - - - - - - - - - - + android:text="@string/favorite_apps" + android:textSize="18sp" /> + + - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingVertical="16dp"> - + - - - + android:orientation="vertical"> - - - - - - - - - - - + android:text="@string/hidden_apps" + android:textSize="18sp" /> + + - - - + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingVertical="16dp"> + - + android:orientation="vertical"> - - - - - - - - - - - - - + android:text="@string/settings_advanced_title" + android:textSize="18sp" /> + + + + - - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_settings_advanced.xml b/app/src/main/res/layout/fragment_settings_advanced.xml new file mode 100644 index 00000000..6b03bf04 --- /dev/null +++ b/app/src/main/res/layout/fragment_settings_advanced.xml @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_settings_features.xml b/app/src/main/res/layout/fragment_settings_features.xml new file mode 100644 index 00000000..f53fc7c8 --- /dev/null +++ b/app/src/main/res/layout/fragment_settings_features.xml @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_settings_look_feel.xml b/app/src/main/res/layout/fragment_settings_look_feel.xml new file mode 100644 index 00000000..03334bc1 --- /dev/null +++ b/app/src/main/res/layout/fragment_settings_look_feel.xml @@ -0,0 +1,436 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index c401227d..4a690ab3 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -30,7 +30,7 @@ + + + + @@ -55,10 +67,16 @@ + android:id="@+id/SettingsFeaturesFragment" + android:name="com.github.droidworksstudio.launcher.ui.settings.SettingsFeaturesFragment" + android:label="@string/settings_fragment_label" + tools:layout="@layout/fragment_settings_features" /> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 6ad1889c..b4ec72d9 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -1,8 +1,5 @@ - #FF03DAC5 - #FF018786 - #FFFFFFFF #56A1E6 @@ -27,4 +24,7 @@ #4CAF50 #AF684C #AF4C4C + + #33FFFFFF + #B3FFFFFF \ No newline at end of file diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 44e1a110..ebc69852 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -7,12 +7,12 @@ true - @color/teal_700 - @color/teal_200 + @color/icon_700 + @color/icon_200 ?attr/color - @color/teal_200 - @color/teal_700 + @color/icon_200 + @color/icon_700 @color/white @color/black @color/whiteTrans50 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6ad1889c..9955697a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,8 +1,5 @@ - #FF03DAC5 - #FF018786 - #FFFFFFFF #56A1E6 @@ -27,4 +24,7 @@ #4CAF50 #AF684C #AF4C4C + + #33000000 + #B3000000 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce1c4fb4..70707018 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,59 @@ + + Favorite Apps + Hidden Apps + + Settings - Set as default launcher + + + Launcher Settings + + Features + Improve your productivity. + + Look and Feel + Give your home screen a personal touch. + + Advanced + + + Look And Feel + + + Features + + + Advanced Settings + + App Info + %1$s + + Change Default Launcher + + Restart Launcher + Have you tried turning it on and off? + + Backup/Restore + Please be careful what you wish for? + + Backup Preferences + Restore Preferences + Clear Preferences + + Clear Preferences + Are you sure you want to do this? + Yes + No + + Help and Feedback + + Community Support + + Share Application + Elevate your experience with %1$s! Get it now on fDroid and see what everyone is talking about!\n + Home Fragment Draw Fragment @@ -30,19 +82,13 @@ App Info Uninstall App - Launcher Settings - %1$s Version: %2$s Widgets Settings Display Behavior Appearance - Date Style - Time Style - App Manage Gestures Miscellaneous - Backups Others Show Status Bar @@ -62,14 +108,9 @@ Padding Custom Wallpaper - Date Alignment - Time Alignment - Home App Alignment - Size Color Alignment - Padding Date\u0020:\u0020 Time\u0020:\u0020 App\u0020:\u0020 @@ -79,10 +120,6 @@ Widget Background\u0020:\u0020 Widget Text\u0020:\u0020 - Favorite Apps - Hidden Apps - - Select Wallpaper Double Tap Swipe Up Swipe Down @@ -95,14 +132,6 @@ Select a Font Family Font Family - Share - Feedback - Github - - Backup Preferences - Clear Preferences - Restore Preferences - Preferences backed up. Preferences restored. Restarting. @@ -132,7 +161,7 @@ Authentication Failed Authentication Error: %1$s(code %2$d) - Star + Star Center End @@ -141,10 +170,9 @@ Disable Easy Launcher Actions Service - Please turn on accessibility service to use double tap to lock feature in Easy Launcher.\n\nThis permission is used only to turn off your screen.Our accessibility service does not collect or share any data. - Easy launcher promises to use lock screen permission responsibly. Easy launcher does not collect or share any data. + Please turn on accessibility service to use double tap to lock feature in Easy Launcher.\n\nThis permission is used only to turn off your screen. Our + accessibility service does not collect or share any data. - Search Engine Default Google Yahoo diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8971ffb0..9410d75f 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,12 +7,12 @@ true - @color/teal_700 - @color/teal_200 + @color/icon_700 + @color/icon_200 ?attr/color - @color/teal_200 - @color/teal_700 + @color/icon_200 + @color/icon_700 @color/black @color/white @color/whiteTrans50 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 012f5cdc..f583a031 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Mar 20 20:10:24 CST 2023 +#Sat Sep 07 12:40:08 BST 2024 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists