Skip to content

Commit

Permalink
Merge pull request #5 from wearscript/master
Browse files Browse the repository at this point in the history
Added a flag that can be used when we should ignore select.
  • Loading branch information
kurtisnelson committed Feb 28, 2014
2 parents 7eca007 + db9c133 commit 7ec1690
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/src/main/java/com/kelsonprime/cardtree/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ public class Tree extends CardScrollView {
private Stack<Integer> backPositionStack;
private Activity activity;
private AudioManager systemAudio;
private boolean ignoreSelect;

/**
* Create a tree with an empty root level.
* @param activity
*/
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<Level>();
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 7ec1690

Please sign in to comment.