Skip to content
Snippets Groups Projects
Commit 875e08a5 authored by Sebastian Kürten's avatar Sebastian Kürten
Browse files

HotspotFragment: move button state handling

parent 8952ec8a
No related branches found
No related tags found
1 merge request!6ViewModel cleanup
...@@ -77,9 +77,6 @@ public class HotspotFragment extends Fragment { ...@@ -77,9 +77,6 @@ public class HotspotFragment extends Fragment {
qrCode.setVisibility(GONE); qrCode.setVisibility(GONE);
ssidView.setText(""); ssidView.setText("");
passwordView.setText(""); passwordView.setText("");
button.setText(R.string.start_hotspot);
button.setEnabled(true);
hotspotStarted = false;
} else { } else {
String qrCodeText = createWifiLoginString(config.ssid, String qrCodeText = createWifiLoginString(config.ssid,
config.password, config.hidden); config.password, config.hidden);
...@@ -95,9 +92,6 @@ public class HotspotFragment extends Fragment { ...@@ -95,9 +92,6 @@ public class HotspotFragment extends Fragment {
ssidView.setText(getString(R.string.ssid, config.ssid)); ssidView.setText(getString(R.string.ssid, config.ssid));
passwordView.setText( passwordView.setText(
getString(R.string.password, config.password)); getString(R.string.password, config.password));
button.setText(R.string.stop_hotspot);
button.setEnabled(true);
hotspotStarted = true;
} }
}); });
...@@ -149,7 +143,15 @@ public class HotspotFragment extends Fragment { ...@@ -149,7 +143,15 @@ public class HotspotFragment extends Fragment {
statusView.setText( statusView.setText(
getString(R.string.starting_hotspot)); getString(R.string.starting_hotspot));
break; break;
case WAITING_TO_START_HOTSPOT:
statusView.setText(
getString(R.string.callback_waiting));
break;
case HOTSPOT_STARTED: case HOTSPOT_STARTED:
button.setText(R.string.stop_hotspot);
button.setEnabled(true);
hotspotStarted = true;
LiveData<Double> frequency = viewModel LiveData<Double> frequency = viewModel
.getHotSpotManager().getFrequency(); .getHotSpotManager().getFrequency();
if (frequency.getValue() != null) { if (frequency.getValue() != null) {
...@@ -161,11 +163,11 @@ public class HotspotFragment extends Fragment { ...@@ -161,11 +163,11 @@ public class HotspotFragment extends Fragment {
R.string.callback_started_freq, freq)); R.string.callback_started_freq, freq));
} }
break; break;
case WAITING_TO_START_HOTSPOT:
statusView.setText(
getString(R.string.callback_waiting));
break;
case HOTSPOT_STOPPED: case HOTSPOT_STOPPED:
button.setText(R.string.start_hotspot);
button.setEnabled(true);
hotspotStarted = false;
statusView.setText( statusView.setText(
getString(R.string.hotspot_stopped)); getString(R.string.hotspot_stopped));
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment