-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a00bd47
commit e5a75d6
Showing
12 changed files
with
124 additions
and
42 deletions.
There are no files selected for viewing
39 changes: 20 additions & 19 deletions
39
Example/src/main/java/com/kelsonprime/cardtree/example/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:id="@+id/exit" | ||
android:title="Exit" /> | ||
</menu> |
53 changes: 53 additions & 0 deletions
53
Lib/src/main/java/com/kelsonprime/cardtree/CardTreeActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.kelsonprime.cardtree; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
|
||
/** | ||
* Created by kurt on 12/16/13. | ||
*/ | ||
public class CardTreeActivity extends Activity { | ||
private String TAG = "CardTreeActivity"; | ||
private Tree tree; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
tree = new Tree(this); | ||
} | ||
|
||
protected Tree getTree(){ | ||
return tree; | ||
} | ||
|
||
/** | ||
* Kind of dirty hack to allow swipe down to go back. | ||
*/ | ||
@Override | ||
public void onBackPressed() { | ||
Log.d(TAG, "Back pressed"); | ||
if(tree.isRootCurrent()){ | ||
super.onBackPressed(); | ||
}else{ | ||
tree.back(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onPrepareOptionsMenu(Menu menu) { | ||
if(getCurrentNode().hasMenu()){ | ||
menu.clear(); | ||
Integer activeMenu = getCurrentNode().getMenuRes(); | ||
getMenuInflater().inflate(activeMenu, menu); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
private Node getCurrentNode(){ | ||
return getTree().getCurrentNode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.