Search in sources :

Example 11 with AttachFile

use of net.iGap.module.AttachFile in project iGap-Android by KianIranian-STDG.

the class FragmentUserProfile method useCamera.

private void useCamera() {
    if (getActivity() != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            new AttachFile(getActivity()).dispatchTakePictureIntent(FragmentUserProfile.this);
        } else {
            if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(viewModel.getImageFile()));
                startActivityForResult(intent, AttachFile.request_code_TAKE_PICTURE);
            } else {
                Toast.makeText(getContext(), R.string.please_check_your_camera, Toast.LENGTH_SHORT).show();
            }
        }
    }
}
Also used : AttachFile(net.iGap.module.AttachFile) Intent(android.content.Intent)

Aggregations

AttachFile (net.iGap.module.AttachFile)11 View (android.view.View)6 IOException (java.io.IOException)6 Intent (android.content.Intent)4 Bundle (android.os.Bundle)4 TextView (android.widget.TextView)4 OnGetPermission (net.iGap.observers.interfaces.OnGetPermission)4 Context (android.content.Context)3 Build (android.os.Build)3 LayoutInflater (android.view.LayoutInflater)3 File (java.io.File)3 ActivityMain (net.iGap.activities.ActivityMain)3 HelperFragment (net.iGap.helper.HelperFragment)3 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ObjectAnimator (android.animation.ObjectAnimator)2 Activity (android.app.Activity)2 ClipData (android.content.ClipData)2 ClipboardManager (android.content.ClipboardManager)2 CLIPBOARD_SERVICE (android.content.Context.CLIPBOARD_SERVICE)2