Skip to content

Commit

Permalink
v1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Carles Sentis committed Jul 22, 2012
1 parent 347893a commit 6b29d70
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 33 deletions.
5 changes: 2 additions & 3 deletions AndroidManifest.xml
@@ -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
Expand Down
12 changes: 11 additions & 1 deletion 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.4
* <b>Latest Version:</b> 1.7
* <b>Release Date:</b> 2012

== General Infromation
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion res/values/strings.xml
Expand Up @@ -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 -->
Expand Down
9 changes: 4 additions & 5 deletions src/com/codeskraps/lolo/LoloProvider.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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,
Expand Down
14 changes: 10 additions & 4 deletions src/com/codeskraps/lolo/PrefsActivity.java
Expand Up @@ -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();
Expand All @@ -50,6 +46,7 @@ public class PrefsActivity extends PreferenceActivity implements OnSharedPrefere
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;
Expand Down Expand Up @@ -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));
Expand All @@ -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
Expand Down
36 changes: 17 additions & 19 deletions src/com/codeskraps/lolo/UpdateWidgetService.java
Expand Up @@ -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;
Expand All @@ -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();

Expand All @@ -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");
}
Expand All @@ -106,22 +104,22 @@ static private class MyThread extends Thread {
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);
Expand Down

0 comments on commit 6b29d70

Please sign in to comment.