1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 5 * except in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the 10 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 11 * KIND, either express or implied. See the License for the specific language governing 12 * permissions and limitations under the License. 13 */ 14 15 package com.android.systemui.qs.customize; 16 17 import android.content.Context; 18 import android.view.LayoutInflater; 19 import android.view.View; 20 import android.widget.TextView; 21 import com.android.systemui.R; 22 import com.android.systemui.plugins.qs.QSIconView; 23 import com.android.systemui.qs.tileimpl.QSTileView; 24 import libcore.util.Objects; 25 26 public class CustomizeTileView extends QSTileView { 27 28 private TextView mAppLabel; 29 private int mLabelMinLines; 30 public CustomizeTileView(Context context, QSIconView icon) { 31 super(context, icon); 32 } 33 34 @Override 35 protected void createLabel() { 36 super.createLabel(); 37 mLabelMinLines = mLabel.getMinLines(); 38 mAppLabel = findViewById(R.id.app_label); 39 mAppLabel.setAlpha(.6f); 40 } 41 42 public void setShowAppLabel(boolean showAppLabel) { 43 mAppLabel.setVisibility(showAppLabel ? View.VISIBLE : View.GONE); 44 mLabel.setSingleLine(showAppLabel); 45 } 46 47 public void setAppLabel(CharSequence label) { 48 if (!Objects.equal(label, mAppLabel.getText())) { 49 mAppLabel.setText(label); 50 } 51 } 52 53 public TextView getAppLabel() { 54 return mAppLabel; 55 } 56 } 57