Search in sources :

Example 1 with MultimediaData

use of com.android.dialer.multimedia.MultimediaData in project android_packages_apps_Dialer by LineageOS.

the class CallComposerActivity method placeRCSCall.

private void placeRCSCall(MultimediaData.Builder builder) {
    MultimediaData data = builder.build();
    LogUtil.i("CallComposerActivity.placeRCSCall", "placing enriched call, data: " + data);
    Logger.get(this).logImpression(DialerImpression.Type.CALL_COMPOSER_ACTIVITY_PLACE_RCS_CALL);
    getEnrichedCallManager().sendCallComposerData(sessionId, data);
    TelecomUtil.placeCall(this, new CallIntentBuilder(contact.getNumber(), CallInitiationType.Type.CALL_COMPOSER).build());
    setResult(RESULT_OK);
    SharedPreferences preferences = DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(this);
    // Show a toast for privacy purposes if this is the first time a user uses call composer.
    if (preferences.getBoolean(KEY_IS_FIRST_CALL_COMPOSE, true)) {
        int privacyMessage = data.hasImageData() ? R.string.image_sent_messages : R.string.message_sent_messages;
        Toast toast = Toast.makeText(this, privacyMessage, Toast.LENGTH_LONG);
        int yOffset = getResources().getDimensionPixelOffset(R.dimen.privacy_toast_y_offset);
        toast.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 0, yOffset);
        toast.show();
        preferences.edit().putBoolean(KEY_IS_FIRST_CALL_COMPOSE, false).apply();
    }
    finish();
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData) CallIntentBuilder(com.android.dialer.callintent.CallIntentBuilder) Toast(android.widget.Toast) SharedPreferences(android.content.SharedPreferences)

Example 2 with MultimediaData

use of com.android.dialer.multimedia.MultimediaData in project android_packages_apps_Dialer by LineageOS.

the class AnswerFragment method updateDataFragment.

private void updateDataFragment() {
    if (!isAdded()) {
        return;
    }
    LogUtil.enterBlock("AnswerFragment.updateDataFragment");
    Fragment current = getChildFragmentManager().findFragmentById(R.id.incall_data_container);
    Fragment newFragment = null;
    MultimediaData multimediaData = getSessionData();
    if (multimediaData != null && (!TextUtils.isEmpty(multimediaData.getText()) || (multimediaData.getImageUri() != null) || (multimediaData.getLocation() != null && canShowMap()))) {
        // Need message fragment
        String subject = multimediaData.getText();
        Uri imageUri = multimediaData.getImageUri();
        Location location = multimediaData.getLocation();
        if (!(current instanceof MultimediaFragment) || !Objects.equals(((MultimediaFragment) current).getSubject(), subject) || !Objects.equals(((MultimediaFragment) current).getImageUri(), imageUri) || !Objects.equals(((MultimediaFragment) current).getLocation(), location)) {
            LogUtil.i("AnswerFragment.updateDataFragment", "Replacing multimedia fragment");
            // Needs replacement
            newFragment = MultimediaFragment.newInstance(multimediaData, false, /* isInteractive */
            !primaryInfo.isSpam, /* showAvatar */
            primaryInfo.isSpam);
        }
    } else if (shouldShowAvatar()) {
        // Needs Avatar
        if (!(current instanceof AvatarFragment)) {
            LogUtil.i("AnswerFragment.updateDataFragment", "Replacing avatar fragment");
            // Needs replacement
            newFragment = new AvatarFragment();
        }
    } else {
        // Needs empty
        if (current != null) {
            LogUtil.i("AnswerFragment.updateDataFragment", "Removing current fragment");
            getChildFragmentManager().beginTransaction().remove(current).commitNow();
        }
        contactGridManager.setAvatarImageView(null, 0, false);
    }
    if (newFragment != null) {
        getChildFragmentManager().beginTransaction().replace(R.id.incall_data_container, newFragment).commitNow();
    }
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData) MultimediaFragment(com.android.incallui.sessiondata.MultimediaFragment) MultimediaFragment(com.android.incallui.sessiondata.MultimediaFragment) Fragment(android.support.v4.app.Fragment) Uri(android.net.Uri) Location(android.location.Location)

Example 3 with MultimediaData

use of com.android.dialer.multimedia.MultimediaData in project android_packages_apps_Dialer by LineageOS.

the class AnswerFragment method updateImportanceBadgeVisibility.

private void updateImportanceBadgeVisibility() {
    if (!isAdded() || getView() == null) {
        return;
    }
    if (!getResources().getBoolean(R.bool.answer_important_call_allowed) || primaryInfo.isSpam) {
        importanceBadge.setVisibility(View.GONE);
        return;
    }
    MultimediaData multimediaData = getSessionData();
    boolean showImportant = multimediaData != null && multimediaData.isImportant();
    TransitionManager.beginDelayedTransition((ViewGroup) importanceBadge.getParent());
    // TODO (keyboardr): Change this back to being View.INVISIBLE once mocks are available to
    // properly handle smaller screens
    importanceBadge.setVisibility(showImportant ? View.VISIBLE : View.GONE);
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData)

Example 4 with MultimediaData

use of com.android.dialer.multimedia.MultimediaData in project android_packages_apps_Dialer by LineageOS.

the class StatusBarNotifier method getECIncomingCallText.

private int getECIncomingCallText(Session session) {
    int resId;
    MultimediaData data = session.getMultimediaData();
    boolean hasImage = data.hasImageData();
    boolean hasSubject = !TextUtils.isEmpty(data.getText());
    boolean hasMap = data.getLocation() != null;
    if (data.isImportant()) {
        if (hasMap) {
            if (hasImage) {
                if (hasSubject) {
                    resId = R.string.important_notification_incoming_call_with_photo_message_location;
                } else {
                    resId = R.string.important_notification_incoming_call_with_photo_location;
                }
            } else if (hasSubject) {
                resId = R.string.important_notification_incoming_call_with_message_location;
            } else {
                resId = R.string.important_notification_incoming_call_with_location;
            }
        } else if (hasImage) {
            if (hasSubject) {
                resId = R.string.important_notification_incoming_call_with_photo_message;
            } else {
                resId = R.string.important_notification_incoming_call_with_photo;
            }
        } else if (hasSubject) {
            resId = R.string.important_notification_incoming_call_with_message;
        } else {
            resId = R.string.important_notification_incoming_call;
        }
        if (mContext.getString(resId).length() > 50) {
            resId = R.string.important_notification_incoming_call_attachments;
        }
    } else {
        if (hasMap) {
            if (hasImage) {
                if (hasSubject) {
                    resId = R.string.notification_incoming_call_with_photo_message_location;
                } else {
                    resId = R.string.notification_incoming_call_with_photo_location;
                }
            } else if (hasSubject) {
                resId = R.string.notification_incoming_call_with_message_location;
            } else {
                resId = R.string.notification_incoming_call_with_location;
            }
        } else if (hasImage) {
            if (hasSubject) {
                resId = R.string.notification_incoming_call_with_photo_message;
            } else {
                resId = R.string.notification_incoming_call_with_photo;
            }
        } else {
            resId = R.string.notification_incoming_call_with_message;
        }
    }
    if (mContext.getString(resId).length() > 50) {
        resId = R.string.notification_incoming_call_attachments;
    }
    return resId;
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData)

Example 5 with MultimediaData

use of com.android.dialer.multimedia.MultimediaData in project android_packages_apps_Dialer by LineageOS.

the class CallCardPresenter method updatePrimaryDisplayInfo.

