Skip to content

Commit

Permalink
feat: disable gravity detection in video
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Aug 1, 2024
1 parent 126ac80 commit 930cfc1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9227,7 +9227,7 @@ private void preparePlayer(Uri uri, boolean playWhenReady, boolean preview, Medi
}
checkFullscreenButton();

if (orientationEventListener == null) {
if (orientationEventListener == null && !Config.disableGravityDetectionInVideo) {
orientationEventListener = new OrientationEventListener(ApplicationLoader.applicationContext) {
@Override
public void onOrientationChanged(int orientation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public class ChatSettingActivity extends BaseActivity {
private int disableChannelMuteButtonRow;
private int disableAutoPipRow;
private int sendMp4DocumentAsVideoRow;
private int disableGravityDetectionInVideoRow;
private int chat2Row;

private int markdownRow;
Expand Down Expand Up @@ -466,6 +467,11 @@ protected void onItemClick(View view, int position, float x, float y) {
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(Config.sendMp4DocumentAsVideo);
}
} else if (position == disableGravityDetectionInVideoRow) {
Config.toggleDisableGravityDetectionInVideo();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(Config.disableGravityDetectionInVideo);
}
}
}

Expand Down Expand Up @@ -534,6 +540,7 @@ protected void updateRows() {
disableChannelMuteButtonRow = addRow("disableChannelMuteButton");
disableAutoPipRow = addRow("disableAutoPip");
sendMp4DocumentAsVideoRow = addRow("sendMp4DocumentAsVideo");
disableGravityDetectionInVideoRow = addRow("disableGravityDetectionInVideo");
chat2Row = addRow();
markdownRow = addRow();
markdownDisableRow = addRow("markdownDisabled");
Expand Down Expand Up @@ -712,6 +719,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, boole
textCell.setTextAndCheck(LocaleController.getString("disableAutoPip", R.string.disableAutoPip), Config.disableAutoPip, true);
} else if (position == sendMp4DocumentAsVideoRow) {
textCell.setTextAndCheck(LocaleController.getString("sendMp4DocumentAsVideo", R.string.sendMp4DocumentAsVideo), Config.sendMp4DocumentAsVideo, true);
} else if (position == disableGravityDetectionInVideoRow) {
textCell.setTextAndCheck(LocaleController.getString("disableGravityDetectionInVideo", R.string.disableGravityDetectionInVideo), Config.disableGravityDetectionInVideo, true);
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ object Defines {
@BooleanConfig const val disableChannelMuteButton = "disableChannelMuteButton"
@BooleanConfig const val disableAutoPip = "disableAutoPip"
@BooleanConfig const val sendMp4DocumentAsVideo = "sendMp4DocumentAsVideo"
@BooleanConfig const val disableGravityDetectionInVideo = "disableGravityDetectionInVideo"

// Drawer List
@BooleanConfig(true) const val showNewGroup = "showNewGroup"
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-zh/strings_nullgram.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,4 +374,5 @@
<string name="disableChannelMuteButton">禁用频道静音按钮</string>
<string name="disableAutoPip">禁用自动画中画</string>
<string name="sendMp4DocumentAsVideo">以视频格式发送 MP4 文件</string>
<string name="disableGravityDetectionInVideo">禁用视频重力检测</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_nullgram.xml
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,5 @@
<string name="disableChannelMuteButton">Disable channel mute button</string>
<string name="disableAutoPip">Disable auto PIP</string>
<string name="sendMp4DocumentAsVideo">Send MP4 document as video</string>
<string name="disableGravityDetectionInVideo">Disable gravity detection in video</string>
</resources>

0 comments on commit 930cfc1

Please sign in to comment.