Merge pull request #40 from m2049r/bugfix_issue_37

request and respond to permissions marshmallow style
This commit is contained in:
m2049r 2017-09-04 22:32:30 +02:00 committed by GitHub
commit 88110b702f
2 changed files with 23 additions and 2 deletions

View File

@ -593,7 +593,7 @@ public class LoginActivity extends AppCompatActivity
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startLoginFragment();
startLoginFragment = true;
} else {
String msg = getString(R.string.message_strorage_not_permitted);
Log.e(TAG, msg);
@ -605,6 +605,17 @@ public class LoginActivity extends AppCompatActivity
}
}
private boolean startLoginFragment = false;
@Override
protected void onResumeFragments() {
super.onResumeFragments();
if (startLoginFragment) {
startLoginFragment();
startLoginFragment = false;
}
}
void startLoginFragment() {
Fragment fragment = new LoginFragment();
getSupportFragmentManager().beginTransaction()

View File

@ -612,6 +612,16 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
getWallet().disposePendingTransaction();
}
private boolean startScanFragment = false;
@Override
protected void onResumeFragments() {
super.onResumeFragments();
if (startScanFragment) {
startScanFragment();
startScanFragment = false;
}
}
private void startScanFragment() {
Bundle extras = new Bundle();
@ -703,7 +713,7 @@ public class WalletActivity extends AppCompatActivity implements WalletFragment.
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startScanFragment();
startScanFragment = true;
} else {
String msg = getString(R.string.message_camera_not_permitted);
Log.e(TAG, msg);