Skip to content

Commit

Permalink
Merge pull request #5 from ChrisTomAlx/master
Browse files Browse the repository at this point in the history
Android Quality is now a user preference with key "quality"
  • Loading branch information
ChrisTomAlx authored Jul 18, 2019
2 parents 0517d49 + 3044a7c commit 4e1c6fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion library/src/main/java/com/scanlibrary/PickImageFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,12 @@ protected void postImagePick(Bitmap bitmap) {

private Bitmap getBitmap(Uri selectedimg) throws IOException {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 1;
try {
int quality = getArguments().getInt("quality", 1);
options.inSampleSize = quality;
} catch (Exception e) {
options.inSampleSize = 1;
}
AssetFileDescriptor fileDescriptor = null;
fileDescriptor =
getActivity().getContentResolver().openAssetFileDescriptor(selectedimg, "r");
Expand Down
4 changes: 3 additions & 1 deletion library/src/main/java/com/scanlibrary/ScanActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

/**
* Created by jhansi on 28/03/15.
Expand All @@ -24,6 +25,7 @@ private void init() {
PickImageFragment fragment = new PickImageFragment();
Bundle bundle = new Bundle();
bundle.putInt(ScanConstants.OPEN_INTENT_PREFERENCE, getPreferenceContent());
bundle.putInt("quality", getIntent().getIntExtra("quality", 1));
fragment.setArguments(bundle);
android.app.FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Expand Down Expand Up @@ -124,4 +126,4 @@ public void onTrimMemory(int level) {
static {
Loader.load();
}
}
}

0 comments on commit 4e1c6fb

Please sign in to comment.