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;
}
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;
}
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;
}
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;
}
Aggregations