Skip to content

Commit

Permalink
增加unbinder解绑为null判断
Browse files Browse the repository at this point in the history
  • Loading branch information
fly803 committed Aug 10, 2018
1 parent ccb4810 commit 8085809
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

<!-- 往SDCard写入数据权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS"/>
<application
android:name=".AppApplication"
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.cg.baseproject.request.data.pojo.IpResult;
import com.cg.baseproject.request.data.response.BookSearchResponse;
import com.cg.baseproject.request.retrofit.subscriber.ProgressSubscriber;
import com.cg.baseproject.utils.android.EasyPermissionUtils;
import com.cg.baseproject.utils.android.ResolutionAdaptationUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ivy.baseproject.test.R;
Expand Down Expand Up @@ -71,7 +72,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
initView();
initMainInterfaceAdapter();
requireSomePermission();
// requireSomePermission();
EasyPermissionUtils.hiPermission(this);
}

private static final int num = 23;//用于验证获取的权
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ protected void onDestroy() {
super.onDestroy();
Log.i(TAG, "--->onDestroy()");
ActivityStackManager.getActivityStackManager().popActivity(this);
unbinder.unbind();
if(unbinder!=null){
unbinder.unbind();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public void onStop() {
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
if(unbinder!=null){
unbinder.unbind();
}
}

@Override
Expand Down Expand Up @@ -297,12 +299,12 @@ protected void removeFragment() {
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
Log.d("cg", "setUserVisibleHint: isVisibleToUser:"+isVisibleToUser);
// Log.d("cg", "setUserVisibleHint: isVisibleToUser:"+isVisibleToUser);
this.isVisible = isVisibleToUser;
Log.d("cg", "setUserVisibleHint: 0");
// Log.d("cg", "setUserVisibleHint: 0");
if (isVisibleToUser) {
onVisibleToUser(isLazyLoad);
Log.d("cg", "setUserVisibleHint: 1");
// Log.d("cg", "setUserVisibleHint: 1");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,31 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
}*/


/*public void requestPermission(Context context){
public static void hiPermission(final Context context){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
HiPermission.create(context)
.checkMutiPermission(new PermissionCallback() {
@Override
public void onClose() {
Log.i(TAG, "onClose");
ToastUtils.showShort("They cancelled our request");
// Log.i(TAG, "onClose");
// Toast.makeText(context,"They cancelled our request",Toast.LENGTH_LONG).show();
}

@Override
public void onFinish() {
ToastUtils.showToast("All permissions requested completed");
// Toast.makeText(context,"All permissions requested completed",Toast.LENGTH_LONG).show();
}

@Override
public void onDeny(String permission, int position) {
Log.i(TAG, "onDeny");
// Log.i(TAG, "onDeny");
}

@Override
public void onGuarantee(String permission, int position) {
Log.i(TAG, "onGuarantee");
// Log.i(TAG, "onGuarantee");
}
});
}
}*/
}
}

0 comments on commit 8085809

Please sign in to comment.