Action bar styling

This commit is contained in:
M66B 2022-02-19 20:14:31 +01:00
parent 2d67664d4c
commit c2396b0ac0
4 changed files with 15 additions and 10 deletions

View File

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

View File

@ -1572,8 +1572,11 @@ public class FragmentCompose extends FragmentBase {
menu.findItem(R.id.menu_zoom).setTitle(ssbZoom);
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 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();
ImageButton ib = v.findViewById(R.id.button);

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<eu.faircode.email.FixedImageButton xmlns:android="http://schemas.android.com/apk/res/android"
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_height="match_parent"
android:theme="?actionBarTheme"
app:srcCompat="@mipmap/ic_launcher"
app:tint="?colorActionForeground" />
app:tint="?android:attr/textColorPrimary" />

View File

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