Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiromansev committed Dec 14, 2017
2 parents 07bbeb4 + 977a3cd commit 0d26505
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ Android permission manager wrapper
```Java
public class MainActivity extends AppCompatActivity {

private PermissionsManager permissionsManager = new PermissionsManager();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
permissionsManager.attachTo(this);

Button btnCheck = (Button) findViewById(R.id.btnCheck);
btnCheck.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
permissionsManager.checkPermission(PermissionsManager.WRITE_EXTERNAL_REQUEST, new PermissionsManager.PermissionCallback() {
PermissionsManager.get().checkWriteExternalAccess(new PermissionsManager.PermissionCallback() {
@Override
public void permissionAccepted() {
Toast.makeText(MainActivity.this, getString(R.string.message_permission_accepted), Toast.LENGTH_LONG).show();
Expand All @@ -57,17 +54,6 @@ public class MainActivity extends AppCompatActivity {
}
});
}

@Override
protected void onPause() {
super.onPause();
permissionsManager.detachFrom();
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
```

Expand Down

0 comments on commit 0d26505

Please sign in to comment.