Permalink
Browse files

Some initial widget work

  • Loading branch information...
1 parent f44f6bf commit d674824d7a253b4942c78e608d78cbb52a267dae @matburt committed May 5, 2010
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
- android:minWidth="214dip"
+ android:minWidth="286dip"
android:minHeight="214dip"
android:updatePeriodMillis="3600000"
android:initialLayout="@layout/widget_mobileorg"
@@ -8,16 +8,23 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
+import android.content.Context;
import android.net.Uri;
import android.os.IBinder;
import android.text.format.Time;
import android.util.Log;
import android.widget.RemoteViews;
-
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
+import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MobileOrgWidget extends AppWidgetProvider {
+ private static final String LT = "MobileOrgWidget";
+
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
@@ -44,10 +51,30 @@ public RemoteViews genUpdateDisplay(Context context) {
RemoteViews updateViews = null;
updateViews = new RemoteViews(context.getPackageName(),
R.layout.widget_mobileorg);
+ this.getOrgFiles(context);
updateViews.setTextViewText(R.id.message, "Everything worked");
return updateViews;
}
+ public ArrayList<String> getOrgFiles(Context context) {
+ ArrayList<String> allFiles = new ArrayList<String>();
+ SQLiteDatabase appdb = context.openOrCreateDatabase("MobileOrg",
+ 0, null);
+ Cursor result = appdb.rawQuery("SELECT file FROM files", null);
+ if (result != null) {
+ if (result.getCount() > 0) {
+ result.moveToFirst();
+ do {
+ Log.d(LT, "pulled " + result.getString(0));
+ allFiles.add(result.getString(0));
+ } while(result.moveToNext());
+ }
+ }
+ appdb.close();
+ result.close();
+ return allFiles;
+ }
+
@Override
public IBinder onBind(Intent intent) {
// We don't need to bind to this service

0 comments on commit d674824

Please sign in to comment.