Reload the task list when multiwindow mode changes

Bug: 73097187
Change-Id: I05d8635f78451600cbb8a9c03515e60d3c32e1ae
This commit is contained in:
Winson Chung
2018-04-11 12:47:47 -07:00
parent eeb084cb4b
commit 1a77c3dce1
2 changed files with 34 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Point;
import android.view.Display;
import android.view.View.AccessibilityDelegate;
@@ -33,6 +34,8 @@ import java.util.ArrayList;
public abstract class BaseActivity extends Activity {
private final ArrayList<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
private final ArrayList<MultiWindowModeChangedListener> mMultiWindowModeChangedListeners =
new ArrayList<>();
protected DeviceProfile mDeviceProfile;
protected UserEventDispatcher mUserEventDispatcher;
@@ -100,6 +103,14 @@ public abstract class BaseActivity extends Activity {
super.onUserLeaveHint();
}
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
for (int i = mMultiWindowModeChangedListeners.size() - 1; i >= 0; i--) {
mMultiWindowModeChangedListeners.get(i).onMultiWindowModeChanged(isInMultiWindowMode);
}
}
@Override
protected void onStop() {
mStarted = false;
@@ -129,6 +140,14 @@ public abstract class BaseActivity extends Activity {
}
}
public void addMultiWindowModeChangedListener(MultiWindowModeChangedListener listener) {
mMultiWindowModeChangedListeners.add(listener);
}
public void removeMultiWindowModeChangedListener(MultiWindowModeChangedListener listener) {
mMultiWindowModeChangedListeners.remove(listener);
}
/**
* Used to set the override visibility state, used only to handle the transition home with the
* recents animation.
@@ -157,4 +176,8 @@ public abstract class BaseActivity extends Activity {
mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
}
}
public interface MultiWindowModeChangedListener {
void onMultiWindowModeChanged(boolean isInMultiWindowMode);
}
}