Added:
/trunk/src/android/res/layout/search.xml
/trunk/src/android/src/org/musikcube/Search.java
Modified:
/trunk/src/android/AndroidManifest.xml
/trunk/src/android/res/menu/default_menu.xml
/trunk/src/android/res/values/strings.xml
/trunk/src/android/src/doep/xml/Reader.java
/trunk/src/android/src/doep/xml/ReaderNode.java
/trunk/src/android/src/doep/xml/WriterNode.java
/trunk/src/android/src/org/musikcube/core/TrackPlayer.java
=======================================
--- /dev/null
+++ /trunk/src/android/res/layout/search.xml Sun Sep 13 14:48:00 2009
@@ -0,0 +1,35 @@
+<?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">
+ <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">
+ <TextView
+ android:id="@+id/tracks"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="Tracks" />
+ <TextView
+ android:id="@+id/artists"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="Artists" />
+ <TextView
+ android:id="@+id/albums"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="Albums" />
+ </FrameLayout>
+ </LinearLayout>
+</TabHost>
=======================================
--- /dev/null
+++ /trunk/src/android/src/org/musikcube/Search.java Sun Sep 13 14:48:00
2009
@@ -0,0 +1,24 @@
+package org.musikcube;
+
+import android.app.TabActivity;
+import android.os.Bundle;
+import android.widget.Button;
+import android.widget.TabHost;
+
+public class Search extends TabActivity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.search);
+
+ TabHost mTabHost = getTabHost();
+
+
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Tracks").setContent(R.id.tracks));
+
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Artists").setContent(R.id.artists));
+
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Albums").setContent(R.id.albums));
+
+ mTabHost.setCurrentTab(0);
+ }
+
+}
=======================================
--- /trunk/src/android/AndroidManifest.xml Mon Sep 7 22:06:38 2009
+++ /trunk/src/android/AndroidManifest.xml Sun Sep 13 14:48:00 2009
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.musikcube"
android:versionName="1.0.5" android:versionCode="5">
- <application android:icon="@drawable/icon"
android:label="@string/app_name" android:name="App"
android:debuggable="true">
+ <application android:icon="@drawable/icon"
android:label="@string/app_name" android:name="App"
android:debuggable="false">
<activity android:name=".main"
android:label="@string/app_name"
android:launchMode="singleTask" android:screenOrientation="portrait">
<intent-filter>
@@ -18,6 +18,7 @@
<activity android:name="NowPlayingList"
android:launchMode="singleTask"></activity>
<activity android:name="PlayerBPMControl" android:launchMode="singleTask"
android:screenOrientation="portrait"></activity>
<activity android:name="CategorySelect"
android:launchMode="singleTask"></activity>
+<activity android:name="Search"></activity>
</application>
<uses-sdk android:minSdkVersion="3" />
=======================================
--- /trunk/src/android/res/menu/default_menu.xml Sat Aug 29 14:20:13 2009
+++ /trunk/src/android/res/menu/default_menu.xml Sun Sep 13 14:48:00 2009
@@ -4,4 +4,5 @@
<item android:title="@string/menu_settings"
android:id="@+id/context_settings" android:enabled="true"
android:visible="true" android:icon="@drawable/ic_menu_preferences"></item>
<item android:id="@+id/context_nowplaying"
android:title="@string/menu_nowplaying"
android:icon="@drawable/ic_menu_nowplaying"></item>
<item android:id="@+id/context_help" android:title="@string/menu_help"
android:icon="@drawable/ic_menu_help"></item>
+<item android:id="@+id/context_search"
android:title="@string/menu_search"></item>
</menu>
=======================================
--- /trunk/src/android/res/values/strings.xml Mon Aug 31 03:00:07 2009
+++ /trunk/src/android/res/values/strings.xml Sun Sep 13 14:48:00 2009
@@ -21,4 +21,5 @@
<string name="menu_nowplaying">Now playing</string>
<string name="help_main">musikCube is a application that connects to your
musikServer that you have installed on your desktop/server computer. The
musikServer can be downloaded from
http://code.google.com/p/musikcube/\nOnce musikCube is connected you are
able to browse and play all your music directly on your phone without
having to copy them to you SD card.\n</string>
+<string name="menu_search">Search</string>
</resources>
=======================================
--- /trunk/src/android/src/doep/xml/Reader.java Sat Aug 29 14:20:13 2009
+++ /trunk/src/android/src/doep/xml/Reader.java Sun Sep 13 14:48:00 2009
@@ -37,11 +37,12 @@
throws Exception
{
int eventType = 0;
+ final XmlPullParser parser = this.parser;
if(this.firstParse){
this.firstParse = false;
- eventType = this.parser.getEventType();
+ eventType = parser.getEventType();
}else{
- eventType = this.parser.next();
+ eventType = parser.next();
}
// while (eventType != XmlPullParser.END_DOCUMENT) {
@@ -61,12 +62,12 @@
//Log.v("doep::Reader::Parse","Start tag "+this.parser.getName());
//System.out.println("Start tag "+xpp.getName());
// Start a new node
- ReaderNode node = new
ReaderNode(this.parser.getName(),this.nodeLevels.getLast());
+ ReaderNode node = new
ReaderNode(parser.getName(),this.nodeLevels.getLast());
// Get the attributes
- int attributes = this.parser.getAttributeCount();
+ int attributes = parser.getAttributeCount();
for(int i=0;i<attributes;i++){
-
node.attributes.put(this.parser.getAttributeName(i),this.parser.getAttributeValue(i));
+
node.attributes.put(parser.getAttributeName(i),parser.getAttributeValue(i));
}
// Add to the end of the levels
@@ -78,7 +79,7 @@
} else if(eventType == XmlPullParser.END_TAG) {
//Log.v("doep::Reader::Parse","End tag "+this.parser.getName());
//System.out.println("End tag "+xpp.getName());
- if(this.parser.getName().equals(this.currentNode.name)){
+ if(parser.getName().equals(this.currentNode.name)){
// End the node, and remove from levels
this.currentNode.ended = true;
this.nodeLevels.removeLast();
@@ -90,7 +91,7 @@
} else if(eventType == XmlPullParser.TEXT) {
//Log.v("doep::Reader::Parse","Text "+this.parser.getText());
//System.out.println("Text "+xpp.getText());
- this.currentNode.content += this.parser.getText();
+ this.currentNode.content += parser.getText();
}
// }
}
=======================================
--- /trunk/src/android/src/doep/xml/ReaderNode.java Sat Aug 29 14:20:13 2009
+++ /trunk/src/android/src/doep/xml/ReaderNode.java Sun Sep 13 14:48:00 2009
@@ -41,18 +41,19 @@
// Check if this is the current node, if not - lets wait for it to bee
while(!this.ended){
this.reader.Parse();
+ final ReaderNode currentNode = this.reader.currentNode;
//Log.v("doep::ReaderNode::ChildNode1","Node: "+this.reader.currentNode.level+" "+this.level);
- if(this.reader.currentNode.level==this.level+1){
+ if(currentNode.level==this.level+1){
// We have a childnode
//Log.v("doep::ReaderNode::ChildNode2",""+this.reader.currentNode.name+"=="+name);
- if(this.reader.currentNode.name.equals(name)){
+ if(currentNode.name.equals(name)){
//Log.v("doep::ReaderNode::ChildNode3","FOUND "+this.reader.currentNode.name);
- return this.reader.currentNode;
+ return currentNode;
}else{
- this.reader.currentNode.End();
- }
- }else if( this.reader.currentNode.level>this.level+1){
- this.reader.currentNode.End();
+ currentNode.End();
+ }
+ }else if( currentNode.level>this.level+1){
+ currentNode.End();
}
}
//Log.v("doep::ReaderNode::ChildNode4","NOT FOUND "+name);
@@ -78,14 +79,16 @@
{
while(!this.ended){
this.reader.Parse();
- if(this.reader.currentNode.level==this.level+1){
+ final ReaderNode currentNode = this.reader.currentNode;
+ if(currentNode.level==this.level+1){
// We have a childnode
- return this.reader.currentNode;
- }else if( this.reader.currentNode.level>this.level+1){
- this.reader.currentNode.End();
+ return currentNode;
+ }else if( currentNode.level>this.level+1){
+ currentNode.End();
}
}
return null;
}
+
}
=======================================
--- /trunk/src/android/src/doep/xml/WriterNode.java Sat Aug 29 14:20:13 2009
+++ /trunk/src/android/src/doep/xml/WriterNode.java Sun Sep 13 14:48:00 2009
@@ -15,14 +15,14 @@
protected WriterNode(String name,WriterNode parent){
this.name = name;
+ this.parent = parent;
if(parent!=null){
- this.parent = parent;
this.writer = parent.writer;
}
}
- public WriterNode ChildNode(String name){
- WriterNode newNode = new WriterNode(name,this);
+ public final WriterNode ChildNode(String name){
+ final WriterNode newNode = new WriterNode(name,this);
this.children.add(newNode);
return newNode;
}
=======================================
--- /trunk/src/android/src/org/musikcube/core/TrackPlayer.java Mon Aug 31
03:00:07 2009
+++ /trunk/src/android/src/org/musikcube/core/TrackPlayer.java Sun Sep 13
14:48:00 2009
@@ -25,10 +25,10 @@
this.mediaPlayer = new MediaPlayer();
}
try {
-
- this.mediaPlayer.setOnCompletionListener(this);
- this.mediaPlayer.setOnErrorListener(this);
- this.mediaPlayer.setOnBufferingUpdateListener(this);
+ MediaPlayer mP = this.mediaPlayer;
+ mP.setOnCompletionListener(this);
+ mP.setOnErrorListener(this);
+ mP.setOnBufferingUpdateListener(this);
String url = Library.GetInstance().GetTrackURL(this.trackId);
synchronized(this.lock){
@@ -43,8 +43,8 @@
this.status = STATUS_EXIT;
}
}else{
- this.mediaPlayer.setDataSource(url);
- this.mediaPlayer.prepare();
+ mP.setDataSource(url);
+ mP.prepare();
}
synchronized(this.lock){
@@ -62,7 +62,7 @@
}
if(currentStatus==STATUS_PLAYING)
- this.mediaPlayer.start();
+ mP.start();
synchronized(this.lock){
@@ -70,8 +70,8 @@
while(this.status==STATUS_PLAYING){
if(!this.almostDoneSend){
- int duration = this.mediaPlayer.getDuration();
- int position = this.mediaPlayer.getCurrentPosition();
+ int duration = mP.getDuration();
+ int position = mP.getCurrentPosition();
if(duration>0 && position+10000>duration){
// The track is almost done
this.almostDoneSend = true;
@@ -87,10 +87,11 @@
}
- this.mediaPlayer.stop();
- this.mediaPlayer.release();
+ mP.stop();
+ mP.release();
synchronized(this.lock){
this.mediaPlayer = null;
+ mP = null;
}