My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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);
}
}

Change log

r22 by coomar.101 on Oct 12, 2010   Diff
[No log message]
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1670 bytes, 62 lines
Powered by Google Project Hosting