当前位置: 首页>>代码示例>>Java>>正文


Java MultiplePermissionsReport类代码示例

本文整理汇总了Java中com.karumi.dexter.MultiplePermissionsReport的典型用法代码示例。如果您正苦于以下问题:Java MultiplePermissionsReport类的具体用法?Java MultiplePermissionsReport怎么用?Java MultiplePermissionsReport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MultiplePermissionsReport类属于com.karumi.dexter包,在下文中一共展示了MultiplePermissionsReport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkCameraPermission

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
private void checkCameraPermission() {
    Dexter.withActivity(this)
            .withPermissions(Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE)
            .withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    if (report.areAllPermissionsGranted()) {
                        // Do something
                    } else {
                        Toast.makeText(MainActivity.this, R.string.camera_and_write_external_storage_denied, Toast.LENGTH_SHORT).show();
                    }
                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                    token.continuePermissionRequest();
                }
            })
            .check();
}
 
开发者ID:akexorcist,项目名称:CameraSample,代码行数:21,代码来源:MainActivity.java

示例2: checkPermissions

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
private void checkPermissions() {
    Logger.getInstance().Debug(TAG, "checkPermissions");
    Dexter.withActivity(this)
            .withPermissions(PERMISSIONS_TO_REQUEST)
            .withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    if (report.areAllPermissionsGranted()) {
                        Toasty.success(BootActivity.this, "All permissions granted! Thanks!", Toast.LENGTH_LONG).show();
                    }
                    _checkPermissionsFinished = true;
                    checkNavigateToMain();
                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                }
            }).check();
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:20,代码来源:BootActivity.java

示例3: checkCameraPermission

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
private void checkCameraPermission(){

        Dexter.withActivity(this)
                .withPermissions(
                        Manifest.permission.READ_EXTERNAL_STORAGE,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE,
                        Manifest.permission.CAMERA
                ).withListener(new MultiplePermissionsListener() {
            @Override public void onPermissionsChecked(MultiplePermissionsReport report) {
                if(report.areAllPermissionsGranted()){
                    Intent intent = new Intent(NurseRecordActivity.this, CameraActivity.class);
                    startActivityForResult(intent, UPDATE_PHOTO);
                }else{
                    showNeedPermissionDialog();
                }
            }
            @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {

                showNeedPermissionDialog();

            }
        }).check();

    }
 
开发者ID:pooi,项目名称:Nearby,代码行数:25,代码来源:NurseRecordActivity.java

示例4: onCreateView

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_sos, container, false);
    ButterKnife.bind(this, view);

    sharedPreferences = getActivity().getSharedPreferences("Profile", MODE_PRIVATE);

    Dexter.checkPermissions(new MultiplePermissionsListener() {
        @Override
        public void onPermissionsChecked(MultiplePermissionsReport report) {/* ... */}

        @Override
        public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {/* ... */}
    }, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION);

    LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
    LocationListener locationListener = new MyLocationListener();
    try {
        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10, locationListener);
        else
            Toast.makeText(getContext(), "Enable location services", Toast.LENGTH_SHORT).show();
    } catch (SecurityException e) {
        Log.e("locationListener", e.toString());
    }

    return view;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:29,代码来源:SOSFragment.java

示例5: request

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
public static void request(Activity activity) {
    Dexter.withActivity(activity)
            .withPermissions(
                    Manifest.permission.CAMERA
            ).withListener(new MultiplePermissionsListener() {
        @Override public void onPermissionsChecked(MultiplePermissionsReport report) {}
        @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {}
    }).check();
}
 
开发者ID:daeng-id,项目名称:nfkita-mobile,代码行数:10,代码来源:RuntimePermissions.java

示例6: configureDexterListeners

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
private void configureDexterListeners() {
    permissionListener = new MultiplePermissionsListener() {
        @Override
        public void onPermissionsChecked(MultiplePermissionsReport report) {
            Timber.d("Accepted: %s", report.getGrantedPermissionResponses());
            Timber.d("Denied: %s", report.getDeniedPermissionResponses());

            if (report.areAllPermissionsGranted()) {
                Timber.d("All granted, requesting");
                requestPicture();
            }
        }

        @Override
        public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
            Timber.d("should show rationale");
            token.continuePermissionRequest();
        }
    };
    anyPermissionDeniedListener = DialogOnAnyDeniedMultiplePermissionsListener.Builder
            .withContext(this)
            .withTitle("Camera & file permissions")
            .withMessage("Camera & file permissions are needed for saving pictures")
            .withButtonText("Ok")
            .build();
    Dexter.continuePendingRequestsIfPossible(anyPermissionDeniedListener);
}
 
开发者ID:fzymek,项目名称:FunWithAndroid,代码行数:28,代码来源:MainActivity.java

示例7: launchCamera

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
public void launchCamera(final CameraCallback cameraCallback) {
    Dexter.withActivity(mActivity)
            .withPermissions(
                    Manifest.permission.CAMERA,
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.RECORD_AUDIO)
            .withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    launchIntent();
                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {

                }
            }).check();

    SandriosBus.getBus()
            .toObserverable()
            .subscribe(new Consumer<Object>() {
                @Override
                public void accept(Object o) throws Exception {
                    if (o instanceof CameraOutputModel) {
                        CameraOutputModel outputModel = (CameraOutputModel) o;
                        if (cameraCallback != null) {
                            cameraCallback.onComplete(outputModel);
                            mInstance = null;
                        }
                        SandriosBus.complete();
                    }
                }
            });
}
 
开发者ID:sandrios,项目名称:sandriosCamera,代码行数:35,代码来源:SandriosCamera.java

