@@ -131,41 +131,4 @@ public static Context updateLocale(Context pContext, Locale pNewUserLocale) {
131
131
public static boolean needUpdateLocale (Context pContext , Locale pNewUserLocale ) {
132
132
return pNewUserLocale != null && !getCurrentLocale (pContext ).equals (pNewUserLocale );
133
133
}
134
-
135
-
136
- // public static Context selectLanguage(Context context, String language) {
137
- // Context updateContext;
138
- // //设置语言类型
139
- // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
140
- // updateContext = createConfigurationResources(context, language);
141
- // } else {
142
- // applyLanguage(context, language);
143
- // updateContext = context;
144
- // }
145
- // //保存设置语言的类型
146
- // return updateContext;
147
- // }
148
-
149
- // @TargetApi(Build.VERSION_CODES.N)
150
- // private static Context createConfigurationResources(Context context, String language) {
151
- // //设置语言类型
152
- // Resources resources = context.getResources();
153
- // Configuration configuration = resources.getConfiguration();
154
- // Locale locale = new Locale(language);
155
- // configuration.setLocale(locale);
156
- // return context.createConfigurationContext(configuration);
157
- // }
158
- //
159
- // private static void applyLanguage(Context context, String language) {
160
- // Resources resources = context.getResources();
161
- // Configuration configuration = resources.getConfiguration();
162
- // DisplayMetrics dm = resources.getDisplayMetrics();
163
- // Locale locale = new Locale(language);
164
- // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
165
- // configuration.setLocale(locale);
166
- // } else {
167
- // configuration.locale = locale;
168
- // }
169
- // resources.updateConfiguration(configuration, dm);
170
- // }
171
134
}
0 commit comments