Skip to content

Commit

Permalink
Change minimum SDK to API 16
Browse files Browse the repository at this point in the history
  • Loading branch information
hkk595 committed Nov 22, 2017
1 parent e1c076f commit a933b52
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 33 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allprojects {
2. Add the dependency in your module-level build.gradle
```groovy
dependencies {
compile 'com.github.hkk595:Resizer:v1.2'
compile 'com.github.hkk595:Resizer:v1.3'
}
```

Expand All @@ -40,7 +40,7 @@ Bitmap resizedImage = new Resizer(this)
```
Note: You only need to specify the target length (in pixel) of the longer side of the image. Resizer will calculate the rest automatically.

#### Using RxJava to get the resized image asynchronously
#### Using RxJava 2 with RxAndroid to get the resized image asynchronously
```java
final File[] resizedImage = new File[1];
new Resizer(this)
Expand Down Expand Up @@ -87,7 +87,7 @@ new Resizer(this)
Note: You don't need to declare the new image as final nor array if it is an instance variable of the class, instead of a local variable in a function.

#### Library specification
Minimum SDK: API 21
Minimum SDK: API 16
Default settings:
targetLength: 1080
Expand Down
20 changes: 9 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ apply plugin: 'com.github.dcendents.android-maven'
group='com.github.hkk595'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
defaultConfig {
minSdkVersion 21
targetSdkVersion 25
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -22,12 +21,11 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
}
8 changes: 2 additions & 6 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Ho/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="me.echodev.resizer">

<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">

</application>

android:supportsRtl="true" />
</manifest>
2 changes: 1 addition & 1 deletion app/src/main/java/me/echodev/resizer/util/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

public class FileUtils {
public static String getDestinationFilePath(Bitmap.CompressFormat compressFormat, String outputDirPath, File sourceImage) {
public static String getOutputFilePath(Bitmap.CompressFormat compressFormat, String outputDirPath, File sourceImage) {
String originalFileName = sourceImage.getName();
String targetFileName;
String targetFileExtension = "." + compressFormat.name().toLowerCase().replace("jpeg", "jpg");
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/me/echodev/resizer/util/ImageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public static File getScaledImage(int targetLength, int quality, Bitmap.Compress
}

// Prepare the new file name and path
String destinationFilePath = FileUtils.getDestinationFilePath(compressFormat, outputDirPath, sourceImage);
String outputFilePath = FileUtils.getOutputFilePath(compressFormat, outputDirPath, sourceImage);

// Write the resized image to the new file
Bitmap scaledBitmap = getScaledBitmap(targetLength, sourceImage);
FileUtils.writeBitmapToFile(scaledBitmap, compressFormat, quality, destinationFilePath);
FileUtils.writeBitmapToFile(scaledBitmap, compressFormat, quality, outputFilePath);

return new File(destinationFilePath);
return new File(outputFilePath);
}

public static Bitmap getScaledBitmap(int targetLength, File sourceImage) {
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -15,6 +16,7 @@ buildscript {

allprojects {
repositories {
google()
jcenter()
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Sep 01 13:20:48 HKT 2017
#Tue Nov 21 01:40:52 HKT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

0 comments on commit a933b52

Please sign in to comment.