Skip to content

Commit 5c18ac6

Browse files
author
Amith Yamasani
committed
Save the click position and restore it on orientation change.
Bug: 5417556 Change-Id: I817890a3ff2910aa49ec44a30edb1a39d0d97095
1 parent ba8ecd2 commit 5c18ac6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/java/com/android/internal/app/RingtonePickerActivity.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public final class RingtonePickerActivity extends AlertActivity implements
4747
private static final String TAG = "RingtonePickerActivity";
4848

4949
private static final int DELAY_MS_SELECTION_PLAYED = 300;
50-
50+
51+
private static final String SAVE_CLICKED_POS = "clicked_pos";
52+
5153
private RingtoneManager mRingtoneManager;
5254

5355
private Cursor mCursor;
@@ -120,7 +122,10 @@ protected void onCreate(Bundle savedInstanceState) {
120122
if (mUriForDefaultItem == null) {
121123
mUriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI;
122124
}
123-
125+
126+
if (savedInstanceState != null) {
127+
mClickedPos = savedInstanceState.getInt(SAVE_CLICKED_POS, -1);
128+
}
124129
// Get whether to show the 'Silent' item
125130
mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
126131

@@ -167,6 +172,12 @@ protected void onCreate(Bundle savedInstanceState) {
167172
setupAlert();
168173
}
169174

175+
@Override
176+
public void onSaveInstanceState(Bundle outState) {
177+
super.onSaveInstanceState(outState);
178+
outState.putInt(SAVE_CLICKED_POS, mClickedPos);
179+
}
180+
170181
public void onPrepareListView(ListView listView) {
171182

172183
if (mHasDefaultItem) {

0 commit comments

Comments
 (0)