am 82a7b185: am 16ec2e11: Merge "Add finish action to setup wizard"

* commit '82a7b185bb8a14e610950548d36fae7a06030236':
  Add finish action to setup wizard
main
Tadashi G. Takaoka 2013-05-15 10:52:40 -07:00 committed by Android Git Automerger
commit 680fa7ba77
5 changed files with 28 additions and 5 deletions

View File

@ -57,6 +57,7 @@
android:layout_height="24dp" android:layout_height="24dp"
android:layout_below="@id/setup_step_bullets" /> android:layout_below="@id/setup_step_bullets" />
<FrameLayout <FrameLayout
android:id="@+id/setup_steps_pane"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/setup_step_indicator"> android:layout_below="@id/setup_step_indicator">
@ -70,4 +71,10 @@
android:id="@+id/setup_step3" android:id="@+id/setup_step3"
layout="@layout/setup_step" /> layout="@layout/setup_step" />
</FrameLayout> </FrameLayout>
<TextView
android:id="@+id/setup_finish"
android:text="@string/setup_finish_action"
style="@style/setupStepActionLabelStyle"
android:layout_below="@id/setup_steps_pane"
android:layout_marginTop="2dp" />
</RelativeLayout> </RelativeLayout>

View File

@ -44,7 +44,7 @@
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
</style> </style>
<style name="setupStepActionLabelStyleCommon" parent="setupStepBaseStyle"> <style name="setupStepActionLabelStyleCommon" parent="setupStepBaseStyle">
<item name="android:textColor">@drawable/setup_step_action_color</item> <item name="android:textColor">@color/setup_step_action_color</item>
<item name="android:background">@drawable/setup_step_action_background</item> <item name="android:background">@drawable/setup_step_action_background</item>
<item name="android:layout_height">48dp</item> <item name="android:layout_height">48dp</item>
<item name="android:paddingLeft">12dp</item> <item name="android:paddingLeft">12dp</item>

View File

@ -20,7 +20,6 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.provider.Settings; import android.provider.Settings;
@ -39,8 +38,9 @@ import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
import java.util.HashMap; import java.util.HashMap;
public final class SetupActivity extends Activity { public final class SetupActivity extends Activity implements View.OnClickListener {
private SetupStepIndicatorView mStepIndicatorView; private SetupStepIndicatorView mStepIndicatorView;
private TextView mActionFinish;
private final SetupStepGroup mSetupSteps = new SetupStepGroup(); private final SetupStepGroup mSetupSteps = new SetupStepGroup();
private static final String STATE_STEP = "step"; private static final String STATE_STEP = "step";
private int mStepNumber; private int mStepNumber;
@ -152,6 +152,19 @@ public final class SetupActivity extends Activity {
} }
}); });
mSetupSteps.addStep(STEP_3, step3); mSetupSteps.addStep(STEP_3, step3);
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;
}
} }
private void invokeSetupWizardOfThisIme() { private void invokeSetupWizardOfThisIme() {
@ -166,7 +179,8 @@ public final class SetupActivity extends Activity {
final Intent intent = new Intent(); final Intent intent = new Intent();
intent.setClass(this, SettingsActivity.class); intent.setClass(this, SettingsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP); | Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent); startActivity(intent);
} }
@ -278,6 +292,7 @@ public final class SetupActivity extends Activity {
mStepIndicatorView.setIndicatorPosition( mStepIndicatorView.setIndicatorPosition(
getIndicatorPosition(mStepNumber, mSetupSteps.getTotalStep(), layoutDirection)); getIndicatorPosition(mStepNumber, mSetupSteps.getTotalStep(), layoutDirection));
mSetupSteps.enableStep(mStepNumber); mSetupSteps.enableStep(mStepNumber);
mActionFinish.setVisibility((mStepNumber == STEP_3) ? View.VISIBLE : View.GONE);
} }
private static float getIndicatorPosition(final int step, final int totalStep, private static float getIndicatorPosition(final int step, final int totalStep,
@ -337,8 +352,9 @@ public final class SetupActivity extends Activity {
@Override @Override
public void onClick(final View v) { public void onClick(final View v) {
if (mAction != null) { if (v == mActionLabel && mAction != null) {
mAction.run(); mAction.run();
return;
} }
} }
} }