Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ public void onChange(boolean selfChange, Uri uri) {
};
getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, observer);

checkPermission();
// EudesSilva: BugFix: #24
if( !checkPermission() ){ // call direct functions in android versions <= 6
loadAlbums();
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
Expand All @@ -24,16 +25,27 @@ public class HelperActivity extends AppCompatActivity {
private final int maxLines = 4;
private final String[] permissions = new String[]{ Manifest.permission.WRITE_EXTERNAL_STORAGE };

protected void checkPermission() {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
permissionGranted();

} else {
ActivityCompat.requestPermissions(this, permissions, Constants.PERMISSION_REQUEST_CODE);
protected boolean checkPermission() {
if (!isMarshmallow()) {
return false;
}else {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
permissionGranted();

} else {
ActivityCompat.requestPermissions(this, permissions, Constants.PERMISSION_REQUEST_CODE);
}
return true;
}
}

// EudesSilva: BugFix: #24
// verify if version android is 6 or hight
private boolean isMarshmallow(){
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
}

private void requestPermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
showRequestPermissionRationale();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ public void onChange(boolean selfChange) {
};
getContentResolver().registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, false, observer);

checkPermission();
// EudesSilva: BugFix: #24
if( !checkPermission() ){ // call direct functions in android versions <= 6
loadImages();
}
}

@Override
Expand Down