Allow disable instant camera

This commit is contained in:
arm64v8a 2021-11-18 22:59:41 +08:00
parent 1014cfd48d
commit a5c29444a7
5 changed files with 18 additions and 5 deletions

View File

@ -617,7 +617,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
}
return;
} else if (noGalleryPermissions) {
} else if (noGalleryPermissions && position != 0) {
try {
if (NekoConfig.forceSystemPicker) {
menu.onItemClick(open_in); // Use system photo picker
@ -662,6 +662,9 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
PhotoViewer.getInstance().setCaption(parentAlert.getCommentTextView().getText());
} else {
if (SharedConfig.inappCamera) {
if (NekomuraConfig.disableInstantCamera.Bool()) {
showCamera();
}
openCamera(true);
} else {
if (parentAlert.delegate != null) {
@ -1620,10 +1623,15 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
deviceHasGoodCamera = CameraController.getInstance().isCameraInitied();
}
}
if (deviceHasGoodCamera && NekomuraConfig.disableInstantCamera.Bool()) {
// Clear cached bitmap
File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
if (file.exists()) file.delete();
}
if ((old != deviceHasGoodCamera || old2 != noCameraPermissions) && adapter != null) {
adapter.notifyDataSetChanged();
}
if (parentAlert.isShowing() && deviceHasGoodCamera && parentAlert.baseFragment != null && parentAlert.getBackDrawable().getAlpha() != 0 && !cameraOpened) {
if (parentAlert.isShowing() && deviceHasGoodCamera && parentAlert.baseFragment != null && parentAlert.getBackDrawable().getAlpha() != 0 && !cameraOpened && !NekomuraConfig.disableInstantCamera.Bool()) {
showCamera();
}
}
@ -1912,7 +1920,7 @@ public class ChatAttachAlertPhotoLayout extends ChatAttachAlert.AttachAlertLayou
}
private void saveLastCameraBitmap() {
if (!canSaveCameraPreview) {
if (!canSaveCameraPreview || NekomuraConfig.disableInstantCamera.Bool()) {
return;
}
try {

View File

@ -149,6 +149,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
private final AbstractCell disableUndoRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.disableUndo));
private final AbstractCell showIdAndDcRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.showIdAndDc));
private final AbstractCell inappCameraRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.inappCamera));
private final AbstractCell disableInstantCameraRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.disableInstantCamera));
private final AbstractCell hideProxySponsorChannelRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.hideProxySponsorChannel));
private final AbstractCell hideSponsoredMessageRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.hideSponsoredMessage));
private final AbstractCell askBeforeCallRow = cellGroup.appendCell(new NekomuraTGTextCheck(NekomuraConfig.askBeforeCall));
@ -313,6 +314,7 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
}
} else if (key.equals(NekomuraConfig.inappCamera.getKey())) {
SharedConfig.setInappCamera((boolean) newValue);
restartTooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NekomuraConfig.hidePhone.getKey())) {
parentLayout.rebuildAllFragmentViews(false, false);
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged);

View File

@ -45,13 +45,14 @@ public class NekomuraConfig {
public static ConfigItem update_download_soucre = addConfig("update_download_soucre", configTypeInt, 0); // 0: Github 1: Channel 2:CDNDrive
public static ConfigItem useCustomEmoji = addConfig("useCustomEmoji", configTypeBool, false);
public static ConfigItem repeatConfirm = addConfig("repeatConfirm", configTypeBool, false);
public static ConfigItem disableInstantCamera = addConfig("DisableInstantCamera", configTypeBool, false);
// From NekoConfig
public static ConfigItem useIPv6 = addConfig("IPv6", configTypeBool, false);
public static ConfigItem hidePhone = addConfig("HidePhone", configTypeBool, true);
public static ConfigItem ignoreBlocked = addConfig("IgnoreBlocked", configTypeBool, false);
public static ConfigItem tabletMode = addConfig("TabletMode", configTypeInt, 0);
public static ConfigItem inappCamera = addConfig("DebugMenuEnableCamera", configTypeBool, false); // fake
public static ConfigItem inappCamera = addConfig("DebugMenuEnableCamera", configTypeBool, true); // fake
public static ConfigItem smoothKeyboard = addConfig("DebugMenuEnableSmoothKeyboard", configTypeBool, false);// fake
public static ConfigItem typeface = addConfig("TypefaceUseDefault", configTypeBool, false);

View File

@ -266,4 +266,5 @@
\n使用头像作为背景
\n使用大只头像作为背景</string>
<string name="hideSponsoredMessage">隐藏赞助消息</string>
<string name="DisableInstantCamera">禁用相机即时预览</string>
</resources>

View File

@ -258,8 +258,9 @@
<string name="useCustomEmojiInvalid">Not a vaild emoji zip.</string>
<string name="repeatConfirm">Ask before repeat</string>
<string name="repeatConfirmText">Are you sure to repeat?</string>
<string name="valuesLargeAvatarInDrawer">Telegram Default\nAvatar as background\nBig avatar as background</string>
<string name="hideSponsoredMessage">Hide sponsored messages</string>
<string name="rememberAllBackMessages">Remember all clicked replies</string>
<string name="DisableInstantCamera">Disable instant camera</string>
</resources>