fff
This commit is contained in:
parent
053d819d27
commit
505c68fb6b
@ -1,14 +1,21 @@
|
|||||||
package com.arpa.hndahesudintocctmsdriver.ui.news;
|
package com.arpa.hndahesudintocctmsdriver.ui.news;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.arpa.hndahesudintocctmsdriver.R;
|
import com.arpa.hndahesudintocctmsdriver.R;
|
||||||
|
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||||
import com.arpa.hndahesudintocctmsdriver.util.view.BottomTabUtil;
|
import com.arpa.hndahesudintocctmsdriver.util.view.BottomTabUtil;
|
||||||
|
import com.dahe.mylibrary.utils.ToastUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hlh
|
* @author hlh
|
||||||
@ -27,6 +34,33 @@ public class NewActivity extends BaseAppCompatActivity {
|
|||||||
fs[0] =new NewsFragment();
|
fs[0] =new NewsFragment();
|
||||||
BottomTabUtil bt =new BottomTabUtil(this,R.id.body, fs);
|
BottomTabUtil bt =new BottomTabUtil(this,R.id.body, fs);
|
||||||
bt.selectItem(fs[0]);
|
bt.selectItem(fs[0]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
if (!Environment.isExternalStorageManager()) {
|
||||||
|
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||||
|
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||||
|
this.startActivityForResult(intent, 1024);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRefuse = false;
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == 1024 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
// 检查是否有权限
|
||||||
|
if (Environment.isExternalStorageManager()) {
|
||||||
|
isRefuse = false;
|
||||||
|
ToastUtils.showToast(this,"授权成功");
|
||||||
|
// 授权成功
|
||||||
|
} else {
|
||||||
|
isRefuse = true;
|
||||||
|
ToastUtils.showToast(this,"授权失败");
|
||||||
|
// 授权失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user