mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
DeepL: enter auth key
This commit is contained in:
@@ -1939,8 +1939,8 @@ public class FragmentCompose extends FragmentBase {
|
||||
}
|
||||
|
||||
private void onMenuTranslateKey() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putString("deepl", "").apply();
|
||||
FragmentDialogDeepL fragment = new FragmentDialogDeepL();
|
||||
fragment.show(getParentFragmentManager(), "deepl");
|
||||
}
|
||||
|
||||
private void onMenuTranslate(String target) {
|
||||
@@ -6683,6 +6683,35 @@ public class FragmentCompose extends FragmentBase {
|
||||
}
|
||||
}
|
||||
|
||||
public static class FragmentDialogDeepL extends FragmentDialogBase {
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
|
||||
final Context context = getContext();
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dialog_deepl, null);
|
||||
final EditText etKey = view.findViewById(R.id.etKey);
|
||||
etKey.setText(prefs.getString("deepl", null));
|
||||
|
||||
return new AlertDialog.Builder(context)
|
||||
.setView(view)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String key = etKey.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(key))
|
||||
prefs.edit().remove("deepl").apply();
|
||||
else
|
||||
prefs.edit().putString("deepl", key).apply();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
||||
private static UriInfo getInfo(Uri uri, Context context) {
|
||||
UriInfo result = new UriInfo();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user