mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +01:00
Fix lint warnings in opoc ; update langprefs; more power for contextutils
This commit is contained in:
parent
d1c4e68df3
commit
0393bf274f
2 changed files with 18 additions and 6 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {"\"${it}\""}.join(",") + '}')
|
||||
|
||||
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"])
|
||||
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
|
||||
static String[] getUsedAndroidLanguages() {
|
||||
Set<String> langs = new HashSet<>()
|
||||
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
|
||||
|
@ -28,7 +28,6 @@ static String[] getUsedAndroidLanguages() {
|
|||
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
|
||||
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
|
||||
langs.add(foldername.replace("values-", ""))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +146,8 @@ public class LanguagePreference extends ListPreference {
|
|||
String country = locale.getDisplayCountry(locale);
|
||||
String language = locale.getDisplayLanguage(locale);
|
||||
return locale.getDisplayLanguage(Locale.ENGLISH)
|
||||
+ " (" + language.substring(0, 1).toUpperCase() + language.substring(1)
|
||||
+ ((!country.isEmpty() && !country.toLowerCase().equals(language.toLowerCase())) ? (", " + country) : "")
|
||||
+ " (" + language.substring(0, 1).toUpperCase(Locale.getDefault()) + language.substring(1)
|
||||
+ ((!country.isEmpty() && !country.toLowerCase(Locale.getDefault()).equals(language.toLowerCase(Locale.getDefault()))) ? (", " + country) : "")
|
||||
+ ")";
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ import android.text.SpannableString;
|
|||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -446,7 +445,7 @@ public class ContextUtils {
|
|||
|
||||
public File writeImageToFileDetectFormat(File imageFile, Bitmap image, int quality) {
|
||||
CompressFormat format = CompressFormat.JPEG;
|
||||
String lc = imageFile.getAbsolutePath().toLowerCase();
|
||||
String lc = imageFile.getAbsolutePath().toLowerCase(Locale.ROOT);
|
||||
if (lc.endsWith(".png")) {
|
||||
format = CompressFormat.PNG;
|
||||
}
|
||||
|
@ -544,4 +543,18 @@ public class ContextUtils {
|
|||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void showRateOnGplayDialog() {
|
||||
String pkgId = "details?id=" + _context.getPackageName();
|
||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://" + pkgId));
|
||||
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
|
||||
(Build.VERSION.SDK_INT >= 21 ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) |
|
||||
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||
try {
|
||||
_context.startActivity(goToMarket);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
_context.startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse("http://play.google.com/store/apps/" + pkgId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue