Search in sources :

Example 1 with SwipeButtonView

use of com.android.incallui.answer.impl.affordance.SwipeButtonView in project android_packages_apps_Dialer by LineageOS.

the class AnswerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Trace.beginSection("AnswerFragment.onCreateView");
    Bundle arguments = getArguments();
    Assert.checkState(arguments.containsKey(ARG_CALL_ID));
    Assert.checkState(arguments.containsKey(ARG_IS_RTT_CALL));
    Assert.checkState(arguments.containsKey(ARG_IS_VIDEO_CALL));
    Assert.checkState(arguments.containsKey(ARG_IS_VIDEO_UPGRADE_REQUEST));
    buttonAcceptClicked = false;
    buttonRejectClicked = false;
    View view = inflater.inflate(R.layout.fragment_incoming_call, container, false);
    secondaryButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button);
    answerAndReleaseButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button2);
    affordanceHolderLayout = (AffordanceHolderLayout) view.findViewById(R.id.incoming_container);
    affordanceHolderLayout.setAffordanceCallback(affordanceCallback);
    chipContainer = view.findViewById(R.id.incall_data_container_chip_container);
    importanceBadge = view.findViewById(R.id.incall_important_call_badge);
    importanceBadge.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            int leftRightPadding = importanceBadge.getHeight() / 2;
            importanceBadge.setPadding(leftRightPadding, importanceBadge.getPaddingTop(), leftRightPadding, importanceBadge.getPaddingBottom());
        }
    });
    updateImportanceBadgeVisibility();
    contactGridManager = new ContactGridManager(view, null, 0, false);
    boolean isInMultiWindowMode = getActivity().isInMultiWindowMode();
    contactGridManager.onMultiWindowModeChanged(isInMultiWindowMode);
    Fragment answerMethod = getChildFragmentManager().findFragmentById(R.id.answer_method_container);
    if (AnswerMethodFactory.needsReplacement(answerMethod)) {
        getChildFragmentManager().beginTransaction().replace(R.id.answer_method_container, AnswerMethodFactory.createAnswerMethod(getActivity())).commitNow();
    }
    answerScreenDelegate = FragmentUtils.getParentUnsafe(this, AnswerScreenDelegateFactory.class).newAnswerScreenDelegate(this);
    initSecondaryButton();
    initChips();
    int flags = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    if (!isInMultiWindowMode && (getActivity().checkSelfPermission(permission.STATUS_BAR) == PackageManager.PERMISSION_GRANTED)) {
        LogUtil.i("AnswerFragment.onCreateView", "STATUS_BAR permission granted, disabling nav bar");
        // These flags will suppress the alert that the activity is in full view mode
        // during an incoming call on a fresh system/factory reset of the app
        flags |= STATUS_BAR_DISABLE_BACK | STATUS_BAR_DISABLE_HOME | STATUS_BAR_DISABLE_RECENT;
    }
    view.setSystemUiVisibility(flags);
    if (isVideoCall() || isVideoUpgradeRequest()) {
        if (VideoUtils.hasCameraPermissionAndShownPrivacyToast(getContext())) {
            if (isSelfManagedCamera()) {
                answerVideoCallScreen = new SelfManagedAnswerVideoCallScreen(getCallId(), this, view);
            } else {
                answerVideoCallScreen = new AnswerVideoCallScreen(getCallId(), this, view);
            }
        } else {
            view.findViewById(R.id.videocall_video_off).setVisibility(View.VISIBLE);
        }
    }
    Trace.endSection();
    return view;
}
Also used : Bundle(android.os.Bundle) OnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener) ContactGridManager(com.android.incallui.contactgrid.ContactGridManager) ImageView(android.widget.ImageView) View(android.view.View) SwipeButtonView(com.android.incallui.answer.impl.affordance.SwipeButtonView) MultimediaFragment(com.android.incallui.sessiondata.MultimediaFragment) Fragment(android.support.v4.app.Fragment) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Bundle (android.os.Bundle)1 Fragment (android.support.v4.app.Fragment)1 View (android.view.View)1 OnGlobalLayoutListener (android.view.ViewTreeObserver.OnGlobalLayoutListener)1 ImageView (android.widget.ImageView)1 SwipeButtonView (com.android.incallui.answer.impl.affordance.SwipeButtonView)1 ContactGridManager (com.android.incallui.contactgrid.ContactGridManager)1 MultimediaFragment (com.android.incallui.sessiondata.MultimediaFragment)1