示例8: onPermissionsChecked

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override public void onPermissionsChecked(MultiplePermissionsReport report) {
  super.onPermissionsChecked(report);

  if (!report.areAllPermissionsGranted()) {
    showDialog();
  }
}
 
开发者ID:longtaoge,项目名称:Dexter,代码行数:8,代码来源:DialogOnAnyDeniedMultiplePermissionsListener.java

示例9: onPermissionsChecked

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override public void onPermissionsChecked(MultiplePermissionsReport report) {
  super.onPermissionsChecked(report);

  if (!report.areAllPermissionsGranted()) {
    showSnackbar();
  }
}
 
开发者ID:longtaoge,项目名称:Dexter,代码行数:8,代码来源:SnackbarOnAnyDeniedMultiplePermissionsListener.java

示例10: onPermissionsChecked

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
    if (report.areAllPermissionsGranted() && report.getGrantedPermissionResponses().size() == 3) {
        for (PermissionGrantedResponse permissionGrantedResponse : report.getGrantedPermissionResponses()) {
            if (!validatePermissionCamera(permissionGrantedResponse)) {
                return;
            }
        }
        bottomSheetDialog.show();
    }
}
 
开发者ID:scott7462,项目名称:Udacity-Capstone-Project,代码行数:12,代码来源:BasePickImageFragment.java

示例11: onPermissionsChecked

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
    if (report.areAllPermissionsGranted() && report.getGrantedPermissionResponses().size() == 2) {
        for (PermissionGrantedResponse permissionGrantedResponse : report.getGrantedPermissionResponses()) {
            if (!validatePermission(permissionGrantedResponse)) {
                finish();
            }
        }
    }
}
 
开发者ID:scott7462,项目名称:Udacity-Capstone-Project,代码行数:11,代码来源:ActivityInit.java

示例12: onPermissionsChecked

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
public void onPermissionsChecked(MultiplePermissionsReport report) {
    if (report.areAllPermissionsGranted() && report.getGrantedPermissionResponses().size() == 2) {
        for (PermissionGrantedResponse permissionGrantedResponse : report.getGrantedPermissionResponses()) {
            if (!validatePermission(permissionGrantedResponse)) {
                return;
            }
        }
    }
    initWorkout();
}
 
开发者ID:scott7462,项目名称:Udacity-Capstone-Project,代码行数:12,代码来源:ActivityDoWorkout.java

示例13: initializeVoiceService

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
/**
 * Initialize voice service
 * @param context
 * @param registrationListener
 * @param callback
 * @throws Exception
 */
public static void initializeVoiceService(final Activity context, final RegistrationListener registrationListener, final Callback<VoiceService> callback) throws Exception {

    if (callback == null) {
        throw new Exception("callback cannot be null");
    }

    if (registrationListener == null) {
        throw new Exception("registrationListener cannot be null");
    }

    // Permissions
    Dexter.withActivity(context)
            .withPermissions(PERMISSION_LIST)
            .withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {

                    if (!report.areAllPermissionsGranted()) {
                        callback.onFailure(new Exception("The following permissions are required: \n" + TextUtils.join("\n", PERMISSION_LIST)));
                        return;
                    }

                    try {
                        VoiceService service = VoiceService.newInstance(context.getApplicationContext(), registrationListener);
                        callback.onSuccess(service);
                    } catch (IOException e) {
                        callback.onFailure(e);
                    }
                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {

                }
            })
            .withErrorListener(new PermissionRequestErrorListener() {
                @Override
                public void onError(DexterError error) {
                    callback.onFailure(new Exception("The following permissions are required: \n" + TextUtils.join("\n", PERMISSION_LIST)));
                }
            })
            .onSameThread()
            .check();
}
 
开发者ID:aksalj,项目名称:africastalking-android,代码行数:52,代码来源:AfricasTalking.java

示例14: onCreate

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    _receiverController = new ReceiverController(this);

    if (UserService.getInstance().IsAnUserSaved()) {
        List<String> userList = new ArrayList<>();
        userList.add(UserService.getInstance().GetUser().GetName());
        _userView.setAdapter(new ArrayAdapter<>(LoginActivity.this, android.R.layout.simple_dropdown_item_1line, userList));
    }

    // Set up the login form.
    _userView = findViewById(R.id.user);

    _passwordView = findViewById(R.id.password);
    _passwordView.setOnEditorActionListener((textView, id, keyEvent) -> {
        if (id == R.id.login || id == EditorInfo.IME_NULL) {
            attemptLogin();
            return true;
        }
        return false;
    });

    com.rey.material.widget.Button userSignInButton = findViewById(R.id.user_sign_in_button);
    userSignInButton.setOnClickListener(view -> attemptLogin());

    _loginFormView = findViewById(R.id.login_form);
    _progressView = findViewById(R.id.login_progress);

    Dexter.withActivity(this)
            .withPermissions(PERMISSIONS_TO_REQUEST)
            .withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    if (report.areAllPermissionsGranted()) {
                        Toasty.success(LoginActivity.this, "All permissions granted! Thanks!", Toast.LENGTH_LONG).show();
                    }
                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                }
            }).check();
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:47,代码来源:LoginActivity.java

示例15: successful

import com.karumi.dexter.MultiplePermissionsReport; //导入依赖的package包/类
@Override
public void successful(MultiplePermissionsReport report) {
    refreshBluetooth();
}
 
开发者ID:barisatalay,项目名称:thermalprinterhelper,代码行数:5,代码来源:PrinterListPresenter.java


注:本文中的com.karumi.dexter.MultiplePermissionsReport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。