Search in sources :

Example 6 with PhotoItem

use of com.stickercamera.app.model.PhotoItem in project StickerCamera by Skykai521.

the class CameraActivity method initView.

private void initView() {
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    surfaceHolder.setKeepScreenOn(true);
    surfaceView.setFocusable(true);
    surfaceView.setBackgroundColor(TRIM_MEMORY_BACKGROUND);
    //为SurfaceView的句柄添加一个回调函数
    surfaceView.getHolder().addCallback(new SurfaceCallback());
    //设置相机界面,照片列表,以及拍照布局的高度(保证相机预览为正方形)
    ViewGroup.LayoutParams layout = cameraGrid.getLayoutParams();
    layout.height = App.getApp().getScreenWidth();
    layout = photoArea.getLayoutParams();
    layout.height = DistanceUtil.getCameraPhotoAreaHeight();
    layout = takePhotoPanel.getLayoutParams();
    layout.height = App.getApp().getScreenHeight() - App.getApp().getScreenWidth() - DistanceUtil.getCameraPhotoAreaHeight();
    //添加系统相册内的图片
    ArrayList<PhotoItem> sysPhotos = FileUtils.getInst().findPicsInDir(FileUtils.getInst().getSystemPhotoPath());
    int showNumber = sysPhotos.size() > photoNumber ? photoNumber : sysPhotos.size();
    for (int i = 0; i < showNumber; i++) {
        addPhoto(sysPhotos.get(showNumber - 1 - i));
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) PhotoItem(com.stickercamera.app.model.PhotoItem) ViewGroup(android.view.ViewGroup)

Aggregations

PhotoItem (com.stickercamera.app.model.PhotoItem)6 ArrayList (java.util.ArrayList)2 Cursor (android.database.Cursor)1 LayoutInflater (android.view.LayoutInflater)1 SurfaceHolder (android.view.SurfaceHolder)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AbsListView (android.widget.AbsListView)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 GridView (android.widget.GridView)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 Album (com.stickercamera.app.model.Album)1 File (java.io.File)1 FileFilter (java.io.FileFilter)1 HashMap (java.util.HashMap)1