Permalink
Browse files

v1.13 Improved widget size in some devices

  • Loading branch information...
1 parent 486d1fe commit d9f62f08eb3d21eb3c643431f597ade6f56f9d59 Carles Sentis committed Sep 4, 2012
View
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codeskraps.lolo"
- android:versionCode="12"
- android:versionName="1.11" >
+ android:versionCode="14"
+ android:versionName="1.13" >
<!-- Remember to update the info code version -->
@@ -31,23 +31,31 @@
android:name=".AboutActivity"
android:theme="@style/Theme.Translucent" />
- <receiver android:name=".LoloProvider" >
+ <receiver
+ android:name=".LoloProvider"
+ android:exported="true" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
- <action android:name="com.codeskraps.lolo.FORCE_WIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/loloinfo" />
</receiver>
- <receiver android:name=".UpdateWidgetReceiver" >
+ <receiver
+ android:name=".LoloProvider"
+ android:exported="false" >
+ <intent-filter>
+ <action android:name="com.codeskraps.lolo.FORCE_WIDGET_UPDATE" />
+ </intent-filter>
+ </receiver>
+ <receiver
+ android:name=".UpdateWidgetReceiver"
+ android:exported="false" >
<intent-filter>
<action android:name="com.codeskraps.lolo.BROADCAST_RECEIVER" />
</intent-filter>
</receiver>
-
- <service android:name=".UpdateWidgetService" />
</application>
</manifest>
View
@@ -31,6 +31,11 @@ Install from Google Play
* http://play.google.com/store/apps/details?id=com.codeskraps.lolo
== ChangeLog
+<b>v1.13</b>
+* Improved widget size in some devices
+
+<b>v1.12</b>
+* Changed try/catch after reported crashes
<b>v1.11</b>
* ACRA - Crash report added
@@ -40,7 +45,7 @@ Install from Google Play
<b>v1.10</b>
* Out of bound exception fixed
-<b>v.1.9</>
+<b>v.1.9</b>
* On touch event stopped working after sometime has been fixed
* Get lolo json parser been fixed
View
@@ -54,7 +54,7 @@
<string name="prefsCat_Info">Information</string>
- <string name="prefsInfo_Title">091 Labs lo-lo v1.11</string>
+ <string name="prefsInfo_Title">091 Labs lo-lo v1.13</string>
<string name="prefsInfo_summary">GNU GPL License v3 - 2012</string>
<!-- About -->
View
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/widget"
- android:minHeight="72dip"
- android:minWidth="72dip"
+ android:minHeight="56dip"
+ android:minWidth="56dip"
android:configure="com.codeskraps.lolo.PrefsActivity"
android:previewImage="@drawable/open" />
-
-<!-- android:updatePeriodMillis="180000" -->
@@ -32,7 +32,6 @@ protected void onCreate(Bundle savedInstanceState) {
sb.append("<font color='#AAAAAA'>Code:</font> https://github.com/091labs/lo-lo<br />");
txtContent.setText(Html.fromHtml(sb.toString()));
-
}
@Override
@@ -2,6 +2,8 @@
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";
@@ -31,15 +31,14 @@
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
-import android.widget.RemoteViews;
public class LoloProvider extends AppWidgetProvider {
private static final String TAG = LoloProvider.class.getSimpleName();
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
if (BuildConfig.DEBUG) Log.d(TAG, "onUpdate");
- updateWidget(context);
+ updateWidget(context, appWidgetManager, appWidgetIds);
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
@@ -65,15 +64,15 @@ public void updateWidget(Context context) {
private void updateWidget(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
if (BuildConfig.DEBUG) Log.d(TAG, "updateWidget2");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
-
- if (appWidgetIds.length > 0) {
- for (int appWidgetId : appWidgetIds) {
-
- remoteViews.setOnClickPendingIntent(R.id.imgLolo, Utils.getOnTouchIntent(context));
- appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
- }
- }
+// RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
+//
+// if (appWidgetIds.length > 0) {
+// for (int appWidgetId : appWidgetIds) {
+//
+// remoteViews.setOnClickPendingIntent(R.id.imgLolo, Utils.getOnTouchIntent(context));
+// appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
+// }
+// }
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(Constants.BROADCAST_RECEIVER);
@@ -55,13 +55,13 @@ public void onReceive(Context context, Intent intent) {
remoteViews.setViewVisibility(R.id.prgBar, View.VISIBLE);
appWidgetManager.updateAppWidget(widgetId, remoteViews);
}
- } else Log.d(TAG, "No widgets installed");
+ } else if (BuildConfig.DEBUG) Log.d(TAG, "No widgets installed");
downloadThread = new MyThread();
downloadThread.start();
// new DownloadXmlTask().execute();
- } else Log.d(TAG, "No network connection");
+ } else if (BuildConfig.DEBUG) Log.d(TAG, "No network connection");
}
static private class MyThread extends Thread {
@@ -70,17 +70,17 @@ public void run() {
try {
lolo = Utils.getLolo();
} catch (UnsupportedEncodingException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} catch (ClientProtocolException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} catch (IOException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} catch (IllegalArgumentException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} catch (NullPointerException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} catch (JSONException e) {
- if (e != null) Log.e(TAG, e.getMessage());
+ if (BuildConfig.DEBUG && e != null) Log.e(TAG, e.getMessage());
} finally {
handler.post(new MyRunnable());
}
@@ -116,13 +116,11 @@ public void run() {
boolean showSync = prefs.getBoolean(Constants.SHOW_SYNC, true);
if (showSync) {
boolean hour24 = prefs.getBoolean(Constants.HOUR24, true);
- String hours = new String();
+ String hours = new String("");
if (hour24) {
- hours = new String("");
if (c.get(Calendar.HOUR_OF_DAY) < 10) hours += "0";
hours += c.get(Calendar.HOUR_OF_DAY);
} else {
- hours = new String("");
if (c.get(Calendar.HOUR) < 10) hours += "0";
hours += c.get(Calendar.HOUR);
}
@@ -143,7 +141,7 @@ public void run() {
Utils.getOnTouchIntent(context));
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
- } else Log.d(TAG, "No widgets installed");
+ } else if (BuildConfig.DEBUG) Log.d(TAG, "No widgets installed");
}
}
@@ -50,28 +50,27 @@
public class Utils {
private static final String TAG = Utils.class.getSimpleName();
- private static final String URL = "http://scruffy.091labs.com/lolo/json/status.json";
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
- if (networkInfo != null && networkInfo.isConnected()) { return true; }
+ if (networkInfo != null && networkInfo.isConnected()) return true;
return false;
}
- public static boolean getLolo() throws JSONException, IOException, IllegalArgumentException,
- ClientProtocolException, NullPointerException, UnsupportedEncodingException {
+ public static boolean getLolo() throws UnsupportedEncodingException, ClientProtocolException,
+ IOException, IllegalArgumentException, NullPointerException, JSONException {
long startTime = System.currentTimeMillis();
- Log.d(TAG, "download begining");
- Log.d(TAG, "download url:" + URL);
+ if (BuildConfig.DEBUG) Log.d(TAG, "download begining");
+ if (BuildConfig.DEBUG) Log.d(TAG, "download url:" + Constants.LOLO_URL);
HttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, 5000);
HttpConnectionParams.setSoTimeout(httpParameters, 10000);
HttpClient client = new DefaultHttpClient(httpParameters);
- HttpGet request = new HttpGet(URL);
+ HttpGet request = new HttpGet(Constants.LOLO_URL);
HttpResponse response = client.execute(request);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity()
@@ -86,9 +85,10 @@ public static boolean getLolo() throws JSONException, IOException, IllegalArgume
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");
+ if (BuildConfig.DEBUG) Log.d(TAG, "lolo: " + lolo);
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "download ready in " + ((System.currentTimeMillis() - startTime) / 1000)
+ + " sec");
return lolo;
}

0 comments on commit d9f62f0

Please sign in to comment.