Permalink
Browse files

Improved layout, fixed updating of location on sync.

  • Loading branch information...
hdweiss committed Dec 10, 2012
1 parent 664a747 commit 8a1148f2102b0c86fa830f0359bbb27f8a5f9a9a
View
@@ -194,7 +194,8 @@
<activity android:name=".Gui.Agenda.AgendaActivity" >
</activity>
- <receiver android:name=".Gui.Widget.CaptureWidgetProvider" >
+ <receiver android:name=".Gui.Widget.CaptureWidgetProvider"
+ android:label="MobileOrg Capture" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
@@ -3,14 +3,14 @@
android:id="@+id/capture_widget_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="15dp"
android:orientation="vertical" >
<ImageView
android:id="@+id/capture_widget_icon"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dp"
android:layout_gravity="center"
+ android:layout_margin="5dp"
android:layout_weight="1"
android:src="@drawable/widget_capture" />
@@ -20,7 +20,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/capture_widget_text_bg"
- android:text="Widget"
android:textColor="@android:color/primary_text_dark" />
</LinearLayout>
@@ -1,9 +1,9 @@
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="com.matburt.mobileorg.Gui.Widget.CaptureWidgetConfig"
android:initialLayout="@layout/capture_widget"
- android:minHeight="72dp"
- android:minWidth="72dp"
- android:previewImage="@drawable/icon"
+ android:minHeight="40dp"
+ android:minWidth="40dp"
+ android:previewImage="@drawable/widget_capture"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="86400000" >
@@ -6,6 +6,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.text.TextUtils;
import android.util.Log;
import com.actionbarsherlock.app.SherlockFragmentActivity;
@@ -24,6 +25,7 @@
PayloadFragment.OnPayloadModifiedListener,
DatesFragment.OnDatesModifiedListener {
public final static String NODE_ID = "node_id";
+ public final static String OLP_LOCATION = "olp_location";
public final static String ACTIONMODE = "actionMode";
public final static String ACTIONMODE_CREATE = "create";
public final static String ACTIONMODE_EDIT = "edit";
@@ -64,7 +66,16 @@ protected void onDestroy() {
private void initState() {
Intent intent = getIntent();
this.actionMode = intent.getStringExtra(ACTIONMODE);
- long node_id = intent.getLongExtra(NODE_ID, -1);
+ long node_id = intent.getLongExtra(NODE_ID, -1);
+ String olpLocation = intent.getStringExtra(OLP_LOCATION);
+
+ if (TextUtils.isEmpty(olpLocation) == false) {
+ try {
+ OrgNode parentNode = OrgProviderUtils.getOrgNodeFromOlpPath(
+ olpLocation, getContentResolver());
+ node_id = parentNode.id;
+ } catch (Exception e) {}
+ }
if (this.actionMode == null) {
this.node = OrgUtils.getCaptureIntentContents(intent);
@@ -11,8 +11,6 @@
import com.matburt.mobileorg.R;
import com.matburt.mobileorg.Gui.Capture.EditActivity;
-import com.matburt.mobileorg.OrgData.OrgNode;
-import com.matburt.mobileorg.OrgData.OrgProviderUtils;
public class CaptureWidgetProvider extends AppWidgetProvider {
public static final String LOCATION = "location";
@@ -61,11 +59,7 @@ private static Intent getWidgetIntent(int appWidgetId, Context context) {
SharedPreferences prefs = getPreferences(appWidgetId, context);
String olpLocation = prefs.getString(LOCATION, "");
- try {
- OrgNode parentNode = OrgProviderUtils.getOrgNodeFromOlpPath(
- olpLocation, context.getContentResolver());
- intent.putExtra(EditActivity.NODE_ID, parentNode.id);
- } catch (Exception e) {}
+ intent.putExtra(EditActivity.OLP_LOCATION, olpLocation);
return intent;
}

0 comments on commit 8a1148f

Please sign in to comment.