Search in sources :

Example 1 with VisualVoicemailEnabledChecker

use of com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker in project android_packages_apps_Dialer by LineageOS.

the class BlockedNumbersFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    getListView().addHeaderView(inflater.inflate(R.layout.blocked_number_header, null));
    getListView().addFooterView(inflater.inflate(R.layout.blocked_number_footer, null));
    // replace the icon for add number with LetterTileDrawable(), so it will have identical style
    ImageView addNumberIcon = (ImageView) getActivity().findViewById(R.id.add_number_icon);
    LetterTileDrawable drawable = new LetterTileDrawable(getResources());
    drawable.setLetter(ADD_BLOCKED_NUMBER_ICON_LETTER);
    drawable.setColor(ActivityCompat.getColor(getActivity(), R.color.add_blocked_number_icon_color));
    drawable.setIsCircular(true);
    addNumberIcon.setImageDrawable(drawable);
    if (mAdapter == null) {
        mAdapter = BlockedNumbersAdapter.newBlockedNumbersAdapter(getContext(), getActivity().getFragmentManager());
    }
    setListAdapter(mAdapter);
    blockedNumbersText = (TextView) getListView().findViewById(R.id.blocked_number_text_view);
    migratePromoView = getListView().findViewById(R.id.migrate_promo);
    getListView().findViewById(R.id.migrate_promo_allow_button).setOnClickListener(this);
    mImportSettings = getListView().findViewById(R.id.import_settings);
    mBlockedNumbersDisabledForEmergency = getListView().findViewById(R.id.blocked_numbers_disabled_for_emergency);
    mBlockedNumberListDivider = getActivity().findViewById(R.id.blocked_number_list_divider);
    getListView().findViewById(R.id.import_button).setOnClickListener(this);
    getListView().findViewById(R.id.view_numbers_button).setOnClickListener(this);
    getListView().findViewById(R.id.add_number_linear_layout).setOnClickListener(this);
    footerText = (TextView) getActivity().findViewById(R.id.blocked_number_footer_textview);
    mVoicemailEnabledChecker = new VisualVoicemailEnabledChecker(getContext(), this);
    mVoicemailEnabledChecker.asyncUpdate();
    updateActiveVoicemailProvider();
}
Also used : VisualVoicemailEnabledChecker(com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker) LayoutInflater(android.view.LayoutInflater) LetterTileDrawable(com.android.contacts.common.lettertiles.LetterTileDrawable) ImageView(android.widget.ImageView)

Example 2 with VisualVoicemailEnabledChecker

use of com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker in project android_packages_apps_Dialer by LineageOS.

the class BlockNumberDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    super.onCreateDialog(savedInstanceState);
    final boolean isBlocked = getArguments().containsKey(ARG_BLOCK_ID);
    mNumber = getArguments().getString(ARG_NUMBER);
    mDisplayNumber = getArguments().getString(ARG_DISPLAY_NUMBER);
    mCountryIso = getArguments().getString(ARG_COUNTRY_ISO);
    if (TextUtils.isEmpty(mDisplayNumber)) {
        mDisplayNumber = mNumber;
    }
    mHandler = new FilteredNumberAsyncQueryHandler(getContext());
    mVoicemailEnabledChecker = new VisualVoicemailEnabledChecker(getActivity(), null);
    // Choose not to update VoicemailEnabledChecker, as checks should already been done in
    // all current use cases.
    mParentView = getActivity().findViewById(getArguments().getInt(ARG_PARENT_VIEW_ID));
    CharSequence title;
    String okText;
    String message;
    if (isBlocked) {
        title = null;
        okText = getString(R.string.unblock_number_ok);
        message = ContactDisplayUtils.getTtsSpannedPhoneNumber(getResources(), R.string.unblock_number_confirmation_title, mDisplayNumber).toString();
    } else {
        title = ContactDisplayUtils.getTtsSpannedPhoneNumber(getResources(), R.string.block_number_confirmation_title, mDisplayNumber);
        okText = getString(R.string.block_number_ok);
        if (FilteredNumberCompat.useNewFiltering(getContext())) {
            message = getString(R.string.block_number_confirmation_message_new_filtering);
        } else if (mVoicemailEnabledChecker.isVisualVoicemailEnabled()) {
            message = getString(R.string.block_number_confirmation_message_vvm);
        } else {
            message = getString(R.string.block_number_confirmation_message_no_vvm);
        }
    }
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message).setPositiveButton(okText, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int id) {
            if (isBlocked) {
                unblockNumber();
            } else {
                blockNumber();
            }
        }
    }).setNegativeButton(android.R.string.cancel, null);
    return builder.create();
}
Also used : AlertDialog(android.app.AlertDialog) VisualVoicemailEnabledChecker(com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker) DialogInterface(android.content.DialogInterface)

Aggregations

VisualVoicemailEnabledChecker (com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 LayoutInflater (android.view.LayoutInflater)1 ImageView (android.widget.ImageView)1 LetterTileDrawable (com.android.contacts.common.lettertiles.LetterTileDrawable)1