handle updating the text color

This commit is contained in:
tibbi 2022-10-11 23:36:53 +02:00
parent a1742ff5aa
commit f70d99883c
4 changed files with 16 additions and 0 deletions

View File

@ -68,6 +68,13 @@ class LaunchersAdapter(
}
}
fun updateTextColor(newTextColor: Int) {
if (newTextColor != textColor) {
textColor = newTextColor
notifyDataSetChanged()
}
}
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(launcher: AppLauncher): View {
itemView.apply {

View File

@ -122,6 +122,13 @@ class WidgetsAdapter(
}
}
fun updateTextColor(newTextColor: Int) {
if (newTextColor != textColor) {
textColor = newTextColor
notifyDataSetChanged()
}
}
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bindView(widgetListItem: WidgetsListItem, callback: (itemView: View, adapterPosition: Int) -> Unit) {
itemView.apply {

View File

@ -142,6 +142,7 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
setPadding(0, topPadding, 0, 0)
background = ColorDrawable(context.getProperBackgroundColor())
(all_apps_grid.adapter as? LaunchersAdapter)?.updateTextColor(context.getProperTextColor())
}
override fun onAppLauncherLongPressed(x: Float, y: Float, appLauncher: AppLauncher) {

View File

@ -202,6 +202,7 @@ class WidgetsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
val topPadding = if (addTopPadding) activity!!.statusBarHeight else 0
setPadding(0, topPadding, 0, 0)
background = ColorDrawable(context.getProperBackgroundColor())
(widgets_list.adapter as? WidgetsAdapter)?.updateTextColor(context.getProperTextColor())
}
private fun getAppMetadataFromPackage(packageName: String): WidgetsListSection? {