Search in sources :

Example 1 with ContactGridManager

use of com.android.incallui.contactgrid.ContactGridManager in project android_packages_apps_Dialer by LineageOS.

the class SurfaceViewVideoCallFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
    LogUtil.i("SurfaceViewVideoCallFragment.onCreateView", null);
    View view = layoutInflater.inflate(R.layout.frag_videocall_surfaceview, viewGroup, false);
    contactGridManager = new ContactGridManager(view, null, /* no avatar */
    0, false);
    controls = view.findViewById(R.id.videocall_video_controls);
    controls.setVisibility(ActivityCompat.isInMultiWindowMode(getActivity()) ? View.GONE : View.VISIBLE);
    controlsContainer = view.findViewById(R.id.videocall_video_controls_container);
    speakerButton = (CheckableImageButton) view.findViewById(R.id.videocall_speaker_button);
    muteButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_button);
    muteButton.setOnCheckedChangeListener(this);
    mutePreviewOverlay = view.findViewById(R.id.videocall_video_preview_mute_overlay);
    cameraOffButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_video);
    cameraOffButton.setOnCheckedChangeListener(this);
    previewOffOverlay = view.findViewById(R.id.videocall_video_preview_off_overlay);
    swapCameraButton = (ImageButton) view.findViewById(R.id.videocall_switch_video);
    swapCameraButton.setOnClickListener(this);
    view.findViewById(R.id.videocall_switch_controls).setVisibility(ActivityCompat.isInMultiWindowMode(getActivity()) ? View.GONE : View.VISIBLE);
    switchOnHoldButton = view.findViewById(R.id.videocall_switch_on_hold);
    onHoldContainer = view.findViewById(R.id.videocall_on_hold_banner);
    remoteVideoOff = (TextView) view.findViewById(R.id.videocall_remote_video_off);
    remoteVideoOff.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
    endCallButton = view.findViewById(R.id.videocall_end_call);
    endCallButton.setOnClickListener(this);
    previewSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_preview);
    previewSurfaceView.setZOrderMediaOverlay(true);
    previewOffOverlay.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            checkCameraPermission();
        }
    });
    remoteSurfaceView = (SurfaceView) view.findViewById(R.id.videocall_video_remote);
    remoteSurfaceView.setOnClickListener(surfaceView -> {
        videoCallScreenDelegate.resetAutoFullscreenTimer();
        if (isInFullscreenMode) {
            updateFullscreenAndGreenScreenMode(false, /* shouldShowFullscreen */
            false);
        } else {
            updateFullscreenAndGreenScreenMode(true, /* shouldShowFullscreen */
            false);
        }
    });
    greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background);
    fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background);
    previewRoot = (FrameLayout) view.findViewById(R.id.videocall_preview_root);
    // We need the texture view size to be able to scale the remote video. At this point the view
    // layout won't be complete so add a layout listener.
    ViewTreeObserver observer = remoteSurfaceView.getViewTreeObserver();
    observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            LogUtil.i("SurfaceViewVideoCallFragment.onGlobalLayout", null);
            updateVideoOffViews();
            // Remove the listener so we don't continually re-layout.
            ViewTreeObserver observer = remoteSurfaceView.getViewTreeObserver();
            if (observer.isAlive()) {
                observer.removeOnGlobalLayoutListener(this);
            }
        }
    });
    return view;
}
Also used : OnClickListener(android.view.View.OnClickListener) ContactGridManager(com.android.incallui.contactgrid.ContactGridManager) SurfaceView(android.view.SurfaceView) View(android.view.View) TextView(android.widget.TextView) ViewTreeObserver(android.view.ViewTreeObserver) Nullable(android.support.annotation.Nullable)

Example 2 with ContactGridManager

use of com.android.incallui.contactgrid.ContactGridManager in project android_packages_apps_Dialer by LineageOS.

the class InCallFragment method onCreateView.

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
    LogUtil.i("InCallFragment.onCreateView", null);
    final View view = layoutInflater.inflate(R.layout.frag_incall_voice, viewGroup, false);
    contactGridManager = new ContactGridManager(view, (ImageView) view.findViewById(R.id.contactgrid_avatar), getResources().getDimensionPixelSize(R.dimen.incall_avatar_size), true);
    paginator = (InCallPaginator) view.findViewById(R.id.incall_paginator);
    pager = (LockableViewPager) view.findViewById(R.id.incall_pager);
    pager.setOnTouchListener((v, event) -> {
        handler.removeCallbacks(pagerRunnable);
        return false;
    });
    endCallButton = view.findViewById(R.id.incall_end_call);
    endCallButton.setOnClickListener(this);
    if (ContextCompat.checkSelfPermission(getContext(), permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
        voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
    } else {
        voiceNetworkType = VERSION.SDK_INT >= VERSION_CODES.N ? getContext().getSystemService(TelephonyManager.class).getVoiceNetworkType() : TelephonyManager.NETWORK_TYPE_UNKNOWN;
    }
    phoneType = getContext().getSystemService(TelephonyManager.class).getPhoneType();
    return view;
}
Also used : TelephonyManager(android.telephony.TelephonyManager) ContactGridManager(com.android.incallui.contactgrid.ContactGridManager) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 3 with ContactGridManager

