mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Not not display useless menu items when device is not connected
Also remove "fetch activity data" from pebble context menu, which currently does nothing Closes #75
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package nodomain.freeyourgadget.gadgetbridge;
|
package nodomain.freeyourgadget.gadgetbridge;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
@@ -170,8 +169,17 @@ public class ControlCenter extends Activity {
|
|||||||
// no context menu when device is busy
|
// no context menu when device is busy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getMenuInflater().inflate(
|
getMenuInflater().inflate(R.menu.controlcenter_context, menu);
|
||||||
R.menu.controlcenter_context, menu);
|
|
||||||
|
if (!selectedDevice.isConnected() || selectedDevice.getType() == DeviceType.PEBBLE) {
|
||||||
|
menu.removeItem(R.id.controlcenter_fetch_activity_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedDevice.isConnected()) {
|
||||||
|
menu.removeItem(R.id.controlcenter_disconnect);
|
||||||
|
menu.removeItem(R.id.controlcenter_find_device);
|
||||||
|
}
|
||||||
|
|
||||||
menu.setHeaderTitle(selectedDevice.getName());
|
menu.setHeaderTitle(selectedDevice.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +220,7 @@ public class ControlCenter extends Activity {
|
|||||||
new DialogInterface.OnCancelListener() {
|
new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
findDevice(false);
|
findDevice(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user