Skip to content

Commit

Permalink
improving setup process
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnu7 committed May 27, 2015
1 parent 88dd2fa commit 941c88f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
12 changes: 7 additions & 5 deletions java/res/layout/setup_steps_cards.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
android:id="@+id/setup_step3_bullet"
style="@style/setupStepBulletStyle"
android:text="@string/setup_step3_bullet" />
<TextView
android:id="@+id/setup_step4_bullet"
style="@style/setupStepBulletStyle"
android:text="@string/setup_step4_bullet" />
</LinearLayout>
<org.smc.inputmethod.indic.setup.SetupStepIndicatorView
android:id="@+id/setup_step_indicator"
Expand All @@ -54,16 +58,14 @@
<include
android:id="@+id/setup_step3"
layout="@layout/setup_step" />
<include
android:id="@+id/setup_step4"
layout="@layout/setup_step" />
</FrameLayout>
<TextView
android:id="@+id/setup_next"
android:text="@string/setup_next_action"
android:gravity="end|center_vertical"
style="@style/setupStepActionLabelStyleCommon"
android:layout_marginTop="@dimen/setup_step_horizontal_line_height" />
<TextView
android:id="@+id/setup_finish"
android:text="@string/setup_finish_action"
style="@style/setupStepActionLabelStyle"
android:layout_marginTop="@dimen/setup_step_horizontal_line_height" />
</merge>
15 changes: 9 additions & 6 deletions java/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ mobile devices. [CHAR LIMIT=25] -->
<string name="button_default">Default</string>

<!-- Title of the setup wizard welcome screen. [CHAR LIMT=40] -->
<string name="setup_welcome_title">"नमस्ते வணக்கம் നമസ്കാരം నమస్కారం সাগতাম"</string>
<string name="setup_welcome_title">"Welcome to <xliff:g id="application_name">%s</xliff:g>"</string>
<!-- Additional title of the setup wizard welcome screen, just below the setup_welcome_title. [CHAR_LIMIT=64] -->
<string name="setup_welcome_additional_description">"Welcome to <xliff:g id="application_name">%s</xliff:g>"</string>
<string name="setup_welcome_additional_description">"नमस्ते\nவணக்கம் \nനമസ്കാരം \nನಮಸ್ಕಾರ \nనమస్కారం \nনমস্কার \nਸਤਿ ਸ੍ਰੀ ਅਕਾਲ \nનમસ્તે"</string>
<!-- The label of the button that starts the setup wizard. [CHAR_LIMIT=64] -->
<string name="setup_start_action">Get started</string>
<!-- The label of the button that navigates the user to the next step of the setup wizard. [CHAR_LIMIT=64] -->
Expand Down Expand Up @@ -361,11 +361,14 @@ mobile devices. [CHAR LIMIT=25] -->
<!-- Ordinal number of the 3rd step in the setup wizard. [CHAR LIMIT=5] -->
<string name="setup_step3_bullet" translatable="false">3</string>
<!-- Title of the 3rd step in the setup wizard. [CHAR LIMIT=64] -->
<string name="setup_step3_title">"Congratulations, you're all set!"</string>
<!-- Detailed instruction of the 3rd step in the setup wizard. [CHAR LIMIT=120] -->
<string name="setup_step3_instruction">Now you can type in all your favorite apps with <xliff:g id="APPLICATION_NAME" example="Android Keyboard">%s</xliff:g>.</string>
<string name="setup_step3_title">"Select languages"</string>
<string name="setup_step3_instruction">Select the languages and layouts you want to use.</string>
<string name="setup_step3_action">Configure languages</string>
<!-- The label of the button that triggers the screen for configuaring additional languages of the keyboard. [CHAR_LIMIT=64] -->
<string name="setup_step3_action">Configure additional languages</string>
<string name="setup_step4_bullet" translatable="false">4</string>
<string name="setup_step4_title">"Congratulations, you're all set!"</string>
<!-- Detailed instruction of the 3rd step in the setup wizard. [CHAR LIMIT=120] -->
<string name="setup_step4_instruction">Now you can type in all your favorite apps with <xliff:g id="APPLICATION_NAME" example="Android Keyboard">%s</xliff:g>.</string>
<!-- The label of the button that finishes the setup wizard. [CHAR_LIMIT=64] -->
<string name="setup_finish_action">Finished</string>
<!-- Option to show setup wizard icon. [CHAR LIMIT=30]-->
Expand Down
40 changes: 32 additions & 8 deletions java/src/org.smc.inputmethod/indic/setup/SetupWizardActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
private View mActionStart;
private View mActionNext;
private TextView mStep1Bullet;
private TextView mActionFinish;
//private TextView mActionFinish;
private SetupStepGroup mSetupStepGroup;
private static final String STATE_STEP = "step";
private int mStepNumber;
private boolean mNeedsToAdjustStepNumberToSystemState;
private boolean finishState;
private static final int STEP_WELCOME = 0;
private static final int STEP_1 = 1;
private static final int STEP_2 = 2;
private static final int STEP_3 = 3;
private static final int STEP_LAUNCHING_IME_SETTINGS = 4;
private static final int STEP_BACK_FROM_IME_SETTINGS = 5;
private static final int STEP_4 = 4;
private static final int STEP_LAUNCHING_IME_SETTINGS = 5;
private static final int STEP_BACK_FROM_IME_SETTINGS = 6;

