Permalink
Browse files

v1.7

  • Loading branch information...
1 parent 347893a commit 6b29d70928b0bf57d80eeb1db865c6fbc2efde65 Carles Sentis committed Jul 22, 2012
View
@@ -1,8 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codeskraps.lolo"
- android:versionCode="5"
- android:versionName="1.4" >
-
+ android:versionCode="8"
+ android:versionName="1.7" >
<!-- Remember to update the info code version -->
<uses-sdk
View
@@ -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.4
+* <b>Latest Version:</b> 1.7
* <b>Release Date:</b> 2012
== General Infromation
@@ -32,6 +32,16 @@ Install from Google Play
== ChangeLog
+<b>v1.7</b>
+* Fix bug - Widget views not updating from pedingIntent
+* Fix bug - Connection time out view update
+
+<b>v1.6</b>
+* Bug fixed - onSharedPreferenceChanged not fired
+
+<b>v1.5</b>
+* Shows About activity on first launch
+
<b>v1.4</b>
* New super awesome about page
* Added show 24-hour setting
@@ -33,7 +33,7 @@
<string name="prefsURL_summary">Set a Custom URL -</string>
<string name="prefsURL_default">091labs.com</string>
<string name="prefsCat_Info">Information</string>
- <string name="prefsInfo_Title">091 Labs lo-lo v1.4</string>
+ <string name="prefsInfo_Title">091 Labs lo-lo v1.7</string>
<string name="prefsInfo_summary">GNU GPL License v3 - 2012</string>
<!-- About -->
@@ -21,9 +21,6 @@
package com.codeskraps.lolo;
-import java.util.Calendar;
-
-import android.app.AlarmManager;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
@@ -52,8 +49,8 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
public void onReceive(Context context, Intent intent) {
if (BuildConfig.DEBUG == true)
Log.d(TAG, "onReceive");
- final String action = intent.getAction();
+ final String action = intent.getAction();
if (action.equals(FORCE_WIDGET_UPDATE))
updateWidget(context);
@@ -78,7 +75,6 @@ private void updateWidget(Context context, AppWidgetManager appWidgetManager, in
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Intent serviceIntent = new Intent(context, UpdateWidgetService.class);
- serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
Intent intent = null;
PendingIntent pendingIntent = null;
@@ -94,13 +90,16 @@ private void updateWidget(Context context, AppWidgetManager appWidgetManager, in
intent = new Intent("com.codeskraps.lol.DO_NOTHING");
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
break;
+
case 1:
pendingIntent = PendingIntent.getService(context, 0, serviceIntent, 0);
break;
+
case 2:
intent = new Intent(context, PrefsActivity.class);
pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
break;
+
case 3:
intent = new Intent(Intent.ACTION_VIEW);
String url = prefs.getString(PrefsActivity.EURL,
@@ -35,10 +35,6 @@
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.RelativeLayout.LayoutParams;
public class PrefsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener, OnPreferenceClickListener {
private static final String TAG = PrefsActivity.class.getSimpleName();
@@ -50,6 +46,7 @@
public static final String SHOW_SYNC = "chkSync";
public static final String HOUR24 = "chk24";
public static final String ABOUT = "prefAbout";
+ public static final String FIRST_LAUNCH = "firstLaunch";
private SharedPreferences prefs = null;
private ListPreference lstOnClick = null;
@@ -85,6 +82,8 @@ protected void onCreate(Bundle savedInstanceState) {
protected void onResume() {
super.onResume();
+ prefs.registerOnSharedPreferenceChangeListener(this);
+
String lstSync = prefs.getString(LAST_SYNC, null);
if (lstSync == null)
chkSync.setSummary(getString(R.string.prefsSync_summarNot));
@@ -107,6 +106,13 @@ protected void onResume() {
if (action != 3)
eURL.setEnabled(false);
+
+ if (prefs.getBoolean(FIRST_LAUNCH, true)) {
+ startActivity(new Intent(this, AboutActivity.class));
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(FIRST_LAUNCH, false);
+ editor.commit();
+ }
}
@Override
@@ -26,16 +26,14 @@
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import org.xmlpull.v1.XmlPullParserException;
-import com.codeskraps.lolo.RSSXmlParser.Entry;
-
import android.app.Service;
import android.appwidget.AppWidgetManager;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -47,6 +45,8 @@
import android.view.View;
import android.widget.RemoteViews;
+import com.codeskraps.lolo.RSSXmlParser.Entry;
+
public class UpdateWidgetService extends Service {
private static final String TAG = UpdateWidgetService.class.getSimpleName();
@@ -72,26 +72,24 @@ public int onStartCommand(Intent intent, int flags, int startId) {
handler = new Handler();
if (Utils.isNetworkAvailable(getApplicationContext())) {
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context
- .getApplicationContext());
-
- int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
+ ComponentName provider = new ComponentName(context, LoloProvider.class);
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
+ int[] appWidgets = appWidgetManager.getAppWidgetIds(provider);
- if (appWidgetIds.length > 0) {
- for (int widgetId : appWidgetIds) {
+ if (appWidgets.length > 0) {
+ for (int widgetId : appWidgets) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget);
remoteViews.setViewVisibility(R.id.prgBar, View.VISIBLE);
appWidgetManager.updateAppWidget(widgetId, remoteViews);
}
- } else {
+ } else
Log.d(TAG, "No widgets installed");
- }
downloadThread = new MyThread();
downloadThread.start();
-// new DownloadXmlTask().execute();
+ // new DownloadXmlTask().execute();
} else {
Log.d(TAG, "No network connection");
}
@@ -106,22 +104,22 @@ public int onStartCommand(Intent intent, int flags, int startId) {
public void run() {
try {
lolo = Utils.getLolo();
- handler.post(new MyRunnable());
} catch (IOException e) {
Log.e(TAG, e.getMessage());
+ } finally {
+ handler.post(new MyRunnable());
}
}
}
static private class MyRunnable implements Runnable {
public void run() {
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context
- .getApplicationContext());
-
- int[] appWidgetIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
+ ComponentName provider = new ComponentName(context, LoloProvider.class);
+ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
+ int[] appWidgets = appWidgetManager.getAppWidgetIds(provider);
- if (appWidgetIds.length > 0) {
- for (int widgetId : appWidgetIds) {
+ if (appWidgets.length > 0) {
+ for (int widgetId : appWidgets) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.widget);

0 comments on commit 6b29d70

Please sign in to comment.