Added setting to set default camera for Video Messages

close #41
This commit is contained in:
NekoInverter 2020-04-17 10:38:01 +08:00
parent d5838df847
commit 36925e6282
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
4 changed files with 26 additions and 3 deletions

View File

@ -103,6 +103,8 @@ import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL;
import tw.nekomimi.nekogram.NekoConfig;
@TargetApi(18)
public class InstantCameraView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
@ -486,7 +488,7 @@ public class InstantCameraView extends FrameLayout implements NotificationCenter
textureOverlayView.setImageResource(R.drawable.icplaceholder);
}
cameraReady = false;
isFrontface = true;
isFrontface = !NekoConfig.rearVideoMessages;
selectedCamera = null;
recordedTime = 0;
progress = 0;

View File

@ -26,6 +26,7 @@ public class NekoConfig {
public static boolean disablePhotoSideAction = true;
public static boolean hideKeyboardOnChatScroll = false;
public static boolean chatMessageAnimation = false;
public static boolean rearVideoMessages = false;
public static int mapPreviewProvider = 0;
public static float stickerSize = 14.0f;
public static int translationProvider = 1;
@ -97,6 +98,7 @@ public class NekoConfig {
editor.putBoolean("useSystemEmoji", useSystemEmoji);
editor.putBoolean("showTabsOnForward", showTabsOnForward);
editor.putBoolean("chatMessageAnimation", chatMessageAnimation);
editor.putBoolean("rearVideoMessages", rearVideoMessages);
editor.putFloat("stickerSize", stickerSize);
editor.putInt("typeface", typeface);
editor.putInt("nameOrder", nameOrder);
@ -154,6 +156,7 @@ public class NekoConfig {
useSystemEmoji = preferences.getBoolean("useSystemEmoji", SharedConfig.useSystemEmoji);
showTabsOnForward = preferences.getBoolean("showTabsOnForward", false);
chatMessageAnimation = preferences.getBoolean("chatMessageAnimation", false);
rearVideoMessages = preferences.getBoolean("rearVideoMessages", false);
configLoaded = true;
}
}
@ -448,4 +451,12 @@ public class NekoConfig {
editor.putBoolean("chatMessageAnimation", chatMessageAnimation);
editor.commit();
}
public static void toggleRearVideoMessages() {
rearVideoMessages = !rearVideoMessages;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("rearVideoMessages", rearVideoMessages);
editor.commit();
}
}

View File

@ -79,6 +79,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int pauseMusicOnRecordRow;
private int disablePhotoSideActionRow;
private int hideKeyboardOnChatScrollRow;
private int rearVideoMessagesRow;
private int mapPreviewRow;
private int stickerSizeRow;
private int translationProviderRow;
@ -524,6 +525,11 @@ public class NekoSettingsActivity extends BaseFragment {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.chatMessageAnimation);
}
} else if (position == rearVideoMessagesRow) {
NekoConfig.toggleRearVideoMessages();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.rearVideoMessages);
}
}
});
@ -554,6 +560,7 @@ public class NekoSettingsActivity extends BaseFragment {
pauseMusicOnRecordRow = rowCount++;
disablePhotoSideActionRow = rowCount++;
hideKeyboardOnChatScrollRow = rowCount++;
rearVideoMessagesRow = rowCount++;
mapPreviewRow = rowCount++;
stickerSizeRow = rowCount++;
messageMenuRow = rowCount++;
@ -1063,6 +1070,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("ShowTabsOnForward", R.string.ShowTabsOnForward), NekoConfig.showTabsOnForward, true);
} else if (position == chatMessageAnimationRow) {
textCell.setTextAndCheck(LocaleController.getString("ChatMessageAnimation", R.string.ChatMessageAnimation), NekoConfig.chatMessageAnimation, true);
} else if (position == rearVideoMessagesRow) {
textCell.setTextAndCheck(LocaleController.getString("RearVideoMessages", R.string.RearVideoMessages), NekoConfig.rearVideoMessages, true);
}
break;
}
@ -1102,7 +1111,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == translationProviderRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
position == experimentRow || position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow ||
position == showTabsOnForwardRow || position == chatMessageAnimationRow;
position == showTabsOnForwardRow || position == chatMessageAnimationRow || position == rearVideoMessagesRow;
}
@Override
@ -1157,7 +1166,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == disableFilteringRow || position == smoothKeyboardRow || position == pauseMusicOnRecordRow ||
position == disablePhotoSideActionRow || position == unlimitedPinnedDialogsRow || position == openArchiveOnPullRow ||
position == hideKeyboardOnChatScrollRow || position == avatarAsDrawerBackgroundRow || position == showTabsOnForwardRow ||
position == chatMessageAnimationRow) {
position == chatMessageAnimationRow || position == rearVideoMessagesRow) {
return 3;
} else if (position == settingsRow || position == connectionRow || position == chatRow || position == experimentRow) {
return 4;

View File

@ -89,4 +89,5 @@
<string name="CheckAllAdministrated">Add administrated</string>
<string name="ProviderDeepLWeb">DeepL Translator (Web)</string>
<string name="ChatMessageAnimation">Animate new messages</string>
<string name="RearVideoMessages">Rear camera in Video Messages</string>
</resources>