微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > 开机向导中的语言选择界面切换语言,当前语言选择界面未更新到设定的语言,如何解决

开机向导中的语言选择界面切换语言,当前语言选择界面未更新到设定的语言,如何解决

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
Download bin第一次开机,或者恢复出厂设置后开机,会出现OOBE开机向导界面,这个功能是mtk从JB版本开始支持的。
当End user在开机向导的语言选择界面切换语言后,当前语言选择界面的显示内容没有更新到设定的语言,现象如下(红框标注的地方没有更新成中文显示):


该如何解决呢?
[SOLUTION]
LanguageSettingsWizard.java
(alps/mediatek/packages/apps/OOBE/src/mediatek/oobe/basic)
1.1, 添加语句:import com.android.internal.app.LocalePicker;
1.2, 修改OOBEStepPreferenceActivity 的定义,让这个class实现
AdapterView.OnItEMSelectedListener的接口:
public class LanguageSettingsWizard extends OOBEStepPreferenceActivity
implements AdapterView.OnItemSelectedListener{
1.3, 修改private ArrayAdapter<CharSequence> mAdapter = null;为:
private ArrayAdapter<LocalePicker.LocaleInfo> mAdapter;
1.4, 修改onCreate方法为以下这样:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.Layout.frame_layout);
Xlog.d(TAG, "OnCreate LanguageSettingsWizard");
mSIMStateIntentFiLTEr = new
IntentFilter(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
mCurrentLocale = getLanguage();
mSPInner = (Spinner) findViewById(R.id.language_spinner);
mSpinner.setVisibility(View.VISIBLE);
View welcomeView = ((LinearLayout) findViewById(R.id.sp_layout));
welcomeView.setVisibility(View.VISIBLE);
View prefView = (findViewById(android.R.id.list));
prefView.setVisibility(View.GONE);
mShowEmergencycall = isEmergencycallShow();
mEmergencybtn = (Button) findViewById(R.id.emergcy_call_button);
updateEmergencycallButton(mShowEmergencycall);
initSpecialLayout(R.string.oobe_title_language_setting,
R.string.oobe_summary_language_setting);
}
1.5, 把onResume方法修改成以下这样:
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
mAdapter = LocalePicker.constructAdapter(this);
mSpinner.setAdapter(mAdapter);
for (int i = 0; i < mAdapter.getCount(); i++) {
LocalePicker.LocaleInfo locale = mAdapter.getItem(i);
if (mCurrentLocale != null && locale != null
&& mCurrentLocale.equals(locale.getLocale())) {
Xlog.d(TAG, "set language is: " + locale.toString());
mSpinner.setSelection(i, true);
}
}
mSpinner.setOnItemSelectedListener(this);
registerReceiver(mSimStateChangedListener, mSimStateIntentFilter);
}
1.6, 增加两个方法:
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position,
long id) {
LocalePicker.LocaleInfo locale = mAdapter.getItem(position);
if (locale != null && locale.getLocale() != null
&& !locale.getLocale().equals(mCurrentLocale)) {
Xlog.d(TAG, "onItemSelected,select language is: " + locale.toString());
LocalePicker.updateLocale(locale.getLocale());
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
1.7, 把onNextStep方法修改成以下这样:
@Override
public void onNextStep(boolean isNext) {
int result = isNext ? Utils.RESULT_CODE_NEXT : Utils.RESULT_CODE_BACK;
finishActivityByResult(result);
}
1.8, 增加方法:
/**
* Set result code and finish
* @param resultCode true to start next step, false to start last step
*/
private void finishActivityByResult(int resultCode) {
Xlog.d(TAG, "finishActivityByResult, resultCode: " + resultCode);
Intent intent = new Intent();
setResult(resultCode, intent);
finish();
}
1.9, 修改
Utils.java(alps/mediatek/packages/apps/OOBE/src/mediatek/oobe/utils)
增加三个成员变量:
public static final int RESULT_CODE_NEXT = 20;
public static final int RESULT_CODE_BACK = 21;
public static final int RESULT_CODE_FINISH = 22;
2.0, 把函数体:private void initLanguageSettings()整个拿掉。
修改之后,重新编译OOBE apk: ./mk project_name mm mediatek/packages/apps/OOBE
,然后把OOBE.apk push 到system/app下。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top