[musikcube] r393 committed - Bugfixing

0 views
Skip to first unread message

codesite...@google.com

unread,
Sep 8, 2009, 1:07:46 AM9/8/09
to musikc...@googlegroups.com
Revision: 393
Author: onnerby
Date: Mon Sep 7 22:06:38 2009
Log: Bugfixing
http://code.google.com/p/musikcube/source/detail?r=393

Modified:
/trunk/src/android/AndroidManifest.xml
/trunk/src/android/src/org/musikcube/Service.java
/trunk/src/android/src/org/musikcube/core/Library.java

=======================================
--- /trunk/src/android/AndroidManifest.xml Mon Aug 31 08:24:18 2009
+++ /trunk/src/android/AndroidManifest.xml Mon Sep 7 22:06:38 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="false">
+ <application android:icon="@drawable/icon"
android:label="@string/app_name" android:name="App"
android:debuggable="true">
<activity android:name=".main"
android:label="@string/app_name"
android:launchMode="singleTask" android:screenOrientation="portrait">
<intent-filter>
=======================================
--- /trunk/src/android/src/org/musikcube/Service.java Mon Aug 31 03:00:07
2009
+++ /trunk/src/android/src/org/musikcube/Service.java Mon Sep 7 22:06:38
2009
@@ -78,10 +78,12 @@
// TODO Auto-generated method stub
super.onStart(intent, startId);

+
boolean stopWorkout = false;

String action = intent.getStringExtra("org.musikcube.Service.action");
if(action==null){
+ this.library.Startup(this);
return;
}
if(action.equals("playlist")){
=======================================
--- /trunk/src/android/src/org/musikcube/core/Library.java Sat Aug 29
14:20:13 2009
+++ /trunk/src/android/src/org/musikcube/core/Library.java Mon Sep 7
22:06:38 2009
@@ -10,6 +10,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
+import android.util.Log;
import doep.xml.*;

import org.musikcube.core.IQuery;
@@ -30,7 +31,7 @@
private Thread thread;
private boolean running = false;
private boolean restart = false;
- private boolean exit = false;
+ private boolean exit = true;
private Socket socket;

private Context context;
@@ -78,7 +79,7 @@

private final void SetStatus(int status){
synchronized(this.status){
- //Log.v("mC2::Lib","STATUS "+this.status);
+ Log.v("mC2::Lib","STATUS "+this.status);
this.status = status;
if(this.statusListener!=null){
this.statusListener.OnLibraryStatusChange(status);
@@ -128,18 +129,23 @@


public final void Startup(Context context){
- this.context = context;
-
- // Startup thread when the application sends the context for the first
time
- this.thread = new Thread(this);
- this.running = true;
- this.thread.start();
+ synchronized(this.notifier){
+ if(this.exit){
+ this.exit = false;
+ this.context = context;
+ // Startup thread when the application sends the context for the first
time
+ this.thread = new Thread(this);
+ this.running = true;
+ this.thread.start();
+ }
+ }
}

public final void Restart(){
synchronized(this.notifier){
this.running = false;
this.restart = true;
+
if(this.socket!=null){
try {
this.socket.shutdownInput();
@@ -200,7 +206,7 @@
this.SetStatus(STATUS_SHUTDOWN);

while(true){
- //Log.v("mC2::Lib","1");
+ Log.v("mC2::Lib","1");

this.running = true;
// First try to connect
@@ -310,7 +316,7 @@

}

- //Log.v("mC2::Lib","4");
+ Log.v("mC2::Lib","4");

synchronized (notifier) {
if(!this.restart){
@@ -323,10 +329,10 @@
}
this.restart = false;

- //Log.v("mC2::Lib","5");
+ Log.v("mC2::Lib","5");

if(this.exit){
- //Log.v("mC2::Lib","EXIT");
+ Log.v("mC2::Lib","EXIT");
Intent intent = new Intent(this.context, org.musikcube.Service.class);
intent.putExtra("org.musikcube.Service.action", "shutdown");
this.context.startService(intent);
@@ -334,7 +340,7 @@
}
this.restart = false;
// this.running = true;
- //Log.v("mC2::Lib","6");
+ Log.v("mC2::Lib","6");
}

}
@@ -378,7 +384,7 @@
}
}

- //Log.v("Library::WriteThread","wait over");
+ Log.v("Library::WriteThread","wait over");
}else{
// Get the first query
query = this.sendQueryQueue.removeFirst();
@@ -423,7 +429,7 @@
//Log.e("Library::WriteThread","E "+x.getMessage());
}

- //Log.v("Library::WriteThread","Ended");
+ Log.v("Library::WriteThread","Ended");
}

public final void Exit(){
@@ -450,6 +456,12 @@
//Log.e("Library::Disconnect","Exception error "+x.getMessage());
}
}
+
+ public final boolean Exited(){
+ synchronized(this.notifier){
+ return this.exit;
+ }
+ }

public final void AddQuery(IQuery query){
synchronized(this.sendQueryQueue){

Reply all
Reply to author
Forward
0 new messages