mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Hopefully fix some NPE crashes
This commit is contained in:
parent
5ef7154d5e
commit
2d55f282a8
@ -414,7 +414,8 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
|
|||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if (key.equals(context.getString(R.string.remotekeyboard_editing_only))) {
|
if (key.equals(context.getString(R.string.remotekeyboard_editing_only))) {
|
||||||
final boolean editingOnly = sharedPreferences.getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
final boolean editingOnly = sharedPreferences.getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
||||||
notifyKeyboardState(editingOnly ? RemoteKeyboardService.instance.visible : true);
|
final boolean visible = RemoteKeyboardService.instance != null && RemoteKeyboardService.instance.visible;
|
||||||
|
notifyKeyboardState(!editingOnly || visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,9 @@ class RunCommandControlsProviderService : ControlsProviderService() {
|
|||||||
private fun getAllCommandsList(): List<CommandEntryWithDevice> {
|
private fun getAllCommandsList(): List<CommandEntryWithDevice> {
|
||||||
val commandList = mutableListOf<CommandEntryWithDevice>()
|
val commandList = mutableListOf<CommandEntryWithDevice>()
|
||||||
|
|
||||||
for (device in BackgroundService.getInstance().devices.values) {
|
val service = BackgroundService.getInstance() ?: return commandList
|
||||||
|
|
||||||
|
for (device in service.devices.values) {
|
||||||
if (!device.isReachable) {
|
if (!device.isReachable) {
|
||||||
commandList.addAll(getSavedCommandsList(device))
|
commandList.addAll(getSavedCommandsList(device))
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user