Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/UserInterface/SettingsActivity.java
Show All 38 Lines | 37 | public void onCreate(Bundle savedInstanceState) { | |||
---|---|---|---|---|---|
39 | 39 | | |||
40 | final PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(this); | 40 | final PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(this); | ||
41 | setPreferenceScreen(preferenceScreen); | 41 | setPreferenceScreen(preferenceScreen); | ||
42 | 42 | | |||
43 | if (getIntent().hasExtra("deviceId")) { | 43 | if (getIntent().hasExtra("deviceId")) { | ||
44 | deviceId = getIntent().getStringExtra("deviceId"); | 44 | deviceId = getIntent().getStringExtra("deviceId"); | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | BackgroundService.RunCommand(getApplicationContext(), new BackgroundService.InstanceCallback() { | 47 | BackgroundService.RunCommand(getApplicationContext(), service -> { | ||
48 | @Override | | |||
49 | public void onServiceStart(BackgroundService service) { | | |||
50 | final Device device = service.getDevice(deviceId); | 48 | final Device device = service.getDevice(deviceId); | ||
51 | if (device == null) { | 49 | if (device == null) { | ||
52 | SettingsActivity.this.runOnUiThread(new Runnable() { | 50 | SettingsActivity.this.runOnUiThread(SettingsActivity.this::finish); | ||
53 | @Override | | |||
54 | public void run() { | | |||
55 | SettingsActivity.this.finish(); | | |||
56 | } | | |||
57 | }); | | |||
58 | return; | 51 | return; | ||
59 | } | 52 | } | ||
60 | List<String> plugins = device.getSupportedPlugins(); | 53 | List<String> plugins = device.getSupportedPlugins(); | ||
61 | for (final String pluginKey : plugins) { | 54 | for (final String pluginKey : plugins) { | ||
62 | PluginPreference pref = new PluginPreference(SettingsActivity.this, pluginKey, device); | 55 | PluginPreference pref = new PluginPreference(SettingsActivity.this, pluginKey, device); | ||
63 | preferenceScreen.addPreference(pref); | 56 | preferenceScreen.addPreference(pref); | ||
64 | } | 57 | } | ||
65 | } | | |||
66 | }); | 58 | }); | ||
67 | } | 59 | } | ||
68 | 60 | | |||
69 | @Override | 61 | @Override | ||
70 | public boolean onOptionsItemSelected(MenuItem item) { | 62 | public boolean onOptionsItemSelected(MenuItem item) { | ||
71 | //ActionBar's back button | 63 | //ActionBar's back button | ||
72 | if (item.getItemId() == android.R.id.home) { | 64 | if (item.getItemId() == android.R.id.home) { | ||
73 | finish(); | 65 | finish(); | ||
Show All 19 Lines |