Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial tab layout complete

  • Loading branch information...
commit 4f6943b77f0a027b4fc23253b314c064064d444b 1 parent 7fec29c
@axelson axelson authored
View
3  AndroidManifest.xml
@@ -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>
View
BIN  res/drawable-hdpi/calendar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-hdpi/ic_tab_artists_grey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-hdpi/ic_tab_artists_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 res/drawable-hdpi/ic_tab_conference.xml
@@ -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>
View
BIN  res/drawable-ldpi/calendar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-ldpi/ic_tab_artists_grey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-ldpi/ic_tab_artists_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 res/drawable-ldpi/ic_tab_conference.xml
@@ -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
BIN  res/drawable-mdpi/calendar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-mdpi/ic_tab_artists_grey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-mdpi/ic_tab_artists_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 res/drawable-mdpi/ic_tab_conference.xml
@@ -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
31 res/layout/main.xml
@@ -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>
+
View
19 src/org/hicapacity/techhui/CommunityActivity.java
@@ -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);
+ }
+}
View
19 src/org/hicapacity/techhui/ConferenceActivity.java
@@ -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);
+ }
+}
View
19 src/org/hicapacity/techhui/SongsActivity.java
@@ -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);
+ }
+}
View
46 src/org/hicapacity/techhui/TechHuiActivity.java
@@ -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);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.