Skip to content

Commit

Permalink
Add clear log to options menu on log tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ChainsDD committed Sep 5, 2010
1 parent 2528b65 commit 4d3f2a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Binary file added res/drawable-hdpi/ic_menu_clear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable/ic_menu_clear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/com/noshufou/android/su/LogActivity.java
Expand Up @@ -6,6 +6,8 @@
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
Expand All @@ -22,6 +24,8 @@

public class LogActivity extends ListActivity {
// private static final String TAG = "Su.LogActivity";

private static final int MENU_CLEAR_LOG = 1;

private DBHelper mDB;
private Cursor mCursor;
Expand Down Expand Up @@ -56,6 +60,23 @@ public void onDestroy() {
super.onDestroy();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(Menu.NONE, MENU_CLEAR_LOG, Menu.NONE, R.string.pref_clear_log)
.setIcon(R.drawable.ic_menu_clear);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == MENU_CLEAR_LOG) {
mDB.clearLog();
refreshList();
return true;
}
return false;
}

private void setupListView() {
final ListView list = getListView();
final LayoutInflater inflater = getLayoutInflater();
Expand Down

0 comments on commit 4d3f2a3

Please sign in to comment.