Skip to content

Commit

Permalink
Fix for aspect ratio when sliders are touched (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexodessa authored Dec 17, 2024
1 parent f162be8 commit 879e513
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/main/java/com/openipc/pixelpilot/VideoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
constraintSet.setMargin(R.id.surfaceViewLeft, ConstraintSet.START, margin);
constraintSet.setMargin(R.id.surfaceViewRight, ConstraintSet.END, margin);
constraintSet.applyTo(constraintLayout);
updateViewRatio(R.id.surfaceViewLeft, lastVideoW, lastVideoH);
updateViewRatio(R.id.surfaceViewRight, lastVideoW, lastVideoH);

// Save progress value
SharedPreferences sharedPreferences = getSharedPreferences("SeekBarPrefs", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
Expand All @@ -340,6 +343,8 @@ public void onProgressChanged(SeekBar distanceSeekBar, int progressD, boolean fr
constraintSet.setMargin(R.id.surfaceViewLeft, ConstraintSet.END, size);
constraintSet.setMargin(R.id.surfaceViewRight, ConstraintSet.START, size);
constraintSet.applyTo(constraintLayout);
updateViewRatio(R.id.surfaceViewLeft, lastVideoW, lastVideoH);
updateViewRatio(R.id.surfaceViewRight, lastVideoW, lastVideoH);
// Save progress value
SharedPreferences sharedPreferencesd = getSharedPreferences("SeekBarPrefsD", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferencesd.edit();
Expand Down Expand Up @@ -837,9 +842,9 @@ public void onVideoRatioChanged(final int videoW, final int videoH) {

Log.d(TAG, "Set resolution: " + videoW + "x" + videoH);

updateViewRatio(R.id.mainVideo, videoW, videoH);
updateViewRatio(R.id.surfaceViewLeft, videoW, videoH);
updateViewRatio(R.id.surfaceViewRight, videoW, videoH);
updateViewRatio(R.id.mainVideo, lastVideoW, lastVideoH);
updateViewRatio(R.id.surfaceViewLeft, lastVideoW, lastVideoH);
updateViewRatio(R.id.surfaceViewRight, lastVideoW, lastVideoH);
}

private void updateViewRatio(int viewId, int videoW, int videoH) {
Expand Down

0 comments on commit 879e513

Please sign in to comment.