1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Avoid saved state being discarded when message list is modified

This commit is contained in:
cketti 2013-02-05 19:59:37 +01:00
parent cb51da5ea8
commit f5ec5cd3fb
2 changed files with 34 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.handmark.pulltorefresh.library.PullToRefreshListView
<com.fsck.k9.view.K9PullToRefreshListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message_list"
android:layout_width="fill_parent"

View File

@ -0,0 +1,33 @@
package com.fsck.k9.view;
import android.content.Context;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.widget.ListView;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
public class K9PullToRefreshListView extends PullToRefreshListView {
public K9PullToRefreshListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected ListView createListView(Context context, AttributeSet attrs) {
return new ListView(context, attrs) {
@Override
public void onRestoreInstanceState(Parcelable state) {
super.onRestoreInstanceState(state);
/*
* Force the list view to apply the restored state instantly instead of
* asynchronously, so potential data changes (which in turn cause an internal
* position save/restore) don't overwrite our saved position.
*/
layoutChildren();
}
};
}
}