add a Skip option

Change-Id: I21dca8feb1dedc362350c41e95a12463e6e4bc61
This commit is contained in:
Freeman Ng
2010-08-11 15:45:01 -07:00
parent 6b63dce8c9
commit 09dbf18440
3 changed files with 47 additions and 18 deletions

View File

@@ -125,6 +125,9 @@ public abstract class PreferenceActivity extends ListActivity implements
// Back will then return RESULT_CANCELED and Next RESULT_OK
private static final String EXTRA_PREFS_SHOW_BUTTON_BAR = "extra_prefs_show_button_bar";
// add a Skip button?
private static final String EXTRA_PREFS_SHOW_SKIP = "extra_prefs_show_skip";
// specify custom text for the Back or Next buttons, or cause a button to not appear
// at all by setting it to null
private static final String EXTRA_PREFS_SET_NEXT_TEXT = "extra_prefs_set_next_text";
@@ -307,6 +310,13 @@ public abstract class PreferenceActivity extends ListActivity implements
finish();
}
});
Button skipButton = (Button)findViewById(com.android.internal.R.id.skip_button);
skipButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
setResult(RESULT_OK);
finish();
}
});
mNextButton = (Button)findViewById(com.android.internal.R.id.next_button);
mNextButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
@@ -334,6 +344,9 @@ public abstract class PreferenceActivity extends ListActivity implements
backButton.setText(buttonText);
}
}
if (intent.getBooleanExtra(EXTRA_PREFS_SHOW_SKIP, false)) {
skipButton.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -59,15 +59,28 @@
android:drawablePadding="3dip"
android:text="@string/back_button_label"
/>
<Button android:id="@+id/next_button"
android:layout_width="150dip"
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/ic_btn_next"
android:drawablePadding="3dip"
android:text="@string/next_button_label"
/>
android:layout_alignParentRight="true">
<Button android:id="@+id/skip_button"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:text="@string/skip_button_label"
android:visibility="gone"
/>
<Button android:id="@+id/next_button"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:drawableRight="@drawable/ic_btn_next"
android:drawablePadding="3dip"
android:text="@string/next_button_label"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View File

@@ -807,8 +807,8 @@
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_writeCalendar">add or modify calendar events and send email to guests</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_writeCalendar">Allows an application to add or change the
events on your calendar, which may send email to guests. Malicious applications can use this
<string name="permdesc_writeCalendar">Allows an application to add or change the
events on your calendar, which may send email to guests. Malicious applications can use this
to erase or modify your calendar events or to send email to guests.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1918,7 +1918,7 @@
<!-- Text shown by list fragment when waiting for data to display. -->
<string name="loading">Loading...</string>
<!-- Default text for a button that can be toggled on and off. -->
<string name="capital_on">ON</string>
<!-- Default text for a button that can be toggled on and off. -->
@@ -1969,23 +1969,23 @@
<!-- Notification text to tell the user that a heavy-weight application is running. -->
<string name="heavy_weight_notification"><xliff:g id="app">%1$s</xliff:g> running</string>
<!-- Notification details to tell the user that a heavy-weight application is running. -->
<string name="heavy_weight_notification_detail">Select to switch to application</string>
<!-- Title of dialog prompting whether user wants to switch between heavy-weight apps. -->
<string name="heavy_weight_switcher_title">Switch applications?</string>
<!-- Descriptive text for switching to a new heavy-weight application. -->
<string name="heavy_weight_switcher_text">Another application is already running
that must be stopped before you can start a new one.</string>
<string name="old_app_action">Return to <xliff:g id="old_app">%1$s</xliff:g></string>
<string name="old_app_description">Don\'t start the new application.</string>
<string name="new_app_action">Start <xliff:g id="old_app">%1$s</xliff:g></string>
<string name="new_app_description">Stop the old application without saving.</string>
<!-- Displayed in the title of the chooser for things to do with text that
is to be sent to another application. For example, I can send
text through SMS or IM. A dialog with those choices would be shown,
@@ -2278,6 +2278,9 @@
<string name="back_button_label">Back</string>
<string name="next_button_label">Next</string>
<!-- Optional button to Skip a PreferenceActivity [CHAR LIMIT=20] -->
<string name="skip_button_label">Skip</string>
<!-- Strings for throttling notification -->
<!-- Shown when the user is in danger of being throttled -->
<string name="throttle_warning_notification_title">High mobile data use</string>