|
|
@@ -248,17 +248,23 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
|
|
|
PermissionUtil.requestPermission(this, PermissionUtil.DEFAULT_REQUEST, permissions);
|
|
|
} else {
|
|
|
getCaceData(false);
|
|
|
+ LogUtil.d("Test","有权限@....");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ boolean isHasPermiss=false;
|
|
|
@Override
|
|
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
|
if (requestCode == PermissionUtil.DEFAULT_REQUEST) {
|
|
|
if (grantResults.length != 1 || grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
|
|
ToastUtil.showToast(ct, R.string.not_system_permission);
|
|
|
+ isHasPermiss=false;
|
|
|
+ getCaceData(false);
|
|
|
+ LogUtil.d("Test","没有权限....");
|
|
|
} else {
|
|
|
+ isHasPermiss=true;
|
|
|
getCaceData(false);
|
|
|
+ LogUtil.d("Test","有权限....");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -330,25 +336,32 @@ public class ContactsActivity extends OABaseActivity implements ContactsAdapter.
|
|
|
ThreadPool.getThreadPool().addTask(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- List<Contacts> contacts =
|
|
|
- ContactsUtils.getContacts1();
|
|
|
- if (contacts != null) {
|
|
|
- for (Contacts entity : contacts) {
|
|
|
- ContactsModel model = new ContactsModel();
|
|
|
- model.setImid("0");
|
|
|
- model.setName(StringUtils.isEmpty(entity.getName()) ? entity.getNickname() : entity.getName());
|
|
|
- model.setType(3);
|
|
|
- model.setEmail("");
|
|
|
- model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
|
|
|
- model.setPhone(entity.getPhone());
|
|
|
- model.setWhichsys("");
|
|
|
- model.setCompany("");
|
|
|
- tmodels.add(model);
|
|
|
+ if ( isHasPermiss){
|
|
|
+ List<Contacts> contacts =
|
|
|
+ ContactsUtils.getContacts1();
|
|
|
+ if (contacts != null) {
|
|
|
+ for (Contacts entity : contacts) {
|
|
|
+ ContactsModel model = new ContactsModel();
|
|
|
+ model.setImid("0");
|
|
|
+ model.setName(StringUtils.isEmpty(entity.getName()) ? entity.getNickname() : entity.getName());
|
|
|
+ model.setType(3);
|
|
|
+ model.setEmail("");
|
|
|
+ model.setOwnerId(MyApplication.getInstance().mLoginUser.getUserId());
|
|
|
+ model.setPhone(entity.getPhone());
|
|
|
+ model.setWhichsys("");
|
|
|
+ model.setCompany("");
|
|
|
+ tmodels.add(model);
|
|
|
|
|
|
+ }
|
|
|
+ contactsDao.save(tmodels);
|
|
|
+ getCaceData(false);
|
|
|
}
|
|
|
+ }else{
|
|
|
+ //没权限
|
|
|
contactsDao.save(tmodels);
|
|
|
getCaceData(false);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|