-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- #41 App Crashes when removing GeoFence Location - #33 Check Domoticz for updates on boot (and in show in settings screen) - #17 Configure Radius for Geofences - #11 GPS not stopped when losing focus while in the Geofence screen
- Loading branch information
Showing
22 changed files
with
301 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
app/src/main/java/nl/hnogames/domoticz/Domoticz/UpdateParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package nl.hnogames.domoticz.Domoticz; | ||
|
||
import android.util.Log; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import nl.hnogames.domoticz.Interfaces.JSONParserInterface; | ||
import nl.hnogames.domoticz.Interfaces.UpdateReceiver; | ||
import nl.hnogames.domoticz.Interfaces.VersionReceiver; | ||
|
||
public class UpdateParser implements JSONParserInterface { | ||
|
||
private static final String TAG = UpdateParser.class.getSimpleName(); | ||
private UpdateReceiver receiver; | ||
|
||
public UpdateParser(UpdateReceiver receiver) { | ||
this.receiver = receiver; | ||
} | ||
|
||
@Override | ||
public void parseResult(String result) { | ||
try { | ||
JSONObject response = new JSONObject(result); | ||
String version = ""; | ||
if(response.has("revision")) | ||
version= response.getString("revision"); | ||
if(response.has("HaveUpdate") && !response.getBoolean("HaveUpdate")) | ||
version= ""; | ||
|
||
receiver.onReceiveUpdate(version); | ||
} catch (JSONException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onError(Exception error) { | ||
Log.e(TAG, "VersionParser of JSONParserInterface exception"); | ||
receiver.onError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/src/main/java/nl/hnogames/domoticz/Interfaces/UpdateReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nl.hnogames.domoticz.Interfaces; | ||
|
||
public interface UpdateReceiver { | ||
|
||
void onReceiveUpdate(String version); | ||
void onError(Exception error); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
public interface VersionReceiver { | ||
|
||
void onReceiveVersion(String version); | ||
|
||
void onError(Exception error); | ||
|
||
} |
Oops, something went wrong.