blob: 06d27fe92d40eb4e9cc89e0ac0de07384769fb28 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
package com.xtremelabs.robolectric.shadows;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabHost.TabContentFactory;
import com.xtremelabs.robolectric.internal.Implementation;
import com.xtremelabs.robolectric.internal.Implements;
import com.xtremelabs.robolectric.internal.RealObject;
@SuppressWarnings({"UnusedDeclaration"})
@Implements(TabHost.TabSpec.class)
public class ShadowTabSpec {
@RealObject
TabHost.TabSpec realObject;
private String tag;
private View indicatorView;
private Intent intent;
private int viewId;
private View contentView;
private CharSequence label;
private Drawable icon;
/**
* Non-Android accessor, sets the tag on the TabSpec
*/
public void setTag(String tag) {
this.tag = tag;
}
@Implementation
public java.lang.String getTag() {
return tag;
}
/**
* Non-Android accessor
*
* @return the view object set in a call to {@code TabSpec#setIndicator(View)}
*/
public View getIndicatorAsView() {
return this.indicatorView;
}
public String getIndicatorLabel() {
return this.label.toString();
}
public Drawable getIndicatorIcon() {
return this.icon;
}
/**
* Same as GetIndicatorLabel()
* @return
*/
public String getText() {
return label.toString();
}
@Implementation
public TabHost.TabSpec setIndicator(View view) {
this.indicatorView = view;
return realObject;
}
@Implementation
public TabHost.TabSpec setIndicator(CharSequence label) {
this.label = label;
return realObject;
}
@Implementation
public TabHost.TabSpec setIndicator(CharSequence label, Drawable icon) {
this.label = label;
this.icon = icon;
return realObject;
}
/**
* Non-Android accessor
*
* @return the intent object set in a call to {@code TabSpec#setContent(Intent)}
*/
public Intent getContentAsIntent() {
return intent;
}
@Implementation
public android.widget.TabHost.TabSpec setContent(Intent intent) {
this.intent = intent;
return realObject;
}
@Implementation
public android.widget.TabHost.TabSpec setContent(TabContentFactory factory) {
contentView = factory.createTabContent(this.tag);
return realObject;
}
@Implementation
public android.widget.TabHost.TabSpec setContent(int viewId) {
this.viewId = viewId;
return realObject;
}
public int getContentViewId() {
return viewId;
}
public View getContentView() {
return contentView;
}
}
|