Add storage permission check

master^2
fengyuecanzhu 2 years ago
parent 7bd5e1d0c4
commit ab67ab6f10
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 5
      app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java

@ -37,6 +37,7 @@ import androidx.activity.result.contract.ActivityResultContract;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.hjq.permissions.OnPermissionCallback;
import com.kongzue.dialogx.dialogs.BottomMenu;
import org.jetbrains.annotations.NotNull;
@ -45,6 +46,7 @@ import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe;
@ -84,6 +86,7 @@ import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.utils.AdUtils;
import xyz.fycz.myreader.util.utils.NetworkUtils;
import xyz.fycz.myreader.util.utils.RxUtils;
import xyz.fycz.myreader.util.utils.StoragePermissionUtils;
/**
* @author fengyue
@ -206,6 +209,7 @@ public class MineFragment extends BaseFragment {
protected void initClick() {
super.initClick();
binding.mineRlUser.setOnClickListener(v -> {
StoragePermissionUtils.request(this, (permissions, all) -> {
if (isLogin) {
Intent intent = new Intent(getActivity(), UserInfoActivity.class);
startActivityForResult(intent, APPCONST.REQUEST_LOGOUT);
@ -214,6 +218,7 @@ public class MineFragment extends BaseFragment {
getActivity().startActivityForResult(intent, APPCONST.REQUEST_LOGIN);
}
});
});
binding.mineRlSyn.setOnClickListener(v -> {
if (!isLogin) {
ToastUtils.showWarring("请先登录!");

Loading…
Cancel
Save