private final static String TAG = "RecentsActivity";
private final static boolean DEBUG = false;
+ private final static String KEY_SAVED_STATE_HISTORY_VISIBLE =
+ "saved_instance_state_history_visible";
+
public final static int EVENT_BUS_PRIORITY = Recents.EVENT_BUS_PRIORITY + 1;
private RecentsPackageMonitor mPackageMonitor;
}
@Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(KEY_SAVED_STATE_HISTORY_VISIBLE,
+ (mHistoryView != null) && mHistoryView.isVisible());
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ if (savedInstanceState.getBoolean(KEY_SAVED_STATE_HISTORY_VISIBLE, false)) {
+ ReferenceCountedTrigger postHideStackAnimationTrigger =
+ Tnew ReferenceCountedTrigger(this);
+ postHideStackAnimationTrigger.increment();
+ EventBus.getDefault().send(new ShowHistoryEvent(postHideStackAnimationTrigger));
+ postHideStackAnimationTrigger.decrement();
+ }
+ }
+
+ @Override
public void onTrimMemory(int level) {
RecentsTaskLoader loader = Recents.getTaskLoader();
if (loader != null) {
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
+import android.os.Parcelable;
import android.util.IntProperty;
import android.util.Log;
import android.util.Property;
private final static String TAG = "TaskStackView";
private final static boolean DEBUG = false;
+ private final static String KEY_SAVED_STATE_SUPER = "saved_instance_state_super";
+ private final static String KEY_SAVED_STATE_LAYOUT_FOCUSED_STATE =
+ "saved_instance_state_layout_focused_state";
+ private final static String KEY_SAVED_STATE_LAYOUT_STACK_SCROLL =
+ "saved_instance_state_layout_stack_scroll";
+
// The thresholds at which to show/hide the history button.
private static final float SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;
private static final float HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;
}
@Override
+ protected Parcelable onSaveInstanceState() {
+ Bundle savedState = new Bundle();
+ savedState.putParcelable(KEY_SAVED_STATE_SUPER, super.onSaveInstanceState());
+ savedState.putFloat(KEY_SAVED_STATE_LAYOUT_FOCUSED_STATE, mLayoutAlgorithm.getFocusState());
+ savedState.putFloat(KEY_SAVED_STATE_LAYOUT_STACK_SCROLL, mStackScroller.getStackScroll());
+ return super.onSaveInstanceState();
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Parcelable state) {
+ Bundle savedState = (Bundle) state;
+ super.onRestoreInstanceState(savedState.getParcelable(KEY_SAVED_STATE_SUPER));
+
+ mLayoutAlgorithm.setFocusState(savedState.getFloat(KEY_SAVED_STATE_LAYOUT_FOCUSED_STATE));
+ mStackScroller.setStackScroll(savedState.getFloat(KEY_SAVED_STATE_LAYOUT_STACK_SCROLL));
+ }
+
+ @Override
public CharSequence getAccessibilityClassName() {
return TaskStackView.class.getName();
}