Remove preference to flip recents

Now we always flip recents, and don't have a setting.

Bug: 78231551
Change-Id: Icc991dbe4674e9238e1d7e39938009b51bde7bd5
This commit is contained in:
Tony Wickham 2018-04-23 11:38:32 -07:00
parent 229fc93949
commit c6b977a42e
1 changed files with 7 additions and 19 deletions

View File

@ -30,8 +30,6 @@ import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.Rect;
@ -85,8 +83,7 @@ import java.util.function.Consumer;
* A list of recent tasks.
*/
@TargetApi(Build.VERSION_CODES.P)
public abstract class RecentsView<T extends BaseActivity>
extends PagedView implements OnSharedPreferenceChangeListener, Insettable {
public abstract class RecentsView<T extends BaseActivity> extends PagedView implements Insettable {
public static final boolean DEBUG_SHOW_CLEAR_ALL_BUTTON = false;
@ -104,7 +101,7 @@ public abstract class RecentsView<T extends BaseActivity>
return recentsView.mAdjacentScale;
}
};
private static final String PREF_FLIP_RECENTS = "pref_flip_recents";
private static final boolean FLIP_RECENTS = true;
private static final int DISMISS_TASK_DURATION = 300;
protected final T mActivity;
@ -201,7 +198,11 @@ public abstract class RecentsView<T extends BaseActivity>
mQuickScrubController = new QuickScrubController(mActivity, this);
mModel = RecentsModel.getInstance(context);
onSharedPreferenceChanged(Utilities.getPrefs(context), PREF_FLIP_RECENTS);
mIsRtl = Utilities.isRtl(getResources());
if (FLIP_RECENTS) {
mIsRtl = !mIsRtl;
}
setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
mEmptyIcon = context.getDrawable(R.drawable.ic_empty_recents);
mEmptyIcon.setCallback(this);
@ -215,17 +216,6 @@ public abstract class RecentsView<T extends BaseActivity>
setWillNotDraw(false);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
if (s.equals(PREF_FLIP_RECENTS)) {
mIsRtl = Utilities.isRtl(getResources());
if (sharedPreferences.getBoolean(PREF_FLIP_RECENTS, false)) {
mIsRtl = !mIsRtl;
}
setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
}
}
public boolean isRtl() {
return mIsRtl;
}
@ -248,7 +238,6 @@ public abstract class RecentsView<T extends BaseActivity>
protected void onAttachedToWindow() {
super.onAttachedToWindow();
updateTaskStackListenerState();
Utilities.getPrefs(getContext()).registerOnSharedPreferenceChangeListener(this);
mActivity.addMultiWindowModeChangedListener(mMultiWindowModeChangedListener);
}
@ -256,7 +245,6 @@ public abstract class RecentsView<T extends BaseActivity>
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
updateTaskStackListenerState();
Utilities.getPrefs(getContext()).unregisterOnSharedPreferenceChangeListener(this);
mActivity.removeMultiWindowModeChangedListener(mMultiWindowModeChangedListener);
}