chore: migrated preferences to eu.jonahbauer.android.preference

This commit is contained in:
Josia Pietsch 2024-09-09 21:23:01 +02:00
parent 5ab54ea1cb
commit 870ee56b88
Signed by: jrpie
GPG key ID: E70B571D66986A2D
27 changed files with 446 additions and 825 deletions

View file

@ -63,6 +63,10 @@ dependencies {
implementation 'androidx.core:core-ktx:1.13.1' implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "eu.jonahbauer:android-preference-annotations:1.1.2"
implementation 'androidx.preference:preference-ktx:1.2.1'
//kapt "eu.jonahbauer:android-preference-annotations:1.1.2"
//annotationProcessor "eu.jonahbauer:android-preference-annotations:1.1.2"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'

View file

@ -10,6 +10,7 @@
<application <application
android:name=".Application"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"

View file

@ -0,0 +1,15 @@
package de.jrpie.android.launcher
import android.content.Context
class Application: android.app.Application() {
override fun onCreate() {
super.onCreate()
val preferences = getSharedPreferences(
this.getString(R.string.preference_file_key),
Context.MODE_PRIVATE
)
LauncherPreferences.init(preferences, this.resources)
}
}

View file

@ -6,7 +6,6 @@ import android.app.Service
import android.app.role.RoleManager import android.app.role.RoleManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.ApplicationInfo import android.content.pm.ApplicationInfo
import android.content.pm.LauncherActivityInfo import android.content.pm.LauncherActivityInfo
import android.content.pm.LauncherApps import android.content.pm.LauncherApps
@ -48,30 +47,6 @@ import de.jrpie.android.launcher.settings.SettingsActivity
import de.jrpie.android.launcher.tutorial.TutorialActivity import de.jrpie.android.launcher.tutorial.TutorialActivity
/* Preference Key Constants */
const val PREF_DOMINANT = "custom_dominant"
const val PREF_VIBRANT = "custom_vibrant"
const val PREF_THEME = "theme"
const val PREF_SCREEN_TIMEOUT_DISABLED = "disableTimeout"
const val PREF_SCREEN_FULLSCREEN = "useFullScreen"
const val PREF_DATE_LOCALIZED = "dateLocalized"
const val PREF_DATE_VISIBLE = "dateVisible"
const val PREF_TIME_VISIBLE = "timeVisible"
const val PREF_DATE_TIME_FLIP = "dateTimeFlip"
const val PREF_DOUBLE_ACTIONS_ENABLED = "enableDoubleActions"
const val PREF_EDGE_ACTIONS_ENABLED = "enableEdgeActions"
const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch"
const val PREF_SEARCH_AUTO_KEYBOARD = "searchAutoKeyboard"
const val PREF_STARTED = "startedBefore"
const val PREF_STARTED_TIME = "firstStartup"
const val PREF_VERSION = "version"
const val INVALID_USER = -1 const val INVALID_USER = -1
/* Objects used by multiple activities */ /* Objects used by multiple activities */
@ -80,13 +55,11 @@ val appsList: MutableList<AppInfo> = ArrayList()
/* Variables containing settings */ /* Variables containing settings */
val displayMetrics = DisplayMetrics() val displayMetrics = DisplayMetrics()
var dominantColor = 0
var vibrantColor = 0
/* REQUEST CODES */ /* REQUEST CODES */
const val REQUEST_CHOOSE_APP = 1 const val REQUEST_CHOOSE_APP = 1
const val REQUEST_UNINSTALL = 2 const val REQUEST_CHOOSE_APP_FROM_FAVORITES = 2
const val REQUEST_UNINSTALL = 3
const val REQUEST_SET_DEFAULT_HOME = 42 const val REQUEST_SET_DEFAULT_HOME = 42
@ -109,13 +82,6 @@ fun View.blink(
}) })
} }
fun getPreferences(context: Context): SharedPreferences{
return context.getSharedPreferences(
context.getString(R.string.preference_file_key),
Context.MODE_PRIVATE
)
}
fun setDefaultHomeScreen(context: Context, checkDefault: Boolean = false) { fun setDefaultHomeScreen(context: Context, checkDefault: Boolean = false) {
if (checkDefault if (checkDefault
@ -223,16 +189,16 @@ fun audioVolumeDown(activity: Activity) {
) )
} }
fun expandNotificationsPanel(activity: Activity) { fun expandNotificationsPanel(context: Context) {
/* https://stackoverflow.com/a/15582509 */ /* https://stackoverflow.com/a/15582509 */
try { try {
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
val statusBarService: Any? = activity.getSystemService("statusbar") val statusBarService: Any? = context.getSystemService("statusbar")
val statusBarManager = Class.forName("android.app.StatusBarManager") val statusBarManager = Class.forName("android.app.StatusBarManager")
val showStatusBar = statusBarManager.getMethod("expandNotificationsPanel") val showStatusBar = statusBarManager.getMethod("expandNotificationsPanel")
showStatusBar.invoke(statusBarService) showStatusBar.invoke(statusBarService)
} catch (e: Exception) { } catch (e: Exception) {
Toast.makeText(activity, activity.getString(R.string.alert_cant_expand_notifications_panel), Toast.LENGTH_LONG).show() Toast.makeText(context, context.getString(R.string.alert_cant_expand_notifications_panel), Toast.LENGTH_LONG).show()
} }
} }
@ -315,49 +281,6 @@ fun openNewTabWindow(urls: String, context: Context) {
context.startActivity(intents) context.startActivity(intents)
} }
/* Settings related functions */
fun getSavedTheme(context: Context) : String {
return getPreferences(context).getString(PREF_THEME, "finn").toString()
}
fun saveTheme(context: Context, themeName: String) : String {
getPreferences(context).edit()
.putString(PREF_THEME, themeName)
.apply()
return themeName
}
fun resetToDefaultTheme(activity: Activity) {
dominantColor = activity.resources.getColor(R.color.finnmglasTheme_background_color)
vibrantColor = activity.resources.getColor(R.color.finnmglasTheme_accent_color)
getPreferences(activity).edit()
.putInt(PREF_DOMINANT, dominantColor)
.putInt(PREF_VIBRANT, vibrantColor)
.apply()
saveTheme(activity,"finn")
loadSettings(activity)
activity.recreate()
}
fun resetToDarkTheme(activity: Activity) {
dominantColor = activity.resources.getColor(R.color.darkTheme_background_color)
vibrantColor = activity.resources.getColor(R.color.darkTheme_accent_color)
getPreferences(activity).edit()
.putInt(PREF_DOMINANT, dominantColor)
.putInt(PREF_VIBRANT, vibrantColor)
.apply()
saveTheme(activity,"dark")
activity.recreate()
}
fun openAppSettings(packageName: String, user: Int?, context: Context, sourceBounds: Rect? = null, opts: Bundle? = null) { fun openAppSettings(packageName: String, user: Int?, context: Context, sourceBounds: Rect? = null, opts: Bundle? = null) {
val launcherApps = context.getSystemService(Service.LAUNCHER_APPS_SERVICE) as LauncherApps val launcherApps = context.getSystemService(Service.LAUNCHER_APPS_SERVICE) as LauncherApps
@ -436,45 +359,10 @@ fun loadApps(packageManager: PackageManager, context: Context) {
appsList.addAll(loadList) appsList.addAll(loadList)
} }
fun loadSettings(context: Context) {
val preferences = getPreferences(context)
dominantColor = preferences.getInt(PREF_DOMINANT, 0)
vibrantColor = preferences.getInt(PREF_VIBRANT, 0)
}
fun resetSettings(context: Context) {
val editor = getPreferences(context).edit()
// set default theme
dominantColor = context.resources.getColor(R.color.finnmglasTheme_background_color)
vibrantColor = context.resources.getColor(R.color.finnmglasTheme_accent_color)
editor
.putInt(PREF_DOMINANT, dominantColor)
.putInt(PREF_VIBRANT, vibrantColor)
.putString(PREF_THEME, "finn")
.putBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false)
.putBoolean(PREF_SEARCH_AUTO_LAUNCH, false)
.putBoolean(PREF_DATE_VISIBLE, true)
.putBoolean(PREF_TIME_VISIBLE, true)
.putBoolean(PREF_DATE_TIME_FLIP, false)
.putBoolean(PREF_DATE_LOCALIZED, false)
.putBoolean(PREF_SCREEN_FULLSCREEN, true)
.putBoolean(PREF_DOUBLE_ACTIONS_ENABLED, true)
.putBoolean(PREF_EDGE_ACTIONS_ENABLED, true)
Gesture.values().forEach { editor.putString(it.id, it.pickDefaultApp(context)) }
editor.apply()
}
fun setWindowFlags(window: Window) { fun setWindowFlags(window: Window) {
window.setFlags(0, 0) // clear flags window.setFlags(0, 0) // clear flags
val preferences = getPreferences(window.context)
// Display notification bar // Display notification bar
if (preferences.getBoolean(PREF_SCREEN_FULLSCREEN, true)) if (LauncherPreferences.display().fullScreen())
window.setFlags( window.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN WindowManager.LayoutParams.FLAG_FULLSCREEN
@ -482,7 +370,7 @@ fun setWindowFlags(window: Window) {
else window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) else window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
// Screen Timeout // Screen Timeout
if (preferences.getBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false)) if (LauncherPreferences.display().screenTimeoutDisabled())
window.setFlags( window.setFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
@ -499,8 +387,6 @@ fun saveListActivityChoice(context: Context, data: Intent?) {
val forGesture = data?.getStringExtra("forGesture") ?: return val forGesture = data?.getStringExtra("forGesture") ?: return
Gesture.byId(forGesture)?.setApp(context, value.toString(), user) Gesture.byId(forGesture)?.setApp(context, value.toString(), user)
loadSettings(context)
} }
// Taken from https://stackoverflow.com/a/50743764/12787264 // Taken from https://stackoverflow.com/a/50743764/12787264
@ -512,7 +398,6 @@ fun openSoftKeyboard(context: Context, view: View) {
} }
/* Bitmaps */ /* Bitmaps */
fun setButtonColor(btn: Button, color: Int) { fun setButtonColor(btn: Button, color: Int) {
if (Build.VERSION.SDK_INT >= 29) if (Build.VERSION.SDK_INT >= 29)
btn.background.colorFilter = BlendModeColorFilter(color, BlendMode.MULTIPLY) btn.background.colorFilter = BlendModeColorFilter(color, BlendMode.MULTIPLY)

View file

@ -42,7 +42,7 @@ enum class Gesture (val id: String, private val labelResource: Int,
} }
fun getApp(context: Context): Pair<String, Int?> { fun getApp(context: Context): Pair<String, Int?> {
val preferences = getPreferences(context) val preferences = LauncherPreferences.getSharedPreferences()
var packageName = preferences.getString(this.id, "")!! var packageName = preferences.getString(this.id, "")!!
var u: Int? = preferences.getInt(this.id + "_user", INVALID_USER) var u: Int? = preferences.getInt(this.id + "_user", INVALID_USER)
u = if(u == INVALID_USER) null else u u = if(u == INVALID_USER) null else u
@ -50,18 +50,18 @@ enum class Gesture (val id: String, private val labelResource: Int,
} }
fun removeApp(context: Context) { fun removeApp(context: Context) {
getPreferences(context).edit() LauncherPreferences.getSharedPreferences().edit()
.putString(this.id, "") // clear it .putString(this.id, "") // clear it
.apply() .apply()
} }
fun setApp(context: Context, app: String, user: Int?) { fun setApp(context: Context, app: String, user: Int?) {
getPreferences(context).edit() LauncherPreferences.getSharedPreferences().edit()
.putString(this.id, app) .putString(this.id, app)
.apply() .apply()
val u = user?: INVALID_USER val u = user?: INVALID_USER
getPreferences(context).edit() LauncherPreferences.getSharedPreferences().edit()
.putInt(this.id + "_user", u) .putInt(this.id + "_user", u)
.apply() .apply()
} }

View file

@ -7,6 +7,7 @@ import android.view.GestureDetector
import android.view.KeyEvent import android.view.KeyEvent
import android.view.MotionEvent import android.view.MotionEvent
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.AppLaunchChecker
import androidx.core.view.GestureDetectorCompat import androidx.core.view.GestureDetectorCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import de.jrpie.android.launcher.BuildConfig.VERSION_NAME import de.jrpie.android.launcher.BuildConfig.VERSION_NAME
@ -50,38 +51,14 @@ class HomeActivity: UIObject, AppCompatActivity(),
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val preferences = getPreferences(this)
windowManager.defaultDisplay.getMetrics(displayMetrics)
loadSettings(this)
// First time opening the app: show Tutorial, else: check versions // First time opening the app: show Tutorial, else: check versions
if (!preferences.getBoolean(PREF_STARTED, false)) if (!LauncherPreferences.internal().started()) {
LauncherPreferences.internal().started(true)
startActivity(Intent(this, TutorialActivity::class.java)) startActivity(Intent(this, TutorialActivity::class.java))
else when (preferences.getString(PREF_VERSION, "")) { } else {
// Check versions, make sure transitions between versions go well migrateToNewVersion(this)
VERSION_NAME -> { /* the version installed and used previously are the same */ }
"" -> { /* The version used before was pre- v1.3.0,
as version tracking started then */
/*
* before, the dominant and vibrant color of the `finn` and `dark` theme
* were not stored anywhere. Now they have to be stored:
* -> we just reset them using newly implemented functions
*/
when (getSavedTheme(this)) {
"finn" -> resetToDefaultTheme(this)
"dark" -> resetToDarkTheme(this)
}
preferences.edit()
.putString(PREF_VERSION, VERSION_NAME) // save new version
.apply()
// show the new tutorial
startActivity(Intent(this, TutorialActivity::class.java))
}
} }
// Preload apps to speed up the Apps Recycler // Preload apps to speed up the Apps Recycler
@ -98,21 +75,18 @@ class HomeActivity: UIObject, AppCompatActivity(),
mDetector = GestureDetectorCompat(this, this) mDetector = GestureDetectorCompat(this, this)
mDetector.setOnDoubleTapListener(this) mDetector.setOnDoubleTapListener(this)
// for if the settings changed
loadSettings(this)
super<UIObject>.onStart() super<UIObject>.onStart()
} }
private fun updateClock() { private fun updateClock() {
clockTimer?.cancel() clockTimer.cancel()
val preferences = getPreferences(this)
val locale = Locale.getDefault() val locale = Locale.getDefault()
val dateVisible = preferences.getBoolean(PREF_DATE_VISIBLE, true) val dateVisible = LauncherPreferences.clock().dateVisible()
val timeVisible = preferences.getBoolean(PREF_TIME_VISIBLE, true) val timeVisible = LauncherPreferences.clock().timeVisible()
var dateFMT = "yyyy-MM-dd" var dateFMT = "yyyy-MM-dd"
var timeFMT = "HH:mm:ss" var timeFMT = "HH:mm:ss"
if (preferences.getBoolean(PREF_DATE_LOCALIZED, false)) { if (LauncherPreferences.clock().localized()) {
dateFMT = android.text.format.DateFormat.getBestDateTimePattern(locale, dateFMT) dateFMT = android.text.format.DateFormat.getBestDateTimePattern(locale, dateFMT)
timeFMT = android.text.format.DateFormat.getBestDateTimePattern(locale, timeFMT) timeFMT = android.text.format.DateFormat.getBestDateTimePattern(locale, timeFMT)
} }
@ -122,7 +96,7 @@ class HomeActivity: UIObject, AppCompatActivity(),
var upperVisible = dateVisible var upperVisible = dateVisible
var lowerVisible = timeVisible var lowerVisible = timeVisible
if(preferences.getBoolean(PREF_DATE_TIME_FLIP, false)) { if(LauncherPreferences.clock().flipDateTime()) {
upperFormat = lowerFormat.also { lowerFormat = upperFormat } upperFormat = lowerFormat.also { lowerFormat = upperFormat }
upperVisible = lowerVisible.also { lowerVisible = upperVisible } upperVisible = lowerVisible.also { lowerVisible = upperVisible }
} }
@ -176,10 +150,8 @@ class HomeActivity: UIObject, AppCompatActivity(),
val diffX = e1.x - e2.x val diffX = e1.x - e2.x
val diffY = e1.y - e2.y val diffY = e1.y - e2.y
val preferences = getPreferences(this) val doubleActions = LauncherPreferences.enabled_gestures().doubleSwipe()
val edgeActions = LauncherPreferences.enabled_gestures().edgeSwipe()
val doubleActions = preferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
val edgeActions = preferences.getBoolean(PREF_EDGE_ACTIONS_ENABLED, false)
val edgeStrictness = 0.15 val edgeStrictness = 0.15
var gesture = if(abs(diffX) > abs(diffY)) { // horizontal swipe var gesture = if(abs(diffX) > abs(diffY)) { // horizontal swipe
@ -250,9 +222,8 @@ class HomeActivity: UIObject, AppCompatActivity(),
override fun setOnClicks() { override fun setOnClicks() {
val preferences = getPreferences(this)
binding.homeUpperView.setOnClickListener { binding.homeUpperView.setOnClickListener {
if(preferences.getBoolean(PREF_DATE_TIME_FLIP, false)) { if(LauncherPreferences.clock().flipDateTime()) {
Gesture.TIME(this) Gesture.TIME(this)
} else { } else {
Gesture.DATE(this) Gesture.DATE(this)
@ -260,7 +231,7 @@ class HomeActivity: UIObject, AppCompatActivity(),
} }
binding.homeLowerView.setOnClickListener { binding.homeLowerView.setOnClickListener {
if(preferences.getBoolean(PREF_DATE_TIME_FLIP, false)) { if(LauncherPreferences.clock().flipDateTime()) {
Gesture.DATE(this) Gesture.DATE(this)
} else { } else {
Gesture.TIME(this) Gesture.TIME(this)

View file

@ -0,0 +1,48 @@
package de.jrpie.android.launcher;
import eu.jonahbauer.android.preference.annotations.Preference;
import eu.jonahbauer.android.preference.annotations.PreferenceGroup;
import eu.jonahbauer.android.preference.annotations.Preferences;
@Preferences(
name = "de.jrpie.android.launcher.LauncherPreferences",
makeFile = true,
r = R.class,
value = {
@PreferenceGroup(name = "internal", prefix = "settings_internal_", suffix = "_key", value = {
@Preference(name = "started", type = boolean.class, defaultValue = "false"),
@Preference(name = "started_time", type = long.class),
@Preference(name = "version_code", type = int.class, defaultValue = "-1"),
}),
@PreferenceGroup( name = "gestures", prefix = "settings_gesture_", suffix = "_key", value = {
}),
@PreferenceGroup(name = "general", prefix = "settings_general_", suffix = "_key", value = {
@Preference(name = "choose_home_screen", type = void.class)
}),
@PreferenceGroup(name = "theme", prefix = "settings_theme_", suffix = "_key", value = {
@Preference(name = "wallpaper", type = void.class),
@Preference(name = "theme", type = String.class), // TODO: change to enum
@Preference(name = "dominant", type = int.class),
@Preference(name = "vibrant", type = int.class),
}),
@PreferenceGroup(name = "clock", prefix = "settings_clock_", suffix = "_key", value = {
@Preference(name = "date_visible", type = boolean.class, defaultValue = "true"),
@Preference(name = "time_visible", type = boolean.class, defaultValue = "true"),
@Preference(name = "flip_date_time", type = boolean.class, defaultValue = "false"),
@Preference(name = "localized", type = boolean.class, defaultValue = "false"),
}),
@PreferenceGroup(name = "display", prefix = "settings_display_", suffix = "_key", value = {
@Preference(name = "screen_timeout_disabled", type = boolean.class, defaultValue = "false"),
@Preference(name = "full_screen", type = boolean.class, defaultValue = "true"),
}),
@PreferenceGroup( name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
@Preference(name = "search_auto_open_keyboard", type = boolean.class, defaultValue = "true"),
}),
@PreferenceGroup(name = "enabled_gestures", prefix = "settings_enabled_gestures_", suffix = "_key", value = {
@Preference(name = "double_swipe", type = boolean.class, defaultValue = "true"),
@Preference(name = "edge_swipe", type = boolean.class, defaultValue = "true"),
}),
})
public final class LauncherPreferences$Config {
}

View file

@ -1,2 +1,72 @@
package de.jrpie.android.launcher package de.jrpie.android.launcher
import android.app.Activity
import android.content.Context
import android.content.Intent
import de.jrpie.android.launcher.BuildConfig.VERSION_CODE
import de.jrpie.android.launcher.tutorial.TutorialActivity
fun migrateToNewVersion(activity: Activity) {
when (LauncherPreferences.internal().versionCode()) {
// Check versions, make sure transitions between versions go well
VERSION_CODE -> { /* the version installed and used previously are the same */ }
21,22,23 -> {
// TODO
} else -> { /* The version used before was pre- v1.3.0,
as version tracking started then */
/*
* before, the dominant and vibrant color of the `finn` and `dark` theme
* were not stored anywhere. Now they have to be stored:
* -> we just reset them using newly implemented functions
*/
when (LauncherPreferences.theme().theme()) {
"finn" -> resetToDefaultTheme(activity)
"dark" -> resetToDarkTheme(activity)
}
LauncherPreferences.internal().versionCode(VERSION_CODE)
// show the new tutorial
activity.startActivity(Intent(activity, TutorialActivity::class.java))
}
}
}
fun resetSettings(context: Context) {
val editor = LauncherPreferences.getSharedPreferences().edit()
Gesture.values().forEach { editor.putString(it.id, it.pickDefaultApp(context)) }
editor.apply()
// set default theme
val dominantColor = context.resources.getColor(R.color.finnmglasTheme_background_color)
val vibrantColor = context.resources.getColor(R.color.finnmglasTheme_accent_color)
LauncherPreferences.theme().dominant(dominantColor)
LauncherPreferences.theme().vibrant(vibrantColor)
}
fun resetToDefaultTheme(activity: Activity) {
val dominantColor = activity.resources.getColor(R.color.finnmglasTheme_background_color)
val vibrantColor = activity.resources.getColor(R.color.finnmglasTheme_accent_color)
LauncherPreferences.theme().dominant(dominantColor)
LauncherPreferences.theme().vibrant(vibrantColor)
activity.recreate()
}
fun resetToDarkTheme(activity: Activity) {
val dominantColor = activity.resources.getColor(R.color.darkTheme_background_color)
val vibrantColor = activity.resources.getColor(R.color.darkTheme_accent_color)
LauncherPreferences.theme().dominant(dominantColor)
LauncherPreferences.theme().vibrant(vibrantColor)
activity.recreate()
}

View file

@ -14,16 +14,14 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import de.jrpie.android.launcher.PREF_SCREEN_FULLSCREEN import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.REQUEST_UNINSTALL import de.jrpie.android.launcher.REQUEST_UNINSTALL
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.databinding.ListBinding import de.jrpie.android.launcher.databinding.ListBinding
import de.jrpie.android.launcher.getPreferences
import de.jrpie.android.launcher.list.apps.ListFragmentApps import de.jrpie.android.launcher.list.apps.ListFragmentApps
import de.jrpie.android.launcher.list.other.LauncherAction import de.jrpie.android.launcher.list.other.LauncherAction
import de.jrpie.android.launcher.list.other.ListFragmentOther import de.jrpie.android.launcher.list.other.ListFragmentOther
import de.jrpie.android.launcher.vibrantColor
// TODO: Better solution for this intercommunication functionality (used in list-fragments) // TODO: Better solution for this intercommunication functionality (used in list-fragments)
@ -67,7 +65,7 @@ class ListActivity : AppCompatActivity(), UIObject {
binding.listContainer.context.resources.displayMetrics.heightPixels binding.listContainer.context.resources.displayMetrics.heightPixels
val diff = height - r.bottom val diff = height - r.bottom
if (diff != 0 && if (diff != 0 &&
getPreferences(this).getBoolean(PREF_SCREEN_FULLSCREEN, true)) { LauncherPreferences.display().fullScreen()) {
if (binding.listContainer.paddingBottom !== diff) { if (binding.listContainer.paddingBottom !== diff) {
binding.listContainer.setPadding(0, 0, 0, diff) binding.listContainer.setPadding(0, 0, 0, diff)
} }
@ -107,7 +105,7 @@ class ListActivity : AppCompatActivity(), UIObject {
override fun applyTheme() { override fun applyTheme() {
// list_close.setTextColor(vibrantColor) // list_close.setTextColor(vibrantColor)
binding.listTabs.setSelectedTabIndicatorColor(vibrantColor) binding.listTabs.setSelectedTabIndicatorColor(LauncherPreferences.theme().vibrant())
} }
override fun setOnClicks() { override fun setOnClicks() {

View file

@ -12,12 +12,10 @@ import android.widget.ImageView
import android.widget.PopupMenu import android.widget.PopupMenu
import android.widget.TextView import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_LAUNCH import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.REQUEST_CHOOSE_APP import de.jrpie.android.launcher.REQUEST_CHOOSE_APP
import de.jrpie.android.launcher.appsList import de.jrpie.android.launcher.appsList
import de.jrpie.android.launcher.getPreferences
import de.jrpie.android.launcher.getSavedTheme
import de.jrpie.android.launcher.launch import de.jrpie.android.launcher.launch
import de.jrpie.android.launcher.launchApp import de.jrpie.android.launcher.launchApp
import de.jrpie.android.launcher.list.ListActivity import de.jrpie.android.launcher.list.ListActivity
@ -68,7 +66,7 @@ class AppsRecyclerAdapter(val activity: Activity,
viewHolder.textView.text = appLabel viewHolder.textView.text = appLabel
viewHolder.img.setImageDrawable(appIcon) viewHolder.img.setImageDrawable(appIcon)
if (getSavedTheme(activity) == "dark") transformGrayscale( if (LauncherPreferences.theme().theme() == "dark") transformGrayscale(
viewHolder.img viewHolder.img
) )
@ -188,11 +186,8 @@ class AppsRecyclerAdapter(val activity: Activity,
appsListDisplayed.addAll(appsSecondary) appsListDisplayed.addAll(appsSecondary)
} }
// Launch apps automatically if only one result is found and the user wants it
// Disabled at the moment. The Setting 'PREF_SEARCH_AUTO_LAUNCH' may be
// modifiable at some later point.
if (appsListDisplayed.size == 1 && intention == ListActivity.ListActivityIntention.VIEW if (appsListDisplayed.size == 1 && intention == ListActivity.ListActivityIntention.VIEW
&& getPreferences(activity).getBoolean(PREF_SEARCH_AUTO_LAUNCH, false)) { && LauncherPreferences.functionality().searchAutoLaunch()) {
val info = appsListDisplayed[0] val info = appsListDisplayed[0]
launch(info.packageName.toString(), info.user, activity) launch(info.packageName.toString(), info.user, activity)

View file

@ -6,10 +6,9 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_KEYBOARD import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.databinding.ListAppsBinding import de.jrpie.android.launcher.databinding.ListAppsBinding
import de.jrpie.android.launcher.getPreferences
import de.jrpie.android.launcher.list.ListActivity import de.jrpie.android.launcher.list.ListActivity
import de.jrpie.android.launcher.list.forGesture import de.jrpie.android.launcher.list.forGesture
import de.jrpie.android.launcher.list.intention import de.jrpie.android.launcher.list.intention
@ -70,8 +69,7 @@ class ListFragmentApps : Fragment(), UIObject {
}) })
if (intention == ListActivity.ListActivityIntention.VIEW if (intention == ListActivity.ListActivityIntention.VIEW
&& getPreferences(requireContext()) && LauncherPreferences.functionality().searchAutoOpenKeyboard()){
.getBoolean(PREF_SEARCH_AUTO_KEYBOARD, true)) {
openSoftKeyboard(requireContext(), binding.listAppsSearchview) openSoftKeyboard(requireContext(), binding.listAppsSearchview)
} }
} }

View file

@ -51,7 +51,7 @@ class SettingsActivity: AppCompatActivity(), UIObject {
override fun applyTheme() { override fun applyTheme() {
//settings_system.setTextColor(vibrantColor) //settings_system.setTextColor(vibrantColor)
//settings_close.setTextColor(vibrantColor) //settings_close.setTextColor(vibrantColor)
binding.settingsTabs.setSelectedTabIndicatorColor(vibrantColor) binding.settingsTabs.setSelectedTabIndicatorColor(LauncherPreferences.theme().vibrant())
} }
override fun setOnClicks(){ override fun setOnClicks(){

View file

@ -8,12 +8,12 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast import android.widget.Toast
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.databinding.SettingsActionsBinding import de.jrpie.android.launcher.databinding.SettingsActionsBinding
import de.jrpie.android.launcher.list.ListActivity import de.jrpie.android.launcher.list.ListActivity
import de.jrpie.android.launcher.setButtonColor import de.jrpie.android.launcher.setButtonColor
import de.jrpie.android.launcher.vibrantColor
/** /**
@ -44,6 +44,7 @@ SettingsFragmentActions : Fragment(), UIObject {
} }
override fun applyTheme() { override fun applyTheme() {
val vibrantColor = LauncherPreferences.theme().vibrant()
setButtonColor(binding!!.settingsActionsButtonViewApps, vibrantColor) setButtonColor(binding!!.settingsActionsButtonViewApps, vibrantColor)
setButtonColor(binding!!.settingsActionsButtonInstallApps, vibrantColor) setButtonColor(binding!!.settingsActionsButtonInstallApps, vibrantColor)
} }
@ -67,7 +68,4 @@ SettingsFragmentActions : Fragment(), UIObject {
} }
} }
override fun onDestroy() {
super.onDestroy()
}
} }

View file

@ -56,13 +56,13 @@ class SettingsFragmentActionsRecycler : Fragment(), UIObject {
layoutManager = actionViewManager layoutManager = actionViewManager
adapter = actionViewAdapter adapter = actionViewAdapter
} }
getPreferences(requireContext()).registerOnSharedPreferenceChangeListener(sharedPreferencesListener) LauncherPreferences.getSharedPreferences().registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
super<UIObject>.onStart() super<UIObject>.onStart()
} }
override fun onDestroy() { override fun onDestroy() {
getPreferences(requireContext()).unregisterOnSharedPreferenceChangeListener(sharedPreferencesListener) LauncherPreferences.getSharedPreferences().unregisterOnSharedPreferenceChangeListener(sharedPreferencesListener)
super.onDestroy() super.onDestroy()
} }
@ -116,9 +116,10 @@ class ActionsRecyclerAdapter(val activity: Activity):
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) { override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
val gesture = gesturesList[i] val gesture = gesturesList[i]
val vibrantColor = LauncherPreferences.theme().vibrant()
viewHolder.textView.text = gesture.getLabel(activity) viewHolder.textView.text = gesture.getLabel(activity)
setButtonColor(viewHolder.chooseButton, vibrantColor) setButtonColor(viewHolder.chooseButton, vibrantColor)
if (getSavedTheme(activity) == "dark") transformGrayscale( if (LauncherPreferences.theme().theme() == "dark") transformGrayscale(
viewHolder.img viewHolder.img
) )
updateViewHolder(gesture, viewHolder) updateViewHolder(gesture, viewHolder)
@ -136,16 +137,16 @@ class ActionsRecyclerAdapter(val activity: Activity):
} }
init { init {
val doubleActions = getPreferences(activity).getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false) val doubleActions = LauncherPreferences.enabled_gestures().doubleSwipe()
val edgeActions = getPreferences(activity).getBoolean(PREF_EDGE_ACTIONS_ENABLED, false) val edgeActions = LauncherPreferences.enabled_gestures().edgeSwipe()
gesturesList = Gesture.values().filter { gesturesList = Gesture.values().filter {
(doubleActions || !it.isDoubleVariant()) (doubleActions || !it.isDoubleVariant())
&& (edgeActions || !it.isEdgeVariant())} as ArrayList<Gesture> && (edgeActions || !it.isEdgeVariant())} as ArrayList<Gesture>
} }
fun updateActions() { fun updateActions() {
val doubleActions = getPreferences(activity).getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false) val doubleActions = LauncherPreferences.enabled_gestures().doubleSwipe()
val edgeActions = getPreferences(activity).getBoolean(PREF_EDGE_ACTIONS_ENABLED, false) val edgeActions = LauncherPreferences.enabled_gestures().edgeSwipe()
this.gesturesList.clear() this.gesturesList.clear()
gesturesList.addAll(Gesture.values().filter { gesturesList.addAll(Gesture.values().filter {
(doubleActions || !it.isDoubleVariant()) (doubleActions || !it.isDoubleVariant())

View file

@ -1,36 +1,13 @@
package de.jrpie.android.launcher.settings.launcher package de.jrpie.android.launcher.settings.launcher
import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import androidx.preference.PreferenceFragmentCompat
import android.view.View import de.jrpie.android.launcher.LauncherPreferences
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Switch
import androidx.fragment.app.Fragment
import de.jrpie.android.launcher.PREF_DATE_LOCALIZED
import de.jrpie.android.launcher.PREF_DATE_TIME_FLIP
import de.jrpie.android.launcher.PREF_DATE_VISIBLE
import de.jrpie.android.launcher.PREF_DOUBLE_ACTIONS_ENABLED
import de.jrpie.android.launcher.PREF_EDGE_ACTIONS_ENABLED
import de.jrpie.android.launcher.PREF_SCREEN_FULLSCREEN
import de.jrpie.android.launcher.PREF_SCREEN_TIMEOUT_DISABLED
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_KEYBOARD
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_LAUNCH
import de.jrpie.android.launcher.PREF_TIME_VISIBLE
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.getPreferences
import de.jrpie.android.launcher.getSavedTheme
import de.jrpie.android.launcher.resetToDarkTheme
import de.jrpie.android.launcher.resetToDefaultTheme
import de.jrpie.android.launcher.setButtonColor
import de.jrpie.android.launcher.setSwitchColor
import de.jrpie.android.launcher.setWindowFlags
import de.jrpie.android.launcher.vibrantColor
import de.jrpie.android.launcher.databinding.SettingsLauncherBinding
import de.jrpie.android.launcher.setDefaultHomeScreen import de.jrpie.android.launcher.setDefaultHomeScreen
import eu.jonahbauer.android.preference.annotations.Preference
/** /**
@ -38,111 +15,27 @@ import de.jrpie.android.launcher.setDefaultHomeScreen
* *
* It is used to change themes, select wallpapers ... theme related stuff * It is used to change themes, select wallpapers ... theme related stuff
*/ */
class SettingsFragmentLauncher : Fragment(), UIObject { class SettingsFragmentLauncher : PreferenceFragmentCompat() {
private lateinit var binding: SettingsLauncherBinding override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
override fun onCreateView( setPreferencesFromResource(R.xml.preferences, rootKey)
inflater: LayoutInflater, container: ViewGroup?, preferenceManager.sharedPreferencesName = getString(R.string.preference_file_key)
savedInstanceState: Bundle? preferenceManager.sharedPreferencesMode = Context.MODE_PRIVATE
): View {
binding = SettingsLauncherBinding.inflate(inflater, container, false)
return binding.root
}
override fun onStart(){ val selectWallpaper = findPreference<androidx.preference.Preference>(LauncherPreferences.theme().keys().wallpaper())
super<Fragment>.onStart() selectWallpaper?.setOnPreferenceClickListener {
super<UIObject>.onStart()
}
override fun applyTheme() {
setButtonColor(binding.settingsLauncherButtonChooseHomeScreen, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchScreenTimeout, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchScreenFull, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchAutoLaunch, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchAutoKeyboard, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchEnableDouble, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchEnableEdge, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchDateLocalized, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchDateVisible, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchTimeVisible, vibrantColor)
setSwitchColor(binding.settingsLauncherSwitchDateTimeFlip, vibrantColor)
setButtonColor(binding.settingsLauncherButtonChooseWallpaper, vibrantColor)
}
override fun setOnClicks() {
val preferences = getPreferences(requireActivity())
fun bindSwitchToPref(switch: Switch, pref: String, default: Boolean, onChange: (Boolean) -> Unit){
switch.isChecked = preferences.getBoolean(pref, default)
switch.setOnCheckedChangeListener { _, isChecked -> // Toggle double actions
preferences.edit()
.putBoolean(pref, isChecked)
.apply()
onChange(isChecked)
}
}
binding.settingsLauncherButtonChooseHomeScreen.setOnClickListener {
setDefaultHomeScreen(requireContext(), checkDefault = false)
}
binding.settingsLauncherButtonChooseWallpaper.setOnClickListener {
// https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/6caab89b21b2b91f0a439e1fd8c4510dcb255819/src/com/android/launcher3/views/OptionsPopupView.java#L271 // https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/6caab89b21b2b91f0a439e1fd8c4510dcb255819/src/com/android/launcher3/views/OptionsPopupView.java#L271
val intent = Intent(Intent.ACTION_SET_WALLPAPER) val intent = Intent(Intent.ACTION_SET_WALLPAPER)
//.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) //.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra("com.android.wallpaper.LAUNCH_SOURCE", "app_launched_launcher") .putExtra("com.android.wallpaper.LAUNCH_SOURCE", "app_launched_launcher")
.putExtra("com.android.launcher3.WALLPAPER_FLAVOR", "focus_wallpaper") .putExtra("com.android.launcher3.WALLPAPER_FLAVOR", "focus_wallpaper")
startActivity(intent) startActivity(intent)
true
} }
val chooseHomeScreen = findPreference<androidx.preference.Preference>(LauncherPreferences.general().keys().chooseHomeScreen())
bindSwitchToPref(binding.settingsLauncherSwitchDateLocalized, PREF_DATE_LOCALIZED, false) { } chooseHomeScreen?.setOnPreferenceClickListener {
bindSwitchToPref(binding.settingsLauncherSwitchDateVisible, PREF_DATE_VISIBLE, true) {} setDefaultHomeScreen(requireContext(), checkDefault = false)
bindSwitchToPref(binding.settingsLauncherSwitchTimeVisible, PREF_TIME_VISIBLE, true) {} true
bindSwitchToPref(binding.settingsLauncherSwitchDateTimeFlip, PREF_DATE_TIME_FLIP, false) {}
bindSwitchToPref(binding.settingsLauncherSwitchScreenTimeout, PREF_SCREEN_TIMEOUT_DISABLED, false) {
activity?.let{setWindowFlags(it.window)}
}
bindSwitchToPref(binding.settingsLauncherSwitchScreenFull, PREF_SCREEN_FULLSCREEN, true) {
activity?.let{setWindowFlags(it.window)}
}
bindSwitchToPref(binding.settingsLauncherSwitchAutoLaunch, PREF_SEARCH_AUTO_LAUNCH, false) {}
bindSwitchToPref(binding.settingsLauncherSwitchAutoKeyboard, PREF_SEARCH_AUTO_KEYBOARD, true) {}
bindSwitchToPref(binding.settingsLauncherSwitchEnableDouble, PREF_DOUBLE_ACTIONS_ENABLED, false) {}
bindSwitchToPref(binding.settingsLauncherSwitchEnableEdge, PREF_EDGE_ACTIONS_ENABLED, false) {}
}
override fun adjustLayout() {
// Load values into the theme spinner
val staticThemeAdapter = ArrayAdapter.createFromResource(
requireActivity(), R.array.settings_launcher_theme_spinner_items,
android.R.layout.simple_spinner_item )
staticThemeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
binding.settingsLauncherThemeSpinner.adapter = staticThemeAdapter
val themeInt = when (getSavedTheme(requireActivity())) {
"finn" -> 0
"dark" -> 1
else -> 0
}
binding.settingsLauncherThemeSpinner.setSelection(themeInt)
binding.settingsLauncherThemeSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
when (position) {
0 -> if (getSavedTheme(activity!!) != "finn") resetToDefaultTheme(activity!!)
1 -> if (getSavedTheme(activity!!) != "dark") resetToDarkTheme(activity!!)
}
}
override fun onNothingSelected(parent: AdapterView<*>?) { }
} }
} }
} }

View file

@ -8,13 +8,13 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.openNewTabWindow import de.jrpie.android.launcher.openNewTabWindow
import de.jrpie.android.launcher.resetSettings import de.jrpie.android.launcher.resetSettings
import de.jrpie.android.launcher.setButtonColor import de.jrpie.android.launcher.setButtonColor
import de.jrpie.android.launcher.tutorial.TutorialActivity import de.jrpie.android.launcher.tutorial.TutorialActivity
import de.jrpie.android.launcher.vibrantColor
import de.jrpie.android.launcher.databinding.SettingsMetaBinding import de.jrpie.android.launcher.databinding.SettingsMetaBinding
/** /**
@ -57,6 +57,7 @@ class SettingsFragmentMeta : Fragment(), UIObject {
} }
override fun applyTheme() { override fun applyTheme() {
val vibrantColor = LauncherPreferences.theme().vibrant()
setButtonColor(binding.settingsMetaButtonViewTutorial, vibrantColor) setButtonColor(binding.settingsMetaButtonViewTutorial, vibrantColor)
setButtonColor(binding.settingsMetaButtonResetSettings, vibrantColor) setButtonColor(binding.settingsMetaButtonResetSettings, vibrantColor)
setButtonColor(binding.settingsMetaButtonReportBug, vibrantColor) setButtonColor(binding.settingsMetaButtonReportBug, vibrantColor)

View file

@ -8,12 +8,10 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter import androidx.fragment.app.FragmentPagerAdapter
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import de.jrpie.android.launcher.PREF_STARTED import de.jrpie.android.launcher.LauncherPreferences
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.REQUEST_CHOOSE_APP import de.jrpie.android.launcher.REQUEST_CHOOSE_APP
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.getPreferences
import de.jrpie.android.launcher.loadSettings
import de.jrpie.android.launcher.resetSettings import de.jrpie.android.launcher.resetSettings
import de.jrpie.android.launcher.saveListActivityChoice import de.jrpie.android.launcher.saveListActivityChoice
import de.jrpie.android.launcher.tutorial.tabs.TutorialFragmentConcept import de.jrpie.android.launcher.tutorial.tabs.TutorialFragmentConcept
@ -37,13 +35,10 @@ class TutorialActivity: AppCompatActivity(), UIObject {
// Initialise layout // Initialise layout
setContentView(R.layout.tutorial) setContentView(R.layout.tutorial)
val preferences = getPreferences(this)
// Check if the app was started before // Check if the app was started before
if (!preferences.getBoolean(PREF_STARTED, false)) if(!LauncherPreferences.internal().started())
resetSettings(this) resetSettings(this)
loadSettings(this)
// set up tabs and swiping in settings // set up tabs and swiping in settings
val sectionsPagerAdapter = TutorialSectionsPagerAdapter(supportFragmentManager) val sectionsPagerAdapter = TutorialSectionsPagerAdapter(supportFragmentManager)
val viewPager: ViewPager = findViewById(R.id.tutorial_viewpager) val viewPager: ViewPager = findViewById(R.id.tutorial_viewpager)
@ -66,7 +61,7 @@ class TutorialActivity: AppCompatActivity(), UIObject {
// Default: prevent going back, allow if viewed again later // Default: prevent going back, allow if viewed again later
override fun onBackPressed() { override fun onBackPressed() {
if (getPreferences(this).getBoolean(PREF_STARTED, false)) if (LauncherPreferences.internal().started())
super.onBackPressed() super.onBackPressed()
} }

View file

@ -6,7 +6,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import de.jrpie.android.launcher.* import de.jrpie.android.launcher.*
import de.jrpie.android.launcher.BuildConfig.VERSION_NAME import de.jrpie.android.launcher.BuildConfig.VERSION_CODE
import de.jrpie.android.launcher.databinding.TutorialFinishBinding import de.jrpie.android.launcher.databinding.TutorialFinishBinding
/** /**
@ -32,6 +32,7 @@ class TutorialFragmentFinish : Fragment(), UIObject {
} }
override fun applyTheme() { override fun applyTheme() {
val vibrantColor = LauncherPreferences.theme().vibrant()
setButtonColor(binding.tutorialFinishButtonStart, vibrantColor) setButtonColor(binding.tutorialFinishButtonStart, vibrantColor)
binding.tutorialFinishButtonStart.blink() binding.tutorialFinishButtonStart.blink()
} }
@ -42,20 +43,12 @@ class TutorialFragmentFinish : Fragment(), UIObject {
} }
private fun finishTutorial() { private fun finishTutorial() {
context?.let { getPreferences(it) }?.let { if(!LauncherPreferences.internal().started()) {
if (!it.getBoolean(PREF_STARTED, false)) { LauncherPreferences.internal().started(true)
it.edit() LauncherPreferences.internal().startedTime(System.currentTimeMillis() / 1000L)
.putBoolean(PREF_STARTED, true) // never auto run this again LauncherPreferences.internal().versionCode(VERSION_CODE)
.putLong(
PREF_STARTED_TIME,
System.currentTimeMillis() / 1000L
) // record first startup timestamp
.putString(PREF_VERSION, VERSION_NAME) // save current launcher version
.apply()
}
} }
context?.let { setDefaultHomeScreen(it, checkDefault = true) } context?.let { setDefaultHomeScreen(it, checkDefault = true) }
activity?.finish() activity?.finish()
} }
} }

View file

@ -30,6 +30,7 @@ class TutorialFragmentStart : Fragment(), UIObject {
} }
override fun applyTheme() { override fun applyTheme() {
val vibrantColor = LauncherPreferences.theme().vibrant()
binding.tutorialStartIconRight.setTextColor(vibrantColor) binding.tutorialStartIconRight.setTextColor(vibrantColor)
binding.tutorialStartIconRight.blink() binding.tutorialStartIconRight.blink()

View file

@ -1,402 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/settings_launcher_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:paddingLeft="32sp"
android:paddingTop="16sp"
android:paddingRight="32sp"
tools:context=".settings.meta.SettingsFragmentMeta">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal">
<Button
android:id="@+id/settings_launcher_button_choose_home_screen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_choose_home_screen"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/settings_launcher_section_appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/settings_launcher_section_appearance_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_section_appearance"
android:textColor="#ccc"
android:textSize="18sp"
android:layout_marginBottom="16sp"
tools:layout_editor_absoluteX="32dp"
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_theme_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_theme"
android:textSize="16sp" />
<Spinner
android:id="@+id/settings_launcher_theme_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/settings_launcher_theme_spinner_items"
android:spinnerMode="dropdown" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal">
<Button
android:id="@+id/settings_launcher_button_choose_wallpaper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_choose_wallpaper"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/settings_launcher_section_date_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal">
<TextView
android:id="@+id/settings_launcher_section_date_time_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_section_date_time"
android:textColor="#ccc"
android:textSize="18sp"
tools:layout_editor_absoluteX="32dp"
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_date_localized"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_date_localized"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_date_localized"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_switch_date_visible"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_show_date"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_date_visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_switch_time_visible"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_show_time"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_time_visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_switch_date_time_flip"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_date_time_flip"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_date_time_flip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/settings_launcher_section_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal">
<TextView
android:id="@+id/settings_launcher_section_options_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_section_display"
android:textColor="#ccc"
android:textSize="18sp"
tools:layout_editor_absoluteX="32dp"
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_screen_timeout"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_disable_timeout"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_screen_timeout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_screen_full"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_full_screen"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_screen_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/settings_launcher_section_functions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:orientation="horizontal">
<TextView
android:id="@+id/settings_launcher_section_functions_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_section_functions"
android:textColor="#ccc"
android:textSize="18sp"
tools:layout_editor_absoluteX="32dp"
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_auto_launch"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_auto_launch"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_auto_launch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_start_keyboard"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_auto_keyboard"
android:textSize="16sp"
/>
<Switch
android:id="@+id/settings_launcher_switch_auto_keyboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_enable_double"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_enable_double"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_enable_double"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_enable_edge"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_enable_edge"
android:textSize="16sp" />
<Switch
android:id="@+id/settings_launcher_switch_enable_edge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -62,31 +62,31 @@
--> -->
<string name="settings_launcher_section_appearance">Aussehen</string> <string name="settings_launcher_section_appearance">Aussehen</string>
<string name="settings_launcher_show_time">Zeit anzeigen</string> <string name="settings_clock_time_visible">Zeit anzeigen</string>
<string name="settings_launcher_show_date">Datum anzeigen</string> <string name="settings_clock_date_visible">Datum anzeigen</string>
<string name="settings_launcher_date_localized">Lokalisiertes Datumsformat verwenden</string> <string name="settings_clock_localized">Lokalisiertes Datumsformat verwenden</string>
<string name="settings_launcher_date_time_flip">Datum und Uhrzeit tauschen</string> <string name="settings_clock_flip_date_time">Datum und Uhrzeit tauschen</string>
<string name="settings_launcher_section_date_time"><![CDATA[Datum & Uhrzeit]]></string> <string name="settings_launcher_section_date_time"><![CDATA[Datum & Uhrzeit]]></string>
<string name="settings_launcher_theme">Theme</string> <string name="settings_theme_theme">Theme</string>
<string-array name="settings_launcher_theme_spinner_items"> <string-array name="settings_launcher_theme_spinner_items">
<item>Standard</item> <item>Standard</item>
<item>Dunkel</item> <item>Dunkel</item>
</string-array> </string-array>
<string name="settings_launcher_choose_wallpaper">Hintergrund auswählen</string> <string name="settings_theme_wallpaper">Hintergrund auswählen</string>
<string name="settings_launcher_change_wallpaper">Hintergrund ändern</string> <string name="settings_launcher_change_wallpaper">Hintergrund ändern</string>
<string name="settings_launcher_section_display">Bildschirm</string> <string name="settings_launcher_section_display">Bildschirm</string>
<string name="settings_launcher_disable_timeout">Bildschirm nicht ausschalten</string> <string name="settings_display_screen_timeout_disabled">Bildschirm nicht ausschalten</string>
<string name="settings_launcher_full_screen">Vollbild</string> <string name="settings_launcher_full_screen">Vollbild</string>
<string name="settings_launcher_section_functions">Funktionen</string> <string name="settings_launcher_section_functionality">Funktionen</string>
<string name="settings_launcher_enable_double">Doppelte Wischaktionen</string> <string name="settings_enabled_gestures_double_swipe">Doppelte Wischaktionen</string>
<string name="settings_launcher_enable_edge">Kantenwischaktionen</string> <string name="settings_enabled_gestures_edge_swipe">Kantenwischaktionen</string>
<string name="settings_launcher_auto_launch">Suchergebnis starten</string> <string name="settings_functionality_auto_launch">Suchergebnis starten</string>
<string name="settings_launcher_auto_keyboard">Tastatur automatisch öffnen</string> <string name="settings_functionality_auto_keyboard">Tastatur automatisch öffnen</string>
<string name="settings_launcher_sensitivity">Empfindlichkeit</string> <string name="settings_launcher_sensitivity">Empfindlichkeit</string>
@ -95,7 +95,7 @@
- Settings : Meta - Settings : Meta
- -
--> -->
<string name="settings_launcher_choose_home_screen">Launcher wählen</string> <string name="settings_general_choose_home_screen">Launcher wählen</string>
<string name="settings_meta_cant_select_launcher">App Info</string> <string name="settings_meta_cant_select_launcher">App Info</string>
<string name="settings_meta_cant_select_launcher_msg">Dein Gerät unterstützt diese Funktion nicht. Stattdessen die App Details bearbeiten?</string> <string name="settings_meta_cant_select_launcher_msg">Dein Gerät unterstützt diese Funktion nicht. Stattdessen die App Details bearbeiten?</string>

View file

@ -70,19 +70,19 @@
<item>Oscuro</item> <item>Oscuro</item>
</string-array> </string-array>
<string name="settings_launcher_choose_wallpaper">Seleccionar fondo de pantalla</string> <string name="settings_theme_wallpaper">Seleccionar fondo de pantalla</string>
<string name="settings_launcher_change_wallpaper">Cambiar fondo de pantalla</string> <string name="settings_launcher_change_wallpaper">Cambiar fondo de pantalla</string>
<string name="settings_launcher_section_display">Pantalla</string> <string name="settings_launcher_section_display">Pantalla</string>
<string name="settings_launcher_disable_timeout">Mantener encendida</string> <string name="settings_display_screen_timeout_disabled">Mantener encendida</string>
<string name="settings_launcher_full_screen">Pantalla completa</string> <string name="settings_launcher_full_screen">Pantalla completa</string>
<string name="settings_launcher_section_functions">Funciones</string> <string name="settings_launcher_section_functionality">Funciones</string>
<string name="settings_launcher_enable_double">Deslizar con dos dedos</string> <string name="settings_enabled_gestures_double_swipe">Deslizar con dos dedos</string>
<string name="settings_launcher_auto_launch">Auto-lanzar búsquedas</string> <string name="settings_functionality_auto_launch">Auto-lanzar búsquedas</string>
<string name="settings_launcher_auto_keyboard">Abrir teclado en búsqueda</string> <string name="settings_functionality_auto_keyboard">Abrir teclado en búsqueda</string>
<string name="settings_launcher_sensitivity">Sensibilidad</string> <string name="settings_launcher_sensitivity">Sensibilidad</string>
@ -91,7 +91,7 @@
- Settings : Meta - Settings : Meta
- -
--> -->
<string name="settings_launcher_choose_home_screen">Seleccionar Launcher</string> <string name="settings_general_choose_home_screen">Seleccionar Launcher</string>
<string name="settings_meta_cant_select_launcher">Información de la aplicación</string> <string name="settings_meta_cant_select_launcher">Información de la aplicación</string>
<string name="settings_meta_cant_select_launcher_msg">Su dispositivo no posee esta caracrerística. Desea cambiar los detalles de la aplicación?</string> <string name="settings_meta_cant_select_launcher_msg">Su dispositivo no posee esta caracrerística. Desea cambiar los detalles de la aplicación?</string>

View file

@ -47,27 +47,27 @@
--> -->
<string name="settings_launcher_section_appearance">Apparence</string> <string name="settings_launcher_section_appearance">Apparence</string>
<string name="settings_launcher_section_date_time">Format de date</string> <string name="settings_launcher_section_date_time">Format de date</string>
<string name="settings_launcher_theme">Thème</string> <string name="settings_theme_theme">Thème</string>
<string-array name="settings_launcher_theme_spinner_items"> <string-array name="settings_launcher_theme_spinner_items">
<item>Défaut</item> <item>Défaut</item>
<item>Noir</item> <item>Noir</item>
</string-array> </string-array>
<string name="settings_launcher_choose_wallpaper">Choisir un fond d\'écran</string> <string name="settings_theme_wallpaper">Choisir un fond d\'écran</string>
<string name="settings_launcher_change_wallpaper">Changer le fond d\'écran</string> <string name="settings_launcher_change_wallpaper">Changer le fond d\'écran</string>
<string name="settings_launcher_section_display">Écran</string> <string name="settings_launcher_section_display">Écran</string>
<string name="settings_launcher_disable_timeout">Garder l\'écran allumé</string> <string name="settings_display_screen_timeout_disabled">Garder l\'écran allumé</string>
<string name="settings_launcher_full_screen">Utiliser le plein écran</string> <string name="settings_launcher_full_screen">Utiliser le plein écran</string>
<string name="settings_launcher_section_functions">Fonctions</string> <string name="settings_launcher_section_functionality">Fonctions</string>
<string name="settings_launcher_enable_double">Actions de double balayage</string> <string name="settings_enabled_gestures_double_swipe">Actions de double balayage</string>
<string name="settings_launcher_auto_launch">Lancer apps par recherche</string> <string name="settings_functionality_auto_launch">Lancer apps par recherche</string>
<string name="settings_launcher_auto_keyboard">Ouvrir le clavier automatiquement pour la recherche</string> <string name="settings_functionality_auto_keyboard">Ouvrir le clavier automatiquement pour la recherche</string>
<string name="settings_launcher_sensitivity">Sensibilité</string> <string name="settings_launcher_sensitivity">Sensibilité</string>
<!-- <!--
- -
- Settings : Meta - Settings : Meta
- -
--> -->
<string name="settings_launcher_choose_home_screen">Choisir Launcher comme application d\'écran d\'accueil par défaut</string> <string name="settings_general_choose_home_screen">Choisir Launcher comme application d\'écran d\'accueil par défaut</string>
<string name="settings_meta_cant_select_launcher">Informations sur l\'application</string> <string name="settings_meta_cant_select_launcher">Informations sur l\'application</string>
<string name="settings_meta_cant_select_launcher_msg">Votre appareil ne prend pas en charge cette fonctionnalité. Souhaitez-vous plutôt accéder aux détails de l\'application ?</string> <string name="settings_meta_cant_select_launcher_msg">Votre appareil ne prend pas en charge cette fonctionnalité. Souhaitez-vous plutôt accéder aux détails de l\'application ?</string>
<string name="settings_meta_show_tutorial">Regarder le tutoriel</string> <string name="settings_meta_show_tutorial">Regarder le tutoriel</string>
@ -129,7 +129,7 @@
<string name="settings">Réglages</string> <string name="settings">Réglages</string>
<string name="ic_menu_alt">Plus d\'options</string> <string name="ic_menu_alt">Plus d\'options</string>
<string name="settings_gesture_right_top_edge">Balayer vers la droite (en haut de l\'écran)</string> <string name="settings_gesture_right_top_edge">Balayer vers la droite (en haut de l\'écran)</string>
<string name="settings_launcher_enable_edge">Actions associées aux mouvements sur les bords de l\'écran</string> <string name="settings_enabled_gestures_edge_swipe">Actions associées aux mouvements sur les bords de l\'écran</string>
<string name="settings_gesture_right_bottom_edge">Balayer vers la droite (en bas de l\'écran)</string> <string name="settings_gesture_right_bottom_edge">Balayer vers la droite (en bas de l\'écran)</string>
<string name="settings_gesture_down_left_edge">Balayer vers le bas (à gauche de l\'écran)</string> <string name="settings_gesture_down_left_edge">Balayer vers le bas (à gauche de l\'écran)</string>
<string name="settings_gesture_left_bottom_edge">Balayer vers la gauche (en bas de l\'écran)</string> <string name="settings_gesture_left_bottom_edge">Balayer vers la gauche (en bas de l\'écran)</string>
@ -137,8 +137,8 @@
<string name="settings_gesture_up_left_edge">Balayer vers le haut (à gauche de l\'écran)</string> <string name="settings_gesture_up_left_edge">Balayer vers le haut (à gauche de l\'écran)</string>
<string name="settings_gesture_up_right_edge">Balayer vers le haut (à droite de l\'écran)</string> <string name="settings_gesture_up_right_edge">Balayer vers le haut (à droite de l\'écran)</string>
<string name="settings_gesture_down_right_edge">Balayer vers le bas (à droite de l\'écran)</string> <string name="settings_gesture_down_right_edge">Balayer vers le bas (à droite de l\'écran)</string>
<string name="settings_launcher_show_time">Afficher l\'heure</string> <string name="settings_clock_time_visible">Afficher l\'heure</string>
<string name="settings_launcher_date_time_flip">Échanger la date et l\'heure</string> <string name="settings_clock_flip_date_time">Échanger la date et l\'heure</string>
<string name="settings_launcher_show_date">Afficher la date</string> <string name="settings_clock_date_visible">Afficher la date</string>
<string name="settings_launcher_date_localized">Utiliser le format de date local</string> <string name="settings_clock_localized">Utiliser le format de date local</string>
</resources> </resources>

View file

@ -5,7 +5,7 @@
<string name="ic_menu_alt">更多选项</string> <string name="ic_menu_alt">更多选项</string>
<string name="settings_title">设置</string> <string name="settings_title">设置</string>
<string name="settings_launcher_section_appearance">外观</string> <string name="settings_launcher_section_appearance">外观</string>
<string name="settings_launcher_theme">主题</string> <string name="settings_theme_theme">主题</string>
<string name="settings_launcher_section_display">显示</string> <string name="settings_launcher_section_display">显示</string>
<string name="list_tab_other">其他</string> <string name="list_tab_other">其他</string>
<string name="settings_gesture_up">上滑</string> <string name="settings_gesture_up">上滑</string>
@ -41,14 +41,14 @@
<string name="settings_apps_install">安装应用</string> <string name="settings_apps_install">安装应用</string>
<string name="settings_apps_toast_store_not_found">没有找到应用市场</string> <string name="settings_apps_toast_store_not_found">没有找到应用市场</string>
<string name="settings_launcher_section_date_time">日期和时间</string> <string name="settings_launcher_section_date_time">日期和时间</string>
<string name="settings_launcher_choose_wallpaper">选择一个壁纸</string> <string name="settings_theme_wallpaper">选择一个壁纸</string>
<string name="settings_launcher_change_wallpaper">换壁纸</string> <string name="settings_launcher_change_wallpaper">换壁纸</string>
<string name="settings_launcher_disable_timeout">保持屏幕常亮</string> <string name="settings_display_screen_timeout_disabled">保持屏幕常亮</string>
<string name="settings_launcher_full_screen">使用全屏</string> <string name="settings_launcher_full_screen">使用全屏</string>
<string name="settings_launcher_section_functions">功能</string> <string name="settings_launcher_section_functionality">功能</string>
<string name="settings_launcher_enable_edge">边缘滑动动作</string> <string name="settings_enabled_gestures_edge_swipe">边缘滑动动作</string>
<string name="settings_launcher_auto_launch">零点击启动唯一搜索结果</string> <string name="settings_functionality_auto_launch">零点击启动唯一搜索结果</string>
<string name="settings_launcher_auto_keyboard">搜索时呼出键盘</string> <string name="settings_functionality_auto_keyboard">搜索时呼出键盘</string>
<string name="settings_launcher_sensitivity">灵敏度</string> <string name="settings_launcher_sensitivity">灵敏度</string>
<string name="settings_meta_cant_select_launcher">应用信息</string> <string name="settings_meta_cant_select_launcher">应用信息</string>
<string name="settings_meta_cant_select_launcher_msg">您的设备不支持此功能。要不打开应用程序详细?</string> <string name="settings_meta_cant_select_launcher_msg">您的设备不支持此功能。要不打开应用程序详细?</string>
@ -92,16 +92,16 @@
\n \n
\n它不付费、无广告、不追踪。</string> \n它不付费、无广告、不追踪。</string>
<string name="tutorial_usage_text_2">您只需滑动屏幕或按下按钮即可启动应用程序。在下一步向导中选择一些应用程序。</string> <string name="tutorial_usage_text_2">您只需滑动屏幕或按下按钮即可启动应用程序。在下一步向导中选择一些应用程序。</string>
<string name="settings_launcher_choose_home_screen">将 μLauncher 设为默认桌面</string> <string name="settings_general_choose_home_screen">将 μLauncher 设为默认桌面</string>
<string name="tutorial_finish_text">您已经准备好开始了! <string name="tutorial_finish_text">您已经准备好开始了!
\n \n
\n我希望这对你有很大的价值! \n我希望这对你有很大的价值!
\n \n
\n- Finn (Launcher 的作者) \n- Finn (Launcher 的作者)
\n以及 Josia(做了一些改进并维护了 μLauncher 分支)</string> \n以及 Josia(做了一些改进并维护了 μLauncher 分支)</string>
<string name="settings_launcher_enable_double">双滑动作</string> <string name="settings_enabled_gestures_double_swipe">双滑动作</string>
<string name="settings_launcher_date_localized">使用本地日期格式</string> <string name="settings_clock_localized">使用本地日期格式</string>
<string name="settings_launcher_show_time">显示时间</string> <string name="settings_clock_time_visible">显示时间</string>
<string name="settings_launcher_show_date">显示日期</string> <string name="settings_clock_date_visible">显示日期</string>
<string name="settings_launcher_date_time_flip">翻转日期和时间</string> <string name="settings_clock_flip_date_time">翻转日期和时间</string>
</resources> </resources>

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">μLauncher</string>
<!--
-
- Settings
-
-->
<string name="preference_file_key" translatable="false">V3RYR4ND0MK3YCR4P</string>
<string name="settings_internal_started_key" translatable="false">startedBefore</string>
<string name="settings_internal_started_time_key" translatable="false">firstStartup</string>
<string name="settings_internal_version_code_key" translatable="false">version_code</string>
<string name="settings_general_choose_home_screen_key">settings.general.select_launcher</string>
<!--
-
- Settings : Gestures
-
-->
<string name="settings_gesture_up_key" translatable="false">Swipe Up</string>
<string name="settings_gesture_double_up_key" translatable="false">Double Up</string>
<string name="settings_gesture_down_key" translatable="false">Swipe Down</string>
<string name="settings_gesture_double_down_key" translatable="false">Double Down</string>
<string name="settings_gesture_left_key" translatable="false">Swipe Left</string>
<string name="settings_gesture_double_left_key" translatable="false">Double Left</string>
<string name="settings_gesture_right_key" translatable="false">Swipe Right</string>
<string name="settings_gesture_double_right_key" translatable="false">Double Right</string>
<string name="settings_gesture_right_top_edge_key" translatable="false">Swipe Right (Top)</string>
<string name="settings_gesture_right_bottom_edge_key" translatable="false">Swipe Right (Bottom)</string>
<string name="settings_gesture_left_bottom_edge_key" translatable="false">Swipe Left (Bottom)</string>
<string name="settings_gesture_left_top_edge_key" translatable="false">Swipe Left (Top)</string>
<string name="settings_gesture_up_left_edge_key" translatable="false">Swipe Up (Left Edge)</string>
<string name="settings_gesture_up_right_edge_key" translatable="false">Swipe Up (Right Edge)</string>
<string name="settings_gesture_down_left_edge_key" translatable="false">Swipe Down (Left Edge)</string>
<string name="settings_gesture_down_right_edge_key" translatable="false">Swipe Down (Right Edge)</string>
<string name="settings_gesture_vol_up_key" translatable="false">Volume Up</string>
<string name="settings_gesture_vol_down_key" translatable="false">Volume Down</string>
<string name="settings_gesture_double_click_key" translatable="false">Double Click</string>
<string name="settings_gesture_long_click_key" translatable="false">Long Click</string>
<string name="settings_gesture_date_key" translatable="false">Click on Date</string>
<string name="settings_gesture_time_key" translatable="false">Click on Time</string>
<!--
-
- Settings : Theme
-
-->
<string name="settings_theme_theme_key" translatable="false">theme</string>
<string name="settings_theme_wallpaper_key" translatable="false">settings.theme.wallpaper</string>
<string name="settings_theme_dominant_key" translatable="false">custom_dominant</string>
<string name="settings_theme_vibrant_key" translatable="false">custom_vibrant</string>
<!--
-
- Settings : Clock
-
-->
<string name="settings_clock_time_visible_key" translatable="false">timeVisible</string>
<string name="settings_clock_date_visible_key" translatable="false">dateVisible</string>
<string name="settings_clock_localized_key" translatable="false">dateLocalized</string>
<string name="settings_clock_flip_date_time_key" translatable="false">dateTimeFlip</string>
<!--
-
- Settings : Functionality
-
-->
<string name="settings_display_screen_timeout_disabled_key" translatable="false">disableTimeout</string>
<string name="settings_display_full_screen_key" translatable="false">useFullScreen</string>
<string name="settings_enabled_gestures_double_swipe_key" translatable="false">enableDoubleActions</string>
<string name="settings_enabled_gestures_edge_swipe_key" translatable="false">enableEdgeActions</string>
<string name="settings_functionality_search_auto_launch_key" translatable="false">searchAutoLaunch</string>
<string name="settings_functionality_search_auto_open_keyboard_key" translatable="false">searchAutoKeyboard</string>
<!--
-
- URLs
-
-->
<string name="settings_meta_link_github" translatable="false">https://github.com/jrpie/Launcher</string>
<string name="settings_meta_report_bug_link" translatable="false">https://github.com/jrpie/Launcher/issues/new</string>
<string name="settings_meta_fork_contact_url" translatable="false">https://s.jrpie.de/contact</string>
<string name="settings_meta_privacy_url" translatable="false">https://s.jrpie.de/android-legal</string>
<string name="settings_meta_contact_url">https://www.finnmglas.com/contact/</string>
<string name="settings_meta_discord_url" translatable="false">https://discord.com/invite/jV2AhF8</string>
<!--
-
- Tutorial
-
-->
<string name="swipe" translatable="false"><![CDATA[>>>>>>]]></string>
</resources>

View file

@ -1,12 +1,4 @@
<resources> <resources>
<!--
-
- General
-
-->
<string name="app_name" translatable="false">μLauncher</string>
<string name="preference_file_key" translatable="false">V3RYR4ND0MK3YCR4P</string>
<!-- <!--
- -
- Home - Home
@ -71,32 +63,34 @@
<string name="settings_launcher_section_appearance">Appearance</string> <string name="settings_launcher_section_appearance">Appearance</string>
<string name="settings_launcher_theme">Theme</string> <string name="settings_theme_theme">Theme</string>
<string-array name="settings_launcher_theme_spinner_items"> <string-array name="settings_launcher_theme_spinner_items">
<item>Default</item> <item>Default</item>
<item>Dark</item> <item>Dark</item>
</string-array> </string-array>
<string name="settings_theme_dominant">Dominant color</string>
<string name="settings_theme_vibrant">Vibrant color</string>
<string name="settings_launcher_section_date_time"><![CDATA[Date & time]]></string> <string name="settings_launcher_section_date_time"><![CDATA[Date & time]]></string>
<string name="settings_launcher_show_time">Show time</string> <string name="settings_clock_time_visible">Show time</string>
<string name="settings_launcher_show_date">Show date</string> <string name="settings_clock_date_visible">Show date</string>
<string name="settings_launcher_date_localized">Use localized date format</string> <string name="settings_clock_localized">Use localized date format</string>
<string name="settings_launcher_date_time_flip">Flip date and time</string> <string name="settings_clock_flip_date_time">Flip date and time</string>
<string name="settings_launcher_choose_wallpaper">Choose a wallpaper</string> <string name="settings_theme_wallpaper">Choose a wallpaper</string>
<string name="settings_launcher_change_wallpaper">Change wallpaper</string> <string name="settings_launcher_change_wallpaper">Change wallpaper</string>
<string name="settings_launcher_section_display">Display</string> <string name="settings_launcher_section_display">Display</string>
<string name="settings_launcher_disable_timeout">Keep screen on</string> <string name="settings_display_screen_timeout_disabled">Keep screen on</string>
<string name="settings_launcher_full_screen">Use full screen</string> <string name="settings_display_full_screen">Use full screen</string>
<string name="settings_launcher_section_functions">Functions</string> <string name="settings_launcher_section_functionality">Functionality</string>
<string name="settings_launcher_enable_double">Double swipe actions</string> <string name="settings_enabled_gestures_double_swipe">Double swipe actions</string>
<string name="settings_launcher_enable_edge">Edge swipe actions</string> <string name="settings_enabled_gestures_edge_swipe">Edge swipe actions</string>
<string name="settings_launcher_auto_launch">Launch search results</string> <string name="settings_functionality_auto_launch">Launch search results</string>
<string name="settings_launcher_auto_keyboard">Start keyboard for search</string> <string name="settings_functionality_auto_keyboard">Start keyboard for search</string>
<string name="settings_launcher_sensitivity">Sensitivity</string> <string name="settings_launcher_sensitivity">Sensitivity</string>
@ -105,7 +99,7 @@
- Settings : Meta - Settings : Meta
- -
--> -->
<string name="settings_launcher_choose_home_screen">Set μLauncher as home screen</string> <string name="settings_general_choose_home_screen">Set μLauncher as home screen</string>
<string name="settings_meta_cant_select_launcher">App Info</string> <string name="settings_meta_cant_select_launcher">App Info</string>
<string name="settings_meta_cant_select_launcher_msg">Your device does not support this feature. Manage application details instead?</string> <string name="settings_meta_cant_select_launcher_msg">Your device does not support this feature. Manage application details instead?</string>
@ -114,23 +108,15 @@
<string name="settings_meta_reset">Reset Settings</string> <string name="settings_meta_reset">Reset Settings</string>
<string name="settings_meta_reset_confirm">You are going to discard all your preferences. Continue?</string> <string name="settings_meta_reset_confirm">You are going to discard all your preferences. Continue?</string>
<string name="settings_meta_link_github" translatable="false">https://github.com/jrpie/Launcher</string>
<string name="settings_meta_report_bug">Report a bug</string> <string name="settings_meta_report_bug">Report a bug</string>
<string name="settings_meta_report_bug_link" translatable="false">https://github.com/jrpie/Launcher/issues/new</string>
<string name="settings_meta_fork_contact">Contact the developer of the fork</string> <string name="settings_meta_fork_contact">Contact the developer of the fork</string>
<string name="settings_meta_fork_contact_url" translatable="false">https://s.jrpie.de/contact</string>
<string name="settings_meta_privacy">Privacy Policy</string> <string name="settings_meta_privacy">Privacy Policy</string>
<string name="settings_meta_privacy_url" translatable="false">https://s.jrpie.de/android-legal</string>
<string name="settings_meta_contact">Contact the original developer</string> <string name="settings_meta_contact">Contact the original developer</string>
<string name="settings_meta_contact_url">https://www.finnmglas.com/contact/</string>
<string name="settings_meta_discord">Join us on discord!</string> <string name="settings_meta_discord">Join us on discord!</string>
<string name="settings_meta_discord_url" translatable="false">https://discord.com/invite/jV2AhF8</string>
<!-- <!--
- -
@ -188,7 +174,5 @@
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="ic_menu_alt">More options</string> <string name="ic_menu_alt">More options</string>
<string name="swipe" translatable="false"><![CDATA[>>>>>>]]></string>
<string name="alert_cant_expand_notifications_panel">Error: Can\'t expand status bar.\nThis action is using functionality that is not part of the published Android API. Unfortunately, it does not seem to work on your device.</string> <string name="alert_cant_expand_notifications_panel">Error: Can\'t expand status bar.\nThis action is using functionality that is not part of the published Android API. Unfortunately, it does not seem to work on your device.</string>
</resources> </resources>

View file

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory > <!-- general -->
<Preference
android:key="@string/settings_general_choose_home_screen_key"
android:title="@string/settings_general_choose_home_screen"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_launcher_section_appearance">
<Preference
android:key="@string/settings_theme_wallpaper_key"
android:title="@string/settings_theme_wallpaper"/>
<!--<ListPreference
android:key="@string/settings_theme_theme_key"
android:title="@string/settings_theme_theme"
</ListPreference>-->
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_launcher_section_date_time">
<SwitchPreference
android:key="@string/settings_clock_localized_key"
android:defaultValue="false"
android:title="@string/settings_clock_localized" />
<SwitchPreference
android:key="@string/settings_clock_time_visible_key"
android:defaultValue="true"
android:title="@string/settings_clock_time_visible" />
<SwitchPreference
android:key="@string/settings_clock_date_visible_key"
android:defaultValue="true"
android:title="@string/settings_clock_date_visible" />
<SwitchPreference
android:key="@string/settings_clock_flip_date_time_key"
android:defaultValue="false"
android:title="@string/settings_clock_flip_date_time" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_launcher_section_functionality">
<SwitchPreference
android:key="@string/settings_functionality_search_auto_launch_key"
android:defaultValue="true"
android:title="@string/settings_functionality_auto_launch" />
<SwitchPreference
android:key="@string/settings_functionality_search_auto_open_keyboard_key"
android:defaultValue="true"
android:title="@string/settings_functionality_auto_keyboard" />
<SwitchPreference
android:key="@string/settings_enabled_gestures_double_swipe_key"
android:defaultValue="true"
android:title="@string/settings_enabled_gestures_double_swipe"/>
<SwitchPreference
android:key="@string/settings_enabled_gestures_edge_swipe_key"
android:defaultValue="true"
android:title="@string/settings_enabled_gestures_edge_swipe"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_launcher_section_display">
<SwitchPreference
android:key="@string/settings_display_full_screen_key"
android:title="@string/settings_display_full_screen"/>
<SwitchPreference
android:key="@string/settings_display_screen_timeout_disabled_key"
android:title="@string/settings_display_screen_timeout_disabled"/>
</PreferenceCategory>
</PreferenceScreen>