Permalink
Browse files

Fix the bug that parent node will be changed to subnode when return f…

…rom subnode
  • Loading branch information...
1 parent 4b4d109 commit 54529fc877c803de289fc2d13099e30c3b8bf029 TigerSoldier committed Mar 26, 2010
Showing with 43 additions and 18 deletions.
  1. +37 −13 res/layout/main.xml
  2. +6 −5 src/com/matburt/mobileorg/MobileOrgActivity.java
View
50 res/layout/main.xml
@@ -1,14 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TextView
- android:id="@+id/orgItem"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dip"
- android:gravity="left"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:minHeight="?android:attr/listPreferredItemHeight" />
-</LinearLayout>
+<RelativeLayout android:id="@+id/orgTopLayout"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:minHeight="?android:attr/listPreferredItemHeight">
+
+ <TextView
+ android:id="@+id/todoState"
+ android:layout_width="wrap_content"
+ android:layout_height="20sp"
+ android:layout_marginTop="10dip"
+ android:layout_marginLeft="5dip"
+ android:layout_marginRight="5dip"
+ android:textColor="#FF0000"
+ android:gravity="left"
+ />
+ <TextView
+ android:id="@+id/orgItem"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="5dip"
+ android:layout_marginLeft="5dip"
+ android:layout_toRightOf="@id/todoState"
+ android:gravity="left"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:minHeight="20sp" />
+
+ <LinearLayout
+ android:id="@+id/tagsLayout"
+ android:layout_marginLeft="5dp"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="20sp"
+ android:layout_below="@id/orgItem"
+ />
+
+</RelativeLayout>
View
11 src/com/matburt/mobileorg/MobileOrgActivity.java
@@ -193,12 +193,13 @@ public void onListItemClick(ListView l, View v, int position, long id) {
appInst.nodeSelection = new ArrayList<Integer>();
}
- appInst.nodeSelection.add(new Integer(position));
+ ArrayList<Integer> selection = new ArrayList<Integer>(appInst.nodeSelection);
+ selection.add(new Integer(position));
Node thisNode = appInst.rootNode;
- if (appInst.nodeSelection != null) {
- for (int idx = 0; idx < appInst.nodeSelection.size(); idx++) {
- thisNode = thisNode.subNodes.get(appInst.nodeSelection.get(idx));
+ if (selection != null) {
+ for (int idx = 0; idx < selection.size(); idx++) {
+ thisNode = thisNode.subNodes.get(selection.get(idx));
}
}
if (thisNode.subNodes.size() < 1) {
@@ -212,7 +213,7 @@ public void onListItemClick(ListView l, View v, int position, long id) {
startActivity(textIntent);
}
else {
- dispIntent.putIntegerArrayListExtra("nodePath", appInst.nodeSelection);
+ dispIntent.putIntegerArrayListExtra("nodePath", selection);
startActivityForResult(dispIntent, 1);
}
}

0 comments on commit 54529fc

Please sign in to comment.