am 5ffa5bf3: Merge "Keep SetupActivity alive to check re-launching from launcher"
* commit '5ffa5bf3ba7d169912d163790e461ab8d5aca30a': Keep SetupActivity alive to check re-launching from launchermain
commit
e7de0ce741
|
@ -63,7 +63,8 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
private static final int STEP_1 = 1;
|
private static final int STEP_1 = 1;
|
||||||
private static final int STEP_2 = 2;
|
private static final int STEP_2 = 2;
|
||||||
private static final int STEP_3 = 3;
|
private static final int STEP_3 = 3;
|
||||||
private boolean mWasLanguageAndInputSettingsInvoked;
|
private static final int STEP_LAUNCHING_IME_SETTINGS = 4;
|
||||||
|
private static final int STEP_BACK_FROM_IME_SETTINGS = 5;
|
||||||
|
|
||||||
private final SettingsPoolingHandler mHandler = new SettingsPoolingHandler(this);
|
private final SettingsPoolingHandler mHandler = new SettingsPoolingHandler(this);
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
}
|
}
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case MSG_POLLING_IME_SETTINGS:
|
case MSG_POLLING_IME_SETTINGS:
|
||||||
if (SetupActivity.isThisImeEnabled(setupActivity)) {
|
if (isThisImeEnabled(setupActivity)) {
|
||||||
setupActivity.invokeSetupWizardOfThisIme();
|
setupActivity.invokeSetupWizardOfThisIme();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -112,17 +113,7 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
RichInputMethodManager.init(this);
|
RichInputMethodManager.init(this);
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
mStepNumber = determineSetupStepNumber();
|
mStepNumber = determineSetupStepNumberFromLauncher();
|
||||||
if (mStepNumber == STEP_1 && !mWasLanguageAndInputSettingsInvoked) {
|
|
||||||
mStepNumber = STEP_WELCOME;
|
|
||||||
}
|
|
||||||
if (mStepNumber == STEP_3) {
|
|
||||||
// This IME already has been enabled and set as current IME.
|
|
||||||
// TODO: Implement tutorial.
|
|
||||||
invokeSettingsOfThisIme();
|
|
||||||
finish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mStepNumber = savedInstanceState.getInt(STATE_STEP);
|
mStepNumber = savedInstanceState.getInt(STATE_STEP);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +256,6 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
intent.setAction(Settings.ACTION_INPUT_METHOD_SETTINGS);
|
intent.setAction(Settings.ACTION_INPUT_METHOD_SETTINGS);
|
||||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
mWasLanguageAndInputSettingsInvoked = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeSubtypeEnablerOfThisIme() {
|
private void invokeSubtypeEnablerOfThisIme() {
|
||||||
|
@ -313,6 +303,17 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
return myImi.getId().equals(currentImeId);
|
return myImi.getId().equals(currentImeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int determineSetupStepNumberFromLauncher() {
|
||||||
|
final int stepNumber = determineSetupStepNumber();
|
||||||
|
if (stepNumber == STEP_1) {
|
||||||
|
return STEP_WELCOME;
|
||||||
|
}
|
||||||
|
if (stepNumber == STEP_3) {
|
||||||
|
return STEP_LAUNCHING_IME_SETTINGS;
|
||||||
|
}
|
||||||
|
return stepNumber;
|
||||||
|
}
|
||||||
|
|
||||||
private int determineSetupStepNumber() {
|
private int determineSetupStepNumber() {
|
||||||
mHandler.cancelPollingImeSettings();
|
mHandler.cancelPollingImeSettings();
|
||||||
if (!isThisImeEnabled(this)) {
|
if (!isThisImeEnabled(this)) {
|
||||||
|
@ -336,10 +337,14 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
mStepNumber = savedInstanceState.getInt(STATE_STEP);
|
mStepNumber = savedInstanceState.getInt(STATE_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isInSetupSteps(final int stepNumber) {
|
||||||
|
return stepNumber >= STEP_1 && stepNumber <= STEP_3;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onRestart() {
|
protected void onRestart() {
|
||||||
super.onRestart();
|
super.onRestart();
|
||||||
if (mStepNumber != STEP_WELCOME) {
|
if (isInSetupSteps(mStepNumber)) {
|
||||||
mStepNumber = determineSetupStepNumber();
|
mStepNumber = determineSetupStepNumber();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,6 +352,15 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
if (mStepNumber == STEP_LAUNCHING_IME_SETTINGS) {
|
||||||
|
invokeSettingsOfThisIme();
|
||||||
|
mStepNumber = STEP_BACK_FROM_IME_SETTINGS;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mStepNumber == STEP_BACK_FROM_IME_SETTINGS) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
updateSetupStepView();
|
updateSetupStepView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +388,7 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(final boolean hasFocus) {
|
public void onWindowFocusChanged(final boolean hasFocus) {
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
if (hasFocus && mStepNumber != STEP_WELCOME) {
|
if (hasFocus && isInSetupSteps(mStepNumber)) {
|
||||||
mStepNumber = determineSetupStepNumber();
|
mStepNumber = determineSetupStepNumber();
|
||||||
updateSetupStepView();
|
updateSetupStepView();
|
||||||
}
|
}
|
||||||
|
@ -383,7 +397,7 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
private void updateSetupStepView() {
|
private void updateSetupStepView() {
|
||||||
final boolean welcomeScreen = (mStepNumber == STEP_WELCOME);
|
final boolean welcomeScreen = (mStepNumber == STEP_WELCOME);
|
||||||
mWelcomeScreen.setVisibility(welcomeScreen ? View.VISIBLE : View.GONE);
|
mWelcomeScreen.setVisibility(welcomeScreen ? View.VISIBLE : View.GONE);
|
||||||
mSetupScreen.setVisibility(welcomeScreen ? View.GONE: View.VISIBLE);
|
mSetupScreen.setVisibility(welcomeScreen ? View.GONE : View.VISIBLE);
|
||||||
if (welcomeScreen) {
|
if (welcomeScreen) {
|
||||||
mWelcomeVideoView.setVisibility(View.VISIBLE);
|
mWelcomeVideoView.setVisibility(View.VISIBLE);
|
||||||
mWelcomeVideoView.setVideoURI(mWelcomeVideoUri);
|
mWelcomeVideoView.setVideoURI(mWelcomeVideoUri);
|
||||||
|
@ -410,7 +424,7 @@ public final class SetupActivity extends Activity implements View.OnClickListene
|
||||||
|
|
||||||
public SetupStep(final int stepNo, final String applicationName, final TextView bulletView,
|
public SetupStep(final int stepNo, final String applicationName, final TextView bulletView,
|
||||||
final View stepView, final int title, final int instruction,
|
final View stepView, final int title, final int instruction,
|
||||||
final int finishedInstruction,final int actionIcon, final int actionLabel) {
|
final int finishedInstruction, final int actionIcon, final int actionLabel) {
|
||||||
mStepNo = stepNo;
|
mStepNo = stepNo;
|
||||||
mStepView = stepView;
|
mStepView = stepView;
|
||||||
mBulletView = bulletView;
|
mBulletView = bulletView;
|
||||||
|
|
Loading…
Reference in New Issue