811a5a4a |
1 | package org.openintents.filemanager;\r |
2 | \r |
3 | /* $Id: BulletedTextView.java 57 2007-11-21 18:31:52Z steven $ \r |
4 | * \r |
5 | * Copyright 2007 Steven Osborn \r |
6 | * \r |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); \r |
8 | * you may not use this file except in compliance with the License. \r |
9 | * You may obtain a copy of the License at \r |
10 | * \r |
11 | * http://www.apache.org/licenses/LICENSE-2.0 \r |
12 | * \r |
13 | * Unless required by applicable law or agreed to in writing, software \r |
14 | * distributed under the License is distributed on an "AS IS" BASIS, \r |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. \r |
16 | * See the License for the specific language governing permissions and \r |
17 | * limitations under the License. \r |
18 | */ \r |
19 | \r |
20 | /**\r |
21 | * Dec 7, 2008: Peli: Use inflated layout.\r |
22 | */\r |
23 | \r |
24 | import android.content.Context; \r |
25 | import android.graphics.Bitmap;\r |
26 | import android.graphics.Color;\r |
27 | import android.graphics.drawable.Drawable; \r |
28 | import android.util.Log;\r |
29 | import android.view.LayoutInflater;\r |
30 | import android.view.View;\r |
31 | import android.widget.CheckBox;\r |
32 | import android.widget.CompoundButton;\r |
33 | import android.widget.ImageView; \r |
34 | import android.widget.LinearLayout; \r |
35 | import android.widget.TextView; \r |
36 | \r |
37 | public class IconifiedTextView extends LinearLayout { \r |
38 | \r |
39 | private TextView mText; \r |
40 | private TextView mInfo; \r |
41 | private ImageView mIcon; \r |
42 | private ImageView mCheckIcon;\r |
43 | \r |
44 | public IconifiedTextView(Context context, final IconifiedText aIconifiedText) { \r |
45 | super(context); \r |
46 | \r |
47 | // inflate rating\r |
48 | LayoutInflater inflater = (LayoutInflater) context\r |
49 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r |
50 | \r |
51 | inflater.inflate(\r |
52 | R.layout.filelist_item, this, true);\r |
53 | \r |
54 | mIcon = (ImageView) findViewById(R.id.icon);\r |
55 | mText = (TextView) findViewById(R.id.text);\r |
56 | mInfo = (TextView) findViewById(R.id.info);\r |
57 | mCheckIcon = (ImageView) findViewById(R.id.select_icon);\r |
58 | } \r |
59 | \r |
60 | public ImageView getImageView() {\r |
61 | return mIcon;\r |
62 | }\r |
63 | \r |
64 | public void setText(String words) { \r |
65 | mText.setText(words); \r |
66 | \r |
67 | int height = getHeight();\r |
68 | \r |
69 | if (height > 0) {\r |
70 | ThumbnailLoader.setThumbnailHeight(height);\r |
71 | }\r |
72 | } \r |
73 | \r |
74 | public void setInfo(String info) { \r |
75 | mInfo.setText(info);\r |
76 | } \r |
77 | \r |
78 | public void setIcon(Drawable bullet) { \r |
79 | mIcon.setImageDrawable(bullet); \r |
80 | }\r |
81 | \r |
82 | public void setIcon(Bitmap bitmap) {\r |
83 | mIcon.setImageBitmap(bitmap);\r |
84 | }\r |
85 | \r |
86 | public void setCheckVisible(boolean visible) {\r |
87 | mCheckIcon.setVisibility((visible) ? View.VISIBLE : View.GONE);\r |
88 | }\r |
89 | \r |
90 | public void setCheckDrawable(Drawable icon) {\r |
91 | mCheckIcon.setImageDrawable(icon);\r |
92 | }\r |
93 | } |