mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Avoid saved state being discarded when message list is modified
This commit is contained in:
parent
cb51da5ea8
commit
f5ec5cd3fb
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/message_list"
|
android:id="@+id/message_list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
|
33
src/com/fsck/k9/view/K9PullToRefreshListView.java
Normal file
33
src/com/fsck/k9/view/K9PullToRefreshListView.java
Normal 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();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user