use of com.android.incallui.contactgrid.ContactGridManager in project android_packages_apps_Dialer by LineageOS.

the class AnswerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Bundle arguments = getArguments();
    Assert.checkState(arguments.containsKey(ARG_CALL_ID));
    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);
    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);
    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();
    int flags = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    if (!ActivityCompat.isInMultiWindowMode(getActivity()) && (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);
        }
    }
    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)

Example 4 with ContactGridManager

use of com.android.incallui.contactgrid.ContactGridManager in project android_packages_apps_Dialer by LineageOS.

the class VideoCallFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
    LogUtil.i("VideoCallFragment.onCreateView", null);
    View view = layoutInflater.inflate(isLandscape() ? R.layout.frag_videocall_land : R.layout.frag_videocall, viewGroup, false);
    contactGridManager = new ContactGridManager(view, null, /* no avatar */
    0, false);
    controls = view.findViewById(R.id.videocall_video_controls);
    controls.setVisibility(ActivityCompat.isInMultiWindowMode(getActivity()) ? View.GONE : View.VISIBLE);
    controlsContainer = view.findViewById(R.id.videocall_video_controls_container);
    speakerButton = (CheckableImageButton) view.findViewById(R.id.videocall_speaker_button);
    muteButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_button);
    muteButton.setOnCheckedChangeListener(this);
    mutePreviewOverlay = view.findViewById(R.id.videocall_video_preview_mute_overlay);
    cameraOffButton = (CheckableImageButton) view.findViewById(R.id.videocall_mute_video);
    cameraOffButton.setOnCheckedChangeListener(this);
    previewOffOverlay = view.findViewById(R.id.videocall_video_preview_off_overlay);
    previewOffBlurredImageView = (ImageView) view.findViewById(R.id.videocall_preview_off_blurred_image_view);
    swapCameraButton = (ImageButton) view.findViewById(R.id.videocall_switch_video);
    swapCameraButton.setOnClickListener(this);
    view.findViewById(R.id.videocall_switch_controls).setVisibility(ActivityCompat.isInMultiWindowMode(getActivity()) ? View.GONE : View.VISIBLE);
    switchOnHoldButton = view.findViewById(R.id.videocall_switch_on_hold);
    onHoldContainer = view.findViewById(R.id.videocall_on_hold_banner);
    remoteVideoOff = (TextView) view.findViewById(R.id.videocall_remote_video_off);
    remoteVideoOff.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE);
    remoteOffBlurredImageView = (ImageView) view.findViewById(R.id.videocall_remote_off_blurred_image_view);
    endCallButton = view.findViewById(R.id.videocall_end_call);
    endCallButton.setOnClickListener(this);
    previewTextureView = (TextureView) view.findViewById(R.id.videocall_video_preview);
    previewTextureView.setClipToOutline(true);
    previewOffOverlay.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            checkCameraPermission();
        }
    });
    remoteTextureView = (TextureView) view.findViewById(R.id.videocall_video_remote);
    greenScreenBackgroundView = view.findViewById(R.id.videocall_green_screen_background);
    fullscreenBackgroundView = view.findViewById(R.id.videocall_fullscreen_background);
    remoteTextureView.addOnLayoutChangeListener(new OnLayoutChangeListener() {

        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            LogUtil.i("VideoCallFragment.onLayoutChange", "remoteTextureView layout changed");
            updateRemoteVideoScaling();
            updateRemoteOffView();
        }
    });
    previewTextureView.addOnLayoutChangeListener(new OnLayoutChangeListener() {

        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
            LogUtil.i("VideoCallFragment.onLayoutChange", "previewTextureView layout changed");
            updatePreviewVideoScaling();
            updatePreviewOffView();
        }
    });
    return view;
}
Also used : OnLayoutChangeListener(android.view.View.OnLayoutChangeListener) OnClickListener(android.view.View.OnClickListener) ContactGridManager(com.android.incallui.contactgrid.ContactGridManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) TextureView(android.view.TextureView) Point(android.graphics.Point) Nullable(android.support.annotation.Nullable)

Aggregations

View (android.view.View)4 ContactGridManager (com.android.incallui.contactgrid.ContactGridManager)4 Nullable (android.support.annotation.Nullable)3 ImageView (android.widget.ImageView)3 OnClickListener (android.view.View.OnClickListener)2 TextView (android.widget.TextView)2 SuppressLint (android.annotation.SuppressLint)1 Point (android.graphics.Point)1 Bundle (android.os.Bundle)1 Fragment (android.support.v4.app.Fragment)1 TelephonyManager (android.telephony.TelephonyManager)1 SurfaceView (android.view.SurfaceView)1 TextureView (android.view.TextureView)1 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)1 ViewTreeObserver (android.view.ViewTreeObserver)1 OnGlobalLayoutListener (android.view.ViewTreeObserver.OnGlobalLayoutListener)1 SwipeButtonView (com.android.incallui.answer.impl.affordance.SwipeButtonView)1 MultimediaFragment (com.android.incallui.sessiondata.MultimediaFragment)1