Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09dbf184 authored by Freeman Ng's avatar Freeman Ng
Browse files

add a Skip option

Change-Id: I21dca8feb1dedc362350c41e95a12463e6e4bc61
parent 6b63dce8
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,9 @@ public abstract class PreferenceActivity extends ListActivity implements
    // Back will then return RESULT_CANCELED and Next RESULT_OK
    // Back will then return RESULT_CANCELED and Next RESULT_OK
    private static final String EXTRA_PREFS_SHOW_BUTTON_BAR = "extra_prefs_show_button_bar";
    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
    // specify custom text for the Back or Next buttons, or cause a button to not appear
    // at all by setting it to null
    // at all by setting it to null
    private static final String EXTRA_PREFS_SET_NEXT_TEXT = "extra_prefs_set_next_text";
    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();
                    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 = (Button)findViewById(com.android.internal.R.id.next_button);
            mNextButton.setOnClickListener(new OnClickListener() {
            mNextButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                public void onClick(View v) {
@@ -334,6 +344,9 @@ public abstract class PreferenceActivity extends ListActivity implements
                    backButton.setText(buttonText);
                    backButton.setText(buttonText);
                }
                }
            }
            }
            if (intent.getBooleanExtra(EXTRA_PREFS_SHOW_SKIP, false)) {
                skipButton.setVisibility(View.VISIBLE);
            }
        }
        }
    }
    }


+22 −9
Original line number Original line Diff line number Diff line
@@ -59,15 +59,28 @@
            android:drawablePadding="3dip"
            android:drawablePadding="3dip"
            android:text="@string/back_button_label"
            android:text="@string/back_button_label"
        />
        />
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            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"
            <Button android:id="@+id/next_button"
                android:layout_width="150dip"
                android:layout_width="150dip"
                android:layout_height="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"
                android:layout_margin="5dip"
            android:layout_alignParentRight="true"
                android:drawableRight="@drawable/ic_btn_next"
                android:drawableRight="@drawable/ic_btn_next"
                android:drawablePadding="3dip"
                android:drawablePadding="3dip"
                android:text="@string/next_button_label"
                android:text="@string/next_button_label"
            />
            />
        </LinearLayout>
    </RelativeLayout>
    </RelativeLayout>
</LinearLayout>
</LinearLayout>
+12 −9
Original line number Original line Diff line number Diff line
@@ -2278,6 +2278,9 @@
    <string name="back_button_label">Back</string>
    <string name="back_button_label">Back</string>
    <string name="next_button_label">Next</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 -->
    <!-- Strings for throttling notification -->
    <!-- Shown when the user is in danger of being throttled -->
    <!-- Shown when the user is in danger of being throttled -->
    <string name="throttle_warning_notification_title">High mobile data use</string>
    <string name="throttle_warning_notification_title">High mobile data use</string>