mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 00:23:09 +02:00
Added key import
This commit is contained in:
@@ -26,6 +26,7 @@ import android.content.SharedPreferences;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.security.KeyChain;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -66,8 +67,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
private SwitchCompat swAutoDecrypt;
|
||||
private SwitchCompat swSecure;
|
||||
private Button btnBiometrics;
|
||||
private Spinner spBiometricsTimeout;
|
||||
private Button btnPin;
|
||||
private Spinner spBiometricsTimeout;
|
||||
private Button btnImportKey;
|
||||
|
||||
private List<String> openPgpProvider = new ArrayList<>();
|
||||
|
||||
@@ -96,8 +98,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
|
||||
swSecure = view.findViewById(R.id.swSecure);
|
||||
btnBiometrics = view.findViewById(R.id.btnBiometrics);
|
||||
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
||||
btnPin = view.findViewById(R.id.btnPin);
|
||||
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
||||
btnImportKey = view.findViewById(R.id.btnImportKey);
|
||||
|
||||
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
||||
List<ResolveInfo> ris = getContext().getPackageManager().queryIntentServices(intent, 0);
|
||||
@@ -219,6 +222,16 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||
}
|
||||
});
|
||||
|
||||
final Intent importKey = KeyChain.createInstallIntent();
|
||||
btnImportKey.setEnabled(importKey.resolveActivity(getContext().getPackageManager()) != null);
|
||||
btnImportKey.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||
btnImportKey.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(importKey);
|
||||
}
|
||||
});
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
return view;
|
||||
|
||||
Reference in New Issue
Block a user