Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some initial widget work

  • Loading branch information...
commit d674824d7a253b4942c78e608d78cbb52a267dae 1 parent f44f6bf
@matburt authored
View
BIN  res/drawable-hdpi/widgetb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-ldpi/widgetb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  res/drawable-mdpi/widgetb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  res/xml/widget_mobileorg.xml
@@ -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"
View
29 src/com/matburt/mobileorg/MobileOrgWidget.java
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.