Browse Source

fixed some stuff

Alexander Brakowski 10 years ago
parent
commit
8638831da1

+ 6 - 3
res/values/strings_preferences.xml

@@ -17,12 +17,15 @@
 	<string name="pref_connection_settings">Connection Settings</string>
 	<string name="pref_max_connections">Max Connections</string>	
 	<string name="pref_max_connections_default">5</string>	
-	<string name="pref_timeout">SocketTimeout(in seconds)</string>	
+	<string name="pref_timeout">Socket Timeout</string>
+	<string name="pref_timeout_summary">Socket timeout in seconds</string>
 	<string name="pref_timeout_default">30</string>	
-	<string name="pref_sleeptime">Stream Sleeptime(in mseconds)</string>
+	<string name="pref_sleeptime">Stream sleep time</string>
+	<string name="pref_sleeptime_summary">Time in ms for the stream sleep time</string>
 	<string name="pref_sleeptime_default">500</string>
 	<string name="pref_location_settings">Location Settings</string>
-	<string name="pref_location_time">Time to get Location Data(in mseconds)</string>
+	<string name="pref_location_time">Location Data Timeout</string>
+	<string name="pref_location_time_summary">Timeout when requesting location data in ms</string>
 	<string name="pref_location_time_default">60000</string>
 	<string name="pref_location_retries">Retries</string>
 	<string name="pref_location_retries_default">3</string>

+ 4 - 1
res/xml/settings_preferences.xml

@@ -4,7 +4,7 @@
 	<CheckBoxPreference
 		android:defaultValue="false"
 	    android:key="pref_general_expert"
-	    android:summary="This will activate some expert functionalities."
+	    android:summary="This will activate expert functionalities"
 	    android:title="Expert Mode"/>
 
 
@@ -61,17 +61,20 @@
 				<EditTextPreference
 						android:key="pref_timeout"
 						android:defaultValue="@string/pref_timeout_default"
+						android:summary="@string/pref_timeout_summary"
 						android:title="@string/pref_timeout" />
 
 				<EditTextPreference
 						android:key="pref_sleeptime"
 						android:defaultValue="@string/pref_sleeptime_default"
+						android:summary="@string/pref_sleeptime_summary"
 						android:title="@string/pref_sleeptime" />
 			</PreferenceCategory>
 			<PreferenceCategory android:title="@string/pref_location_settings" >
 				<EditTextPreference
 						android:key="pref_location_time"
 						android:defaultValue="@string/pref_location_time_default"
+						android:summary="@string/pref_location_time_summary"
 						android:title="@string/pref_location_time" />
 
 				<EditTextPreference

+ 15 - 1
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -212,16 +212,30 @@ public class MainActivity extends Activity {
 	}
 
 	public void stopAndUnbind() {
-		unbindService();
+		if(mServiceBound){
+			unbindService();
+		}
+
 		stopService(getServiceIntent());
 	}
 
 	public void unbindService() {
 		unbindService(mConnection);
+		mServiceBound = false;
 	}
 
 	public void bindService() {
 		bindService(getServiceIntent(), mConnection, BIND_AUTO_CREATE);
+		mServiceBound = true;
+	}
+
+	@Override
+	protected void onDestroy() {
+		// Unbind running service
+		if(!mHoneyService.hasRunningListeners()){
+			stopAndUnbind();
+		}
+		super.onDestroy();
 	}
 
 	@Override