Skip to content

Commit

Permalink
Fix for #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Swati4star committed Sep 11, 2016
1 parent 43018c5 commit 773eb6f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/src/main/java/swati4star/createpdf/First.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public class First extends Fragment {
String filename;
MorphingButton buttt;
Image image;
Boolean permissionsGranted = false;

@Override
public void onAttach(Context context) {
Expand All @@ -79,9 +78,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(ac,
if ( (ContextCompat.checkSelfPermission(ac,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
!= PackageManager.PERMISSION_GRANTED )|| (ContextCompat.checkSelfPermission(ac,
Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED ) || (ContextCompat.checkSelfPermission(ac,
Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED ))

{
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.CAMERA},
Expand Down Expand Up @@ -135,10 +140,7 @@ public void onClick(View v) {
btnMorph1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!permissionsGranted) {
Toast.makeText(ac, "Insufficient Permissions!", Toast.LENGTH_LONG)
.show();
} else if (imagesuri.size() == 0) {
if (imagesuri.size() == 0) {
Toast.makeText(ac, "No Images selected", Toast.LENGTH_LONG).show();

} else {
Expand Down

0 comments on commit 773eb6f

Please sign in to comment.