diff --git a/app/src/main/java/de/buttercookie/simbadroid/MainActivity.java b/app/src/main/java/de/buttercookie/simbadroid/MainActivity.java index c4ec285..67c49e0 100644 --- a/app/src/main/java/de/buttercookie/simbadroid/MainActivity.java +++ b/app/src/main/java/de/buttercookie/simbadroid/MainActivity.java @@ -9,6 +9,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.widget.Toast; @@ -60,6 +61,9 @@ protected void onCreate(Bundle savedInstanceState) { binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); binding.toggleService.setOnClickListener(v -> toggleSmbService()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + binding.toggleService.setAllowClickWhenDisabled(true); + } ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); @@ -108,9 +112,11 @@ private void updateButtonState(SmbService.Status status) { if (status.serviceRunning()) { button.setText(R.string.button_stop_server); button.setIcon(AppCompatResources.getDrawable(this, R.drawable.ic_stop)); + button.setEnabled(true); } else { button.setText(R.string.button_start_server); button.setIcon(AppCompatResources.getDrawable(this, R.drawable.ic_start)); + button.setEnabled(mBound && mService.isWifiAvailable()); } }