Skip to content

Commit

Permalink
Add custom back press
Browse files Browse the repository at this point in the history
1. return to list state
2. if not pass event to parent
  • Loading branch information
chao-zhou committed Apr 20, 2012
1 parent e26e04b commit cbff535
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/com/utopia/lijiang/LijiangActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class LijiangActivity extends Activity {
private ListView listView = null;
private View emptyView = null;
AlarmManager alarmMgr = null;

/**
* Singleton method, this will be update after this activity is launched
* @return The Latest showed LijiangActivity
Expand Down Expand Up @@ -81,7 +81,26 @@ public void onDestroy(){

alarmMgr.save2DB(this);
}



/*
* Pass the Back Press event to parent
* @see android.app.Activity#onBackPressed()
*/
@Override
public void onBackPressed() {
if(viewState == STATE_EDIT){
setListViewState(STATE_LIST);
return;
}

Activity parent = this.getParent();
if(parent != null){
parent.onBackPressed();
}
}


/** Do work after showAddAlarm button is clicked
* @param target trigger
* */
Expand Down Expand Up @@ -154,6 +173,7 @@ private void refreshList(){
setListViewState(getListViewState());
}


//--------------------------
// Show alarming alarms
//--------------------------
Expand Down

0 comments on commit cbff535

Please sign in to comment.