|
@@ -362,14 +362,28 @@ public class WhiteBoardFragment extends BaseFragment<FragmentWhiteBoardBinding>
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public void insertImag(String imgUrl) {
|
|
|
+ public void insertImg(String imgUrl, int imgWidth, int imgHeight) {
|
|
|
if (room != null) {
|
|
|
- LogUtils.i("WhiteBoardFragment","imgUrl:"+imgUrl);
|
|
|
- ImageInformationWithUrl imageUrl = new ImageInformationWithUrl(0d, 0d, 200d, 200d, imgUrl);
|
|
|
+ ImageInformationWithUrl imageUrl = new ImageInformationWithUrl(0d, 0d, imgWidth != 0 ? imgWidth : 200d, imgHeight != 0 ? imgHeight : 200d, imgUrl);
|
|
|
room.insertImage(imageUrl);
|
|
|
+ move(imgWidth, imgHeight);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void move(int width, int height) {
|
|
|
+ WindowManager manager = getActivity().getWindowManager();
|
|
|
+ DisplayMetrics outMetrics = new DisplayMetrics();
|
|
|
+ manager.getDefaultDisplay().getMetrics(outMetrics);
|
|
|
+ int displayHeigth = outMetrics.heightPixels;
|
|
|
+ int imageHeight = (int) SizeUtils.px2dp((displayHeigth - SizeUtils.dp2px(90)));
|
|
|
+ double scale = imageHeight / Double.valueOf(height);
|
|
|
+
|
|
|
+ if (scale >= 1) {
|
|
|
+ scale = 1;
|
|
|
+ }
|
|
|
+ moveCamera(scale);
|
|
|
+ }
|
|
|
+
|
|
|
private void updateWhiteBoardList() {
|
|
|
room.getScenes(new Promise<Scene[]>() {
|
|
|
@Override
|