use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.
the class CameraStoryFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getEventManager().addObserver(EventManager.ON_VOLUME_DOWN_KEY, this);
galleryIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onGalleryIconClicked.onGalleryIconClicked();
}
});
checkFlashMode();
flashModeButton = new ImageView(context);
flashModeButton.setScaleType(ImageView.ScaleType.CENTER);
topToolPanel.addView(flashModeButton, LayoutCreator.createFrame(48, 48, Gravity.LEFT | Gravity.CENTER_VERTICAL));
flashModeButton.setOnClickListener(currentImage -> {
if (cameraView == null || !cameraView.isInitied()) {
return;
}
String current = cameraView.getCameraSession().getCurrentFlashMode();
String next = cameraView.getCameraSession().getNextFlashMode();
if (current.equals(next)) {
return;
}
cameraView.getCameraSession().setCurrentFlashMode(next);
setCameraFlashModeIcon(flashModeButton, next);
});
flashModeButton.setContentDescription("flash mode ");
takePicture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String fileName = "story_" + HelperString.getRandomFileName(3) + ".jpg";
File cameraFile = null;
try {
cameraFile = new AttachFile(getActivity()).createImageFile();
} catch (IOException e) {
e.printStackTrace();
}
File finalCameraFile = cameraFile;
CameraController.getInstance().takePicture(cameraFile, cameraView.getCameraSession(), () -> {
if (finalCameraFile == null || getActivity() == null) {
return;
}
int orientation = 0;
try {
ExifInterface ei = new ExifInterface(finalCameraFile.getAbsolutePath());
int exif = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch(exif) {
case ExifInterface.ORIENTATION_ROTATE_90:
orientation = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
orientation = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
orientation = 270;
break;
}
} catch (Exception e) {
FileLog.e(e);
}
// CameraController.getInstance().initCamera(null);
cameraView.initCamera();
ImageHelper.correctRotateImage(finalCameraFile.getAbsolutePath(), true);
FragmentEditImage.checkItemGalleryList();
FragmentEditImage.insertItemList(finalCameraFile.getAbsolutePath(), true);
if (getActivity() != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), PhotoViewer.newInstance(finalCameraFile.getAbsolutePath(), isForRoom, roomId, listMode, roomTitle)).setReplace(false).load();
}
});
}
});
switchCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cameraView.switchCamera();
ObjectAnimator animator = ObjectAnimator.ofFloat(switchCamera, View.SCALE_X, 0.0f).setDuration(100);
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
switchCamera.setImageResource(cameraView != null && cameraView.isFrontface() ? R.drawable.camera_revert1 : R.drawable.camera_revert2);
ObjectAnimator.ofFloat(switchCamera, View.SCALE_X, 1.0f).setDuration(100).start();
}
});
animator.start();
}
});
if (checkCameraHardware(getContext())) {
if (allPermissionsGranted()) {
CameraController.getInstance().initCamera(null);
// switchCamera.setVisibility(cameraView.hasFrontFaceCamera() ? View.VISIBLE : View.INVISIBLE);
showCamera();
} else {
try {
HelperPermission.getCameraPermission(getContext(), new OnGetPermission() {
@Override
public void Allow() throws IOException {
HelperPermission.getStoragePermission(getContext(), new OnGetPermission() {
@Override
public void Allow() throws IOException {
if (checkCameraHardware(getContext())) {
CameraController.getInstance().initCamera(null);
// switchCamera.setVisibility(cameraView.hasFrontFaceCamera() ? View.VISIBLE : View.INVISIBLE);
showCamera();
}
}
@Override
public void deny() {
}
});
}
@Override
public void deny() {
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
Toast.makeText(getContext(), getString(R.string.your_device_does_not_have_a_camera), Toast.LENGTH_LONG).show();
}
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new HelperFragment(Objects.requireNonNull(getActivity()).getSupportFragmentManager(), CameraStoryFragment.this).popBackStack();
}
});
}
use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.
the class ActivityCrop method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_crop);
attachFile = new AttachFile(this);
ProgressBar prgWaiting = (ProgressBar) findViewById(R.id.crop_prgWaiting);
AppUtils.setProgresColler(prgWaiting);
imgPic = (ImageView) findViewById(R.id.pu_img_imageBefore);
TextView txtAgreeImage = (TextView) findViewById(R.id.pu_txt_agreeImage);
TextView txtCancel = (TextView) findViewById(R.id.pu_txt_cancel_crop);
txtSet = (TextView) findViewById(R.id.pu_txt_set_crop);
final Bundle bundle = getIntent().getExtras();
if (bundle != null) {
path = bundle.getString("IMAGE_CAMERA");
String newPath = "file://" + path;
uri = Uri.parse(newPath);
page = bundle.getString("PAGE");
type = bundle.getString("TYPE");
id = bundle.getInt("ID");
}
if (uri != null || path != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
G.imageLoader.displayImage(AndroidUtils.suitablePath(path), imgPic);
} else {
G.imageLoader.displayImage(AndroidUtils.suitablePath(uri.getPath()), imgPic);
}
prgWaiting.setVisibility(View.GONE);
}
RippleView rippleCrop = (RippleView) findViewById(R.id.pu_ripple_crop);
TextView txtCrop = (TextView) findViewById(R.id.pu_txt_crop);
/*
open crop page
*/
if (uri != null && !uri.toString().equals("")) {
rippleCrop.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) {
nzmeFile = path.substring(path.lastIndexOf("/"));
String newPath = "file://" + path;
Uri uri = Uri.parse(newPath);
UCrop.Options options = new UCrop.Options();
options.setStatusBarColor(ContextCompat.getColor(G.context, R.color.black));
options.setToolbarColor(ContextCompat.getColor(G.context, R.color.black));
options.setCompressionQuality(80);
UCrop.of(uri, Uri.fromFile(new File(G.context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath(), nzmeFile))).withAspectRatio(16, 9).withOptions(options).start(ActivityCrop.this);
}
});
}
RippleView rippleBack = (RippleView) findViewById(R.id.pu_ripple_back);
rippleBack.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
@Override
public void onComplete(RippleView rippleView) throws IOException {
if (type.equals("camera") || type.equals("crop_camera")) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
new AttachFile(ActivityCrop.this).dispatchTakePictureIntent();
} else {
new AttachFile(ActivityCrop.this).requestTakePicture();
}
} else if (type.equals("gallery")) {
attachFile.requestOpenGalleryForImageMultipleSelect();
}
}
});
txtCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
txtSet.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (uri != null && type.equals("crop_camera")) {
pathImageUser = getRealPathFromURI(uri);
result = G.imageFile.toString() + "_" + id + ".jpg";
HelperCopyFile.copyFile(pathImageUser, result);
} else {
result = getRealPathFromURI(uri);
}
if (page != null) {
Intent data = new Intent();
data.setData(Uri.parse(result));
setResult(Activity.RESULT_OK, data);
finish();
}
}
});
}
use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.
the class FragmentGroupProfile method onViewCreated.
@Override
public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
isNeedResume = true;
// because actionbar not in this view do that and not correct in viewModel
imvGroupAvatar = binding.toolbarAvatar;
imvGroupAvatar.setOnClickListener(v -> viewModel.onClickRippleGroupAvatar());
if (currentRoomAccess != null) {
checkRoomAccess(currentRoomAccess);
roomAccessChangeListener = (realmRoomAccess, changeSet) -> checkRoomAccess(realmRoomAccess);
currentRoomAccess.addChangeListener(roomAccessChangeListener);
}
binding.toolbarMore.setOnClickListener(v -> viewModel.onClickRippleMenu());
binding.toolbarBack.setOnClickListener(v -> popBackStackFragment());
binding.toolbarEdit.setOnClickListener(v -> {
if (getActivity() != null && currentRoomAccess != null && currentRoomAccess.isCanModifyRoom()) {
new HelperFragment(getActivity().getSupportFragmentManager(), EditGroupFragment.newInstance(viewModel.roomId)).setReplace(false).load();
}
});
viewModel.groupName.observe(getViewLifecycleOwner(), s -> {
binding.toolbarTxtNameCollapsed.setText(EmojiManager.getInstance().replaceEmoji(s, binding.toolbarTxtNameCollapsed.getPaint().getFontMetricsInt()));
binding.toolbarTxtNameExpanded.setText(EmojiManager.getInstance().replaceEmoji(s, binding.toolbarTxtNameExpanded.getPaint().getFontMetricsInt()));
});
viewModel.groupNumber.observe(getViewLifecycleOwner(), s -> binding.toolbarTxtStatusExpanded.setText(String.format("%s %s", s, getString(R.string.member))));
viewModel.showMoreMenu.observe(getViewLifecycleOwner(), isShow -> {
if (isShow != null) {
binding.toolbarMore.setVisibility(isShow ? View.VISIBLE : View.GONE);
}
});
viewModel.goToShearedMediaPage.observe(getViewLifecycleOwner(), model -> {
if (getActivity() != null && model != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentShearedMedia.newInstance(model)).setReplace(false).load();
}
});
viewModel.goToShowAvatarPage.observe(getViewLifecycleOwner(), roomId -> {
if (getActivity() != null && roomId != null) {
new HelperFragment(getActivity().getSupportFragmentManager(), FragmentShowAvatars.newInstance(roomId, FragmentShowAvatars.From.group)).setReplace(false).load();
}
});
viewModel.showMenu.observe(getViewLifecycleOwner(), menuList -> {
if (getActivity() != null && menuList != null) {
new TopSheetDialog(getActivity()).setListDataWithResourceId(menuList, -1, position -> {
if (menuList.get(position) == R.string.clear_history) {
new MaterialDialog.Builder(getActivity()).title(R.string.clear_history).content(R.string.clear_history_content).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
getMessageController().clearHistoryMessage(viewModel.roomId);
}
}).negativeText(R.string.no).show();
} else if (menuList.get(position) == R.string.group_title_convert_to_public || menuList.get(position) == R.string.group_title_convert_to_private) {
viewModel.convertMenuClick();
}
}).show();
}
});
viewModel.goToShowMemberPage.observe(getViewLifecycleOwner(), type -> {
if (getActivity() != null && type != null) {
FragmentShowMember fragment = FragmentShowMember.newInstance2(this, viewModel.roomId, viewModel.role.toString(), AccountManager.getInstance().getCurrentUser().getId(), type, viewModel.isNeedgetContactlist, true);
new HelperFragment(getActivity().getSupportFragmentManager(), fragment).setReplace(false).load();
}
});
viewModel.showDialogConvertToPublic.observe(getViewLifecycleOwner(), isShow -> {
if (getActivity() != null && isShow != null && isShow) {
new MaterialDialog.Builder(getActivity()).title(getString(R.string.group_title_convert_to_public)).content(getString(R.string.group_text_convert_to_public)).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
setUsername();
}
}).negativeText(R.string.no).show();
}
});
viewModel.showDialogConvertToPrivate.observe(getViewLifecycleOwner(), isShow -> {
if (getActivity() != null && isShow != null && isShow) {
new MaterialDialog.Builder(getActivity()).title(R.string.group_title_convert_to_private).content(R.string.group_text_convert_to_private).positiveText(R.string.yes).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
viewModel.sendRequestRemoveGroupUsername();
}
}).negativeText(R.string.no).show();
}
});
viewModel.showRequestError.observe(getViewLifecycleOwner(), errorMessage -> {
if (errorMessage != null) {
HelperError.showSnackMessage(getString(errorMessage), false);
}
});
viewModel.goToShowCustomListPage.observe(getViewLifecycleOwner(), listItem -> {
if (getActivity() != null && listItem != null) {
ShowCustomList showCustomListFragment = new ShowCustomList();
showCustomListFragment.setFields(ProtoGlobal.Room.Type.GROUP, listItem, (result, message, countForShowLastMessage, list) -> {
for (int i = 0; i < list.size(); i++) {
new RequestGroupAddMember().groupAddMember(viewModel.roomId, list.get(i).peerId, RealmRoomMessage.findCustomMessageId(viewModel.roomId, countForShowLastMessage));
}
});
Bundle bundle = new Bundle();
bundle.putBoolean("DIALOG_SHOWING", true);
bundle.putLong("COUNT_MESSAGE", 0);
showCustomListFragment.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), showCustomListFragment).setReplace(false).load();
}
});
viewModel.goBack.observe(getViewLifecycleOwner(), isGoBack -> {
if (isGoBack != null && isGoBack) {
popBackStackFragment();
}
});
BetterLinkMovementMethod.linkify(Linkify.ALL, binding.description).setOnLinkClickListener((tv, url) -> {
return false;
}).setOnLinkLongClickListener((tv, url) -> {
if (HelperUrl.isTextLink(url)) {
G.isLinkClicked = true;
HelperUrl.openLinkDialog(getActivity(), url);
}
return true;
});
viewModel.groupDescription.observe(getViewLifecycleOwner(), groupDescription -> {
if (getActivity() != null && groupDescription != null) {
binding.description.setText(EmojiManager.getInstance().replaceEmoji(HelperUrl.setUrlLink(getActivity(), groupDescription, true, false, null, true), binding.description.getPaint().getFontMetricsInt()));
}
});
viewModel.goToRoomListPage.observe(getViewLifecycleOwner(), isGo -> {
if (getActivity() instanceof ActivityMain && isGo != null) {
Log.wtf(this.getClass().getName(), "goToRoomListPage observe");
((ActivityMain) getActivity()).removeAllFragmentFromMain();
/*new HelperFragment(getActivity().getSupportFragmentManager()).popBackStack(2);*/
}
});
viewModel.showDialogEditLink.observe(getViewLifecycleOwner(), link -> {
if (getActivity() != null && link != null) {
MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.group_link).positiveText(R.string.array_Copy).customView(createDialogLayout(link), true).widgetColor(new Theme().getPrimaryColor(getContext())).negativeText(R.string.edit).onPositive((dialog1, which) -> {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("LINK_GROUP", link);
clipboard.setPrimaryClip(clip);
}).onNegative((dialog12, which) -> {
if (viewModel.isPrivate) {
viewModel.sendRequestRevokeGroupUsername();
} else {
setUsername();
}
}).build();
dialog.show();
}
});
viewModel.showDialogCopyLink.observe(getViewLifecycleOwner(), link -> {
if (getActivity() != null && link != null) {
MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).title(R.string.group_link).positiveText(R.string.array_Copy).customView(createDialogLayout(link), true).widgetColor(new Theme().getPrimaryColor(getContext())).onPositive((dialog1, which) -> {
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("LINK_GROUP", link);
clipboard.setPrimaryClip(clip);
Toast.makeText(getActivity(), R.string.copied, Toast.LENGTH_SHORT).show();
}).build();
dialog.show();
}
});
viewModel.goToCustomNotificationPage.observe(getViewLifecycleOwner(), roomId -> {
if (getActivity() != null && roomId != null) {
FragmentNotification fragmentNotification = new FragmentNotification();
Bundle bundle = new Bundle();
bundle.putLong("ID", roomId);
fragmentNotification.setArguments(bundle);
new HelperFragment(getActivity().getSupportFragmentManager(), fragmentNotification).setReplace(false).load();
}
});
viewModel.showDialogLeaveGroup.observe(getViewLifecycleOwner(), isShow -> {
if (isShow != null && isShow) {
groupLeft();
}
});
if (viewModel.role.equals(GroupChatRole.OWNER)) {
binding.editGroupPermission.setVisibility(View.VISIBLE);
binding.editGroupPermission.setOnClickListener(v -> {
openChatEditRightsFragment(viewModel.getRealmRoom());
});
}
initComponent();
attachFile = new AttachFile(getActivity());
G.onGroupAvatarDelete = this;
initialToolbar();
}
use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.
the class ChatAttachmentPopup method build.
public ChatAttachmentPopup build() {
if (mRootView == null)
throw new IllegalArgumentException(TAG + " : set root view!");
// inflate layout
LayoutInflater inflater = LayoutInflater.from(mFrgActivity);
viewRoot = inflater.inflate(R.layout.attachment_popup_view, null, false);
attachFile = new AttachFile(mFrgActivity);
initViews(viewRoot);
// setup popup
mPopup = new PopupWindow(mFrgActivity);
mPopup.setContentView(viewRoot);
mPopup.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
mPopup.setHeight(ViewGroup.LayoutParams.MATCH_PARENT);
mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
mPopup.setBackgroundDrawable(new BitmapDrawable());
mPopup.setFocusable(true);
mPopup.setOutsideTouchable(true);
privacyView = viewRoot.findViewById(R.id.fl_attachment_privacyView);
mPopup.setOnDismissListener(() -> {
isNewBottomSheet = true;
isShowing = false;
disableCamera();
});
EventManager.getInstance(AccountManager.selectedAccount).addObserver(EventManager.ON_CAMERA_PERMISSION_GRANTED, ChatAttachmentPopup.this);
return this;
}
use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.
the class ChatAttachmentPopup method initViews.
private void initViews(View view) {
View camera, photo, video, music, file, contact, location;
View root;
camera = view.findViewById(R.id.camera);
photo = view.findViewById(R.id.picture);
video = view.findViewById(R.id.video);
music = view.findViewById(R.id.music);
file = view.findViewById(R.id.file);
location = view.findViewById(R.id.location);
contact = view.findViewById(R.id.contact);
btnSend = view.findViewById(R.id.close);
icoSend = view.findViewById(R.id.txtSend);
lblSend = view.findViewById(R.id.txtNumberItem);
root = view.findViewById(R.id.root);
root.setOnClickListener(v -> {
dismiss();
});
btnSend.setOnClickListener(v -> {
if (animation != null)
animation.cancel();
if (FragmentEditImage.textImageList.size() > 0) {
dismiss();
clearRecyclerAdapter();
lblSend.setText(mFrgActivity.getString(R.string.icon_close));
lblSend.setText(mFrgActivity.getString(R.string.navigation_drawer_close));
mPopupListener.onAttachPopupSendSelected();
} else {
dismiss();
}
});
camera.setOnClickListener(v -> {
dismiss();
attachFile.showDialogOpenCamera(v, null, mFragment);
});
photo.setOnClickListener(v -> {
dismiss();
openPhotoGallery();
});
video.setOnClickListener(v -> {
dismiss();
openVideoGallery();
});
music.setOnClickListener(v -> {
dismiss();
openMusicGallery();
});
file.setOnClickListener(v -> {
dismiss();
try {
attachFile.requestPickFile((selectedPathList, caption) -> {
mPopupListener.onAttachPopupFilePicked(selectedPathList, caption);
});
} catch (IOException e) {
e.printStackTrace();
}
});
contact.setOnClickListener(v -> {
dismiss();
try {
attachFile.requestPickContact(mFragment);
} catch (IOException e) {
e.printStackTrace();
}
});
location.setOnClickListener(v -> {
dismiss();
try {
attachFile.requestGetPosition((result, messageOne, MessageTow) -> {
mPopupListener.onAttachPopupLocation(messageOne);
}, mFragment);
} catch (IOException e) {
e.printStackTrace();
}
});
// init local pictures
fastItemAdapter = new FastItemAdapter();
onClickCamera = () -> {
try {
dismiss();
new AttachFile(mFrgActivity).requestTakePicture(mFragment);
} catch (IOException e) {
e.printStackTrace();
}
};
onPathAdapterBottomSheet = (path, isCheck, isEdit, mList, id) -> {
if (isEdit) {
dismiss();
new HelperFragment(mFrgActivity.getSupportFragmentManager(), FragmentEditImage.newInstance(null, true, false, id)).setReplace(false).load();
} else {
if (isCheck) {
StructBottomSheet item = new StructBottomSheet();
item.setPath(path);
item.setText("");
item.setId(id);
FragmentEditImage.textImageList.put(path, item);
} else {
FragmentEditImage.textImageList.remove(path);
}
if (FragmentEditImage.textImageList.size() > 0) {
icoSend.setText(mFrgActivity.getString(R.string.icon_send));
lblSend.setText("" + FragmentEditImage.textImageList.size() + " " + mFrgActivity.getString(item));
} else {
icoSend.setText(mFrgActivity.getString(R.string.icon_close));
lblSend.setText(mFrgActivity.getString(R.string.navigation_drawer_close));
}
}
};
mNoCameraPermission = view.findViewById(R.id.no_camera_permission);
rcvBottomSheet = view.findViewById(R.id.rcvContent);
rcvBottomSheet.setLayoutManager(new GridLayoutManager(mFrgActivity, 1, GridLayoutManager.HORIZONTAL, false));
rcvBottomSheet.setAdapter(fastItemAdapter);
mNoCameraPermission.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
HelperPermission.getCameraPermission(G.fragmentActivity, new OnGetPermission() {
@Override
public void Allow() throws IOException {
mNoCameraPermission.setVisibility(View.GONE);
rcvBottomSheet.setVisibility(View.VISIBLE);
}
@Override
public void deny() {
HelperPermission.showDeniedPermissionMessage(G.context.getString(R.string.permission_camera));
}
});
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
});
// disable and enable camera when user scroll on recycler view
rcvBottomSheet.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(final View view) {
if (isPermissionCamera) {
if (rcvBottomSheet.getChildAdapterPosition(view) == 0) {
isCameraAttached = true;
}
if (isCameraAttached) {
enableCamera();
}
}
}
@Override
public void onChildViewDetachedFromWindow(final View view) {
if (isPermissionCamera) {
if (rcvBottomSheet.getChildAdapterPosition(view) == 0) {
isCameraAttached = false;
}
if (!isCameraAttached) {
disableCamera();
}
}
}
});
}
Aggregations