Skip to content

Commit

Permalink
Improved layout, fixed updating of location on sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
hdweiss committed Dec 10, 2012
1 parent 664a747 commit 8a1148f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
3 changes: 2 additions & 1 deletion AndroidManifest.xml
Expand Up @@ -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>
Expand Down
5 changes: 2 additions & 3 deletions res/layout/capture_widget.xml
Expand Up @@ -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" />

Expand All @@ -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>
6 changes: 3 additions & 3 deletions res/xml/capture_widget_provider.xml
@@ -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" >

Expand Down
13 changes: 12 additions & 1 deletion src/com/matburt/mobileorg/Gui/Capture/EditActivity.java
Expand Up @@ -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;
Expand All @@ -24,6 +25,7 @@ public class EditActivity extends SherlockFragmentActivity implements EditHost,
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";
Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8a1148f

Please sign in to comment.