My favorites
▼
|
Sign in
myandroidwidgets
Sample Apps for Android
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
TitleWidgetSample
/
src
/
com
/
beanie
/
samples
/
titlewidget
/
TitleWidget.java
r56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.beanie.samples.titlewidget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
public class TitleWidget extends LinearLayout
{
private ImageView image;
private TextView title;
private ProgressBar pBar;
public TitleWidget(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
public TitleWidget(Context context)
{
super(context);
init();
}
// Init method of the TitleWidget which initializes all the widgets
// after loading the layout file
private void init(){
// Inflate the title_widget.xml
View view = inflate(getContext(), R.layout.title_widget, null);
image = (ImageView)view.findViewById(R.id.titleIcon);
title = (TextView)view.findViewById(R.id.titleText);
pBar = (ProgressBar)view.findViewById(R.id.titleProgress);
// Add the view to the LinearLayout since TitleWidget extends LinearLayout
LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
addView(view, params);
}
public void setTitle(String text){
title.setText(text);
}
public void setIcon(int resId){
image.setImageResource(resId);
}
public void showProgressBar(){
pBar.setVisibility(View.VISIBLE);
}
public void hideProgressBar(){
pBar.setVisibility(View.INVISIBLE);
}
}
Show details
Hide details
Change log
r22
by coomar.101 on Oct 12, 2010
Diff
[No log message]
Go to:
/trunk/TitleWidgetSample/.classpath
/trunk/TitleWidgetSample/.project
...WidgetSample/AndroidManifest.xml
/trunk/TitleWidgetSample/assets
...eWidgetSample/default.properties
/trunk/TitleWidgetSample/res
...leWidgetSample/res/drawable-hdpi
...ample/res/drawable-hdpi/icon.png
...leWidgetSample/res/drawable-ldpi
...ample/res/drawable-ldpi/icon.png
...leWidgetSample/res/drawable-mdpi
...ample/res/drawable-mdpi/icon.png
/trunk/TitleWidgetSample/res/layout
...WidgetSample/res/layout/main.xml
...mple/res/layout/title_widget.xml
/trunk/TitleWidgetSample/res/values
...getSample/res/values/strings.xml
/trunk/TitleWidgetSample/src
/trunk/TitleWidgetSample/src/com
...TitleWidgetSample/src/com/beanie
...getSample/src/com/beanie/samples
...c/com/beanie/samples/titlewidget
...les/titlewidget/TitleWidget.java
...ewidget/TitleWidgetActivity.java
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 1670 bytes, 62 lines
View raw file
Powered by
Google Project Hosting