Merge "Add finish action to setup wizard"

This commit is contained in:
Tadashi G. Takaoka 2013-04-19 10:58:54 +00:00 committed by Android (Google) Code Review
commit 16ec2e1155
5 changed files with 28 additions and 5 deletions

View file

@ -57,6 +57,7 @@
android:layout_height="24dp"
android:layout_below="@id/setup_step_bullets" />
<FrameLayout
android:id="@+id/setup_steps_pane"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/setup_step_indicator">
@ -70,4 +71,10 @@
android:id="@+id/setup_step3"
layout="@layout/setup_step" />
</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>

View file

@ -44,7 +44,7 @@
<item name="android:textSize">14sp</item>
</style>
<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:layout_height">48dp</item>
<item name="android:paddingLeft">12dp</item>

View file

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