Skip to content

Commit

Permalink
save and restore instance state of wrapped list, and delegate setMult…
Browse files Browse the repository at this point in the history
…iChoiceModeListener
  • Loading branch information
mtotschnig committed Jan 29, 2014
1 parent 7dd8989 commit af8f7ed
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.SparseBooleanArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
Expand Down Expand Up @@ -952,4 +954,24 @@ public int getPositionForView(View view) {
return mList.getPositionForView(view);
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setMultiChoiceModeListener(MultiChoiceModeListener listener) {
requireSdkVersion(Build.VERSION_CODES.HONEYCOMB);
mList.setMultiChoiceModeListener(listener);
}

@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
if (superState != BaseSavedState.EMPTY_STATE) {
throw new IllegalStateException("Handling non empty state of parent class is not implemented");
}
return mList.onSaveInstanceState();
}

@Override
protected void onRestoreInstanceState(Parcelable state) {
super.onRestoreInstanceState(BaseSavedState.EMPTY_STATE);
mList.onRestoreInstanceState(state);
}
}

0 comments on commit af8f7ed

Please sign in to comment.