修改泰国需求,默认第一次设置为泰语字体大小为1.08倍
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
///modify{@
import java.util.Locale;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
///@}
protected void onConfigurationChanged(Configuration newConfig) {
///modify{@
thFont(newConfig);
///@}
updateResources();
updateDisplaySize(); // populates mDisplayMetrics
super.onConfigurationChanged(newConfig); // calls refreshLayout
if (DEBUG) {
Log.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration());
}
repositionNavigationBar();
updateRowStates();
mScreenPinningRequest.onConfigurationChanged();
mNetworkController.onConfigurationChanged();
}
/// modify{@
private void thFont(Configuration newConfig){
if (newConfig != null) {
Locale locale = newConfig.locale;
String lan = locale.getLanguage();
if ("th".equals(lan)){
SharedPreferences sp = mContext.getSharedPreferences("th_font", Context.MODE_PRIVATE);
boolean isFirstTime = sp.getBoolean("isFirst", false);
if (isFirstTime) {
return;
}
final float currentScale = Settings.System.getFloat(mContext.getContentResolver(),Settings.System.FONT_SCALE, 1.0f);
if (currentScale < 1.08f){
Settings.System.putFloat(mContext.getContentResolver(), Settings.System.FONT_SCALE, 1.08f);
Editor editor = sp.edit();
editor.putBoolean("isFirst", true);
editor.apply();
}
}
}
}
///@}