Merge branch 'master' into 'master'
last fixes for 0.103.1 Closes #1018, #943, and #1010 See merge request !515
This commit is contained in:
commit
94e4ded672
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,3 +1,21 @@
|
|||||||
|
### 0.103.1 (2017-05-12)
|
||||||
|
|
||||||
|
* Various stability fixes
|
||||||
|
|
||||||
|
* Bits of text no longer randomly switches to English
|
||||||
|
|
||||||
|
* Fix send F-Droid via Bluetooth on Android 7.x
|
||||||
|
|
||||||
|
### 0.103 (2017-05-02)
|
||||||
|
|
||||||
|
* Complete overhaul of the user experience
|
||||||
|
|
||||||
|
* Complete support for localization, including app descriptions
|
||||||
|
|
||||||
|
* Support for screenshots, graphics, and "What's New" texts
|
||||||
|
|
||||||
|
* Stable support for F-Droid Privileged Extension
|
||||||
|
|
||||||
### 0.102.3 (2017-04-01)
|
### 0.102.3 (2017-04-01)
|
||||||
|
|
||||||
* Fix issue with installing from the wrong repo (#909)
|
* Fix issue with installing from the wrong repo (#909)
|
||||||
|
@ -197,7 +197,7 @@ public class FDroidApp extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
Languages.setLanguage(this, Preferences.get().getLanguage(), false);
|
Languages.setLanguage(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -214,8 +214,7 @@ public class FDroidApp extends Application {
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
Preferences.setup(this);
|
Preferences.setup(this);
|
||||||
Languages.setup(getClass(), R.string.pref_language_default);
|
Languages.setLanguage(this);
|
||||||
Languages.setLanguage(this, Preferences.get().getLanguage(), false);
|
|
||||||
|
|
||||||
ACRA.init(this);
|
ACRA.init(this);
|
||||||
if (isAcraProcess()) {
|
if (isAcraProcess()) {
|
||||||
|
@ -4,13 +4,12 @@ import android.annotation.TargetApi;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ContextWrapper;
|
import android.content.ContextWrapper;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.AssetManager;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -26,12 +25,9 @@ public final class Languages {
|
|||||||
private static final Locale DEFAULT_LOCALE;
|
private static final Locale DEFAULT_LOCALE;
|
||||||
private static final Locale TIBETAN = new Locale("bo");
|
private static final Locale TIBETAN = new Locale("bo");
|
||||||
private static final Locale CHINESE_HONG_KONG = new Locale("zh", "HK");
|
private static final Locale CHINESE_HONG_KONG = new Locale("zh", "HK");
|
||||||
private static final String DEFAULT_STRING = "System Default";
|
|
||||||
|
|
||||||
private static Locale locale;
|
private static Locale locale;
|
||||||
private static Languages singleton;
|
private static Languages singleton;
|
||||||
private static Class<?> clazz;
|
|
||||||
private static int resId;
|
|
||||||
private static Map<String, String> tmpMap = new TreeMap<>();
|
private static Map<String, String> tmpMap = new TreeMap<>();
|
||||||
private static Map<String, String> nameMap;
|
private static Map<String, String> nameMap;
|
||||||
|
|
||||||
@ -40,23 +36,8 @@ public final class Languages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Languages(Activity activity) {
|
private Languages(Activity activity) {
|
||||||
AssetManager assets = activity.getAssets();
|
|
||||||
Configuration config = activity.getResources().getConfiguration();
|
|
||||||
// Resources() requires DisplayMetrics, but they are only needed for drawables
|
|
||||||
DisplayMetrics ignored = new DisplayMetrics();
|
|
||||||
activity.getWindowManager().getDefaultDisplay().getMetrics(ignored);
|
|
||||||
Resources resources;
|
|
||||||
Set<Locale> localeSet = new LinkedHashSet<>();
|
Set<Locale> localeSet = new LinkedHashSet<>();
|
||||||
Locale currentLocale = config.locale;
|
localeSet.addAll(Arrays.asList(LOCALES_TO_TEST));
|
||||||
for (Locale locale : LOCALES_TO_TEST) {
|
|
||||||
config.locale = locale;
|
|
||||||
resources = new Resources(assets, ignored, config);
|
|
||||||
if (!TextUtils.equals(DEFAULT_STRING, resources.getString(resId))
|
|
||||||
|| locale.equals(Locale.ENGLISH)) {
|
|
||||||
localeSet.add(locale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
config.locale = currentLocale;
|
|
||||||
|
|
||||||
for (Locale locale : localeSet) {
|
for (Locale locale : localeSet) {
|
||||||
if (locale.equals(TIBETAN)) {
|
if (locale.equals(TIBETAN)) {
|
||||||
@ -74,39 +55,13 @@ public final class Languages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove the current system language from the menu
|
// remove the current system language from the menu
|
||||||
tmpMap.remove(currentLocale.getLanguage());
|
tmpMap.remove(Locale.getDefault().getLanguage());
|
||||||
|
|
||||||
/* SYSTEM_DEFAULT is a fake one for displaying in a chooser menu. */
|
/* SYSTEM_DEFAULT is a fake one for displaying in a chooser menu. */
|
||||||
tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(resId));
|
tmpMap.put(USE_SYSTEM_DEFAULT, activity.getString(R.string.pref_language_default));
|
||||||
nameMap = Collections.unmodifiableMap(tmpMap);
|
nameMap = Collections.unmodifiableMap(tmpMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the instance of {@link Languages} to work with, providing the
|
|
||||||
* {@link Activity} that is will be working as part of, as well as the
|
|
||||||
* {@code resId} that has the exact string "Use System Default",
|
|
||||||
* i.e. {@code R.string.use_system_default}.
|
|
||||||
* <p/>
|
|
||||||
* That string resource {@code resId} is also used to find the supported
|
|
||||||
* translations: if an included translation has a translated string that
|
|
||||||
* matches that {@code resId}, then that language will be included as a
|
|
||||||
* supported language.
|
|
||||||
*
|
|
||||||
* @param clazz the {@link Class} of the default {@code Activity},
|
|
||||||
* usually the main {@code Activity} from where the
|
|
||||||
* Settings is launched from.
|
|
||||||
* @param resId the string resource ID to for the string "System Default",
|
|
||||||
* e.g. {@code R.string.pref_language_default}
|
|
||||||
*/
|
|
||||||
public static void setup(Class<?> clazz, int resId) {
|
|
||||||
if (Languages.clazz == null) {
|
|
||||||
Languages.clazz = clazz;
|
|
||||||
Languages.resId = resId;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("Languages singleton was already initialized, duplicate call to Languages.setup()!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param activity the {@link Activity} this is working as part of
|
* @param activity the {@link Activity} this is working as part of
|
||||||
* @return the singleton to work with
|
* @return the singleton to work with
|
||||||
@ -124,16 +79,17 @@ public final class Languages {
|
|||||||
* or different than the current system-wide locale. The preference is cleared
|
* or different than the current system-wide locale. The preference is cleared
|
||||||
* if the language matches the system-wide locale or "System Default" is chosen.
|
* if the language matches the system-wide locale or "System Default" is chosen.
|
||||||
*/
|
*/
|
||||||
public static void setLanguage(final ContextWrapper contextWrapper, String language, boolean refresh) {
|
public static void setLanguage(final ContextWrapper contextWrapper) {
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
if (Build.VERSION.SDK_INT >= 24) {
|
||||||
Utils.debugLog(TAG, "Languages.setLanguage() ignored on >= android-24");
|
Utils.debugLog(TAG, "Languages.setLanguage() ignored on >= android-24");
|
||||||
Preferences.get().clearLanguage();
|
Preferences.get().clearLanguage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String language = Preferences.get().getLanguage();
|
||||||
if (TextUtils.equals(language, DEFAULT_LOCALE.getLanguage())) {
|
if (TextUtils.equals(language, DEFAULT_LOCALE.getLanguage())) {
|
||||||
Preferences.get().clearLanguage();
|
Preferences.get().clearLanguage();
|
||||||
locale = DEFAULT_LOCALE;
|
locale = DEFAULT_LOCALE;
|
||||||
} else if (locale != null && TextUtils.equals(locale.getLanguage(), language) && (!refresh)) {
|
} else if (locale != null && TextUtils.equals(locale.getLanguage(), language)) {
|
||||||
return; // already configured
|
return; // already configured
|
||||||
} else if (language == null || language.equals(USE_SYSTEM_DEFAULT)) {
|
} else if (language == null || language.equals(USE_SYSTEM_DEFAULT)) {
|
||||||
Preferences.get().clearLanguage();
|
Preferences.get().clearLanguage();
|
||||||
@ -212,12 +168,9 @@ public final class Languages {
|
|||||||
CHINESE_HONG_KONG,
|
CHINESE_HONG_KONG,
|
||||||
TIBETAN,
|
TIBETAN,
|
||||||
new Locale("af"),
|
new Locale("af"),
|
||||||
new Locale("am"),
|
|
||||||
new Locale("ar"),
|
new Locale("ar"),
|
||||||
new Locale("az"),
|
|
||||||
new Locale("be"),
|
new Locale("be"),
|
||||||
new Locale("bg"),
|
new Locale("bg"),
|
||||||
new Locale("bn"),
|
|
||||||
new Locale("ca"),
|
new Locale("ca"),
|
||||||
new Locale("cs"),
|
new Locale("cs"),
|
||||||
new Locale("da"),
|
new Locale("da"),
|
||||||
@ -228,58 +181,29 @@ public final class Languages {
|
|||||||
new Locale("eu"),
|
new Locale("eu"),
|
||||||
new Locale("fa"),
|
new Locale("fa"),
|
||||||
new Locale("fi"),
|
new Locale("fi"),
|
||||||
new Locale("gl"),
|
new Locale("he"),
|
||||||
new Locale("hi"),
|
new Locale("hi"),
|
||||||
new Locale("hr"),
|
|
||||||
new Locale("hu"),
|
new Locale("hu"),
|
||||||
new Locale("hy"),
|
new Locale("hy"),
|
||||||
new Locale("in"),
|
new Locale("id"),
|
||||||
new Locale("hy"),
|
|
||||||
new Locale("in"),
|
|
||||||
new Locale("is"),
|
new Locale("is"),
|
||||||
new Locale("it"),
|
new Locale("it"),
|
||||||
new Locale("iw"),
|
|
||||||
new Locale("ka"),
|
|
||||||
new Locale("kk"),
|
|
||||||
new Locale("km"),
|
|
||||||
new Locale("kn"),
|
|
||||||
new Locale("ky"),
|
|
||||||
new Locale("lo"),
|
|
||||||
new Locale("lt"),
|
|
||||||
new Locale("lv"),
|
|
||||||
new Locale("mk"),
|
|
||||||
new Locale("ml"),
|
|
||||||
new Locale("mn"),
|
|
||||||
new Locale("mr"),
|
|
||||||
new Locale("ms"),
|
|
||||||
new Locale("my"),
|
new Locale("my"),
|
||||||
new Locale("nb"),
|
new Locale("nb"),
|
||||||
new Locale("ne"),
|
|
||||||
new Locale("nl"),
|
new Locale("nl"),
|
||||||
new Locale("pl"),
|
new Locale("pl"),
|
||||||
new Locale("pt"),
|
new Locale("pt"),
|
||||||
new Locale("rm"),
|
|
||||||
new Locale("ro"),
|
new Locale("ro"),
|
||||||
new Locale("ru"),
|
new Locale("ru"),
|
||||||
new Locale("sc"),
|
new Locale("sc"),
|
||||||
new Locale("si"),
|
|
||||||
new Locale("sk"),
|
new Locale("sk"),
|
||||||
new Locale("sl"),
|
|
||||||
new Locale("sn"),
|
new Locale("sn"),
|
||||||
new Locale("sq"),
|
|
||||||
new Locale("sr"),
|
new Locale("sr"),
|
||||||
new Locale("sv"),
|
new Locale("sv"),
|
||||||
new Locale("sw"),
|
|
||||||
new Locale("ta"),
|
|
||||||
new Locale("te"),
|
|
||||||
new Locale("th"),
|
new Locale("th"),
|
||||||
new Locale("tl"),
|
|
||||||
new Locale("tr"),
|
new Locale("tr"),
|
||||||
new Locale("uk"),
|
new Locale("uk"),
|
||||||
new Locale("ur"),
|
|
||||||
new Locale("uz"),
|
|
||||||
new Locale("vi"),
|
new Locale("vi"),
|
||||||
new Locale("zu"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
entrySummary(key);
|
entrySummary(key);
|
||||||
if (changing) {
|
if (changing) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
Languages.setLanguage(activity, Preferences.get().getLanguage(), false);
|
Languages.setLanguage(activity);
|
||||||
|
|
||||||
RepoProvider.Helper.clearEtags(getContext());
|
RepoProvider.Helper.clearEtags(getContext());
|
||||||
UpdateService.updateNow(getContext());
|
UpdateService.updateNow(getContext());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user