blob: e512f93f2ced726616f08fc59fa6b7c1d0a1009d [file] [log] [blame]
Jason Monk0b349ad2016-04-04 11:18:03 -04001/*
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
15package com.android.systemui.qs.customize;
16
17import android.content.Context;
18import android.view.LayoutInflater;
19import android.view.View;
20import android.widget.TextView;
21import com.android.systemui.R;
22import com.android.systemui.qs.QSIconView;
23import com.android.systemui.qs.QSTileView;
24import libcore.util.Objects;
25
26public class CustomizeTileView extends QSTileView {
27
28 private TextView mAppLabel;
29
30 public CustomizeTileView(Context context, QSIconView icon) {
31 super(context, icon);
32 }
33
34 @Override
35 protected void createLabel() {
36 super.createLabel();
37 View view = LayoutInflater.from(mContext).inflate(R.layout.qs_tile_label, null);
38 mAppLabel = (TextView) view.findViewById(R.id.tile_label);
39 mAppLabel.setAlpha(.6f);
40 mAppLabel.setSingleLine(true);
41 addView(view);
42 }
43
44 public void setShowAppLabel(boolean showAppLabel) {
45 mAppLabel.setVisibility(showAppLabel ? View.VISIBLE : View.GONE);
46 mLabel.setSingleLine(showAppLabel);
47 }
48
49 public void setAppLabel(CharSequence label) {
50 if (!Objects.equal(label, mAppLabel.getText())) {
51 mAppLabel.setText(label);
52 }
53 }
54
55 public TextView getAppLabel() {
56 return mAppLabel;
57 }
58}