Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27954786 authored by chihhangchuang's avatar chihhangchuang
Browse files

Add width and height set for Grid preview

Test: Manually
Bug: 155938545
Change-Id: Ibe957b09e812b8545c3c5c211610e50d09fbb1eb
parent b567b75f
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.RemoteException;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

@@ -78,12 +79,12 @@ class GridOptionPreviewer {

        if (usesSurfaceView) {
            mGridOptionSurface = new SurfaceView(mContext);
            mPreviewContainer.addView(mGridOptionSurface);
            setUpView(mGridOptionSurface);
            mGridOptionSurface.setZOrderOnTop(true);
            mGridOptionSurface.getHolder().addCallback(mSurfaceCallback);
        } else {
            final ImageView previewImage = new ImageView(mContext);
            mPreviewContainer.addView(previewImage);
            setUpView(previewImage);
            final Asset previewAsset = new ContentUriAsset(
                    mContext,
                    mGridOption.previewImageUri,
@@ -97,6 +98,13 @@ class GridOptionPreviewer {
        }
    }

    private void setUpView(View view) {
        view.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mPreviewContainer.addView(view);
    }

    private final SurfaceHolder.Callback mSurfaceCallback = new SurfaceHolder.Callback() {
        private Surface mLastSurface;
        private Message mCallback;