Removed exit button, made app always run on device start

This commit is contained in:
Felix Ableitner 2016-09-24 18:56:52 +09:00
parent 6d65b739c6
commit d1768ea8b4
5 changed files with 1 additions and 25 deletions

View file

@ -14,8 +14,4 @@
android:id="@+id/settings"
android:title="@string/settings" />
<item
android:id="@+id/exit"
android:title="@string/exit" />
</menu>

View file

@ -41,9 +41,6 @@
<!-- Menu item to share this app's apk -->
<string name="share_app">Share App</string>
<!-- Menu item to close app and stop service -->
<string name="exit">Exit</string>
<!-- ChatFragment -->
<!-- Hint text for the message EditText -->
@ -93,9 +90,6 @@
<!-- Preference title -->
<string name="scan_interval_seconds">Scan Interval (seconds)</string>
<!-- Preference title -->
<string name="start_on_boot">Start on Boot</string>
<!-- Preference title -->
<string name="notification_sounds">Notification Sounds</string>

View file

@ -12,10 +12,6 @@
android:key="user_status"
android:inputType="textCapSentences" />
<CheckBoxPreference
android:title="@string/start_on_boot"
android:key="start_on_boot" />
<CheckBoxPreference
android:title="@string/notification_sounds"
android:key="notification_sounds" />

View file

@ -110,14 +110,6 @@ class ContactsFragment extends ListFragment with OnClickListener {
case R.id.settings =>
startActivity(new Intent(getActivity, classOf[SettingsActivity]))
true
case R.id.exit =>
val pm = PreferenceManager.getDefaultSharedPreferences(getActivity)
if (!pm.getBoolean(MainActivity.PrefWasBluetoothEnabled, false))
BluetoothAdapter.getDefaultAdapter.disable()
getActivity.stopService(new Intent(getActivity, classOf[ChatService]))
getActivity.finish()
true
case _ =>
super.onOptionsItemSelected(item)
}

View file

@ -10,9 +10,7 @@ class BootReceiver extends BroadcastReceiver {
override def onReceive(context: Context, intent: Intent): Unit = {
val sp = PreferenceManager.getDefaultSharedPreferences(context)
if (sp.getBoolean("start_on_boot", false)) {
context.startService(new Intent(context, classOf[ChatService]))
}
context.startService(new Intent(context, classOf[ChatService]))
}
}