Skip to content

Commit 9de0a62

Browse files
author
David Gräff
committed
New theme elements. Improved animations. Bugs fixed: Crash on rotation; wrong computed span elements in grid view.
Open bug counter in preferences.
1 parent 610ce55 commit 9de0a62

File tree

198 files changed

+2805
-2007
lines changed

Some content is hidden

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

198 files changed

+2805
-2007
lines changed

.idea/workspace.xml

Lines changed: 593 additions & 1048 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.iml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,37 +56,19 @@
5656
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
5757
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
5858
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
59-
<excludeFolder url="file://$MODULE_DIR$/build/apk" />
60-
<excludeFolder url="file://$MODULE_DIR$/build/assets" />
61-
<excludeFolder url="file://$MODULE_DIR$/build/classes" />
62-
<excludeFolder url="file://$MODULE_DIR$/build/classes-proguard" />
63-
<excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
64-
<excludeFolder url="file://$MODULE_DIR$/build/dex" />
65-
<excludeFolder url="file://$MODULE_DIR$/build/exploded-aar" />
66-
<excludeFolder url="file://$MODULE_DIR$/build/incremental" />
6759
<excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
68-
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
69-
<excludeFolder url="file://$MODULE_DIR$/build/lint-results-release-fatal_files" />
70-
<excludeFolder url="file://$MODULE_DIR$/build/manifests" />
71-
<excludeFolder url="file://$MODULE_DIR$/build/ndk" />
7260
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
73-
<excludeFolder url="file://$MODULE_DIR$/build/pre-dexed" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/proguard" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/res" />
76-
<excludeFolder url="file://$MODULE_DIR$/build/rs" />
77-
<excludeFolder url="file://$MODULE_DIR$/build/source" />
78-
<excludeFolder url="file://$MODULE_DIR$/build/symbols" />
7961
</content>
80-
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
62+
<orderEntry type="jdk" jdkName="Android API 20 Platform" jdkType="Android SDK" />
8163
<orderEntry type="sourceFolder" forTests="false" />
8264
<orderEntry type="library" exported="" name="support-annotations-21.0.0-rc1" level="project" />
8365
<orderEntry type="library" exported="" name="play-services-4.4.52" level="project" />
8466
<orderEntry type="library" exported="" name="support-v4-21.0.0-rc1" level="project" />
8567
<orderEntry type="library" exported="" name="library-0.9.9" level="project" />
8668
<orderEntry type="library" exported="" name="library-0.4.0" level="project" />
8769
<orderEntry type="library" exported="" name="support-v13-21.0.0-rc1" level="project" />
88-
<orderEntry type="library" exported="" name="ckchangelog-1.2.0" level="project" />
8970
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
71+
<orderEntry type="library" exported="" name="library-1.5.1" level="project" />
9072
</component>
9173
</module>
9274

app/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 19
4+
compileSdkVersion 20
55
buildToolsVersion '20'
66

77
defaultConfig {
88
minSdkVersion 14
9-
targetSdkVersion 19
10-
versionCode 67
11-
versionName "5.3"
9+
targetSdkVersion 20
10+
versionCode 72
11+
versionName "5.5.3"
1212
}
1313

1414
lintOptions {
@@ -38,9 +38,8 @@ android {
3838
dependencies {
3939
//compile fileTree(dir: 'libs', include: ['*.jar'])
4040
compile 'com.google.android.gms:play-services:4.+'
41-
41+
compile 'com.github.gabrielemariotti.changeloglib:library:1.5.1'
4242
compile 'ch.acra:acra:4+'
4343
compile 'com.android.support:support-v13:+'
44-
compile 'de.cketti.library.changelog:ckchangelog:1.2+'
4544
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9+'
4645
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.util.Set;
1313

1414
import oly.netpowerctrl.application_state.NetpowerctrlApplication;
15-
import oly.netpowerctrl.application_state.NetpowerctrlService;
1615
import oly.netpowerctrl.application_state.PluginInterface;
1716
import oly.netpowerctrl.devices.Device;
1817
import oly.netpowerctrl.devices.DeviceConnection;
@@ -77,13 +76,11 @@ public void process(UDPSending UDPSending) {
7776
// Toast.LENGTH_SHORT).show();
7877

7978
// Query all existing anel devices directly
80-
NetpowerctrlService service = NetpowerctrlService.getService();
81-
if (service == null)
82-
return;
79+
8380
List<Device> devices = NetpowerctrlApplication.getDataController().deviceCollection.devices;
8481
for (Device device : devices) {
8582
if (device.pluginID.equals(AnelPlugin.PLUGIN_ID)) {
86-
PluginInterface i = device.getPluginInterface(service);
83+
PluginInterface i = device.getPluginInterface();
8784
for (DeviceConnection ci : device.DeviceConnections) {
8885
i.requestData(ci);
8986
}

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

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.app.Activity;
44
import android.app.AlertDialog;
5-
import android.app.Fragment;
65
import android.app.FragmentTransaction;
76
import android.content.DialogInterface;
87
import android.os.Bundle;
@@ -22,7 +21,6 @@
2221

2322
import oly.netpowerctrl.R;
2423
import oly.netpowerctrl.application_state.NetpowerctrlApplication;
25-
import oly.netpowerctrl.application_state.NetpowerctrlService;
2624
import oly.netpowerctrl.application_state.PluginInterface;
2725
import oly.netpowerctrl.device_ports.DevicePort;
2826
import oly.netpowerctrl.devices.Device;
@@ -33,6 +31,7 @@
3331
import oly.netpowerctrl.network.DeviceObserverResult;
3432
import oly.netpowerctrl.network.DeviceQuery;
3533
import oly.netpowerctrl.network.DeviceUpdate;
34+
import oly.netpowerctrl.preferences.SharedPrefs;
3635
import oly.netpowerctrl.utils.DoneCancelFragmentHelper;
3736

3837
public class AnelDevicePreferences extends PreferenceFragment implements DeviceObserverResult, DeviceUpdate {
@@ -137,7 +136,44 @@ public boolean onPreferenceChange(Preference preference, Object o) {
137136
}
138137
});
139138

140-
// update_connections();
139+
p = m.findPreference("connections_http_new");
140+
p.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
141+
@Override
142+
public boolean onPreferenceClick(Preference preference) {
143+
String host = "";
144+
145+
if (device.DeviceConnections.size() > 0)
146+
host = device.DeviceConnections.get(0).getDestinationHost();
147+
DeviceConnection deviceConnection = new DeviceConnectionHTTP(device, host, 80);
148+
DeviceConnectionPreferences fragment = new DeviceConnectionPreferences();
149+
fragment.setDeviceConnection(deviceConnection, device, true);
150+
151+
//noinspection ConstantConditions
152+
getFragmentManager().beginTransaction().addToBackStack(null).
153+
setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).
154+
replace(R.id.content_frame, fragment).commit();
155+
return true;
156+
}
157+
});
158+
p = m.findPreference("connections_udp_new");
159+
p.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
160+
@Override
161+
public boolean onPreferenceClick(Preference preference) {
162+
String host = "";
163+
if (device.DeviceConnections.size() > 0)
164+
host = device.DeviceConnections.get(0).getDestinationHost();
165+
DeviceConnection deviceConnection = new DeviceConnectionUDP(device, host,
166+
SharedPrefs.getDefaultReceivePort(), SharedPrefs.getDefaultSendPort());
167+
DeviceConnectionPreferences fragment = new DeviceConnectionPreferences();
168+
fragment.setDeviceConnection(deviceConnection, device, true);
169+
170+
//noinspection ConstantConditions
171+
getFragmentManager().beginTransaction().addToBackStack(null).
172+
setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).
173+
replace(R.id.content_frame, fragment).commit();
174+
return true;
175+
}
176+
});
141177
}
142178

