Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/src/main/java/app/olauncher/data/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Prefs(context: Context) {
private val DAILY_WALLPAPER = "DAILY_WALLPAPER"
private val DAILY_WALLPAPER_URL = "DAILY_WALLPAPER_URL"
private val WALLPAPER_UPDATED_DAY = "WALLPAPER_UPDATED_DAY"
private val AUTO_LAUNCH_ENABLED = "AUTO_LAUNCH_ENABLED"
private val HOME_ALIGNMENT = "HOME_ALIGNMENT"
private val HOME_BOTTOM_ALIGNMENT = "HOME_BOTTOM_ALIGNMENT"
private val APP_LABEL_ALIGNMENT = "APP_LABEL_ALIGNMENT"
Expand Down Expand Up @@ -131,6 +132,10 @@ class Prefs(context: Context) {
get() = prefs.getString(DAILY_WALLPAPER_URL, "").toString()
set(value) = prefs.edit().putString(DAILY_WALLPAPER_URL, value).apply()

var autoLaunchEnabled: Boolean
get() = prefs.getBoolean(AUTO_LAUNCH_ENABLED, true)
set(value) = prefs.edit().putBoolean(AUTO_LAUNCH_ENABLED, value).apply()

var homeAppsNum: Int
get() = prefs.getInt(HOME_APPS_NUM, 4)
set(value) = prefs.edit().putInt(HOME_APPS_NUM, value).apply()
Expand Down Expand Up @@ -458,4 +463,4 @@ class Prefs(context: Context) {
fun getAppRenameLabel(appPackage: String): String = prefs.getString(appPackage, "").toString()

fun setAppRenameLabel(appPackage: String, renameLabel: String) = prefs.edit().putString(appPackage, renameLabel).apply()
}
}
3 changes: 2 additions & 1 deletion app/src/main/java/app/olauncher/ui/AppDrawerAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import java.text.Normalizer
class AppDrawerAdapter(
private var flag: Int,
private val appLabelGravity: Int,
private val enableAutoLaunch: Boolean,
private val appClickListener: (AppModel) -> Unit,
private val appInfoListener: (AppModel) -> Unit,
private val appDeleteListener: (AppModel) -> Unit,
Expand Down Expand Up @@ -80,7 +81,7 @@ class AppDrawerAdapter(
return object : Filter() {
override fun performFiltering(charSearch: CharSequence?): FilterResults {
isBangSearch = charSearch?.startsWith("!") ?: false
autoLaunch = charSearch?.startsWith(" ")?.not() ?: true
autoLaunch = enableAutoLaunch && (charSearch?.startsWith(" ")?.not() ?: true)

val appFilteredList = (if (charSearch.isNullOrBlank()) appsList
else appsList.filter { app ->
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class AppDrawerFragment : Fragment() {
adapter = AppDrawerAdapter(
flag,
prefs.appLabelAlignment,
prefs.autoLaunchEnabled,
appClickListener = {
if (it.appPackage.isEmpty())
return@AppDrawerAdapter
Expand Down Expand Up @@ -284,4 +285,4 @@ class AppDrawerFragment : Fragment() {
super.onDestroyView()
_binding = null
}
}
}
18 changes: 17 additions & 1 deletion app/src/main/java/app/olauncher/ui/SettingsFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
populateScreenTimeOnOff()
populateLockSettings()
populateWallpaperText()
populateAutoLaunchEnabled()
populateAppThemeText()
populateTextSize()
populateAlignment()
Expand Down Expand Up @@ -103,6 +104,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
R.id.toggleLock -> toggleLockMode()
R.id.autoShowKeyboard -> toggleKeyboardText()
R.id.homeAppsNum -> binding.appsNumSelectLayout.visibility = View.VISIBLE
R.id.autoLaunchEnabled -> toggleAutoLaunchEnabled()
R.id.dailyWallpaperUrl -> requireContext().openUrl(prefs.dailyWallpaperUrl)
R.id.dailyWallpaper -> toggleDailyWallpaperUpdate()
R.id.alignment -> binding.alignmentSelectLayout.visibility = View.VISIBLE
Expand Down Expand Up @@ -202,6 +204,7 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
binding.screenTimeOnOff.setOnClickListener(this)
binding.dailyWallpaperUrl.setOnClickListener(this)
binding.dailyWallpaper.setOnClickListener(this)
binding.autoLaunchEnabled.setOnClickListener(this)
binding.alignment.setOnClickListener(this)
binding.alignmentLeft.setOnClickListener(this)
binding.alignmentCenter.setOnClickListener(this)
Expand Down Expand Up @@ -315,6 +318,14 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
}
}

private fun populateAutoLaunchEnabled() {
if (prefs.autoLaunchEnabled) {
binding.autoLaunchEnabled.text = getString(R.string.on)
} else {
binding.autoLaunchEnabled.text = getString(R.string.off)
}
}

private fun toggleDateTime(selected: Int) {
prefs.dateTimeVisibility = selected
populateDateTime()
Expand Down Expand Up @@ -449,6 +460,11 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
requireContext().showToast(getString(R.string.olauncher_is_not_default_launcher), Toast.LENGTH_LONG)
}

private fun toggleAutoLaunchEnabled() {
prefs.autoLaunchEnabled = !prefs.autoLaunchEnabled
populateAutoLaunchEnabled()
}

private fun updateHomeAppsNum(num: Int) {
binding.homeAppsNum.text = num.toString()
binding.appsNumSelectLayout.visibility = View.GONE
Expand Down Expand Up @@ -641,4 +657,4 @@ class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListe
viewModel.checkForMessages.call()
super.onDestroy()
}
}
}
101 changes: 74 additions & 27 deletions app/src/main/res/layout-land/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -475,32 +475,6 @@
android:text="@string/appearance"
android:textColor="?attr/primaryColor" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_show_keyboard"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoShowKeyboard"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -753,6 +727,79 @@

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:background="@drawable/rounded_rect_shade_color"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:padding="12dp">

<TextView
style="@style/TextLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:text="@string/search"
android:textColor="?attr/primaryColor" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_show_keyboard"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoShowKeyboard"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_launch_enabled"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoLaunchEnabled"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -1081,4 +1128,4 @@

</FrameLayout>

</FrameLayout>
</FrameLayout>
103 changes: 76 additions & 27 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,32 +493,6 @@
android:text="@string/appearance"
android:textColor="?attr/primaryColor" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_show_keyboard"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoShowKeyboard"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -772,6 +746,81 @@

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="12dp"
android:background="@drawable/rounded_rect_shade_color"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:padding="12dp"
tools:visibility="visible">

<TextView
style="@style/TextLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="12dp"
android:text="@string/search"
android:textColor="?attr/primaryColor" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_show_keyboard"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoShowKeyboard"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:animateLayoutChanges="true">

<TextView
style="@style/TextSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingVertical="8dp"
android:text="@string/auto_launch_enabled"
android:textColor="?attr/primaryColor" />

<TextView
android:id="@+id/autoLaunchEnabled"
style="@style/TextSmallBold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginEnd="4dp"
android:padding="8dp"
android:text="@string/on" />
</FrameLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -1108,4 +1157,4 @@

</FrameLayout>

</FrameLayout>
</FrameLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<string name="swipe_left_app">افتح عند التمرير لليسار</string>
<string name="swipe_right_app">افتح عند التمرير لليمين</string>
<string name="auto_show_keyboard">العرض التلقائي للوحة المفاتيح</string>
<string name="auto_launch_enabled">تشغيل التطبيق تلقائيًا</string>
<string name="hide">يخفي</string>
<string name="status_bar">أظهر شريط الحالة</string>
<string name="rename">إعادة تسمية</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<string name="swipe_left_app">Wischen Sie nach links über die App</string>
<string name="swipe_right_app">Wischen Sie nach rechts über die App</string>
<string name="auto_show_keyboard">Tastatur automatisch anzeigen</string>
<string name="auto_launch_enabled">App automatisch starten</string>
<string name="hide">Verstecken</string>
<string name="status_bar">Zeige Statusleiste</string>
<string name="rename">Umbenennen</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<string name="okay">De acuerdo</string>
<string name="cool">¡Guay!</string>
<string name="auto_show_keyboard">Mostrar teclado automáticamente</string>
<string name="auto_launch_enabled">Aplicación de inicio automático</string>
<string name="hide">Ocultar</string>
<string name="status_bar">Mostrar barra de estado</string>
<string name="rename">Renombrar</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<string name="okay">Bueno</string>
<string name="cool">¡Fresco!</string>
<string name="auto_show_keyboard">Mostrar teclado automáticamente</string>
<string name="auto_launch_enabled">Aplicación de inicio automático</string>
<string name="hide">Ocultar</string>
<string name="status_bar">Mostrar barra de estado</string>
<string name="rename">Renombrar</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<string name="okay">D\'accord</string>
<string name="cool">Cool !</string>
<string name="auto_show_keyboard">Afficher automatiquement le clavier</string>
<string name="auto_launch_enabled">Lancement automatique de l\'application</string>
<string name="hide">Cacher</string>
<string name="status_bar">Afficher la barre d\'état</string>
<string name="rename">Renommer</string>
Expand Down
Loading