remember scrolling position

This commit is contained in:
Adrian Ulrich 2015-04-23 18:36:04 +02:00
parent 1bb44eb172
commit f9082f8932
2 changed files with 13 additions and 0 deletions

View File

@ -714,6 +714,7 @@ public class LibraryActivity
.setMessage(delete_message)
.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
mPagerAdapter.maintainState(); // remember current scrolling position
mHandler.sendMessage(mHandler.obtainMessage(MSG_DELETE, intent));
}
})

View File

@ -447,6 +447,18 @@ public class LibraryPagerAdapter
return out;
}
/**
* Forcefully updates mSavedPositions by storing the current
* state and passing it back into restoreState()
* This ensures that the nest MSG_COMMIT_QUERY will
* keep the current scrolling position
*/
public void maintainState()
{
Parcelable state = saveState();
restoreState(state, null);
}
/**
* Sets the text to be displayed in the first row of the artist, album, and
* song lists.