Skip to content
Snippets Groups Projects
Commit 940a207d authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Faster resizing

parent 8f958de6
No related branches found
No related tags found
No related merge requests found
......@@ -30,11 +30,10 @@
<ImageView
android:id="@+id/video_play_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/popup_expand"
android:scaleType="center"
android:src="@drawable/ic_popup_pause"
android:visibility="gone" />
......
......@@ -43,7 +43,6 @@ import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
......@@ -227,7 +226,6 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
return;
int sw = mRootView.getWidth();
int sh = mRootView.getHeight();
vlcVout.setWindowSize(sw, sh);
double dw = sw, dh = sh;
......@@ -256,7 +254,10 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
else
dw = dh * ar;
setViewSize(dw, dh);
width = (int) Math.floor(dw);
height = (int) Math.floor(dh);
vlcVout.setWindowSize(width, height);
setViewSize(width, height);
}
@Override public void onSurfacesCreated(IVLCVout vlcVout) {}
......@@ -266,17 +267,11 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
@Override public void onHardwareAccelerationError(IVLCVout vlcVout) {}
};
private void setViewSize(double dw, double dh) {
LayoutParams lp = mSurfaceView.getLayoutParams();
lp.width = (int) Math.ceil(dw);
lp.height = (int) Math.ceil(dh);
mSurfaceView.setLayoutParams(lp);
lp = mRootView.getLayoutParams();
lp.width = (int) Math.floor(dw);
lp.height = (int) Math.floor(dh);
mRootView.setLayoutParams(lp);
mRootView.invalidate();
private void setViewSize(int width, int height) {
WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mRootView.getLayoutParams();
lp.width = width;
lp.height = height;
windowManager.updateViewLayout(mRootView, lp);
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment