Extract another theming method to common library

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-08-31 10:49:54 +02:00
parent 712e9b9eab
commit 7e3eb05b94
No known key found for this signature in database
GPG Key ID: 2585783189A62105
4 changed files with 8 additions and 11 deletions

View File

@ -333,7 +333,7 @@ dependencies {
// implementation 'androidx.activity:activity-ktx:1.4.0' // implementation 'androidx.activity:activity-ktx:1.4.0'
// TODO substitute for tag after first common release // TODO substitute for tag after first common release
implementation 'com.github.nextcloud.android-common:ui:83c4a8aa885e8ef1bba2e44704be8625db396e1b' implementation 'com.github.nextcloud.android-common:ui:82f6da3e9638e7578a8df8f6e52884e2923b2760'
} }
task installGitHooks(type: Copy, group: "development") { task installGitHooks(type: Copy, group: "development") {

View File

@ -43,7 +43,6 @@ import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.children import androidx.core.view.children
import com.google.android.material.card.MaterialCardView import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.ChipDrawable
import com.nextcloud.android.common.ui.theme.MaterialSchemes import com.nextcloud.android.common.ui.theme.MaterialSchemes
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils
@ -59,7 +58,6 @@ import kotlin.math.roundToInt
/** /**
* View theme utils specific for the Talk app. * View theme utils specific for the Talk app.
* *
* TODO some of these can be renamed and made generic
*/ */
@Suppress("TooManyFunctions") @Suppress("TooManyFunctions")
class TalkSpecificViewThemeUtils @Inject constructor( class TalkSpecificViewThemeUtils @Inject constructor(
@ -216,13 +214,6 @@ class TalkSpecificViewThemeUtils @Inject constructor(
return drawable return drawable
} }
fun themePrimaryMentionChip(context: Context, chip: ChipDrawable) {
withScheme(context) { scheme ->
chip.chipBackgroundColor = ColorStateList.valueOf(scheme.primary)
chip.setTextColor(scheme.onPrimary)
}
}
fun themeSearchView(searchView: SearchView) { fun themeSearchView(searchView: SearchView) {
withScheme(searchView) { scheme -> withScheme(searchView) { scheme ->
// hacky as no default way is provided // hacky as no default way is provided

View File

@ -304,7 +304,7 @@ public class DisplayUtils {
chip.setEllipsize(TextUtils.TruncateAt.MIDDLE); chip.setEllipsize(TextUtils.TruncateAt.MIDDLE);
if (chipResource == R.xml.chip_you) { if (chipResource == R.xml.chip_you) {
viewThemeUtils.talk.themePrimaryMentionChip(context, chip); viewThemeUtils.material.colorChipDrawable(context, chip);
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

View File

@ -20,3 +20,9 @@
include ':app' include ':app'
//// uncomment to use local build of common-ui
//includeBuild('../android-common') {
// dependencySubstitution {
// substitute module('com.github.nextcloud.android-common:ui') using project(':ui')
// }
//}