File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
src/com/noshufou/android/su Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 66import android .graphics .Color ;
77import android .os .Bundle ;
88import android .view .LayoutInflater ;
9+ import android .view .Menu ;
10+ import android .view .MenuItem ;
911import android .view .View ;
1012import android .view .ViewGroup ;
1113import android .widget .AbsListView ;
2224
2325public class LogActivity extends ListActivity {
2426// private static final String TAG = "Su.LogActivity";
27+
28+ private static final int MENU_CLEAR_LOG = 1 ;
2529
2630 private DBHelper mDB ;
2731 private Cursor mCursor ;
@@ -56,6 +60,23 @@ public void onDestroy() {
5660 super .onDestroy ();
5761 }
5862
63+ @ Override
64+ public boolean onCreateOptionsMenu (Menu menu ) {
65+ menu .add (Menu .NONE , MENU_CLEAR_LOG , Menu .NONE , R .string .pref_clear_log )
66+ .setIcon (R .drawable .ic_menu_clear );
67+ return true ;
68+ }
69+
70+ @ Override
71+ public boolean onOptionsItemSelected (MenuItem item ) {
72+ if (item .getItemId () == MENU_CLEAR_LOG ) {
73+ mDB .clearLog ();
74+ refreshList ();
75+ return true ;
76+ }
77+ return false ;
78+ }
79+
5980 private void setupListView () {
6081 final ListView list = getListView ();
6182 final LayoutInflater inflater = getLayoutInflater ();
You can’t perform that action at this time.
0 commit comments