/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.springsource.greenhouse;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import com.springsource.greenhouse.R;
import com.springsource.greenhouse.events.EventsActivity;
import com.springsource.greenhouse.profile.ProfileActivity;
/**
* @author Roy Clarkson
*/
public class MainTabWidget extends TabActivity {
//***************************************
// Activity methods
//***************************************
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec tabSpec;
Intent intent;
// add events tab
intent = new Intent();
intent.setClass(this, EventsActivity.class);
tabSpec = tabHost.newTabSpec("events");
tabSpec.setIndicator("Events", res.getDrawable(R.drawable.ic_tab_events));
tabSpec.setContent(intent);
tabHost.addTab(tabSpec);
// add profile tab
intent = new Intent();
intent.setClass(this, ProfileActivity.class);
tabSpec = tabHost.newTabSpec("profile");
tabSpec.setIndicator("Profile", res.getDrawable(R.drawable.ic_tab_profile));
tabSpec.setContent(intent);
tabHost.addTab(tabSpec);
// add info tab
intent = new Intent();
intent.setClass(this, InfoActivity.class);
tabSpec = tabHost.newTabSpec("info");
tabSpec.setIndicator("Info", res.getDrawable(R.drawable.ic_tab_info));
tabSpec.setContent(intent);
tabHost.addTab(tabSpec);
}
}