private SettingsPoolingHandler mHandler;

Expand Down Expand Up @@ -122,8 +124,8 @@ protected void onCreate(final Bundle savedInstanceState) {

final String applicationName = getResources().getString(getApplicationInfo().labelRes);
mWelcomeScreen = findViewById(R.id.setup_welcome_screen);
final TextView welcomeDesc = (TextView)findViewById(R.id.setup_welcome_description);
welcomeDesc.setText(getString(R.string.setup_welcome_additional_description, applicationName));
final TextView welcomeTitle = (TextView)findViewById(R.id.setup_welcome_title);
welcomeTitle.setText(getString(R.string.setup_welcome_title, applicationName));

mSetupScreen = findViewById(R.id.setup_steps_screen);
final TextView stepsTitle = (TextView)findViewById(R.id.setup_title);
Expand Down Expand Up @@ -176,22 +178,39 @@ public void run() {
});
mSetupStepGroup.addStep(step3);

final SetupStep step4 = new SetupStep(STEP_4, applicationName,
(TextView)findViewById(R.id.setup_step4_bullet), findViewById(R.id.setup_step4),
R.string.setup_step4_title, R.string.setup_step4_instruction,
0 /* finishedInstruction */, R.drawable.ic_setup_finish,
R.string.setup_finish_action);
step4.setAction(new Runnable() {
@Override
public void run() {
finish();
}
});
mSetupStepGroup.addStep(step4);

mActionStart = findViewById(R.id.setup_start_label);
mActionStart.setOnClickListener(this);
mActionNext = findViewById(R.id.setup_next);
mActionNext.setOnClickListener(this);
/*
mActionFinish = (TextView)findViewById(R.id.setup_finish);
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mActionFinish,
getResources().getDrawable(R.drawable.ic_setup_finish), null, null, null);
mActionFinish.setOnClickListener(this);
*/
}

@Override
public void onClick(final View v) {
/*
if (v == mActionFinish) {
finish();
return;
}
*/
final int currentStep = determineSetupStepNumber();
final int nextStep;
if (v == mActionStart) {
Expand Down Expand Up @@ -252,14 +271,16 @@ void invokeSubtypeEnablerOfThisIme() {
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, imi.getId());
startActivity(intent);
mNeedsToAdjustStepNumberToSystemState = true;
finishState = true;
}

private int determineSetupStepNumberFromLauncher() {
final int stepNumber = determineSetupStepNumber();
if (stepNumber == STEP_1) {
return STEP_WELCOME;
}
if (stepNumber == STEP_3) {
if (stepNumber == STEP_4) {
return STEP_LAUNCHING_IME_SETTINGS;
}
return stepNumber;
Expand All @@ -273,6 +294,9 @@ private int determineSetupStepNumber() {
if (!UncachedInputMethodManagerUtils.isThisImeCurrent(this, mImm)) {
return STEP_2;
}
if (finishState) {
return STEP_4;
}
return STEP_3;
}

Expand All @@ -289,7 +313,7 @@ protected void onRestoreInstanceState(final Bundle savedInstanceState) {
}

private static boolean isInSetupSteps(final int stepNumber) {
return stepNumber >= STEP_1 && stepNumber <= STEP_3;
return stepNumber >= STEP_1 && stepNumber <= STEP_4;
}

@Override
Expand Down Expand Up @@ -356,7 +380,7 @@ private void updateSetupStepView() {
final boolean isStepActionAlreadyDone = mStepNumber < determineSetupStepNumber();
mSetupStepGroup.enableStep(mStepNumber, isStepActionAlreadyDone);
mActionNext.setVisibility(isStepActionAlreadyDone ? View.VISIBLE : View.GONE);
mActionFinish.setVisibility((mStepNumber == STEP_3) ? View.VISIBLE : View.GONE);
//mActionFinish.setVisibility((mStepNumber == STEP_4) ? View.VISIBLE : View.GONE);
}

static final class SetupStep implements View.OnClickListener {
Expand Down

0 comments on commit 941c88f

Please sign in to comment.