Permalink
Browse files

View as document if there are no more layers to drill into.

  • Loading branch information...
1 parent 438596c commit 68d593a1f6966feb0c2d0e78a1095c5d900b9fce @matburt committed Feb 25, 2010
Showing with 21 additions and 2 deletions.
  1. +21 −2 src/com/matburt/mobileorg/MobileOrgActivity.java
@@ -172,8 +172,27 @@ public void onListItemClick(ListView l, View v, int position, long id) {
}
appInst.nodeSelection.add(new Integer(position));
- dispIntent.putIntegerArrayListExtra("nodePath", appInst.nodeSelection);
- startActivityForResult(dispIntent, 1);
+
+ 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 (thisNode.subNodes.size() < 1) {
+ Intent textIntent = new Intent();
+
+ String docBuffer = thisNode.nodeName + "\n\n" +
+ thisNode.nodePayload;
+ textIntent.setClassName("com.matburt.mobileorg",
+ "com.matburt.mobileorg.SimpleTextDisplay");
+ textIntent.putExtra("txtValue", docBuffer);
+ startActivity(textIntent);
+ }
+ else {
+ dispIntent.putIntegerArrayListExtra("nodePath", appInst.nodeSelection);
+ startActivityForResult(dispIntent, 1);
+ }
}
@Override

0 comments on commit 68d593a

Please sign in to comment.