diff --git a/MultiLanguages.apk b/MultiLanguages.apk
index 0d9bc9f..fe7beb2 100644
Binary files a/MultiLanguages.apk and b/MultiLanguages.apk differ
diff --git a/README.md b/README.md
index d8774ac..a792ffc 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# 语种切换框架
-* 码云地址:[Gitee](https://gitee.com/getActivity/MultiLanguages)
+* 项目地址:[Github](https://github.com/getActivity/MultiLanguages)、[码云](https://gitee.com/getActivity/MultiLanguages)
* [点击此处下载Demo](MultiLanguages.apk)
@@ -26,7 +26,7 @@ allprojects {
```groovy
dependencies {
// 语种切换框架:https://github.com/getActivity/MultiLanguages
- implementation 'com.github.getActivity:MultiLanguages:6.8'
+ implementation 'com.github.getActivity:MultiLanguages:6.9'
}
```
@@ -199,6 +199,8 @@ public final class LanguagesWebView extends WebView {
* 悬浮窗框架:[XToast](https://github.com/getActivity/XToast)
+* Shape 框架:[ShapeView](https://github.com/getActivity/ShapeView)
+
* Gson 解析容错:[GsonFactory](https://github.com/getActivity/GsonFactory)
* 日志查看框架:[Logcat](https://github.com/getActivity/Logcat)
diff --git a/app/build.gradle b/app/build.gradle
index 900235c..0bf53e6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,8 +7,8 @@ android {
applicationId "com.hjq.language.demo"
minSdkVersion 16
targetSdkVersion 30
- versionCode 68
- versionName "6.8"
+ versionCode 69
+ versionName "6.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 5a559dc..2daddac 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -41,27 +41,27 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
- android:text="自动" />
+ android:text="跟随系统" />
diff --git a/library/build.gradle b/library/build.gradle
index bc39586..ca7e198 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -5,14 +5,14 @@ android {
defaultConfig {
minSdkVersion 14
- versionCode 68
- versionName "6.8"
+ versionCode 69
+ versionName "6.9"
}
android.libraryVariants.all { variant ->
// aar 输出文件名配置
variant.outputs.all { output ->
- outputFileName = "language-${android.defaultConfig.versionName}.aar"
+ outputFileName = "${rootProject.name}-${android.defaultConfig.versionName}.aar"
}
}
}
diff --git a/library/src/main/java/com/hjq/language/MultiLanguages.java b/library/src/main/java/com/hjq/language/MultiLanguages.java
index d9b5493..98f1255 100644
--- a/library/src/main/java/com/hjq/language/MultiLanguages.java
+++ b/library/src/main/java/com/hjq/language/MultiLanguages.java
@@ -58,6 +58,9 @@ public static void updateAppLanguage(Context context) {
* 更新 Resources 的语种
*/
public static void updateAppLanguage(Resources resources) {
+ if (resources == null) {
+ return;
+ }
if (LanguagesUtils.getLocale(resources.getConfiguration()).equals(getAppLanguage())) {
return;
}
@@ -77,6 +80,7 @@ public static Locale getAppLanguage() {
* @return 语种是否发生改变了
*/
public static boolean setAppLanguage(Context context, Locale newLocale) {
+ LanguagesConfig.setAppLanguage(context, newLocale);
if (LanguagesUtils.getLocale(context).equals(newLocale)) {
return false;
}
@@ -88,7 +92,7 @@ public static boolean setAppLanguage(Context context, Locale newLocale) {
// 更新 Application 的语种
LanguagesUtils.updateLanguages(sApplication.getResources(), newLocale);
}
- LanguagesConfig.setAppLanguage(context, newLocale);
+
LanguagesUtils.setDefaultLocale(context);
if (sLanguageListener != null) {
sLanguageListener.onAppLocaleChange(oldLocale, newLocale);
@@ -166,7 +170,7 @@ public static void setOnLanguageListener(OnLanguageListener listener) {
}
/**
- * 设置保存的 SharedPreferences 文件名
+ * 设置保存的 SharedPreferences 文件名(请在 Application 初始化之前设置,可以放在 Application 中的代码块或者静态代码块)
*/
public static void setSharedPreferencesName(String name) {
LanguagesConfig.setSharedPreferencesName(name);