diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml index 565654745..a06f44831 100644 --- a/src/android/AndroidManifest.xml +++ b/src/android/AndroidManifest.xml @@ -2,7 +2,7 @@ - + @@ -18,6 +18,7 @@ + diff --git a/src/android/res/layout/search.xml b/src/android/res/layout/search.xml new file mode 100644 index 000000000..877e4636b --- /dev/null +++ b/src/android/res/layout/search.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/android/res/menu/default_menu.xml b/src/android/res/menu/default_menu.xml index 93251af18..ca7bdd2af 100644 --- a/src/android/res/menu/default_menu.xml +++ b/src/android/res/menu/default_menu.xml @@ -4,4 +4,5 @@ + diff --git a/src/android/res/values/strings.xml b/src/android/res/values/strings.xml index 206169a07..ea1c092de 100644 --- a/src/android/res/values/strings.xml +++ b/src/android/res/values/strings.xml @@ -21,4 +21,5 @@ Now playing 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 +Search diff --git a/src/android/src/doep/xml/Reader.java b/src/android/src/doep/xml/Reader.java index 411defd35..52c319a7b 100644 --- a/src/android/src/doep/xml/Reader.java +++ b/src/android/src/doep/xml/Reader.java @@ -37,11 +37,12 @@ public final class Reader extends ReaderNode { 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 @@ public final class Reader extends ReaderNode { //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;ithis.level+1){ - this.reader.currentNode.End(); + }else if( currentNode.level>this.level+1){ + currentNode.End(); } } //Log.v("doep::ReaderNode::ChildNode4","NOT FOUND "+name); @@ -78,14 +79,16 @@ public class ReaderNode { { 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; } + } diff --git a/src/android/src/doep/xml/WriterNode.java b/src/android/src/doep/xml/WriterNode.java index e2bf6c9f3..7b8931804 100644 --- a/src/android/src/doep/xml/WriterNode.java +++ b/src/android/src/doep/xml/WriterNode.java @@ -15,14 +15,14 @@ public class WriterNode { 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; } diff --git a/src/android/src/org/musikcube/Search.java b/src/android/src/org/musikcube/Search.java new file mode 100644 index 000000000..7f1898ee8 --- /dev/null +++ b/src/android/src/org/musikcube/Search.java @@ -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); + } + +} diff --git a/src/android/src/org/musikcube/core/TrackPlayer.java b/src/android/src/org/musikcube/core/TrackPlayer.java index d0181eff0..d11e05912 100644 --- a/src/android/src/org/musikcube/core/TrackPlayer.java +++ b/src/android/src/org/musikcube/core/TrackPlayer.java @@ -25,10 +25,10 @@ public class TrackPlayer implements Runnable, MediaPlayer.OnCompletionListener, 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 @@ public class TrackPlayer implements Runnable, MediaPlayer.OnCompletionListener, this.status = STATUS_EXIT; } }else{ - this.mediaPlayer.setDataSource(url); - this.mediaPlayer.prepare(); + mP.setDataSource(url); + mP.prepare(); } synchronized(this.lock){ @@ -62,7 +62,7 @@ public class TrackPlayer implements Runnable, MediaPlayer.OnCompletionListener, } if(currentStatus==STATUS_PLAYING) - this.mediaPlayer.start(); + mP.start(); synchronized(this.lock){ @@ -70,8 +70,8 @@ public class TrackPlayer implements Runnable, MediaPlayer.OnCompletionListener, 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 @@ public class TrackPlayer implements Runnable, MediaPlayer.OnCompletionListener, } - this.mediaPlayer.stop(); - this.mediaPlayer.release(); + mP.stop(); + mP.release(); synchronized(this.lock){ this.mediaPlayer = null; + mP = null; }