Skip to content

Commit ab0d76f

Browse files
authored
feat: add options to show/hide app labels (#351)
* feat: add options to show/hide app labels Refs: #55 * refactor: remove dead adapter and dialog layout Added in SimpleMobileTools/Simple-Launcher#103, but never used. * fix: adjust icon spacing in folders when labels are disabled * fix: use proper style for preference items with values
1 parent 7cb0797 commit ab0d76f

10 files changed

Lines changed: 81 additions & 144 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- Option to hide app labels ([#55])
810

911
## [1.8.0] - 2026-01-30
1012
### Added
@@ -105,6 +107,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105107
[#6]: https://github.com/FossifyOrg/Launcher/issues/6
106108
[#44]: https://github.com/FossifyOrg/Launcher/issues/44
107109
[#51]: https://github.com/FossifyOrg/Launcher/issues/51
110+
[#55]: https://github.com/FossifyOrg/Launcher/issues/55
108111
[#63]: https://github.com/FossifyOrg/Launcher/issues/63
109112
[#65]: https://github.com/FossifyOrg/Launcher/issues/65
110113
[#74]: https://github.com/FossifyOrg/Launcher/issues/74

app/src/main/kotlin/org/fossify/home/activities/SettingsActivity.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ class SettingsActivity : SimpleActivity() {
5151
setupOpenKeyboardOnAppDrawer()
5252
setupDrawerColumnCount()
5353
setupDrawerSearchBar()
54+
setupShowDrawerAppLabels()
5455
setupHomeRowCount()
5556
setupHomeColumnCount()
57+
setupShowHomeAppLabels()
5658
setupLanguage()
5759
setupManageHiddenIcons()
5860
updateTextColors(binding.settingsHolder)
@@ -187,6 +189,14 @@ class SettingsActivity : SimpleActivity() {
187189
}
188190
}
189191

192+
private fun setupShowDrawerAppLabels() {
193+
binding.settingsShowDrawerAppLabels.isChecked = config.showDrawerAppLabels
194+
binding.settingsShowDrawerAppLabelsHolder.setOnClickListener {
195+
binding.settingsShowDrawerAppLabels.toggle()
196+
config.showDrawerAppLabels = binding.settingsShowDrawerAppLabels.isChecked
197+
}
198+
}
199+
190200
private fun setupHomeRowCount() {
191201
val currentRowCount = config.homeRowCount
192202
binding.settingsHomeScreenRowCount.text = currentRowCount.toString()
@@ -239,6 +249,14 @@ class SettingsActivity : SimpleActivity() {
239249
}
240250
}
241251

252+
private fun setupShowHomeAppLabels() {
253+
binding.settingsShowHomeAppLabels.isChecked = config.showHomeAppLabels
254+
binding.settingsShowHomeAppLabelsHolder.setOnClickListener {
255+
binding.settingsShowHomeAppLabels.toggle()
256+
config.showHomeAppLabels = binding.settingsShowHomeAppLabels.isChecked
257+
}
258+
}
259+
242260
@SuppressLint("NewApi")
243261
private fun setupLanguage() {
244262
binding.settingsLanguage.text = Locale.getDefault().displayLanguage

app/src/main/kotlin/org/fossify/home/adapters/FolderIconsAdapter.kt

Lines changed: 0 additions & 109 deletions
This file was deleted.

app/src/main/kotlin/org/fossify/home/adapters/LaunchersAdapter.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
1414
import com.bumptech.glide.request.target.DrawableImageViewTarget
1515
import com.bumptech.glide.request.transition.Transition
1616
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
17+
import org.fossify.commons.extensions.beVisibleIf
1718
import org.fossify.commons.extensions.getColoredDrawableWithColor
1819
import org.fossify.commons.extensions.getProperTextColor
1920
import org.fossify.commons.extensions.realScreenSize
@@ -81,6 +82,7 @@ class LaunchersAdapter(
8182
itemView.apply {
8283
binding.launcherLabel.text = launcher.title
8384
binding.launcherLabel.setTextColor(textColor)
85+
binding.launcherLabel.beVisibleIf(activity.config.showDrawerAppLabels)
8486
binding.launcherIcon.setPadding(iconPadding, iconPadding, iconPadding, 0)
8587

8688
if (launcher.drawable != null && binding.launcherIcon.tag == true) {

app/src/main/kotlin/org/fossify/home/helpers/Config.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ class Config(context: Context) : BaseConfig(context) {
3737
get() = prefs.getBoolean(AUTO_SHOW_KEYBOARD_IN_APP_DRAWER, false)
3838
set(autoShowKeyboardInAppDrawer) = prefs.edit()
3939
.putBoolean(AUTO_SHOW_KEYBOARD_IN_APP_DRAWER, autoShowKeyboardInAppDrawer).apply()
40+
41+
var showDrawerAppLabels: Boolean
42+
get() = prefs.getBoolean(SHOW_DRAWER_APP_LABELS, true)
43+
set(showDrawerAppLabels) = prefs.edit().putBoolean(SHOW_DRAWER_APP_LABELS, showDrawerAppLabels).apply()
44+
45+
var showHomeAppLabels: Boolean
46+
get() = prefs.getBoolean(SHOW_HOME_APP_LABELS, true)
47+
set(showHomeAppLabels) = prefs.edit().putBoolean(SHOW_HOME_APP_LABELS, showHomeAppLabels).apply()
4048
}

app/src/main/kotlin/org/fossify/home/helpers/Constants.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const val DRAWER_COLUMN_COUNT = "drawer_column_count"
1313
const val SHOW_SEARCH_BAR = "show_search_bar"
1414
const val CLOSE_APP_DRAWER = "close_app_drawer"
1515
const val AUTO_SHOW_KEYBOARD_IN_APP_DRAWER = "auto_show_keyboard_in_app_drawer"
16+
const val SHOW_DRAWER_APP_LABELS = "show_drawer_app_labels"
17+
const val SHOW_HOME_APP_LABELS = "show_home_app_labels"
1618

1719
// default home screen grid size
1820
const val ROW_COUNT = 6

app/src/main/kotlin/org/fossify/home/views/HomeScreenGrid.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) :
15741574
cell.top - iconMargin
15751575
} + sideMargins.top
15761576
}
1577-
val additionalHeight = if (!item.docked) {
1577+
val additionalHeight = if (!item.docked && context.config.showHomeAppLabels) {
15781578
// multiply line count by line height to get label height
15791579
// we multiply all line heights by 2 so all widgets get the same clickable area and 2 is the max line count
15801580
(2 * (textPaint.fontMetrics.bottom - textPaint.fontMetrics.top)).toInt()
@@ -1888,7 +1888,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) :
18881888
drawableY + iconSize
18891889
)
18901890

1891-
if (item.id != draggedItem?.id && item.title.isNotEmpty()) {
1891+
if (item.id != draggedItem?.id && item.title.isNotEmpty() && context.config.showHomeAppLabels) {
18921892
val textX = cell.left.toFloat() + labelSideMargin
18931893
val textY = cell.top.toFloat() + iconSize + iconMargin + labelSideMargin
18941894
val textPaintToUse = if (item.parentId == null) {
@@ -2036,7 +2036,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) :
20362036
val rowsCount = ceil(count.toFloat() / columnsCount).toInt()
20372037
val cellSize = getCellSize()
20382038
val gap = getGapSize()
2039-
val yGap = gap + textPaint.textSize + 2 * labelSideMargin
2039+
val yGap = if (context.config.showHomeAppLabels) {
2040+
gap + textPaint.textSize + 2 * labelSideMargin
2041+
} else gap
20402042
val cell = cells[item.getTopLeft(rowCount)] ?: return RectF(0f, 0f, 0f, 0f)
20412043
val centerX = sideMargins.left + cell.centerX()
20422044
val centerY = sideMargins.top + cell.centerY()
@@ -2089,7 +2091,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) :
20892091
val folderItemsRect = getItemsDrawingRect()
20902092
val cellSize = getCellSize()
20912093
val gap = getGapSize()
2092-
val yGap = gap + textPaint.textSize + 2 * labelSideMargin
2094+
val yGap = if (context.config.showHomeAppLabels) {
2095+
gap + textPaint.textSize + 2 * labelSideMargin
2096+
} else gap
20932097
return (0 until columnsCount * rowsCount)
20942098
.toList()
20952099
.map { Pair(it % columnsCount, it / columnsCount) }
@@ -2115,7 +2119,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) :
21152119
val itemsRect = getItemsDrawingRect()
21162120
val cellSize = getCellSize()
21172121
val gapSize = getGapSize()
2118-
val yGapSize = gapSize + textPaint.textSize + 2 * labelSideMargin
2122+
val yGapSize = if (context.config.showHomeAppLabels) {
2123+
gapSize + textPaint.textSize + 2 * labelSideMargin
2124+
} else gapSize
21192125
val left = (itemsRect.left + column * cellSize + column * gapSize).roundToInt()
21202126
val top = (itemsRect.top + row * cellSize + row * yGapSize).roundToInt()
21212127
return Rect(

app/src/main/res/layout/activity_settings.xml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<org.fossify.commons.views.PurchaseThankYouItem
7575
android:id="@+id/settings_purchase_thank_you_holder"
7676
android:layout_width="match_parent"
77-
android:layout_height="wrap_content"/>
77+
android:layout_height="wrap_content" />
7878

7979
<RelativeLayout
8080
android:id="@+id/settings_use_english_holder"
@@ -161,7 +161,7 @@
161161

162162
<RelativeLayout
163163
android:id="@+id/settings_drawer_column_count_holder"
164-
style="@style/SettingsHolderTextViewOneLinerStyle"
164+
style="@style/SettingsHolderTextViewStyle"
165165
android:layout_width="match_parent"
166166
android:layout_height="wrap_content"
167167
android:background="@drawable/ripple_background">
@@ -231,6 +231,22 @@
231231

232232
</RelativeLayout>
233233

234+
<RelativeLayout
235+
android:id="@+id/settings_show_drawer_app_labels_holder"
236+
style="@style/SettingsHolderSwitchStyle"
237+
android:layout_width="match_parent"
238+
android:layout_height="wrap_content"
239+
android:background="@drawable/ripple_background">
240+
241+
<org.fossify.commons.views.MyMaterialSwitch
242+
android:id="@+id/settings_show_drawer_app_labels"
243+
style="@style/SettingsSwitchStyle"
244+
android:layout_width="match_parent"
245+
android:layout_height="wrap_content"
246+
android:text="@string/show_app_labels" />
247+
248+
</RelativeLayout>
249+
234250
<include
235251
android:id="@+id/settings_drawer_settings_divider"
236252
layout="@layout/divider" />
@@ -244,7 +260,7 @@
244260

245261
<RelativeLayout
246262
android:id="@+id/settings_home_screen_row_count_holder"
247-
style="@style/SettingsHolderTextViewOneLinerStyle"
263+
style="@style/SettingsHolderTextViewStyle"
248264
android:layout_width="match_parent"
249265
android:layout_height="wrap_content"
250266
android:background="@drawable/ripple_background">
@@ -268,7 +284,7 @@
268284

269285
<RelativeLayout
270286
android:id="@+id/settings_home_screen_column_count_holder"
271-
style="@style/SettingsHolderTextViewOneLinerStyle"
287+
style="@style/SettingsHolderTextViewStyle"
272288
android:layout_width="match_parent"
273289
android:layout_height="wrap_content"
274290
android:background="@drawable/ripple_background">
@@ -289,6 +305,22 @@
289305
tools:text="3" />
290306

291307
</RelativeLayout>
308+
309+
<RelativeLayout
310+
android:id="@+id/settings_show_home_app_labels_holder"
311+
style="@style/SettingsHolderSwitchStyle"
312+
android:layout_width="match_parent"
313+
android:layout_height="wrap_content"
314+
android:background="@drawable/ripple_background">
315+
316+
<org.fossify.commons.views.MyMaterialSwitch
317+
android:id="@+id/settings_show_home_app_labels"
318+
style="@style/SettingsSwitchStyle"
319+
android:layout_width="match_parent"
320+
android:layout_height="wrap_content"
321+
android:text="@string/show_app_labels" />
322+
323+
</RelativeLayout>
292324
</LinearLayout>
293325
</androidx.core.widget.NestedScrollView>
294326
</androidx.coordinatorlayout.widget.CoordinatorLayout>

app/src/main/res/layout/dialog_folder_icons.xml

Lines changed: 0 additions & 26 deletions
This file was deleted.

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<string name="app_drawer_settings">App drawer</string>
1414
<string name="close_app_drawer_on_app_open">Close app drawer on opening an app</string>
1515
<string name="auto_show_keyboard_in_app_drawer">Automatically show keyboard in drawer</string>
16+
<string name="show_app_labels">Show app labels</string>
1617
<string name="home_screen_settings">Home screen</string>
1718
<string name="widget_too_big">Widget is too big for current home screen size</string>
1819
<string name="double_tap_to_lock">Double tap to lock screen</string>

0 commit comments

Comments
 (0)