Skip to content

Commit

Permalink
QS: respect equalizer in switch to small tiles
Browse files Browse the repository at this point in the history
Change-Id: I2fa7f721c5a884bcfad49eb9e6a104ea89b019a5
  • Loading branch information
Unpublished authored and rmcc committed Jun 19, 2014
1 parent 58fe2f6 commit b72d619
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ public void onClick(View v) {
};
}

@Override
protected View getImageView() {
return mTile.findViewById(R.id.visualizer_view);
}

@Override
void onPostCreate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public void setupQuickSettingsTile(LayoutInflater inflater,
}

public void switchToRibbonMode() {
TextView tv = (TextView) mTile.findViewById(R.id.text);
TextView tv = getLabelView();
if (tv != null) {
tv.setVisibility(View.GONE);
}
View image = mTile.findViewById(R.id.image);
View image = getImageView();
if (image != null) {
MarginLayoutParams params = (MarginLayoutParams) image.getLayoutParams();
int margin = mContext.getResources().getDimensionPixelSize(
Expand All @@ -87,7 +87,7 @@ public void switchToRibbonMode() {
}

public void switchToSmallIcons() {
TextView tv = (TextView) mTile.findViewById(R.id.text);
TextView tv = getLabelView();
if (tv != null) {
tv.setText(mLabel);
tv.setTextSize(mTileTextSize);
Expand All @@ -96,7 +96,7 @@ public void switchToSmallIcons() {
tv.setPadding(0, mTileTextPadding, 0, 0);
}
}
View image = mTile.findViewById(R.id.image);
View image = getImageView();
if (image != null) {
MarginLayoutParams params = (MarginLayoutParams) image.getLayoutParams();
int margin = mContext.getResources().getDimensionPixelSize(
Expand All @@ -106,6 +106,14 @@ public void switchToSmallIcons() {
}
}

protected View getImageView() {
return mTile.findViewById(R.id.image);
}

protected TextView getLabelView() {
return (TextView) mTile.findViewById(R.id.text);
}

void onPostCreate() {}

public void onDestroy() {}
Expand All @@ -121,7 +129,7 @@ public void updateResources() {
}

void updateQuickSettings() {
TextView tv = (TextView) mTile.findViewById(R.id.text);
TextView tv = getLabelView();
if (tv != null) {
tv.setText(mLabel);
tv.setTextSize(mTileTextSize);
Expand All @@ -130,7 +138,7 @@ void updateQuickSettings() {
tv.setPadding(0, mTileTextPadding, 0, 0);
}
}
View image = mTile.findViewById(R.id.image);
View image = getImageView();
if (image != null && image instanceof ImageView) {
((ImageView) image).setImageResource(mDrawable);
}
Expand Down

0 comments on commit b72d619

Please sign in to comment.