// Path: app/src/main/java/com/vv/androidreview/utils/PermissionsChecker.java
// public class PermissionsChecker {
//     private final Context mContext;
// 
//     public PermissionsChecker(Context context) {
//         mContext = context.getApplicationContext();
//     }
// 
//     // 判断权限集合
//     public boolean lacksPermissions(String... permissions) {
//         for (String permission : permissions) {
//             if (lacksPermission(permission)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     // 判断是否缺少权限
//     private boolean lacksPermission(String permission) {
//         return ContextCompat.checkSelfPermission(mContext, permission) ==
//                 PackageManager.PERMISSION_DENIED;
//     }
// }


import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.vv.androidreview.R;
import com.vv.androidreview.utils.PermissionsChecker;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
/*
 * Copyright (c) 2016. Vv <envyfan@qq.com><http://www.v-sounds.com/>
 *
 * This file is part of AndroidReview (Android面试复习)
 *
 * AndroidReview is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  AndroidReview is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 * along with AndroidReview.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.vv.androidreview.ui.activites;



/**
 * 权限获取页面
 * <p/>
 * Created by wangchenlong on 16/1/26.
 */
public class PermissionsActivity extends AppCompatActivity {

    public static final int PERMISSIONS_GRANTED = 0; // 权限授权
    public static final int PERMISSIONS_DENIED = 1; // 权限拒绝

    private static final int PERMISSION_REQUEST_CODE = 0; // 系统权限管理页面的参数
    private static final String EXTRA_PERMISSIONS = "extra_permission"; // 权限参数
    private static final String PACKAGE_URL_SCHEME = "package:"; // 方案

// Path: app/src/main/java/com/vv/androidreview/utils/PermissionsChecker.java
// public class PermissionsChecker {
//     private final Context mContext;
// 
//     public PermissionsChecker(Context context) {
//         mContext = context.getApplicationContext();
//     }
// 
//     // 判断权限集合
//     public boolean lacksPermissions(String... permissions) {
//         for (String permission : permissions) {
//             if (lacksPermission(permission)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     // 判断是否缺少权限
//     private boolean lacksPermission(String permission) {
//         return ContextCompat.checkSelfPermission(mContext, permission) ==
//                 PackageManager.PERMISSION_DENIED;
//     }
// }


// Path: app/src/main/java/com/vv/androidreview/ui/activites/PermissionsActivity.java
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.vv.androidreview.R;
import com.vv.androidreview.utils.PermissionsChecker;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;

/*
 * Copyright (c) 2016. Vv <envyfan@qq.com><http://www.v-sounds.com/>
 *
 * This file is part of AndroidReview (Android面试复习)
 *
 * AndroidReview is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  AndroidReview is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 * along with AndroidReview.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.vv.androidreview.ui.activites;



/**
 * 权限获取页面
 * <p/>
 * Created by wangchenlong on 16/1/26.
 */
public class PermissionsActivity extends AppCompatActivity {

    public static final int PERMISSIONS_GRANTED = 0; // 权限授权
    public static final int PERMISSIONS_DENIED = 1; // 权限拒绝

    private static final int PERMISSION_REQUEST_CODE = 0; // 系统权限管理页面的参数
    private static final String EXTRA_PERMISSIONS = "extra_permission"; // 权限参数
    private static final String PACKAGE_URL_SCHEME = "package:"; // 方案

    private PermissionsChecker mChecker; // 权限检测器