Skip to content

Commit cb4572d

Browse files
author
David Graeff
committed
Improve connection add dialog. Switch more dialogs to material design. Use material design buttons whereever possible. Change group list: Add device preferences button. Fix empty list recognition. Do not show "Show all" entry in group list if no group is existing, show text hint instead.
1 parent bbfdb45 commit cb4572d

File tree

100 files changed

+1286
-1302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1286
-1302
lines changed

app/src/main/java/oly/netpowerctrl/anel/AnelPlugin.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ Credentials createDefaultCredentials(String MacAddress) {
120120
return di;
121121
}
122122

123-
@Override
124-
protected void checkReady() {
125-
if (pluginReady != null) pluginReady.onPluginReady(this, false);
126-
}
127-
128123
/**
129124
* Execute multiple port commands for one device (anel supports this as an extra command).
130125
*
@@ -397,7 +392,7 @@ public boolean isStarted() {
397392

398393
@Override
399394
public void requestData() {
400-
AnelSendUDPBroadcastJob.run(dataService);
395+
UDPSend.createBroadcast(dataService, "wer da?\r\n".getBytes(), UDPErrors.INQUERY_BROADCAST_REQUEST);
401396
}
402397

403398
@Override
@@ -543,7 +538,7 @@ public String getPluginID() {
543538

544539
@Override
545540
public String getLocalizedName() {
546-
return PLUGIN_ID;
541+
return App.getAppString(R.string.plugin_anel);
547542
}
548543

549544
public void checkDevicesReachabilityAfterNetworkChange() {

app/src/main/java/oly/netpowerctrl/anel/AnelReceiveSendHTTP.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ public void httpResponse(IOConnection ioConnection, boolean callback_success, St
4949
Credentials credentials = ioConnection.getCredentials();
5050
AnelPlugin anelPlugin = (AnelPlugin) credentials.getPlugin();
5151

52-
// The name is the second ";" separated entry of the response_message.
53-
credentials.setDeviceName(data[1].trim());
52+
// The name is the second ";"-separated entry of the response_message.
53+
// Only update device name if it is empty, we do not want to overwrite the name given by the user.
54+
if (credentials.deviceName.isEmpty())
55+
credentials.setDeviceName(data[1].trim());
56+
57+
// The order is important: First save the credentials, then save the connections, then save the executables.
58+
// Because: connections need the credentials object. Executables need the reachability information of the connections.
59+
5460
dataService.credentials.put(credentials);
5561
// data[10 + i].trim() credentials deviceUID
5662

app/src/main/java/oly/netpowerctrl/anel/AnelSendUDPBroadcastJob.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

app/src/main/java/oly/netpowerctrl/data/AbstractBasePlugin.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
import android.support.annotation.NonNull;
55
import android.support.annotation.Nullable;
66

7-
import java.lang.ref.WeakReference;
8-
import java.util.ArrayList;
9-
import java.util.List;
10-
117
import oly.netpowerctrl.devices.Credentials;
128
import oly.netpowerctrl.executables.Executable;
139
import oly.netpowerctrl.executables.onNameChangeResult;
@@ -21,27 +17,10 @@
2117
*/
2218
public abstract class AbstractBasePlugin {
2319
protected final DataService dataService;
24-
// Connections to the destination device. This is prioritized, the first reachable connection
25-
// is preferred before the second reachable etc.
26-
private final List<IOConnection> mIOConnections = new ArrayList<>();
27-
protected onPluginReady pluginReady = null;
28-
protected WeakReference<onPluginFinished> pluginFinished = new WeakReference<>(null);
29-
3020
protected AbstractBasePlugin(DataService dataService) {
3121
this.dataService = dataService;
3222
}
3323

34-
protected abstract void checkReady();
35-
36-
protected void registerReadyObserver(onPluginReady pluginReady) {
37-
this.pluginReady = pluginReady;
38-
checkReady();
39-
}
40-
41-
protected void registerFinishedObserver(onPluginFinished pluginFinished) {
42-
this.pluginFinished = new WeakReference<>(pluginFinished);
43-
}
44-
4524
public DataService getDataService() {
4625
return dataService;
4726
}

0 commit comments

Comments
 (0)