mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
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
This commit is contained in:
@@ -22,11 +22,16 @@ import android.content.ContextWrapper;
|
||||
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 abstract class BaseActivity extends Activity {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user