Handling configuration changes
> Adding a listener for device profile changes
> Updating various controllers instead of recreating them
> Clearing all-apps icon
Bug: 71709920
Change-Id: Ief7db199eb7494ebd8fb433198f333cd2e8e661d
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index a54c21c..4a0f52d 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -22,11 +22,16 @@
import android.content.Intent;
import android.view.View.AccessibilityDelegate;
+import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.util.SystemUiController;
+import java.util.ArrayList;
+
public abstract class BaseActivity extends Activity {
+ private final ArrayList<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
+
protected DeviceProfile mDeviceProfile;
protected UserEventDispatcher mUserEventDispatcher;
protected SystemUiController mSystemUiController;
@@ -87,4 +92,15 @@
public boolean isStarted() {
return mStarted;
}
+
+ public void addOnDeviceProfileChangeListener(OnDeviceProfileChangeListener listener) {
+ mDPChangeListeners.add(listener);
+ }
+
+ protected void dispatchDeviceProfileChanged() {
+ int count = mDPChangeListeners.size();
+ for (int i = 0; i < count; i++) {
+ mDPChangeListeners.get(i).onDeviceProfileChanged(mDeviceProfile);
+ }
+ }
}