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

Commit d44b1367 authored by jp's avatar jp
Browse files

add ability to send number to phone for blacklist

parent a1528d2b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -362,6 +362,9 @@
    <!-- Menu item used to copy a number from the call log to the dialer so it can be edited before calling it -->
    <string name="recentCalls_editNumberBeforeCall">Edit number before call</string>

    <!--Menu item used to add a number from the call log to Blacklist  -->
    <string name="recentCalls_addToBlacklist">Add to Blacklist</string>
    
    <!-- Menu item used to add a number from the call log to contacts -->
    <string name="recentCalls_addToContact">Add to contacts</string>

+11 −2
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ public class RecentCallsListActivity extends ListActivity
    static final int CALLER_NAME_COLUMN_INDEX = 5;
    static final int CALLER_NUMBERTYPE_COLUMN_INDEX = 6;
    static final int CALLER_NUMBERLABEL_COLUMN_INDEX = 7;
    static final int MENU_ITEM_BLACKLIST = 666;

    /** The projection to use when querying the phones table */
    static final String[] PHONES_PROJECTION = new String[] {
@@ -184,6 +185,8 @@ public class RecentCallsListActivity extends ListActivity
    private static boolean isQuickContact;
    private static boolean showDialButton;

    private static final String INSERT_BLACKLIST = "com.android.phone.INSERT_BLACKLIST";

    private ContactPhotoLoader mPhotoLoader;

    static final class ContactInfo {
@@ -1124,6 +1127,7 @@ public class RecentCallsListActivity extends ListActivity
            intent.putExtra(Insert.PHONE, number);
            menu.add(0, 0, 0, R.string.recentCalls_addToContact)
                    .setIntent(intent);
	    menu.add(0, MENU_ITEM_BLACKLIST, 0, R.string.recentCalls_addToBlacklist);
        }
        menu.add(0, MENU_ITEM_DELETE, 0, R.string.recentCalls_removeFromRecentList);
    }
@@ -1187,9 +1191,9 @@ public class RecentCallsListActivity extends ListActivity
            return false;
        }

        Cursor cursor = (Cursor)mAdapter.getItem(menuInfo.position);
        switch (item.getItemId()) {
            case MENU_ITEM_DELETE: {
                Cursor cursor = (Cursor)mAdapter.getItem(menuInfo.position);
                int groupSize = 1;
                if (mAdapter.isGroupHeader(menuInfo.position)) {
                    groupSize = mAdapter.getGroupSize(menuInfo.position);
@@ -1207,7 +1211,12 @@ public class RecentCallsListActivity extends ListActivity

                getContentResolver().delete(Calls.CONTENT_URI, Calls._ID + " IN (" + sb + ")",
                        null);
            }
            }break;
	    case MENU_ITEM_BLACKLIST: {
	    	Intent intent = new Intent(INSERT_BLACKLIST);
		intent.putExtra("Insert.BLACKLIST", cursor.getString(NUMBER_COLUMN_INDEX));
		sendBroadcast(intent);
 	    }break;
        }
        return super.onContextItemSelected(item);
    }