Initial changes for handling configuration changes dynamically

Bug: 71709920
Change-Id: I88cf2229dea28d01c13a5a76d2290e91b07d095e
This commit is contained in:
Sunny Goyal
2018-01-31 15:18:11 -08:00
parent 260fec1b24
commit f8d56fc8a1
13 changed files with 126 additions and 61 deletions
@@ -2,6 +2,7 @@ package com.android.launcher3.allapps;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -10,6 +11,7 @@ import android.util.Property;
import android.view.View;
import android.view.animation.Interpolator;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
@@ -59,7 +61,7 @@ public class AllAppsTransitionController
private final Launcher mLauncher;
private final boolean mIsDarkTheme;
private final boolean mIsVerticalLayout;
private boolean mIsVerticalLayout;
// Animation in this class is controlled by a single variable {@link mProgress}.
// Visually, it represents top y coordinate of the all apps container if multiplied with
@@ -80,7 +82,7 @@ public class AllAppsTransitionController
mProgress = 1f;
mIsDarkTheme = Themes.getAttrBoolean(mLauncher, R.attr.isMainColorDark);
mIsVerticalLayout = mLauncher.getDeviceProfile().isVerticalBarLayout();
onDeviceProfileChanged(mLauncher.getDeviceProfile());
}
public float getShiftRange() {
@@ -93,6 +95,10 @@ public class AllAppsTransitionController
mAppsView.setVisibility(View.VISIBLE);
}
public void onDeviceProfileChanged(DeviceProfile profile) {
mIsVerticalLayout = profile.isVerticalBarLayout();
}
/**
* Note this method should not be called outside this class. This is public because it is used
* in xml-based animations which also handle updating the appropriate UI.
@@ -125,13 +131,15 @@ public class AllAppsTransitionController
// status bar.
boolean forceChange = shiftCurrent <= mShiftRange / 4;
if (forceChange) {
mLauncher.getSystemUiController().updateUiState(
SystemUiController.UI_STATE_ALL_APPS, !mIsDarkTheme);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALL_APPS, !mIsDarkTheme);
} else {
mLauncher.getSystemUiController().updateUiState(
SystemUiController.UI_STATE_ALL_APPS, 0);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALL_APPS, 0);
}
} else {
mAppsView.setAlpha(1);
mLauncher.getHotseat().setTranslationY(0);
mLauncher.getWorkspace().getPageIndicator().setTranslationY(0);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALL_APPS, 0);
}
}