Search in sources :

Example 6 with RotateImageView

use of com.android.camera.ui.RotateImageView in project android_packages_apps_Snap by LineageOS.

the class BestpictureActivity method onCreate.

@Override
public void onCreate(Bundle state) {
    super.onCreate(state);
    mActivity = this;
    Intent intent = getIntent();
    String action = intent.getAction();
    if (INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(action) || ACTION_IMAGE_CAPTURE_SECURE.equals(action)) {
        mSecureCamera = true;
    } else {
        mSecureCamera = intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false);
    }
    if (mSecureCamera) {
        // Change the window flags so that secure camera can show when locked
        Window win = getWindow();
        WindowManager.LayoutParams params = win.getAttributes();
        params.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
        win.setAttributes(params);
    }
    mFilesPath = getFilesDir() + "/Bestpicture";
    setContentView(R.layout.bestpicture_editor);
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    mWidth = size.x / 4;
    mHeight = size.y / 4;
    mNamedImages = new PhotoModule.NamedImages();
    mImageItems = new ImageItems(mActivity);
    mDotsView = (DotsView) findViewById(R.id.dots_view);
    mDotsView.setItems(mImageItems);
    mPlaceHolderUri = getIntent().getData();
    mImagePager = (ViewPager) findViewById(R.id.bestpicture_pager);
    mImagePagerAdapter = new ImagePagerAdapter(getFragmentManager());
    mImagePager.setAdapter(mImagePagerAdapter);
    mImagePager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            mDotsView.update(position, positionOffset);
        }

        @Override
        public void onPageSelected(int position) {
        }
    });
    findViewById(R.id.bestpicture_done).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            int choosenCount = 0;
            for (int i = 0; i < mImageItems.mChosen.length; i++) {
                if (mImageItems.mChosen[i]) {
                    choosenCount++;
                }
            }
            boolean showSaveDialog = CameraUtil.loadDialogShowConfig(BestpictureActivity.this, CameraUtil.KEY_SAVE);
            if (showSaveDialog) {
                // add save dialog
                initSaveDialog(CameraUtil.MODE_TWO_BT, choosenCount);
                mDialog.show();
                setDialogLayoutPararms();
            } else {
                saveImages(choosenCount, false);
            }
        }
    });
    findViewById(R.id.delete_best).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            boolean showDeleteDialog = CameraUtil.loadDialogShowConfig(BestpictureActivity.this, CameraUtil.KEY_DELETE);
            if (showDeleteDialog) {
                initDeleteDialog(CameraUtil.MODE_TWO_BT);
                mDialog.show();
                setDialogLayoutPararms();
            } else {
                backToViewfinder();
            }
        }
    });
    RotateImageView moreView = (RotateImageView) findViewById(R.id.best_more);
    Bitmap mMoreBp = BitmapFactory.decodeResource(getResources(), R.drawable.more_options);
    mMoreBp = CameraUtil.adjustPhotoRotation(mMoreBp, 90);
    moreView.setImageBitmap(mMoreBp);
    moreView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            initOverFlow(v);
        }
    });
}
Also used : PopupWindow(android.widget.PopupWindow) Window(android.view.Window) Intent(android.content.Intent) Point(android.graphics.Point) ViewPager(android.support.v4.view.ViewPager) RotateImageView(com.android.camera.ui.RotateImageView) DotsView(com.android.camera.ui.DotsView) View(android.view.View) TextView(android.widget.TextView) Point(android.graphics.Point) WindowManager(android.view.WindowManager) RotateImageView(com.android.camera.ui.RotateImageView) Bitmap(android.graphics.Bitmap) Display(android.view.Display)

Example 7 with RotateImageView

use of com.android.camera.ui.RotateImageView in project android_packages_apps_Snap by LineageOS.

the class VideoUI method initializeControlByIntent.

private void initializeControlByIntent() {
    mMenuButton = mRootView.findViewById(R.id.menu);
    mMenuButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            mVideoMenu.openFirstLevel();
        }
    });
    mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
    if (mController.isVideoCaptureIntent()) {
        hideSwitcher();
        mActivity.getLayoutInflater().inflate(R.layout.review_module_control, (ViewGroup) mCameraControls);
        // Cannot use RotateImageView for "done" and "cancel" button because
        // the tablet layout uses RotateLayout, which cannot be cast to
        // RotateImageView.
        mReviewDoneButton = mRootView.findViewById(R.id.done_button);
        mReviewCancelButton = mRootView.findViewById(R.id.btn_cancel);
        mReviewPlayButton = mRootView.findViewById(R.id.btn_play);
        mReviewCancelButton.setVisibility(View.VISIBLE);
        mReviewDoneButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mController.onReviewDoneClicked(v);
            }
        });
        mReviewCancelButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mController.onReviewCancelClicked(v);
            }
        });
        mReviewPlayButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mController.onReviewPlayClicked(v);
            }
        });
    }
}
Also used : OnClickListener(android.view.View.OnClickListener) RotateImageView(com.android.camera.ui.RotateImageView) SurfaceView(android.view.SurfaceView) ImageView(android.widget.ImageView) CameraRootView(com.android.camera.ui.CameraRootView) View(android.view.View) TextView(android.widget.TextView) FaceView(com.android.camera.ui.FaceView) ListView(android.widget.ListView)

Aggregations

RotateImageView (com.android.camera.ui.RotateImageView)7 View (android.view.View)6 TextView (android.widget.TextView)5 ImageView (android.widget.ImageView)4 Intent (android.content.Intent)2 Point (android.graphics.Point)2 ViewPager (android.support.v4.view.ViewPager)2 SurfaceView (android.view.SurfaceView)2 OnClickListener (android.view.View.OnClickListener)2 ListView (android.widget.ListView)2 CameraRootView (com.android.camera.ui.CameraRootView)2 DotsView (com.android.camera.ui.DotsView)2 FaceView (com.android.camera.ui.FaceView)2 Bitmap (android.graphics.Bitmap)1 Display (android.view.Display)1 ViewGroup (android.view.ViewGroup)1 Window (android.view.Window)1 WindowManager (android.view.WindowManager)1 AdapterView (android.widget.AdapterView)1 GridView (android.widget.GridView)1