use of com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnBlockNumberListener in project android_packages_apps_Dialer by MoKee.
the class BlockNumberDialogFragment method blockNumber.
private void blockNumber() {
final CharSequence message = getBlockedMessage();
final CharSequence undoMessage = getUnblockedMessage();
final Callback callback = mCallback;
final int actionTextColor = getActionTextColor();
final Context context = getContext();
final OnUnblockNumberListener onUndoListener = new OnUnblockNumberListener() {
@Override
public void onUnblockComplete(int rows, ContentValues values) {
if (mParentView != null) {
Snackbar.make(mParentView, undoMessage, Snackbar.LENGTH_LONG).show();
}
if (callback != null) {
callback.onChangeFilteredNumberUndo();
}
}
};
final OnBlockNumberListener onBlockNumberListener = new OnBlockNumberListener() {
@Override
public void onBlockComplete(final Uri uri) {
final View.OnClickListener undoListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
// Delete the newly created row on 'undo'.
Logger.logInteraction(InteractionEvent.UNDO_BLOCK_NUMBER);
mHandler.unblock(onUndoListener, uri);
}
};
if (mParentView != null) {
Snackbar.make(mParentView, message, Snackbar.LENGTH_LONG).setAction(R.string.block_number_undo, undoListener).setActionTextColor(actionTextColor).show();
}
if (callback != null) {
callback.onFilterNumberSuccess();
}
if (context != null && FilteredNumbersUtil.hasRecentEmergencyCall(context)) {
FilteredNumbersUtil.maybeNotifyCallBlockingDisabled(context);
}
}
};
mHandler.blockNumber(onBlockNumberListener, mNumber, mCountryIso);
}
use of com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnBlockNumberListener in project android_packages_apps_Dialer by MoKee.
the class BlockNumberDialogFragment method unblockNumber.
private void unblockNumber() {
final CharSequence message = getUnblockedMessage();
final CharSequence undoMessage = getBlockedMessage();
final Callback callback = mCallback;
final int actionTextColor = getActionTextColor();
final OnBlockNumberListener onUndoListener = new OnBlockNumberListener() {
@Override
public void onBlockComplete(final Uri uri) {
if (mParentView != null) {
Snackbar.make(mParentView, undoMessage, Snackbar.LENGTH_LONG).show();
}
if (callback != null) {
callback.onChangeFilteredNumberUndo();
}
}
};
mHandler.unblock(new OnUnblockNumberListener() {
@Override
public void onUnblockComplete(int rows, final ContentValues values) {
final View.OnClickListener undoListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
// Re-insert the row on 'undo', with a new ID.
Logger.logInteraction(InteractionEvent.UNDO_UNBLOCK_NUMBER);
mHandler.blockNumber(onUndoListener, values);
}
};
if (mParentView != null) {
Snackbar.make(mParentView, message, Snackbar.LENGTH_LONG).setAction(R.string.block_number_undo, undoListener).setActionTextColor(actionTextColor).show();
}
if (callback != null) {
callback.onUnfilterNumberSuccess();
}
}
}, getArguments().getInt(ARG_BLOCK_ID));
}
Aggregations