Skip to content

Commit

Permalink
Aggiunta possibilità di modificare dimensioni immagine scattata/scelt…
Browse files Browse the repository at this point in the history
…a da galleria
  • Loading branch information
Matty3Run committed Mar 21, 2017
1 parent a9d5461 commit a7d9742
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion androidbase-account/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ dependencies {
})
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
testCompile 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion androidbase-adapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
testCompile 'junit:junit:4.12'
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*/
public abstract class PickerActivity extends LocationActivity {

private static final int COMPRESSION_QUALITY = 80;
private static final int COMPRESSION_WIDTH = 1280;
private static final int COMPRESSION_HEIGHT = 1280;

Expand All @@ -60,7 +61,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
private static final int actionPickAudio = 5000;
private static final int actionRecordAudio = 6000;

private int qualityImage = 80;
private int qualityImage = COMPRESSION_QUALITY;
private int imageWidth = COMPRESSION_WIDTH;
private int imageHeight = COMPRESSION_HEIGHT;

/**
* Sets the quality of the image taken or chosen from gallery
Expand All @@ -71,6 +74,24 @@ public void setQualityImage(int qualityImage) {
this.qualityImage = qualityImage;
}

/**
* Sets the width of the image taken or chosen from gallery
*
* @param imageWidth the width of the image
*/
public void setImageWidth(int imageWidth) {
this.imageWidth = imageWidth;
}

/**
* Sets the height of the image taken or chosen from gallery
*
* @param imageHeight the height of the image
*/
public void setImageHeight(int imageHeight) {
this.imageHeight = imageHeight;
}

private boolean saveInInternalStorage = false;

/**
Expand Down Expand Up @@ -444,7 +465,7 @@ private void onImageSelected(Bitmap bitmap) {

try {

Bitmap resizedBitmap = BitmapUtils.scaleBitmap(bitmap, COMPRESSION_WIDTH, COMPRESSION_HEIGHT);
Bitmap resizedBitmap = BitmapUtils.scaleBitmap(bitmap, imageWidth, imageHeight);

OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
resizedBitmap.compress(Bitmap.CompressFormat.JPEG, qualityImage, os);
Expand Down Expand Up @@ -517,7 +538,7 @@ private void handleTempUri(Uri tempUri) {
ExifInterface exif = new ExifInterface(tempUri.getPath());
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED);

Bitmap resizedBitmap = BitmapUtils.scaleBitmap(bitmap, COMPRESSION_WIDTH, COMPRESSION_HEIGHT);
Bitmap resizedBitmap = BitmapUtils.scaleBitmap(bitmap, imageWidth, imageHeight);

Bitmap bitmap1 = BitmapUtils.rotateBitmap(resizedBitmap, orientation);

Expand Down
4 changes: 2 additions & 2 deletions androidbase-gallery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
})
compile 'com.github.chrisbanes:PhotoView:1.2.6'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-share:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-share:1.1.3beta'
testCompile 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion androidbase-tutorial/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
testCompile 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion androidbase-webservice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
testCompile 'junit:junit:4.12'
}
14 changes: 7 additions & 7 deletions androidbase/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ artifacts {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-account:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-gallery:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-share:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-tutorial:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-webservice:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-adapter:1.1.2'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-core:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-account:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-gallery:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-share:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-tutorial:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-webservice:1.1.3beta'
compile 'com.github.MrAPPs-RSM.MrAppsAndroidBase:androidbase-adapter:1.1.3beta'
}

0 comments on commit a7d9742

Please sign in to comment.