Permalink
Browse files

When going up in the node tree, fouces the list on the element you we…

…re coming from.
  • Loading branch information...
1 parent e3629fa commit 9d95ed1cc7f1539d241835833706c4d5c1bd382e Daniel Kullmann committed May 22, 2011
@@ -1,5 +1,13 @@
package com.matburt.mobileorg;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.StringReader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+
import android.app.Activity;
import android.app.ListActivity;
import android.app.ProgressDialog;
@@ -12,8 +20,18 @@
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
-import android.view.*;
-import android.widget.*;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
import com.matburt.mobileorg.Capture.Capture;
import com.matburt.mobileorg.Capture.ViewNodeDetailsActivity;
import com.matburt.mobileorg.Error.ErrorReporter;
@@ -27,14 +45,6 @@
import com.matburt.mobileorg.Synchronizers.Synchronizer;
import com.matburt.mobileorg.Synchronizers.WebDAVSynchronizer;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.StringReader;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-
public class MobileOrgActivity extends ListActivity
{
private static class OrgViewAdapter extends BaseAdapter {
@@ -223,6 +233,7 @@ public void run() {
};
protected ArrayList<Integer> mNodePath;
+ private int displayIndex;
@Override
public void onCreate(Bundle savedInstanceState)
@@ -313,6 +324,7 @@ public void populateDisplay() {
appInst.nodeSelection,
appInst.edits,
this.appdb.getTodos()));
+ getListView().setSelection( displayIndex );
}
@Override
@@ -435,6 +447,7 @@ else if(requestCode == Encryption.DECRYPT_MESSAGE)
expandSelection(appInst.nodeSelection);
}
else {
+ displayIndex = appInst.lastIndex();
appInst.popSelection();
}
}
@@ -41,6 +41,12 @@ public void popSelection()
if (this.nodeSelection != null && this.nodeSelection.size() > 0)
this.nodeSelection.remove(nodeSelection.size()-1);
}
+
+ public int lastIndex() {
+ if (this.nodeSelection != null && this.nodeSelection.size() > 0)
+ return this.nodeSelection.get(nodeSelection.size()-1);
+ return 0;
+ }
public Node getSelectedNode()
{

0 comments on commit 9d95ed1

Please sign in to comment.