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

Commit fbb602fe authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Save the click position and restore it on orientation change."

parents 43ee0ab8 5c18ac65
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ public final class RingtonePickerActivity extends AlertActivity implements

    private static final int DELAY_MS_SELECTION_PLAYED = 300;

    private static final String SAVE_CLICKED_POS = "clicked_pos";

    private RingtoneManager mRingtoneManager;
    
    private Cursor mCursor;
@@ -121,6 +123,9 @@ public final class RingtonePickerActivity extends AlertActivity implements
            mUriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI;
        }

        if (savedInstanceState != null) {
            mClickedPos = savedInstanceState.getInt(SAVE_CLICKED_POS, -1);
        }
        // Get whether to show the 'Silent' item
        mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
        
@@ -167,6 +172,12 @@ public final class RingtonePickerActivity extends AlertActivity implements
        setupAlert();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(SAVE_CLICKED_POS, mClickedPos);
    }

    public void onPrepareListView(ListView listView) {
        
        if (mHasDefaultItem) {