blob: 94b2fc77336a902fb85d48d24328742307a1b220 [file] [log] [blame]
Daniel Sandlerb5538e62013-04-12 15:16:53 -04001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui.statusbar.phone;
18
19import com.android.systemui.R;
20
21import android.content.Context;
22import android.graphics.drawable.Drawable;
23import android.util.AttributeSet;
24import android.view.LayoutInflater;
25import android.widget.FrameLayout;
26import android.widget.ImageView;
27import android.widget.TextView;
28
29class QuickSettingsBasicTile extends QuickSettingsTileView {
30 private final TextView mTextView;
31 private final ImageView mImageView;
32
33 public QuickSettingsBasicTile(Context context) {
34 this(context, null);
35 }
36
37 public QuickSettingsBasicTile(Context context, AttributeSet attrs) {
38 super(context, attrs);
39
40 setLayoutParams(new FrameLayout.LayoutParams(
41 FrameLayout.LayoutParams.MATCH_PARENT,
42 context.getResources().getDimensionPixelSize(R.dimen.quick_settings_cell_height)
43 ));
44 setBackgroundResource(R.drawable.qs_tile_background);
45 addView(LayoutInflater.from(context).inflate(
46 R.layout.quick_settings_tile_basic, null),
47 new FrameLayout.LayoutParams(
48 FrameLayout.LayoutParams.MATCH_PARENT,
49 FrameLayout.LayoutParams.MATCH_PARENT));
50 mTextView = (TextView) findViewById(R.id.text);
51 mImageView = (ImageView) findViewById(R.id.image);
52 }
53
54 @Override
55 void setContent(int layoutId, LayoutInflater inflater) {
56 throw new RuntimeException("why?");
57 }
58
59 public ImageView getImageView() {
60 return mImageView;
61 }
62
63 public TextView getTextView() {
64 return mTextView;
65 }
66
67 public void setImageDrawable(Drawable drawable) {
68 mImageView.setImageDrawable(drawable);
69 }
70
71 public void setImageResource(int resId) {
72 mImageView.setImageResource(resId);
73 }
74
75 public void setText(CharSequence text) {
76 mTextView.setText(text);
77 }
78
79 public void setTextResource(int resId) {
80 mTextView.setText(resId);
81 }
82}