use of android.widget.TabHost in project cw-android by commonsguy.
the class IntentTabDemo method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost host = getTabHost();
Intent i = new Intent(this, CWBrowser.class);
i.putExtra(CWBrowser.URL, "http://commonsware.com");
host.addTab(host.newTabSpec("one").setIndicator("CW").setContent(i));
i = new Intent(i);
i.putExtra(CWBrowser.URL, "http://www.android.com");
host.addTab(host.newTabSpec("two").setIndicator("Android").setContent(i));
}
use of android.widget.TabHost in project Trello-Android by chrisHoekstra.
the class TrelloTabActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab);
TabHost tabHost = getTabHost();
tabHost.addTab(tabHost.newTabSpec(BOARD_TAB).setIndicator("Boards", null).setContent(new Intent().setClass(this, BoardActivityGroup.class)));
tabHost.addTab(tabHost.newTabSpec(NOTIFICATION_TAB).setIndicator("Notifications", null).setContent(new Intent().setClass(this, NotificationsActivity.class)));
tabHost.addTab(tabHost.newTabSpec(PROFILE_TAB).setIndicator("Profile", null).setContent(new Intent().setClass(this, ProfileActivity.class)));
}
use of android.widget.TabHost in project GreenDroid by cyrilmottier.
the class GDTabActivity method addTab.
/**
* Add a new tab to this GDTabActivity
*
* @param tag The tag associated this the new tab
* @param label The label of the new tab
* @param intent The Intent used to start the content of the tab
*/
public void addTab(String tag, CharSequence label, Intent intent) {
final TabHost host = getTabHost();
View indicator = createTabIndicator(tag, label, getTabWidget());
if (indicator == null) {
final TextView textIndicator = (TextView) getLayoutInflater().inflate(R.layout.gd_tab_indicator, getTabWidget(), false);
textIndicator.setText(label);
indicator = textIndicator;
}
host.addTab(host.newTabSpec(tag).setIndicator(indicator).setContent(intent));
}
use of android.widget.TabHost in project android_frameworks_base by ParanoidAndroid.
the class MediaDump method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: Read/Write the settings.
setContentView(R.layout.main);
TabHost tab = getTabHost();
// Setup video dumping tab
TabHost.TabSpec videoDumpTab = tab.newTabSpec("VideoDump");
videoDumpTab.setIndicator("VideoDump");
Intent videoDumpIntent = new Intent(this, VideoDumpActivity.class);
videoDumpTab.setContent(videoDumpIntent);
tab.addTab(videoDumpTab);
// Setup rgb player tab
TabHost.TabSpec rgbPlayerTab = tab.newTabSpec("RgbPlayer");
rgbPlayerTab.setIndicator("RgbPlayer");
Intent rgbPlayerIntent = new Intent(this, RgbPlayerActivity.class);
rgbPlayerTab.setContent(rgbPlayerIntent);
tab.addTab(rgbPlayerTab);
}
use of android.widget.TabHost in project android_frameworks_base by ParanoidAndroid.
the class RenderSessionImpl method postInflateProcess.
/**
* Post process on a view hierachy that was just inflated.
* <p/>At the moment this only support TabHost: If {@link TabHost} is detected, look for the
* {@link TabWidget}, and the corresponding {@link FrameLayout} and make new tabs automatically
* based on the content of the {@link FrameLayout}.
* @param view the root view to process.
* @param projectCallback callback to the project.
*/
private void postInflateProcess(View view, IProjectCallback projectCallback) throws PostInflateException {
if (view instanceof TabHost) {
setupTabHost((TabHost) view, projectCallback);
} else if (view instanceof QuickContactBadge) {
QuickContactBadge badge = (QuickContactBadge) view;
badge.setImageToDefault();
} else if (view instanceof AdapterView<?>) {
// get the view ID.
int id = view.getId();
BridgeContext context = getContext();
// get a ResourceReference from the integer ID.
ResourceReference listRef = context.resolveId(id);
if (listRef != null) {
SessionParams params = getParams();
AdapterBinding binding = params.getAdapterBindings().get(listRef);
// if there was no adapter binding, trying to get it from the call back.
if (binding == null) {
binding = params.getProjectCallback().getAdapterBinding(listRef, context.getViewKey(view), view);
}
if (binding != null) {
if (view instanceof AbsListView) {
if ((binding.getFooterCount() > 0 || binding.getHeaderCount() > 0) && view instanceof ListView) {
ListView list = (ListView) view;
boolean skipCallbackParser = false;
int count = binding.getHeaderCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getHeaderAt(i), list, false, /*attachToRoot*/
skipCallbackParser);
if (pair.getFirst() != null) {
list.addHeaderView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
count = binding.getFooterCount();
for (int i = 0; i < count; i++) {
Pair<View, Boolean> pair = context.inflateView(binding.getFooterAt(i), list, false, /*attachToRoot*/
skipCallbackParser);
if (pair.getFirst() != null) {
list.addFooterView(pair.getFirst());
}
skipCallbackParser |= pair.getSecond();
}
}
if (view instanceof ExpandableListView) {
((ExpandableListView) view).setAdapter(new FakeExpandableAdapter(listRef, binding, params.getProjectCallback()));
} else {
((AbsListView) view).setAdapter(new FakeAdapter(listRef, binding, params.getProjectCallback()));
}
} else if (view instanceof AbsSpinner) {
((AbsSpinner) view).setAdapter(new FakeAdapter(listRef, binding, params.getProjectCallback()));
}
}
}
} else if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
final int count = group.getChildCount();
for (int c = 0; c < count; c++) {
View child = group.getChildAt(c);
postInflateProcess(child, projectCallback);
}
}
}
Aggregations