Skip to content

Commit 0f6e355

Browse files
author
David Graeff
committed
Remove all alarm/timer classes. Renaming with anel plugin works now again without activity crash. Remove donations library.
1 parent 0675058 commit 0f6e355

Some content is hidden

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

57 files changed

+371
-2993
lines changed

app/app.iml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,5 @@
114114
<orderEntry type="library" exported="" scope="TEST" name="junit-4.11" level="project" />
115115
<orderEntry type="library" exported="" name="ndeftools-util-1.2.4" level="project" />
116116
<orderEntry type="library" exported="" name="cardview-v7-22.0.0" level="project" />
117-
<orderEntry type="module" module-name="Donations" exported="" />
118117
</component>
119118
</module>

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ android {
9292
dependencies {
9393
//compile fileTree(dir: 'libs', include: ['*.jar']) :5.2.08 5.0.89
9494
//compile 'com.google.android.gms:play-services:5.2.08'
95-
compile project(':libraries:Donations')
9695
//noinspection GradleDependency
9796
compile 'com.android.support:appcompat-v7:22.0.0'
9897
compile 'com.android.support:support-v13:22.0.0'

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,6 @@ public boolean isNewIOConnectionAllowed(Credentials credentials) {
9898
*/
9999
public void addNewIOConnection(@NonNull Credentials credentials, @NonNull onNewIOConnection callback) {
100100
}
101+
102+
public abstract boolean supportsRemoteRename();
101103
}

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
import oly.netpowerctrl.main.GuiThreadHandler;
3232
import oly.netpowerctrl.main.MainActivity;
3333
import oly.netpowerctrl.network.NetworkChangedBroadcastReceiver;
34+
import oly.netpowerctrl.network.ReachabilityStates;
35+
import oly.netpowerctrl.network.UDPSend;
3436
import oly.netpowerctrl.plugin_anel.AnelPlugin;
3537
import oly.netpowerctrl.plugin_simpleudp.SimpleUDPPlugin;
36-
import oly.netpowerctrl.preferences.SharedPrefs;
3738
import oly.netpowerctrl.status_bar.FavCollection;
38-
import oly.netpowerctrl.timer.TimerCollection;
3939
import oly.netpowerctrl.utils.Logging;
4040

4141
/**
@@ -59,7 +59,6 @@ public class DataService extends Service implements onDataLoaded, onDataQueryCom
5959
final public CredentialsCollection credentials = new CredentialsCollection(this);
6060
final public GroupCollection groups = new GroupCollection(this);
6161
final public FavCollection favourites = new FavCollection(this);
62-
final public TimerCollection timers = new TimerCollection(this);
6362
final public IOConnectionsCollection connections = new IOConnectionsCollection(this);
6463
private final DataLoadedObserver observersOnDataLoaded = new DataLoadedObserver();
6564
private final List<AbstractBasePlugin> plugins = new ArrayList<>();
@@ -173,9 +172,6 @@ public int onStartCommand(@Nullable final Intent intent, final int flags, final
173172
return START_NOT_STICKY;
174173
} else {
175174
Logging.getInstance().logMain("START");
176-
// Although the next alarm should be registered to android already,
177-
// we do it again, just to be sure.
178-
TimerCollection.armAndroidAlarm(this, SharedPrefs.getNextAlarmCheckTimestamp(this));
179175
}
180176

181177
// We are a singleton, set the instance variable now.
@@ -233,6 +229,8 @@ public void onDestroy() {
233229
loadStoreCollections.finish(this);
234230
loadStoreCollections = null;
235231

232+
UDPSend.killSendThread();
233+
236234
// Clean up
237235
for (AbstractBasePlugin abstractBasePlugin : plugins)
238236
abstractBasePlugin.onDestroy();
@@ -332,7 +330,6 @@ public void clear() {
332330
connections.storage.clear();
333331
credentials.storage.clear();
334332
groups.storage.clear();
335-
timers.storage.clear();
336333
executables.storage.clear();
337334
observersOnDataLoaded.reset();
338335
}
@@ -406,6 +403,14 @@ public void onObserverJobFinished(DevicesObserver devicesObserver) {
406403
}
407404
}
408405

406+
/**
407+
* This is issued by the network observer if no network connection is active (no wlan, no mobile network)
408+
*/
409+
public void makeAllOffline() {
410+
connections.clearNotConfigured();
411+
connections.applyStateToAll(ReachabilityStates.NotReachable);
412+
}
413+
409414
public void remove(Credentials credentials) {
410415
this.executables.remove(credentials);
411416
this.connections.remove(credentials);

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import oly.netpowerctrl.main.App;
1818
import oly.netpowerctrl.preferences.SharedPrefs;
1919
import oly.netpowerctrl.status_bar.FavItem;
20-
import oly.netpowerctrl.timer.Timer;
2120
import oly.netpowerctrl.ui.notifications.InAppNotifications;
2221
import oly.netpowerctrl.utils.FactoryInterface;
2322
import oly.netpowerctrl.utils.IOInterface;
@@ -80,7 +79,6 @@ public void loadData(final DataService dataService) {
8079
dataService.connections.getStorage().setStorage(this);
8180
dataService.executables.getStorage().setStorage(this);
8281
dataService.groups.getStorage().setStorage(this);
83-
dataService.timers.getStorage().setStorage(this);
8482
dataService.favourites.getStorage().setStorage(this);
8583

8684
new AsyncTask<Void, Void, Boolean>() {
@@ -111,7 +109,6 @@ public void finish(DataService dataService) {
111109
dataService.connections.getStorage().setStorage(null);
112110
dataService.executables.getStorage().setStorage(null);
113111
dataService.groups.getStorage().setStorage(null);
114-
dataService.timers.getStorage().setStorage(null);
115112
dataService.favourites.getStorage().setStorage(null);
116113
}
117114

@@ -223,12 +220,6 @@ private void readOtherThread(final DataService dataService) {
223220
e.printStackTrace();
224221
}
225222

226-
try {
227-
readOtherThreadCollection(dataService.timers.getStorage(), Timer.class, false);
228-
} catch (Exception e) {
229-
e.printStackTrace();
230-
}
231-
232223
try {
233224
readOtherThreadCollection(dataService.favourites.getStorage(), FavItem.class, false);
234225
} catch (Exception e) {

app/src/main/java/oly/netpowerctrl/data/importexport/ImportExport.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public static void clearData(DataService dataService) {
3535
loadStoreCollections.clear(dataService.connections.getStorage());
3636
loadStoreCollections.clear(dataService.executables.getStorage());
3737
loadStoreCollections.clear(dataService.credentials.getStorage());
38-
loadStoreCollections.clear(dataService.timers.getStorage());
3938
}
4039

4140
@SuppressWarnings("ResultOfMethodCallIgnored")

app/src/main/java/oly/netpowerctrl/executables/Executable.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,11 @@ public int getCurrentValueToggled() {
138138
public void setTitle(String title, @NonNull onNameChangeResult callback) {
139139
if (title.equals(this.title)) return;
140140

141-
this.title = title;
142-
143-
if (credentials != null) {
141+
if (credentials != null && credentials.getPlugin().supportsRemoteRename()) {
144142
callback.onNameChangeStart(this);
145143
credentials.getPlugin().setTitle(this, title, callback);
146-
}
144+
} else
145+
this.title = title;
147146
}
148147

149148
public boolean isHidden() {

app/src/main/java/oly/netpowerctrl/executables/ExecutablesFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public void onClick(View view) {
299299
@Override
300300
public void onClick(View view) {
301301
if (SharedPrefs.getInstance().isFirstTimeSceneAdd()) {
302-
SceneHelp.showHelp(getActivity());
302+
SceneHelp.showHelp(getActivity(), R.string.scene_add, R.string.help_scene);
303303
} else {
304304
Intent it = new Intent(getActivity(), EditActivity.class);
305305
it.putExtra(EditActivity.CREATE_SCENE, true);

app/src/main/java/oly/netpowerctrl/ioconnection/IOConnectionsCollection.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,15 @@ public Set<Integer> getAllUDPReceivePorts(AbstractBasePlugin plugin) {
280280
}
281281
return ports;
282282
}
283+
284+
public void applyStateToAll(ReachabilityStates state) {
285+
for (DeviceIOConnections deviceIOConnections : items.values()) {
286+
for (Iterator<IOConnection> iterator = deviceIOConnections.iterator(); iterator.hasNext(); ) {
287+
IOConnection ioConnection = iterator.next();
288+
ioConnection.resetChanged();
289+
ioConnection.setReachability(state);
290+
putInternal(deviceIOConnections, ioConnection);
291+
}
292+
}
293+
}
283294
}

app/src/main/java/oly/netpowerctrl/main/App.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void onCreate() {
8383
config.setFormUriBasicAuthPassword(getString(R.string.acralyzer_http_pwd));
8484
config.setReportType(HttpSender.Type.JSON);
8585
config.setResToastText(R.string.crash_toast_text);
86+
config.setBuildConfigClass(BuildConfig.class);
8687
try {
8788
config.setMode(ReportingInteractionMode.TOAST);
8889
} catch (ACRAConfigurationException e) {

0 commit comments

Comments
 (0)