Skip to content

Commit

Permalink
v1.16 - no signal image
Browse files Browse the repository at this point in the history
  • Loading branch information
Carles Sentis committed Oct 9, 2012
1 parent c7d0aaf commit 074f0c4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codeskraps.lolo"
android:versionCode="16"
android:versionName="1.15" >
android:versionCode="17"
android:versionName="1.16" >

<!-- Remember to update the info code version -->

Expand Down
7 changes: 5 additions & 2 deletions README.rdoc
Expand Up @@ -4,7 +4,7 @@
* <b>Git:</b> https://github.com/091labs/lo-lo
* <b>Author:</b> 091 Labs members
* <b>License:</b> GNU GPL v3
* <b>Latest Version:</b> 1.15
* <b>Latest Version:</b> 1.16
* <b>Release Date:</b> 2012

== General Infromation
Expand All @@ -21,7 +21,7 @@ and all creative ideas.
== Authors

* <b>Android:</b> Carles Sentis
* <b>Art design:</b> Darren Kearney
* <b>Art design:</b> Darren Kearney
* <b>Server:</b> Padraic Harley

== Install
Expand All @@ -31,6 +31,9 @@ Install from Google Play
* http://play.google.com/store/apps/details?id=com.codeskraps.lolo

== ChangeLog
<b>v1.16</b>
* No signal image if unknown lolo state

<b>v1.15</b>
* Release version using Proguard and ZipAlign

Expand Down
Binary file added res/drawable/_null.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/com/codeskraps/lolo/Constants.java
Expand Up @@ -3,11 +3,11 @@
public class Constants {

public static final String LOLO_URL = "http://scruffy.091labs.com/lolo/json/status.json";

public static final String FORCE_WIDGET_UPDATE = "com.codeskraps.lolo.FORCE_WIDGET_UPDATE";
public static final String BROADCAST_RECEIVER = "com.codeskraps.lolo.BROADCAST_RECEIVER";
public static final String CONFIGURE_ACTION = "android.appwidget.action.APPWIDGET_CONFIGURE";

public static final String ONCLICK = "lstOnClick";
public static final String EURL = "eURL";
public static final String LAST_SYNC = "sync";
Expand All @@ -16,4 +16,8 @@ public class Constants {
public static final String INTERVAL = "lstInterval";
public static final String ABOUT = "prefAbout";
public static final String FIRST_LAUNCH = "firstLaunch";

public static final short LOLO_ON = 0;
public static final short LOLO_OFF = 1;
public static final short LOLO_NULL = 2;
}
19 changes: 15 additions & 4 deletions src/com/codeskraps/lolo/UpdateWidgetReceiver.java
Expand Up @@ -32,7 +32,7 @@ public class UpdateWidgetReceiver extends BroadcastReceiver {

private static Context context = null;
private static Handler handler;
private static boolean lolo;
private static short lolo;
private Thread downloadThread;

@Override
Expand All @@ -41,6 +41,7 @@ public void onReceive(Context context, Intent intent) {

UpdateWidgetReceiver.context = context;

lolo = Constants.LOLO_NULL;
handler = new Handler();

if (Utils.isNetworkAvailable(context)) {
Expand All @@ -61,7 +62,10 @@ public void onReceive(Context context, Intent intent) {
downloadThread.start();

// new DownloadXmlTask().execute();
} else if (BuildConfig.DEBUG) Log.d(TAG, "No network connection");
} else {
if (BuildConfig.DEBUG) Log.d(TAG, "No network connection");
handler.post(new MyRunnable());
}
}

static private class MyThread extends Thread {
Expand Down Expand Up @@ -104,12 +108,19 @@ public void run() {
if (appWidgetIds.length > 0) {
for (int appWidgetId : appWidgetIds) {

if (lolo) {
switch (lolo) {
case Constants.LOLO_ON:
remoteViews.setImageViewResource(R.id.imgLolo, R.drawable.open);
Log.d(TAG, "The labs is open");
} else {
break;
case Constants.LOLO_OFF:
remoteViews.setImageViewResource(R.id.imgLolo, R.drawable.closed);
Log.d(TAG, "The labs is close");
break;
case Constants.LOLO_NULL:
remoteViews.setImageViewResource(R.id.imgLolo, R.drawable._null);
Log.d(TAG, "The labs is null");
break;
}

Calendar c = Calendar.getInstance();
Expand Down
5 changes: 2 additions & 3 deletions src/com/codeskraps/lolo/Utils.java
Expand Up @@ -59,7 +59,7 @@ public static boolean isNetworkAvailable(Context context) {
return false;
}

public static boolean getLolo() throws UnsupportedEncodingException, ClientProtocolException,
public static short getLolo() throws UnsupportedEncodingException, ClientProtocolException,
IOException, IllegalArgumentException, NullPointerException, JSONException {
long startTime = System.currentTimeMillis();
if (BuildConfig.DEBUG) Log.d(TAG, "download begining");
Expand All @@ -81,9 +81,8 @@ public static boolean getLolo() throws UnsupportedEncodingException, ClientProto

JSONTokener tokener = new JSONTokener(json);

boolean lolo = false;
JSONObject finalResult = new JSONObject(tokener);
lolo = finalResult.getBoolean("open");
short lolo = finalResult.getBoolean("open") ? Constants.LOLO_ON : Constants.LOLO_OFF;

if (BuildConfig.DEBUG) Log.d(TAG, "lolo: " + lolo);
if (BuildConfig.DEBUG)
Expand Down

0 comments on commit 074f0c4

Please sign in to comment.