Action bar styling

pull/194/merge
M66B 4 years ago
parent 2d67664d4c
commit c2396b0ac0

@ -122,7 +122,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
prefs.registerOnSharedPreferenceChangeListener(this); prefs.registerOnSharedPreferenceChangeListener(this);
int colorPrimaryDark = Helper.resolveColor(this, R.attr.colorPrimaryDark); int colorPrimaryDark = Helper.resolveColor(this, R.attr.colorPrimaryDark);
int colorActionForeground = Helper.resolveColor(this, R.attr.colorActionForeground);
try { try {
Drawable d = getDrawable(R.drawable.baseline_mail_24); Drawable d = getDrawable(R.drawable.baseline_mail_24);
@ -132,7 +131,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm); Canvas canvas = new Canvas(bm);
d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); d.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
d.setTint(colorActionForeground); d.setTint(Color.WHITE);
d.draw(canvas); d.draw(canvas);
int colorPrimary = colorPrimaryDark; int colorPrimary = colorPrimaryDark;

@ -1572,8 +1572,11 @@ public class FragmentCompose extends FragmentBase {
menu.findItem(R.id.menu_zoom).setTitle(ssbZoom); menu.findItem(R.id.menu_zoom).setTitle(ssbZoom);
PopupMenuLifecycle.insertIcon(context, menu.findItem(R.id.menu_zoom), false); PopupMenuLifecycle.insertIcon(context, menu.findItem(R.id.menu_zoom), false);
FragmentActivity activity = getActivity();
Context tcontext = (activity instanceof ActivityBase
? ((ActivityBase) activity).getSupportActionBar().getThemedContext() : context);
int colorEncrypt = Helper.resolveColor(context, R.attr.colorEncrypt); int colorEncrypt = Helper.resolveColor(context, R.attr.colorEncrypt);
int colorActionForeground = Helper.resolveColor(context, R.attr.colorActionForeground); int colorActionForeground = Helper.resolveColor((tcontext), android.R.attr.textColorPrimary);
View v = menu.findItem(R.id.menu_encrypt).getActionView(); View v = menu.findItem(R.id.menu_encrypt).getActionView();
ImageButton ib = v.findViewById(R.id.button); ImageButton ib = v.findViewById(R.id.button);

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<eu.faircode.email.FixedImageButton xmlns:android="http://schemas.android.com/apk/res/android" <eu.faircode.email.FixedImageButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation" style="@android:style/Widget.ActionButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:theme="?actionBarTheme"
app:srcCompat="@mipmap/ic_launcher" app:srcCompat="@mipmap/ic_launcher"
app:tint="?colorActionForeground" /> app:tint="?android:attr/textColorPrimary" />

@ -2,18 +2,19 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:theme="?actionBarTheme">
<eu.faircode.email.FixedImageButton <eu.faircode.email.FixedImageButton
android:id="@+id/button" android:id="@+id/button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation" style="@android:style/Widget.ActionButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/title_encrypt" android:contentDescription="@string/title_encrypt"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_lock_24" app:srcCompat="@drawable/twotone_lock_24"
app:tint="?colorActionForeground" /> app:tint="?android:attr/textColorPrimary" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/text" android:id="@+id/text"
@ -22,8 +23,9 @@
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:clickable="false" android:clickable="false"
android:text="P" android:text="P"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle"
android:textColor="?colorActionForeground" android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/button" app:layout_constraintBottom_toBottomOf="@id/button"
app:layout_constraintEnd_toEndOf="@id/button" app:layout_constraintEnd_toEndOf="@id/button"
app:layout_constraintTop_toTopOf="@id/button" /> app:layout_constraintTop_toTopOf="@id/button" />

Loading…
Cancel
Save