Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d403c66 authored by Wysie's avatar Wysie
Browse files

Release 1.3. Added prompt before clearing call log.

parent 0e8b02b6
Loading
Loading
Loading
Loading
+1 B (908 B)
Loading image diff...
+26 −4
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ import android.widget.TextView;
import android.app.Dialog;
import android.widget.Button;
import android.view.View.OnClickListener;
import android.app.AlertDialog;
import android.content.DialogInterface;

import com.android.internal.telephony.CallerInfo;
import com.android.internal.telephony.ITelephony;
@@ -790,10 +792,7 @@ public class RecentCallsListActivity extends ListActivity
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case MENU_ITEM_DELETE_ALL: {
                getContentResolver().delete(Calls.CONTENT_URI, null, null);
                //TODO The change notification should do this automatically, but it isn't working
                // right now. Remove this when the change notification is working properly.
                startQuery();
                clearCallLog();
                return true;
            }
            case MENU_ITEM_TOTAL_CALL_LOG: {
@@ -958,6 +957,29 @@ public class RecentCallsListActivity extends ListActivity
        startActivity(intent);
    }
    
    //Wysie_Soh: Dialog to confirm if user wants to clear call log    
    private void clearCallLog() {
    	AlertDialog.Builder alert = new AlertDialog.Builder(this);
    	alert.setTitle("Clear call log");
    	alert.setMessage("Are you sure you want to clear all call records?");
    	
    	alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
    		public void onClick(DialogInterface dialog, int whichButton) {
    			getContentResolver().delete(Calls.CONTENT_URI, null, null);
                	//TODO The change notification should do this automatically, but it isn't working
                	// right now. Remove this when the change notification is working properly.
                	startQuery();
    		}
    	});
    	
    	alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
    		public void onClick(DialogInterface dialog, int whichButton) {
    			// Canceled.
    	}});
    	
    	alert.show();
    }
    
    private void showTotalCallLog() {
    	final Dialog dialog = new Dialog(this);
    	dialog.setContentView(R.layout.total_call_log);