private void updatePrimaryDisplayInfo() {
    if (mInCallScreen == null) {
        // TODO: May also occur if search result comes back after ui is destroyed. Look into
        // removing that case completely.
        LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "updatePrimaryDisplayInfo called but ui is null!");
        return;
    }
    if (mPrimary == null) {
        // Clear the primary display info.
        mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
        return;
    }
    // Hide the contact photo if we are in a video call and the incoming video surface is
    // showing.
    boolean showContactPhoto = !VideoCallPresenter.showIncomingVideo(mPrimary.getVideoState(), mPrimary.getState());
    // DialerCall placed through a work phone account.
    boolean hasWorkCallProperty = mPrimary.hasProperty(PROPERTY_ENTERPRISE_CALL);
    MultimediaData multimediaData = null;
    if (mPrimary.getEnrichedCallSession() != null) {
        multimediaData = mPrimary.getEnrichedCallSession().getMultimediaData();
    }
    if (mPrimary.isConferenceCall()) {
        LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for conference call.");
        mInCallScreen.setPrimary(new PrimaryInfo(null, /* number */
        CallerInfoUtils.getConferenceString(mContext, mPrimary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)), false, /* nameIsNumber */
        null, /* location */
        null, /* label */
        null, /* photo */
        ContactPhotoType.DEFAULT_PLACEHOLDER, false, /* isSipCall */
        showContactPhoto, hasWorkCallProperty, false, /* isSpam */
        false, /* answeringDisconnectsOngoingCall */
        shouldShowLocation(), null, /* contactInfoLookupKey */
        null, /* enrichedCallMultimediaData */
        mPrimary.getNumberPresentation()));
    } else if (mPrimaryContactInfo != null) {
        LogUtil.v("CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for " + mPrimaryContactInfo);
        String name = getNameForCall(mPrimaryContactInfo);
        String number;
        boolean isChildNumberShown = !TextUtils.isEmpty(mPrimary.getChildNumber());
        boolean isForwardedNumberShown = !TextUtils.isEmpty(mPrimary.getLastForwardedNumber());
        boolean isCallSubjectShown = shouldShowCallSubject(mPrimary);
        if (isCallSubjectShown) {
            number = null;
        } else if (isChildNumberShown) {
            number = mContext.getString(R.string.child_number, mPrimary.getChildNumber());
        } else if (isForwardedNumberShown) {
            // Use last forwarded number instead of second line, if present.
            number = mPrimary.getLastForwardedNumber();
        } else {
            number = mPrimaryContactInfo.number;
        }
        boolean nameIsNumber = name != null && name.equals(mPrimaryContactInfo.number);
        // DialerCall with caller that is a work contact.
        boolean isWorkContact = (mPrimaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK);
        mInCallScreen.setPrimary(new PrimaryInfo(number, mPrimary.updateNameIfRestricted(name), nameIsNumber, shouldShowLocationAsLabel(nameIsNumber, mPrimaryContactInfo.shouldShowLocation) ? mPrimaryContactInfo.location : null, isChildNumberShown || isCallSubjectShown ? null : mPrimaryContactInfo.label, mPrimaryContactInfo.photo, mPrimaryContactInfo.photoType, mPrimaryContactInfo.isSipCall, showContactPhoto, hasWorkCallProperty || isWorkContact, mPrimary.isSpam(), mPrimary.answeringDisconnectsForegroundVideoCall(), shouldShowLocation(), mPrimaryContactInfo.lookupKey, multimediaData, mPrimary.getNumberPresentation()));
    } else {
        // Clear the primary display info.
        mInCallScreen.setPrimary(PrimaryInfo.createEmptyPrimaryInfo());
    }
    if (isInCallScreenReady) {
        mInCallScreen.showLocationUi(getLocationFragment());
    } else {
        LogUtil.i("CallCardPresenter.updatePrimaryDisplayInfo", "UI not ready, not showing location");
    }
}
Also used : MultimediaData(com.android.dialer.multimedia.MultimediaData) PrimaryInfo(com.android.incallui.incall.protocol.PrimaryInfo)

Aggregations

MultimediaData (com.android.dialer.multimedia.MultimediaData)5 SharedPreferences (android.content.SharedPreferences)1 Location (android.location.Location)1 Uri (android.net.Uri)1 Fragment (android.support.v4.app.Fragment)1 Toast (android.widget.Toast)1 CallIntentBuilder (com.android.dialer.callintent.CallIntentBuilder)1 PrimaryInfo (com.android.incallui.incall.protocol.PrimaryInfo)1 MultimediaFragment (com.android.incallui.sessiondata.MultimediaFragment)1