Loading res/menu/call_stats_details_options.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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> src/com/android/contacts/CallDetailActivity.java +1 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading src/com/android/contacts/calllog/ContactInfoHelper.java +22 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading @@ -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; Loading Loading @@ -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(); } } src/com/android/contacts/callstats/CallStatsDetailActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading
res/menu/call_stats_details_options.xml +5 −0 Original line number Diff line number Diff line Loading @@ -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>
src/com/android/contacts/CallDetailActivity.java +1 −11 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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() { Loading
src/com/android/contacts/calllog/ContactInfoHelper.java +22 −0 Original line number Diff line number Diff line Loading @@ -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; /** Loading @@ -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; Loading Loading @@ -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(); } }
src/com/android/contacts/callstats/CallStatsDetailActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -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) { Loading