DeepL: improvements

This commit is contained in:
M66B
2021-05-23 08:26:31 +02:00
parent 0106da9b07
commit 94512a1d39
3 changed files with 26 additions and 9 deletions

View File

@@ -21,6 +21,7 @@ package eu.faircode.email;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import androidx.preference.PreferenceManager;
@@ -154,6 +155,12 @@ public class DeepL {
}
}
public static boolean canTranslate(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String deepl_key = prefs.getString("deepl_key", null);
return !TextUtils.isEmpty(deepl_key);
}
public static Integer[] getUsage(Context context) throws IOException, JSONException {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String key = prefs.getString("deepl_key", null);