From db9c133f880ed13895cabdc78430dc63bfd18de5 Mon Sep 17 00:00:00 2001 From: "Brandyn A. White" Date: Fri, 28 Feb 2014 17:12:15 -0500 Subject: [PATCH] Added a flag that can be used when we should ignore select. It's a hack but it's unclear what would be better Signed-off-by: Brandyn A. White --- Lib/src/main/java/com/kelsonprime/cardtree/Tree.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/src/main/java/com/kelsonprime/cardtree/Tree.java b/Lib/src/main/java/com/kelsonprime/cardtree/Tree.java index dc24bfe..6d61a9f 100644 --- a/Lib/src/main/java/com/kelsonprime/cardtree/Tree.java +++ b/Lib/src/main/java/com/kelsonprime/cardtree/Tree.java @@ -25,6 +25,7 @@ public class Tree extends CardScrollView { private Stack backPositionStack; private Activity activity; private AudioManager systemAudio; + private boolean ignoreSelect; /** * Create a tree with an empty root level. @@ -32,6 +33,7 @@ public class Tree extends CardScrollView { */ public Tree(Activity activity) { super(activity); + this.ignoreSelect = false; this.activity = activity; this.systemAudio = (android.media.AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); this.backStack = new Stack(); @@ -122,10 +124,17 @@ public void back() { private void setLevel(Level level){ setLevel(level, level.getStartPosition()); } + + public boolean getIgnoreSelect() { + return ignoreSelect; + } + private void setLevel(Level level, Integer position) { + ignoreSelect = true; this.currentLevel = level; adapter.setCurrentLevel(level); setSelection(position); + ignoreSelect = false; this.updateViews(true); }