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

Commit afad3274 authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Allow blacklisting numbers from the call stats details menu." into cm-10.1

parents 8b3ede97 a0a47148
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -19,4 +19,9 @@
        android:title="@string/recentCalls_editNumberBeforeCall"
        android:onClick="onMenuEditNumberBeforeCall"
    />
    <item
        android:id="@+id/menu_add_to_blacklist"
        android:title="@string/menu_add_to_blacklist"
        android:onClick="onMenuAddToBlacklist"
    />
</menu>
+1 −11
Original line number Diff line number Diff line
@@ -87,10 +87,6 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
    /** If the activity was triggered from a notification. */
    public static final String EXTRA_FROM_NOTIFICATION = "EXTRA_FROM_NOTIFICATION";

    // Blacklist support
    private static final String INSERT_BLACKLIST = "com.android.phone.INSERT_BLACKLIST";
    private static final String BLACKLIST_NUMBER = "number";

    private CallDetailHeader mCallDetailHeader;
    private CallTypeHelper mCallTypeHelper;
    private PhoneNumberHelper mPhoneNumberHelper;
@@ -576,13 +572,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware
    }

    public void onMenuAddToBlacklist(MenuItem menuItem) {
        Intent intent = new Intent(INSERT_BLACKLIST);
        intent.putExtra(BLACKLIST_NUMBER, mNumber);
        sendBroadcast(intent);

        // Give the user some feedback
        String message = getResources().getString(R.string.toast_added_to_blacklist, mNumber);
        Toast.makeText(CallDetailActivity.this, message, Toast.LENGTH_SHORT).show();
        mContactInfoHelper.addNumberToBlacklist(mNumber);
    }

    private void configureActionBar() {
+22 −0
Original line number Diff line number Diff line
@@ -17,13 +17,16 @@
package com.android.contacts.calllog;

import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.widget.Toast;

import com.android.contacts.R;
import com.android.contacts.util.UriUtils;

/**
@@ -33,6 +36,10 @@ public class ContactInfoHelper {
    private final Context mContext;
    private final String mCurrentCountryIso;

    // Blacklist support
    private static final String INSERT_BLACKLIST = "com.android.phone.INSERT_BLACKLIST";
    private static final String BLACKLIST_NUMBER = "number";

    public ContactInfoHelper(Context context, String currentCountryIso) {
        mContext = context;
        mCurrentCountryIso = currentCountryIso;
@@ -212,4 +219,19 @@ public class ContactInfoHelper {
        }
        return PhoneNumberUtils.formatNumber(number, normalizedNumber, countryIso);
    }

    /**
     * Requests the given number to be added to the phone blacklist
     *
     * @param number the number to be blacklisted
     */
    public void addNumberToBlacklist(String number) {
                Intent intent = new Intent(INSERT_BLACKLIST);
        intent.putExtra(BLACKLIST_NUMBER, number);
        mContext.sendBroadcast(intent);

        // Give the user some feedback
        String message = mContext.getString(R.string.toast_added_to_blacklist, number);
        Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -248,6 +248,10 @@ public class CallStatsDetailActivity extends Activity {
        startActivity(new Intent(Intent.ACTION_DIAL, ContactsUtils.getCallUri(mNumber)));
    }

    public void onMenuAddToBlacklist(MenuItem menuItem) {
        mContactInfoHelper.addNumberToBlacklist(mNumber);
    }

    private void configureActionBar() {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {