Permalink
Browse files

Initial tab layout complete

  • Loading branch information...
1 parent 7fec29c commit 4f6943b77f0a027b4fc23253b314c064064d444b @axelson axelson committed Dec 6, 2011
View
@@ -13,6 +13,9 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name=".ConferenceActivity"></activity>
+ <activity android:name=".CommunityActivity"></activity>
+ <activity android:name=".SongsActivity"></activity>
</application>
</manifest>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- When selected, use grey -->
+ <item android:drawable="@drawable/calendar"
+ android:state_selected="true" />
+ <!-- When not selected, use white-->
+ <item android:drawable="@drawable/ic_tab_artists_grey" />
+</selector>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- When selected, use grey -->
+ <item android:drawable="@drawable/calendar"
+ android:state_selected="true" />
+ <!-- When not selected, use white-->
+ <item android:drawable="@drawable/calendar" />
+</selector>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- When selected, use grey -->
+ <item android:drawable="@drawable/calendar"
+ android:state_selected="true" />
+ <!-- When not selected, use white-->
+ <item android:drawable="@drawable/calendar" />
+</selector>
View
@@ -1,12 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/tabhost"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
- />
-</LinearLayout>
+ android:layout_height="fill_parent">
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="5dp">
+ <TabWidget
+ android:id="@android:id/tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" />
+ <FrameLayout
+ android:id="@android:id/tabcontent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:padding="5dp" />
+ </LinearLayout>
+
+</TabHost>
+
@@ -0,0 +1,19 @@
+package org.hicapacity.techhui;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+/**
+ * @author Jason Axelson
+ *
+ */
+public class CommunityActivity extends Activity {
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ TextView textview = new TextView(this);
+ textview.setText("This is the community tab");
+ setContentView(textview);
+ }
+}
@@ -0,0 +1,19 @@
+package org.hicapacity.techhui;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+/**
+ * @author Jason Axelson
+ *
+ */
+public class ConferenceActivity extends Activity {
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ TextView textview = new TextView(this);
+ textview.setText("This is the conference tab");
+ setContentView(textview);
+ }
+}
@@ -0,0 +1,19 @@
+package org.hicapacity.techhui;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+
+/**
+ * @author Jason Axelson
+ *
+ */
+public class SongsActivity extends Activity {
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ TextView textview = new TextView(this);
+ textview.setText("This is the community tab");
+ setContentView(textview);
+ }
+}
@@ -1,13 +1,43 @@
package org.hicapacity.techhui;
-import android.app.Activity;
+import android.app.TabActivity;
+import android.content.Intent;
+import android.content.res.Resources;
import android.os.Bundle;
+import android.widget.TabHost;
-public class TechHuiActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
+public class TechHuiActivity extends TabActivity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ Resources res = getResources(); // Resource object to get Drawables
+ TabHost tabHost = getTabHost(); // The activity TabHost
+ TabHost.TabSpec spec; // Resusable TabSpec for each tab
+ Intent intent; // Reusable Intent for each tab
+
+ // Create an Intent to launch an Activity for the tab (to be reused)
+ intent = new Intent().setClass(this, ConferenceActivity.class);
+
+ // Initialize a TabSpec for each tab and add it to the TabHost
+ spec = tabHost.newTabSpec("artists")
+ .setIndicator("Artists", res.getDrawable(R.drawable.calendar))
+ .setContent(intent);
+ tabHost.addTab(spec);
+
+ // Do the same for the other tabs
+ intent = new Intent().setClass(this, CommunityActivity.class);
+ spec = tabHost.newTabSpec("albums")
+ .setIndicator("Albums", res.getDrawable(R.drawable.calendar)).setContent(intent);
+ tabHost.addTab(spec);
+
+ intent = new Intent().setClass(this, SongsActivity.class);
+ spec = tabHost.newTabSpec("songs")
+ .setIndicator("Songs", res.getDrawable(R.drawable.ic_tab_conference)).setContent(intent);
+ tabHost.addTab(spec);
+
+ tabHost.setCurrentTab(2);
+ }
}

0 comments on commit 4f6943b

Please sign in to comment.