theme share buttons in m3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-09-26 19:04:36 +02:00 committed by Álvaro Brey
parent 6d1d03caf1
commit d57ea5a010
No known key found for this signature in database
GPG key ID: 2585783189A62105
2 changed files with 27 additions and 5 deletions

View file

@ -207,11 +207,7 @@ public class SendShareDialog extends BottomSheetDialogFragment implements Inject
}
private void themeShareButtonImage(ImageView shareImageView) {
shareImageView.getBackground().setColorFilter(themeColorUtils.primaryColor(getContext().getApplicationContext(),
true),
PorterDuff.Mode.SRC_IN);
shareImageView.getDrawable().mutate().setColorFilter(themeColorUtils.fontColor(getContext().getApplicationContext()),
PorterDuff.Mode.SRC_IN);
viewThemeUtils.files.themeAvatarButton(shareImageView);
}
private void showResharingNotAllowedSnackbar() {

View file

@ -23,6 +23,7 @@
package com.owncloud.android.utils.theme.newm3
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.PorterDuff
import android.graphics.drawable.Drawable
import android.preference.PreferenceCategory
@ -35,6 +36,7 @@ import androidx.annotation.Px
import androidx.annotation.StringRes
import androidx.appcompat.app.ActionBar
import androidx.core.content.res.ResourcesCompat
import com.google.android.material.card.MaterialCardView
import com.nextcloud.android.common.ui.theme.MaterialSchemes
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
import com.nextcloud.android.common.ui.theme.utils.AndroidViewThemeUtils
@ -173,6 +175,30 @@ class FilesSpecificViewThemeUtils @Inject constructor(
androidXViewThemeUtils.themeActionBar(context, actionBar, backArrow)
}
fun themeTemplateCardView(cardView: MaterialCardView) {
withScheme(cardView.context) { scheme ->
cardView.setStrokeColor(
ColorStateList(
arrayOf(
intArrayOf(android.R.attr.state_checked),
intArrayOf(-android.R.attr.state_checked)
),
intArrayOf(
scheme.primary,
scheme.outline
)
)
)
}
}
fun themeAvatarButton(shareImageView: ImageView) {
withScheme(shareImageView.context) { scheme ->
shareImageView.background.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_IN)
shareImageView.drawable.mutate().setColorFilter(scheme.onPrimary, PorterDuff.Mode.SRC_IN)
}
}
companion object {
private val TAG = FilesSpecificViewThemeUtils::class.simpleName