App switch crash fix and Settings Listener case update

-Fixed error where unregisterReceiver would crash app if no BroadcastReceiver was registered
-Update settings UI
This commit is contained in:
Toby Woerthle 2018-01-19 22:49:48 -05:00
parent 3e09483564
commit 001b25dae4
3 changed files with 27 additions and 13 deletions

View File

@ -123,8 +123,13 @@ public class MainActivity extends AppCompatActivity
@Override
protected void onStop() {
super.onStop();
unregisterReceiver(updateUIReceiver);
unbindService(mConnection);
try {unregisterReceiver(updateUIReceiver);
unbindService(mConnection);
}
catch(IllegalArgumentException e) {
System.out.println(e);
}
}
@Override

View File

@ -43,11 +43,20 @@ public class SettingsFragment extends PreferenceFragment implements SharedPrefer
case "pref_key_switch_testnet":
Toast.makeText(getActivity(), "Testnet on/off Changed", Toast.LENGTH_SHORT).show();
break;
case "edit_text_sell_price":
Toast.makeText(getActivity(), "Hotspot Sell Price Changed", Toast.LENGTH_SHORT).show();
break;
case "edit_text_sell_min_minutes":
Toast.makeText(getActivity(), "Hotspot Min sell duration changed", Toast.LENGTH_SHORT).show();
break;
case "edit_text_sell_max_minutes":
Toast.makeText(getActivity(), "Hotspot Max sell duration changed", Toast.LENGTH_SHORT).show();
break;
case "edit_text_buy_price":
Toast.makeText(getActivity(), "Buy Price Changed", Toast.LENGTH_SHORT).show();
break;
case "edit_text_sell_price":
Toast.makeText(getActivity(), "Sell Price Changed", Toast.LENGTH_SHORT).show();
case "edit_text_client_minutes":
Toast.makeText(getActivity(), "Client duration duration changed", Toast.LENGTH_SHORT).show();
break;
}
}

View File

@ -18,7 +18,7 @@
android:divider="@null"
android:dividerHeight="0dp"
android:key="pref_key_reset_data_usage"
android:title="Reset Data Usage"/>
android:title="Reset data usage"/>
</PreferenceCategory>
@ -32,7 +32,7 @@
android:key="pref_key_network_timeout"
android:entries="@array/networkTimeoutPref"
android:entryValues="@array/networkTimeoutPref"
android:title="Network Timeout" />
android:title="Network timeout" />
<ListPreference
android:key="pref_key_units"
@ -65,23 +65,23 @@
android:inputType="number"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Sell Price" />
android:title="Sell price" />
<EditTextPreference
android:defaultValue="15"
android:key="edit_text_min_minutes"
android:inputType="number"
android:key="edit_text_sell_min_minutes"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Minimum selling durance [minutes]" />
android:title="Minimum sell duration (minutes)" />
<EditTextPreference
android:defaultValue="100"
android:key="edit_text_max_minutes"
android:key="edit_text_sell_max_minutes"
android:inputType="number"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Maximum selling durance [minutes]" />
android:title="Maximum sell duration (minutes)" />
</PreferenceCategory>
@ -96,7 +96,7 @@
android:inputType="number"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Max Buy Price" />
android:title="Max buy price" />
<EditTextPreference
android:defaultValue="60"
@ -104,7 +104,7 @@
android:inputType="number"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="Client roaming durance" />
android:title="Client roaming duration" />
</PreferenceCategory>