Permalink
Browse files

removed tab layout, replaced with button list (for ease of component …

…dev)
  • Loading branch information...
1 parent 065a9a5 commit 874929e0e876e7c69442b7653e3779981b6095d0 @BBuchholz BBuchholz committed Oct 17, 2011
View
@@ -6,13 +6,12 @@
<application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name="com.nineworldsdeep.droidmuse.MainTabWidget"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
+ <activity android:name=".ButtonListActivity"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
</activity>
<activity android:name="com.nineworldsdeep.droidmuse.ClefActivity" />
<activity android:name="com.nineworldsdeep.droidmuse.guitar.GuitarActivity" />
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:background="#ffffff" >
+
+ <Button android:text="Clef"
+ android:id="@+id/ButtonClef"
+ android:layout_width="250px"
+ android:textSize="18px"
+ android:layout_height="55px" />
+
+ <Button android:text="Fretboard"
+ android:id="@+id/ButtonFrets"
+ android:layout_width="250px"
+ android:textSize="18px"
+ android:layout_height="55px" />
+
+ <Button android:text="Keyboard"
+ android:id="@+id/ButtonKeys"
+ android:layout_width="250px"
+ android:textSize="18px"
+ android:layout_height="55px" />
+
+</LinearLayout>
+
View
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<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">
- <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,68 @@
+/*
+ * This file is part of DroidMuse.
+ *
+ * DroidMuse is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DroidMuse is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DroidMuse. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.nineworldsdeep.droidmuse;
+
+import com.nineworldsdeep.droidmuse.guitar.GuitarActivity;
+import com.nineworldsdeep.droidmuse.keys.KeyboardActivity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+
+public class ButtonListActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.button_list);
+
+ Button clef = (Button) findViewById(R.id.ButtonClef);
+ clef.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+
+ Intent i = new Intent(v.getContext(), ClefActivity.class);
+ startActivity(i);
+ }
+ });
+
+ Button frets = (Button) findViewById(R.id.ButtonFrets);
+ frets.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+
+ Intent i = new Intent(v.getContext(), GuitarActivity.class);
+ startActivity(i);
+ }
+ });
+
+ Button keys = (Button) findViewById(R.id.ButtonKeys);
+ keys.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View v) {
+
+ Intent i = new Intent(v.getContext(), KeyboardActivity.class);
+ startActivity(i);
+ }
+ });
+ }
+}
@@ -19,13 +19,16 @@
package com.nineworldsdeep.droidmuse;
import android.app.Activity;
+import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.widget.TextView;
public class ClefActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+
TextView textview = new TextView(this);
textview.setText("This is the Treble and Bass Clef tab");
setContentView(textview);
@@ -1,76 +0,0 @@
-/*
- * This file is part of DroidMuse.
- *
- * DroidMuse is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * DroidMuse is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with DroidMuse. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.nineworldsdeep.droidmuse;
-
-import com.nineworldsdeep.droidmuse.R;
-import com.nineworldsdeep.droidmuse.guitar.GuitarActivity;
-import com.nineworldsdeep.droidmuse.keys.KeyboardActivity;
-
-import android.app.TabActivity;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.os.Bundle;
-import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-
-public class MainTabWidget extends TabActivity {
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- 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, ClefActivity.class);
-
- // Initialize a TabSpec for each tab and add it to the TabHost
- spec = tabHost.newTabSpec("clef").setIndicator("these").setContent(intent);
- tabHost.addTab(spec);
-
- // Do the same for the other tabs
- intent = new Intent().setClass(this, GuitarActivity.class);
- spec = tabHost.newTabSpec("guitar").setIndicator("will").setContent(intent);
- tabHost.addTab(spec);
-
- intent = new Intent().setClass(this, KeyboardActivity.class);
- spec = tabHost.newTabSpec("keyboard").setIndicator("go").setContent(intent);
- tabHost.addTab(spec);
-
-
- tabHost.setOnTabChangedListener(new OnTabChangeListener(){
-
- public void onTabChanged(String tabId) {
-
- if(tabId.equals("keyboard") || tabId.equals("clef")){
-
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
- }else if(tabId.equals("guitar")){
-
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- }
- }
-
-
- });
-
- tabHost.setCurrentTab(2);
- }
-}
@@ -28,6 +28,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
+import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
@@ -82,6 +83,9 @@ public void onRestoreInstanceState(Bundle sis){
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+
this._fretboard = new Fretboard(this);
setContentView(this._fretboard);
}
@@ -19,6 +19,7 @@
package com.nineworldsdeep.droidmuse.keys;
import android.app.Activity;
+import android.content.pm.ActivityInfo;
import android.os.Bundle;
public class KeyboardActivity extends Activity {
@@ -28,6 +29,9 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+
this._keyboard = new Keyboard(this);
setContentView(this._keyboard);
}

0 comments on commit 874929e

Please sign in to comment.