mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 22:21:18 +00:00
Click encypt title to open OpneKeychain app
This commit is contained in:
parent
538177ee52
commit
aa69eccfe7
2 changed files with 22 additions and 7 deletions
|
@ -47,6 +47,7 @@ import android.graphics.BitmapFactory;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.ImageDecoder;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
|
@ -6903,6 +6904,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
final int[] sendDelayedValues = getResources().getIntArray(R.array.sendDelayedValues);
|
||||
final String[] sendDelayedNames = getResources().getStringArray(R.array.sendDelayedNames);
|
||||
|
||||
final String pkgOpenKeyChain = Helper.getOpenKeychainPackage(context);
|
||||
|
||||
final ViewGroup dview = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.dialog_send, null);
|
||||
final Button btnFixSent = dview.findViewById(R.id.btnFixSent);
|
||||
final TextView tvAddressError = dview.findViewById(R.id.tvAddressError);
|
||||
|
@ -6926,6 +6929,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
final TextView tvPlainHint = dview.findViewById(R.id.tvPlainHint);
|
||||
final CheckBox cbReceipt = dview.findViewById(R.id.cbReceipt);
|
||||
final TextView tvReceiptHint = dview.findViewById(R.id.tvReceiptHint);
|
||||
final TextView tvEncrypt = dview.findViewById(R.id.tvEncrypt);
|
||||
final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt);
|
||||
final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption);
|
||||
final Spinner spPriority = dview.findViewById(R.id.spPriority);
|
||||
|
@ -7067,6 +7071,18 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
if (Helper.isOpenKeychainInstalled(context)) {
|
||||
tvEncrypt.setPaintFlags(tvEncrypt.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
tvEncrypt.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String pkg = Helper.getOpenKeychainPackage(v.getContext());
|
||||
PackageManager pm = v.getContext().getPackageManager();
|
||||
v.getContext().startActivity(pm.getLaunchIntentForPackage(pkg));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
spEncrypt.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
|
|
@ -517,9 +517,13 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
static boolean isOpenKeychainInstalled(Context context) {
|
||||
static String getOpenKeychainPackage(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
String provider = prefs.getString("openpgp_provider", "org.sufficientlysecure.keychain");
|
||||
return prefs.getString("openpgp_provider", "org.sufficientlysecure.keychain");
|
||||
}
|
||||
|
||||
static boolean isOpenKeychainInstalled(Context context) {
|
||||
String provider = getOpenKeychainPackage(context);
|
||||
|
||||
PackageManager pm = context.getPackageManager();
|
||||
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
||||
|
@ -833,11 +837,6 @@ public class Helper {
|
|||
view(context, Uri.parse(base + "#user-content-faq" + question), "text/html", false, false);
|
||||
}
|
||||
|
||||
static String getOpenKeychainPackage(Context context) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return prefs.getString("openpgp_provider", "org.sufficientlysecure.keychain");
|
||||
}
|
||||
|
||||
static Uri getPrivacyUri(Context context) {
|
||||
// https://translate.google.com/translate?sl=auto&tl=<language>&u=<url>
|
||||
return Uri.parse(PRIVACY_URI)
|
||||
|
|
Loading…
Reference in a new issue