|
@@ -165,25 +165,7 @@ public class AlterHeadpicActivity extends TitleBarActivity implements View.OnCli
|
|
|
*/
|
|
|
private void startActionCamera() {
|
|
|
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
|
|
|
- //权限发生了改变 true // false 小米
|
|
|
- if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
|
|
|
- new AlertDialog.Builder(this).setTitle("提示")
|
|
|
- .setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- // 请求授权
|
|
|
- ActivityCompat.requestPermissions(AlterHeadpicActivity.this, new String[]{Manifest.permission.CAMERA}, 1);
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
-
|
|
|
- }
|
|
|
- }).create().show();
|
|
|
- } else {
|
|
|
- ActivityCompat.requestPermissions(AlterHeadpicActivity.this, new String[]{Manifest.permission.CAMERA}, 1);
|
|
|
- }
|
|
|
+ ActivityCompat.requestPermissions(AlterHeadpicActivity.this, new String[]{Manifest.permission.CAMERA}, 1);
|
|
|
} else {
|
|
|
closePopDialog();
|
|
|
String pictureName = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).format(new Date()) +
|