Skip to content

Commit f70d998

Browse files
committed
handle updating the text color
1 parent a1742ff commit f70d998

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/launcher/adapters/LaunchersAdapter.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class LaunchersAdapter(
6868
}
6969
}
7070

71+
fun updateTextColor(newTextColor: Int) {
72+
if (newTextColor != textColor) {
73+
textColor = newTextColor
74+
notifyDataSetChanged()
75+
}
76+
}
77+
7178
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
7279
fun bindView(launcher: AppLauncher): View {
7380
itemView.apply {

app/src/main/kotlin/com/simplemobiletools/launcher/adapters/WidgetsAdapter.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ class WidgetsAdapter(
122122
}
123123
}
124124

125+
fun updateTextColor(newTextColor: Int) {
126+
if (newTextColor != textColor) {
127+
textColor = newTextColor
128+
notifyDataSetChanged()
129+
}
130+
}
131+
125132
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
126133
fun bindView(widgetListItem: WidgetsListItem, callback: (itemView: View, adapterPosition: Int) -> Unit) {
127134
itemView.apply {

app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
142142
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
143143
setPadding(0, topPadding, 0, 0)
144144
background = ColorDrawable(context.getProperBackgroundColor())
145+
(all_apps_grid.adapter as? LaunchersAdapter)?.updateTextColor(context.getProperTextColor())
145146
}
146147

147148
override fun onAppLauncherLongPressed(x: Float, y: Float, appLauncher: AppLauncher) {

app/src/main/kotlin/com/simplemobiletools/launcher/fragments/WidgetsFragment.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
202202
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
203203
setPadding(0, topPadding, 0, 0)
204204
background = ColorDrawable(context.getProperBackgroundColor())
205+
(widgets_list.adapter as? WidgetsAdapter)?.updateTextColor(context.getProperTextColor())
205206
}
206207

207208
private fun getAppMetadataFromPackage(packageName: String): WidgetsListSection? {

0 commit comments

Comments
 (0)