Skip to content

Commit

Permalink
status bar power menu: be sure to update visibility when showing qs d…
Browse files Browse the repository at this point in the history
…etails

fix status bar power menu icon showing up if previously disabled
step to reproduce:
- enable status bar power menu
- disable it
- pull down qs and tap data icon
- close data details
- status bar power menu icon will be visible even if disabled

thanks @enricocid for the bug report
  • Loading branch information
rascarlo committed Dec 17, 2014
1 parent b11306b commit d57807b
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ protected void onFinishInflate() {
mSignalCluster = findViewById(R.id.signal_cluster);
mSystemIcons = (LinearLayout) findViewById(R.id.system_icons);
loadDimens();
updateStatusBarPowerMenuVisibility();
updateVisibilities();
updateClockScale();
updateAvatarScale();
Expand Down Expand Up @@ -342,6 +343,7 @@ public void updateEverything() {
updateSystemIconsLayoutParams();
updateClickTargets();
updateMultiUserSwitch();
updateStatusBarPowerMenuVisibility();
if (mQSPanel != null) {
mQSPanel.setExpanded(mExpanded);
}
Expand Down Expand Up @@ -372,7 +374,6 @@ private void updateVisibilities() {
mEmergencyCallsOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly ? VISIBLE : GONE);
mBatteryLevel.setVisibility(((mExpanded && (mShowBatteryText == 0 || mBatteryCharging))
|| mShowBatteryText == 2) ? View.VISIBLE : View.GONE);
mStatusBarPowerMenu.setVisibility(mExpanded && (mStatusBarPowerMenuStyle != STATUS_BAR_POWER_MENU_OFF) ? View.VISIBLE : View.GONE);
}

private void updateSignalClusterDetachment() {
Expand Down Expand Up @@ -437,6 +438,12 @@ private void updateAmPmTranslation() {
mAmPm.setTranslationX((rtl ? 1 : -1) * mTime.getWidth() * (1 - mTime.getScaleX()));
}

private void updateStatusBarPowerMenuVisibility() {
mStatusBarPowerMenu.setVisibility(mExpanded
&& (mStatusBarPowerMenuStyle != STATUS_BAR_POWER_MENU_OFF) ? View.VISIBLE
: View.GONE);
}

@Override
public void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging) {
mBatteryLevel.setText(getResources().getString(R.string.battery_level_template, level));
Expand Down Expand Up @@ -838,6 +845,7 @@ public void onClick(View v) {
} else {
mQsDetailHeader.setClickable(false);
}
updateStatusBarPowerMenuVisibility();
}

private void transition(final View v, final boolean in) {
Expand Down

0 comments on commit d57807b

Please sign in to comment.