143179
@Override
@@ -154,13 +190,13 @@ private void update_connections() {
154190

155191
for (int i = pc_http.getPreferenceCount() - 1; i >= 0; --i) {
156192
Preference s = pc_http.getPreference(i);
157-
if (s instanceof PreferenceScreen) {
193+
if (!s.getKey().equals("connections_http_new")) {
158194
pc_http.removePreference(s);
159195
}
160196
}
161197
for (int i = pc_udp.getPreferenceCount() - 1; i >= 0; --i) {
162198
Preference s = pc_udp.getPreference(i);
163-
if (s instanceof PreferenceScreen) {
199+
if (!s.getKey().equals("connections_udp_new")) {
164200
pc_udp.removePreference(s);
165201
}
166202
}
@@ -184,9 +220,13 @@ private void update_connections() {
184220
s.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
185221
@Override
186222
public boolean onPreferenceClick(Preference preference) {
187-
Fragment fragment = Fragment.instantiate(getActivity(),
188-
DeviceConnectionPreferences.class.getName());
189-
((DeviceConnectionPreferences) fragment).setDeviceConnection(deviceConnection);
223+
// Fragment fragment = Fragment.instantiate(getActivity(),
224+
// DeviceConnectionPreferences.class.getName());
225+
// ((DeviceConnectionPreferences) fragment).setDeviceConnection(deviceConnection);
226+
227+
DeviceConnectionPreferences fragment = new DeviceConnectionPreferences();
228+
fragment.setDeviceConnection(deviceConnection, device, false);
229+
190230
//noinspection ConstantConditions
191231
getFragmentManager().beginTransaction().addToBackStack(null).
192232
setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).
@@ -223,9 +263,12 @@ private void testDevice() {
223263

224264
test_state = TestStates.TEST_REACHABLE;
225265

226-
PluginInterface pi = device.getPluginInterface(NetpowerctrlService.getService());
227-
assert pi != null;
228-
pi.enterFullNetworkState(device);
266+
PluginInterface pluginInterface = device.getPluginInterface();
267+
if (pluginInterface == null) {
268+
Toast.makeText(getActivity(), R.string.error_plugin_not_installed, Toast.LENGTH_SHORT).show();
269+
return;
270+
}
271+
pluginInterface.enterFullNetworkState(device);
229272

230273
deviceQuery = new DeviceQuery(this, device);
231274
}
@@ -260,9 +303,10 @@ public void onClick(DialogInterface dialog, int whichButton) {
260303
}
261304

262305
private void saveAndFinish() {
263-
PluginInterface pi = device.getPluginInterface(NetpowerctrlService.getService());
264-
assert pi != null;
265-
pi.enterFullNetworkState(device);
306+
PluginInterface pluginInterface = device.getPluginInterface();
307+
if (pluginInterface != null) {
308+
pluginInterface.enterFullNetworkState(device);
309+
}
266310

267311
NetpowerctrlApplication.getDataController().addToConfiguredDevices(device);
268312
//noinspection ConstantConditions
@@ -288,7 +332,7 @@ public void onDeviceUpdated(Device updated_device, boolean willBeRemoved) {
288332
test_state = TestStates.TEST_ACCESS;
289333
// Just send the current value of the first device port as target value.
290334
// Should change nothing but we will get a feedback if the credentials are working.
291-
PluginInterface pi = device.getPluginInterface(NetpowerctrlService.getService());
335+
PluginInterface pi = device.getPluginInterface();
292336
assert pi != null;
293337
if (deviceQuery != null) {
294338
deviceQuery.addDevice(device, false);

0 commit comments

Comments
 (0)