Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v1.11 ACRA

  • Loading branch information...
commit 486d1fef9465c075d7c7855ac3904b60fce0ce4a 1 parent 5e1f699
Carles Sentis authored
View
1  .classpath
@@ -4,5 +4,6 @@
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="lib" path="libs/acra-4.2.3.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
View
4 .settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=
+googleCloudSqlEnabled=false
+localDevMySqlEnabled=true
View
5 AndroidManifest.xml
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codeskraps.lolo"
- android:versionCode="10"
- android:versionName="1.10" >
+ android:versionCode="12"
+ android:versionName="1.11" >
<!-- Remember to update the info code version -->
@@ -13,6 +13,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
+ android:name=".LoloApp"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
View
5 README.rdoc
@@ -32,6 +32,11 @@ Install from Google Play
== ChangeLog
+<b>v1.11</b>
+* ACRA - Crash report added
+* Small UI improvements
+* Improved error handling
+
<b>v1.10</b>
* Out of bound exception fixed
View
BIN  libs/acra-4.2.3.jar
Binary file not shown
View
3  lint.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+</lint>
View
3  res/layout/widget.xml
@@ -12,7 +12,7 @@
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@string/contentDescription"
- android:padding="15dip"
+ android:padding="10dip"
android:src="@drawable/closed" />
<ProgressBar
@@ -35,6 +35,7 @@
android:shadowDy="1"
android:shadowRadius="1"
android:textColor="#FFFFFF"
+ android:textAppearance="?android:attr/textAppearanceSmall"
android:typeface="monospace" />
</RelativeLayout>
View
2  res/values/strings.xml
@@ -54,7 +54,7 @@
<string name="prefsCat_Info">Information</string>
- <string name="prefsInfo_Title">091 Labs lo-lo v1.10</string>
+ <string name="prefsInfo_Title">091 Labs lo-lo v1.11</string>
<string name="prefsInfo_summary">GNU GPL License v3 - 2012</string>
<!-- About -->
View
17 src/com/codeskraps/lolo/LoloApp.java
@@ -0,0 +1,17 @@
+package com.codeskraps.lolo;
+
+import org.acra.ACRA;
+import org.acra.annotation.ReportsCrashes;
+
+import android.app.Application;
+
+@ReportsCrashes(formKey = "dC1lU3BVVGh4ejlQSTJta05pNXBPQVE6MQ")
+public class LoloApp extends Application {
+
+ @Override
+ public void onCreate() {
+ // The following line triggers the initialization of ACRA
+ ACRA.init(this);
+ super.onCreate();
+ }
+}
View
17 src/com/codeskraps/lolo/UpdateWidgetReceiver.java
@@ -2,12 +2,15 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.List;
+import org.apache.http.client.ClientProtocolException;
+import org.json.JSONException;
import org.xmlpull.v1.XmlPullParserException;
import android.appwidget.AppWidgetManager;
@@ -66,8 +69,18 @@ public void onReceive(Context context, Intent intent) {
public void run() {
try {
lolo = Utils.getLolo();
+ } catch (UnsupportedEncodingException e) {
+ if (e != null) Log.e(TAG, e.getMessage());
+ } catch (ClientProtocolException e) {
+ if (e != null) Log.e(TAG, e.getMessage());
} catch (IOException e) {
- Log.e(TAG, e.getMessage());
+ if (e != null) Log.e(TAG, e.getMessage());
+ } catch (IllegalArgumentException e) {
+ if (e != null) Log.e(TAG, e.getMessage());
+ } catch (NullPointerException e) {
+ if (e != null) Log.e(TAG, e.getMessage());
+ } catch (JSONException e) {
+ if (e != null) Log.e(TAG, e.getMessage());
} finally {
handler.post(new MyRunnable());
}
@@ -118,7 +131,7 @@ public void run() {
if (c.get(Calendar.MINUTE) < 10) minutes += "0";
minutes += c.get(Calendar.MINUTE);
- String lastSync = String.format("%s:%s\n", hours, minutes);
+ String lastSync = String.format("%s:%s", hours, minutes);
Log.d(TAG, "lastSnync:" + lastSync);
remoteViews.setTextViewText(R.id.txtSync, lastSync);
remoteViews.setViewVisibility(R.id.txtSync, View.VISIBLE);
View
17 src/com/codeskraps/lolo/Utils.java
@@ -24,8 +24,10 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
@@ -58,7 +60,8 @@ public static boolean isNetworkAvailable(Context context) {
return false;
}
- public static boolean getLolo() throws IOException {
+ public static boolean getLolo() throws JSONException, IOException, IllegalArgumentException,
+ ClientProtocolException, NullPointerException, UnsupportedEncodingException {
long startTime = System.currentTimeMillis();
Log.d(TAG, "download begining");
Log.d(TAG, "download url:" + URL);
@@ -74,20 +77,16 @@ public static boolean getLolo() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity()
.getContent(), "UTF-8"));
String json = reader.readLine();
- Log.d(TAG, json);
+ Log.d(TAG, "json: " + json);
reader.close();
JSONTokener tokener = new JSONTokener(json);
boolean lolo = false;
- try {
- JSONObject finalResult = new JSONObject(tokener);
- lolo = finalResult.getBoolean("open");
- Log.d(TAG, "lolo: " + lolo);
- } catch (JSONException e) {
- Log.e(TAG, e.getMessage());
- }
+ JSONObject finalResult = new JSONObject(tokener);
+ lolo = finalResult.getBoolean("open");
+ Log.d(TAG, "lolo: " + lolo);
Log.d(TAG, "download ready in " + ((System.currentTimeMillis() - startTime) / 1000)
+ " sec");
return lolo;
Please sign in to comment.
Something went wrong with that request. Please try again.