Differential D12229 Diff 32204 src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardPlugin.java
Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardPlugin.java
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | public boolean onCreate() { | |||
---|---|---|---|---|---|
116 | Log.d("RemoteKeyboardPlugin", "Creating for device " + device.getName()); | 116 | Log.d("RemoteKeyboardPlugin", "Creating for device " + device.getName()); | ||
117 | acquireInstances(); | 117 | acquireInstances(); | ||
118 | try { | 118 | try { | ||
119 | instances.add(this); | 119 | instances.add(this); | ||
120 | } finally { | 120 | } finally { | ||
121 | releaseInstances(); | 121 | releaseInstances(); | ||
122 | } | 122 | } | ||
123 | if (RemoteKeyboardService.instance != null) | 123 | if (RemoteKeyboardService.instance != null) | ||
124 | RemoteKeyboardService.instance.handler.post(new Runnable() { | 124 | RemoteKeyboardService.instance.handler.post(() -> RemoteKeyboardService.instance.updateInputView()); | ||
125 | @Override | | |||
126 | public void run() { | | |||
127 | RemoteKeyboardService.instance.updateInputView(); | | |||
128 | } | | |||
129 | }); | | |||
130 | return true; | 125 | return true; | ||
131 | } | 126 | } | ||
132 | 127 | | |||
133 | @Override | 128 | @Override | ||
134 | public void onDestroy() { | 129 | public void onDestroy() { | ||
135 | acquireInstances(); | 130 | acquireInstances(); | ||
136 | try { | 131 | try { | ||
137 | if (instances.contains(this)) { | 132 | if (instances.contains(this)) { | ||
138 | instances.remove(this); | 133 | instances.remove(this); | ||
139 | if (instances.size() < 1 && RemoteKeyboardService.instance != null) | 134 | if (instances.size() < 1 && RemoteKeyboardService.instance != null) | ||
140 | RemoteKeyboardService.instance.handler.post(new Runnable() { | 135 | RemoteKeyboardService.instance.handler.post(() -> RemoteKeyboardService.instance.updateInputView()); | ||
141 | @Override | | |||
142 | public void run() { | | |||
143 | RemoteKeyboardService.instance.updateInputView(); | | |||
144 | } | | |||
145 | }); | | |||
146 | } | 136 | } | ||
147 | } finally { | 137 | } finally { | ||
148 | releaseInstances(); | 138 | releaseInstances(); | ||
149 | } | 139 | } | ||
150 | 140 | | |||
151 | Log.d("RemoteKeyboardPlugin", "Destroying for device " + device.getName()); | 141 | Log.d("RemoteKeyboardPlugin", "Destroying for device " + device.getName()); | ||
152 | } | 142 | } | ||
153 | 143 | | |||
▲ Show 20 Lines • Show All 249 Lines • Show Last 20 Lines |