Fixed crash on screen rotation in server fragment.
This commit is contained in:
parent
b037a17f2a
commit
278c2bb75a
1 changed files with 4 additions and 8 deletions
|
@ -131,6 +131,8 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene
|
|||
.getDevice(new UDN(mRestoreServer.replace("uuid:", "")), false);
|
||||
if (mCurrentServer != null) {
|
||||
setListAdapter(mFileAdapter);
|
||||
// Duplicate the top element because getFiles will remove it.
|
||||
mListState.add(mListState.peek());
|
||||
getFiles(true);
|
||||
}
|
||||
|
||||
|
@ -196,13 +198,6 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene
|
|||
outState.putParcelableArrayList("list_state", new ArrayList<Parcelable>(mListState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mListState.pop();
|
||||
mListState.push(getListView().onSaveInstanceState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -266,7 +261,8 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene
|
|||
* Displays the current directory on the ListView.
|
||||
*
|
||||
* @param restoreListState True if we are going back up the directory tree,
|
||||
* which means we restore scroll position etc.
|
||||
* which means we restore scroll position etc. This pops
|
||||
* mListState.
|
||||
*/
|
||||
private void getFiles(final boolean restoreListState) {
|
||||
if (mCurrentServer == null)
|
||||
|
|
Reference in a new issue