Search in sources :

Example 1 with PermissionManager

use of com.benmu.framework.manager.impl.PermissionManager in project WeexErosFramework by bmfe.

the class AbstractWeexActivity method onRequestPermissionsResult.

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    PermissionManager permissionManager = ManagerFactory.getManagerService(PermissionManager.class);
    permissionManager.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Also used : PermissionManager(com.benmu.framework.manager.impl.PermissionManager)

Example 2 with PermissionManager

use of com.benmu.framework.manager.impl.PermissionManager in project WeexErosFramework by bmfe.

the class PermissionUtils method checkPermission.

/**
 * 查询权限并申请,未做回调处理
 */
public static boolean checkPermission(Context context, String permission) {
    PermissionManager permissionManager = ManagerFactory.getManagerService(PermissionManager.class);
    boolean hasPermisson = permissionManager.hasPermissions(context, permission);
    if (!hasPermisson) {
        permissionManager.requestPermissions(context, null, permission);
    // ModalManager.BmToast.toast(context, "读取sd卡存储权限未授予,请到应用设置页面开启权限!", Toast.LENGTH_SHORT);
    }
    return hasPermisson;
}
Also used : PermissionManager(com.benmu.framework.manager.impl.PermissionManager)

Example 3 with PermissionManager

use of com.benmu.framework.manager.impl.PermissionManager in project WeexErosFramework by bmfe.

the class WeChatRelayUtil method relayToCircle.

public static void relayToCircle(final Context context, String content, ArrayList<Uri> uris, String type, final JSCallback success, JSCallback failed) {
    if (MEDIA_IMAGE.equals(type)) {
        final Intent localIntent = new Intent();
        localIntent.setComponent(new ComponentName("com.tencent.mm", "com.tencent.mm.ui.tools" + ".ShareToTimeLineUI"));
        localIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
        localIntent.setType("image/*");
        localIntent.putExtra("Kdescription", content);
        localIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        context.startActivity(localIntent);
        if (success != null) {
            success.invoke(new BaseResultBean(WeChatRelayUtil.RELAY_SUCCESS, "分享成功"));
        }
    } else if (MEDIA_VIDEO.equals(type)) {
        // 检查内存卡权限
        PermissionManager permissionManager = ManagerFactory.getManagerService(PermissionManager.class);
        if (permissionManager.hasPermissions(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
            execute(context, content, uris, type, success, failed);
        } else {
            // 没有权限
            ModalManager.BmToast.toast(context, "访问外部存储卡权限被拒绝,请到设置页面开启后再试", Toast.LENGTH_SHORT);
            if (failed != null) {
                failed.invoke(new BaseResultBean(ERROR_PERMISSION, "权限被拒绝"));
            }
        }
    }
}
Also used : BaseResultBean(com.benmu.framework.model.BaseResultBean) PermissionManager(com.benmu.framework.manager.impl.PermissionManager) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Example 4 with PermissionManager

use of com.benmu.framework.manager.impl.PermissionManager in project WeexErosFramework by bmfe.

the class DefaultImageAdapter method checkPermission.

/**
 * 判断Sd卡是否挂载,是否有Sd卡权限
 */
private boolean checkPermission(Context context) {
    PermissionManager permissionManager = ManagerFactory.getManagerService(PermissionManager.class);
    boolean hasPermisson = permissionManager.hasPermissions(context, Manifest.permission.READ_EXTERNAL_STORAGE);
    if (!hasPermisson) {
        ModalManager.BmToast.toast(context, "读取sd卡存储权限未授予,请到应用设置页面开启权限!", Toast.LENGTH_SHORT);
    }
    return hasPermisson;
}
Also used : PermissionManager(com.benmu.framework.manager.impl.PermissionManager)

Aggregations

PermissionManager (com.benmu.framework.manager.impl.PermissionManager)4 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 BaseResultBean (com.benmu.framework.model.BaseResultBean)1