Merge "Fixed an issue where the shelf could be hidden" into oc-dr1-dev
am: fdc84a13a2
Change-Id: I6c90944ad0db3d309210f1df1d0a1c33bc13cc71
This commit is contained in:
@@ -117,6 +117,18 @@ public class TransitionDrawable extends LayerDrawable implements Drawable.Callba
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the second layer on top of the first layer immediately
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void showSecondLayer() {
|
||||
mAlpha = 255;
|
||||
mReverse = false;
|
||||
mTransitionState = TRANSITION_NONE;
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show only the first layer.
|
||||
*/
|
||||
|
||||
@@ -100,4 +100,8 @@ public class QSDetailClipper {
|
||||
mAnimator = null;
|
||||
};
|
||||
};
|
||||
|
||||
public void showBackground() {
|
||||
mBackground.showSecondLayer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,13 @@ public class QSFragment extends Fragment implements QS {
|
||||
if (savedInstanceState != null) {
|
||||
setExpanded(savedInstanceState.getBoolean(EXTRA_EXPANDED));
|
||||
setListening(savedInstanceState.getBoolean(EXTRA_LISTENING));
|
||||
int[] loc = new int[2];
|
||||
View edit = view.findViewById(android.R.id.edit);
|
||||
edit.getLocationInWindow(loc);
|
||||
int x = loc[0] + edit.getWidth() / 2;
|
||||
int y = loc[1] + edit.getHeight() / 2;
|
||||
mQSCustomizer.setEditLocation(x, y);
|
||||
mQSCustomizer.restoreInstanceState(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,6 +117,7 @@ public class QSFragment extends Fragment implements QS {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(EXTRA_EXPANDED, mQsExpanded);
|
||||
outState.putBoolean(EXTRA_LISTENING, mListening);
|
||||
mQSCustomizer.saveInstanceState(outState);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -20,6 +20,9 @@ import android.animation.Animator.AnimatorListener;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.TransitionDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
@@ -42,6 +45,7 @@ import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.qs.QS;
|
||||
import com.android.systemui.plugins.qs.QSTile;
|
||||
import com.android.systemui.qs.QSContainerImpl;
|
||||
import com.android.systemui.qs.QSDetailClipper;
|
||||
import com.android.systemui.qs.QSTileHost;
|
||||
import com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer;
|
||||
@@ -60,6 +64,7 @@ import java.util.List;
|
||||
public class QSCustomizer extends LinearLayout implements OnMenuItemClickListener {
|
||||
|
||||
private static final int MENU_RESET = Menu.FIRST;
|
||||
private static final String EXTRA_QS_CUSTOMIZING = "qs_customizing";
|
||||
|
||||
private final QSDetailClipper mClipper;
|
||||
|
||||
@@ -109,11 +114,16 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
||||
DefaultItemAnimator animator = new DefaultItemAnimator();
|
||||
animator.setMoveDuration(TileAdapter.MOVE_DURATION);
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
updateNavBackDrop(getResources().getConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
updateNavBackDrop(newConfig);
|
||||
}
|
||||
|
||||
private void updateNavBackDrop(Configuration newConfig) {
|
||||
View navBackdrop = findViewById(R.id.nav_bar_background);
|
||||
if (navBackdrop != null) {
|
||||
boolean shouldShow = newConfig.smallestScreenWidthDp >= 600
|
||||
@@ -154,6 +164,21 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showImmediately() {
|
||||
if (!isShown) {
|
||||
setVisibility(VISIBLE);
|
||||
mClipper.showBackground();
|
||||
isShown = true;
|
||||
setTileSpecs();
|
||||
setCustomizing(true);
|
||||
queryTiles();
|
||||
mNotifQsContainer.setCustomizerAnimating(false);
|
||||
mNotifQsContainer.setCustomizerShowing(true);
|
||||
Dependency.get(KeyguardMonitor.class).addCallback(mKeyguardCallback);
|
||||
}
|
||||
}
|
||||
|
||||
private void queryTiles() {
|
||||
mFinishedFetchingTiles = false;
|
||||
Runnable tileQueryFetchCompletion = () -> {
|
||||
@@ -227,6 +252,35 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveInstanceState(Bundle outState) {
|
||||
if (isShown) {
|
||||
Dependency.get(KeyguardMonitor.class).removeCallback(mKeyguardCallback);
|
||||
}
|
||||
outState.putBoolean(EXTRA_QS_CUSTOMIZING, mCustomizing);
|
||||
}
|
||||
|
||||
public void restoreInstanceState(Bundle savedInstanceState) {
|
||||
boolean customizing = savedInstanceState.getBoolean(EXTRA_QS_CUSTOMIZING);
|
||||
if (customizing) {
|
||||
setVisibility(VISIBLE);
|
||||
addOnLayoutChangeListener(new OnLayoutChangeListener() {
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right, int bottom,
|
||||
int oldLeft,
|
||||
int oldTop, int oldRight, int oldBottom) {
|
||||
removeOnLayoutChangeListener(this);
|
||||
showImmediately();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void setEditLocation(int x, int y) {
|
||||
mX = x;
|
||||
mY = y;
|
||||
}
|
||||
|
||||
private final Callback mKeyguardCallback = () -> {
|
||||
if (!isAttachedToWindow()) return;
|
||||
if (Dependency.get(KeyguardMonitor.class).isShowing() && !mOpening) {
|
||||
|
||||
@@ -3487,6 +3487,11 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
pw.print (" ");
|
||||
mNotificationPanel.dump(fd, pw, args);
|
||||
}
|
||||
pw.println(" mStackScroller: ");
|
||||
if (mStackScroller != null) {
|
||||
pw.print (" ");
|
||||
mStackScroller.dump(fd, pw, args);
|
||||
}
|
||||
|
||||
DozeLog.dump(pw);
|
||||
|
||||
|
||||
@@ -91,6 +91,8 @@ import com.android.systemui.statusbar.policy.ScrollAdapter;
|
||||
|
||||
import android.support.v4.graphics.ColorUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -4257,6 +4259,19 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
mShelf.setDarkOffsetX(shelfOffsetX);
|
||||
}
|
||||
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
pw.println(String.format("[%s: pulsing=%s qsCustomizerShowing=%s visibility=%s"
|
||||
+ " alpha:%f scrollY:%d]",
|
||||
this.getClass().getSimpleName(),
|
||||
mPulsing != null ?"T":"f",
|
||||
mAmbientState.isQsCustomizerShowing() ? "T":"f",
|
||||
getVisibility() == View.VISIBLE ? "visible"
|
||||
: getVisibility() == View.GONE ? "gone"
|
||||
: "invisible",
|
||||
getAlpha(),
|
||||
mAmbientState.getScrollY()));
|
||||
}
|
||||
|
||||
/**
|
||||
* A listener that is notified when some child locations might have changed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user