Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a flag that can be used when we should ignore select. #5

Merged
merged 1 commit into from
Feb 28, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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