Skip to content

Commit

Permalink
1.更新权限检测第三方依赖
Browse files Browse the repository at this point in the history
2.更新apk
  • Loading branch information
yuzhiqiang1993 committed Apr 3, 2018
1 parent 4361a98 commit bec408e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:support-vector-drawable:$support_version"
implementation "com.yanzhenjie:permission:1.1.0"
implementation 'com.yanzhenjie:permission:2.0.0-rc4'
//implementation project(':zxinglibrary')
implementation 'com.github.yuzhiqiang1993:zxing:2.1.5'

Expand Down
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1},"path":"app-release.apk","properties":{"packageId":"com.yzq.zxing","split":"","minSdkVersion":"16"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Binary file modified app/release/zxing.apk
Binary file not shown.
32 changes: 16 additions & 16 deletions app/src/main/java/com/yzq/zxing/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
Expand All @@ -18,8 +17,9 @@
import android.widget.Toast;

import com.google.zxing.WriterException;
import com.yanzhenjie.permission.Action;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.PermissionListener;
import com.yanzhenjie.permission.Permission;
import com.yzq.zxinglibrary.android.CaptureActivity;
import com.yzq.zxinglibrary.bean.ZxingConfig;
import com.yzq.zxinglibrary.common.Constant;
Expand Down Expand Up @@ -54,20 +54,20 @@ protected void onCreate(Bundle savedInstanceState) {

private void initView() {
/*扫描按钮*/
scanBtn = findViewById(R.id.scanBtn);
scanBtn = findViewById(R.id.scanBtn);
scanBtn.setOnClickListener(this);
/*扫描结果*/
result = findViewById(R.id.result);
result = findViewById(R.id.result);

/*要生成二维码的输入框*/
contentEt = findViewById(R.id.contentEt);
contentEt = findViewById(R.id.contentEt);
/*生成按钮*/
encodeBtn = findViewById(R.id.encodeBtn);
encodeBtn = findViewById(R.id.encodeBtn);
encodeBtn.setOnClickListener(this);
/*生成的图片*/
contentIv = findViewById(R.id.contentIv);

toolbar=findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);

toolbar.setTitle("扫一扫");
setSupportActionBar(toolbar);
Expand All @@ -82,16 +82,16 @@ public void onClick(View v) {
case R.id.scanBtn:

AndPermission.with(this)
.permission(Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE)
.callback(new PermissionListener() {
.permission(Permission.CAMERA, Permission.READ_EXTERNAL_STORAGE)
.onGranted(new Action() {
@Override
public void onSucceed(int requestCode, @NonNull List<String> grantPermissions) {
public void onAction(List<String> permissions) {
Intent intent = new Intent(MainActivity.this, CaptureActivity.class);

/*ZxingConfig是配置类 可以设置是否显示底部布局,闪光灯,相册,是否播放提示音 震动等动能
* 也可以不传这个参数
* 不传的话 默认都为默认不震动 其他都为true
* */
* 也可以不传这个参数
* 不传的话 默认都为默认不震动 其他都为true
* */

ZxingConfig config = new ZxingConfig();
config.setPlayBeep(true);
Expand All @@ -100,10 +100,10 @@ public void onSucceed(int requestCode, @NonNull List<String> grantPermissions) {

startActivityForResult(intent, REQUEST_CODE_SCAN);
}

})
.onDenied(new Action() {
@Override
public void onFailed(int requestCode, @NonNull List<String> deniedPermissions) {

public void onAction(List<String> permissions) {
Uri packageURI = Uri.parse("package:" + getPackageName());
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, packageURI);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down

0 comments on commit bec408e

Please sign in to comment.