1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Reversed encryption padlock

This commit is contained in:
M66B 2019-11-04 10:12:30 +01:00
parent afa0611a58
commit 551b3d0eb4
4 changed files with 25 additions and 2 deletions

View file

@ -32,6 +32,7 @@ import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
@ -962,6 +963,16 @@ public class FragmentCompose extends FragmentBase {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_compose, menu);
menu.findItem(R.id.menu_encrypt).setActionView(R.layout.action_button);
ImageButton ib = (ImageButton) menu.findItem(R.id.menu_encrypt).getActionView();
ib.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMenuEncrypt();
}
});
super.onCreateOptionsMenu(menu, inflater);
}
@ -987,7 +998,12 @@ public class FragmentCompose extends FragmentBase {
menu.findItem(R.id.menu_answer).setEnabled(!busy);
menu.findItem(R.id.menu_send).setEnabled(!busy);
menu.findItem(R.id.menu_encrypt).setIcon(encrypt ? R.drawable.baseline_lock_open_24 : R.drawable.baseline_lock_24);
int colorEncrypt = Helper.resolveColor(getContext(), R.attr.colorEncrypt);
ImageButton ib = (ImageButton) menu.findItem(R.id.menu_encrypt).getActionView();
ib.setEnabled(!busy);
ib.setImageResource(encrypt ? R.drawable.baseline_lock_24 : R.drawable.baseline_lock_open_24);
ib.setImageTintList(encrypt ? ColorStateList.valueOf(colorEncrypt) : null);
menu.findItem(R.id.menu_media).setChecked(media);
menu.findItem(R.id.menu_compact).setChecked(compact);

View file

@ -4,4 +4,4 @@
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/baseline_folder_24" />
app:srcCompat="@mipmap/ic_launcher" />

View file

@ -18,6 +18,8 @@
<!-- White 87% primary_text_default_material_dark -->
<color name="colorUnreadDark">#ffffffff</color>
<color name="colorEncrypt">#ff00d000</color>
<!-- Grey 800 -->
<color name="darkPrimary">#424242</color>
<color name="darkPrimaryDark">#1b1b1b</color>

View file

@ -3,6 +3,7 @@
<attr name="colorRead" format="reference" />
<attr name="colorUnread" format="reference" />
<attr name="colorUnreadHighlight" format="reference" />
<attr name="colorEncrypt" format="reference" />
<attr name="colorSeparator" format="reference" />
<attr name="colorWarning" format="reference" />
<attr name="colorDrawerScrim" format="reference" />
@ -30,6 +31,8 @@
<item name="colorUnread">@color/colorUnreadLight</item>
<item name="colorUnreadHighlight">@color/colorAccentDark</item>
<item name="colorEncrypt">@color/colorEncrypt</item>
<item name="colorSeparator">@color/lightColorSeparator</item>
<item name="colorWarning">@color/lightColorWarning</item>
@ -75,6 +78,8 @@
<item name="colorUnread">@color/colorUnreadDark</item>
<item name="colorUnreadHighlight">@color/colorAccent</item>
<item name="colorEncrypt">@color/colorEncrypt</item>
<item name="colorSeparator">@color/darkColorSeparator</item>
<item name="colorWarning">@color/darkColorWarning</item>