diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-04-12 12:44:26 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-04-12 12:44:26 +0300 |
commit | 1063dd2347c7933e20b1d6094cb93beeae54b95b (patch) | |
tree | cd02770a4b9f3caf591fe33a8c57c9d85c20cf8d /app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java | |
parent | e10a845b837cc16b193010615e24c29a59eebb6c (diff) |
#317 Adjust theme for each account
Use DeleteDialog for stacks and boards
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java index dd95e69c9..8fc21110e 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java @@ -1,6 +1,7 @@ package it.niedermann.nextcloud.deck.ui.card; import android.content.res.ColorStateList; +import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -21,6 +22,7 @@ import androidx.core.graphics.drawable.DrawableCompat; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; +import com.google.android.material.textfield.TextInputLayout; import java.util.ArrayList; import java.util.Date; @@ -350,10 +352,14 @@ public class EditActivity extends BrandedActivity implements CardDetailsListener super.applyBrand(mainColor, textColor); applyBrandToPrimaryToolbar(mainColor, textColor, binding.toolbar); applyBrandToPrimaryTabLayout(mainColor, textColor, binding.tabLayout); + final int highlightColor = Color.argb(77, Color.red(textColor), Color.green(textColor), Color.blue(textColor)); + binding.title.setHighlightColor(highlightColor); binding.title.setTextColor(textColor); DrawableCompat.setTintList(binding.title.getBackground(), ColorStateList.valueOf(textColor)); applyBrandToTitle(textColor, binding.title); binding.titleTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(textColor)); + + applyBrandToTitleWrapper(textColor, binding.titleTextInputLayout); } private static void applyBrandToTitle(@ColorInt int textColor, @NonNull EditText editText) { @@ -379,4 +385,28 @@ public class EditActivity extends BrandedActivity implements CardDetailsListener editText.requestFocus(); } } + + private static void applyBrandToTitleWrapper(@ColorInt int textColor, @NonNull TextInputLayout editText) { + final Drawable background = editText.getBackground(); +// final ColorFilter oldColorFilter = DrawableCompat.getColorFilter(background); + final View.OnFocusChangeListener oldOnFocusChangeListener = editText.getOnFocusChangeListener(); + + final boolean isFocused = editText.isFocused(); + if (isFocused) { + editText.clearFocus(); + } + editText.setOnFocusChangeListener((v, hasFocus) -> { + if (hasFocus) { + background.setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP); + } else { +// background.setColorFilter(oldColorFilter); + } + if (oldOnFocusChangeListener != null) { + oldOnFocusChangeListener.onFocusChange(v, hasFocus); + } + }); + if (isFocused) { + editText.requestFocus(); + } + } } |