Skip to content

Commit

Permalink
Merge pull request #2 from Findyr/feature/sdk7
Browse files Browse the repository at this point in the history
Add support for Eclair (API 7) devices
  • Loading branch information
Acconut committed Oct 24, 2015
2 parents 523ad89 + 4ffe3c1 commit 0622859
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tus-android-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 15
minSdkVersion 7
targetSdkVersion 21
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.tus.android.client;

import android.content.SharedPreferences;
import android.os.Build;

import java.net.MalformedURLException;
import java.net.URL;
Expand Down Expand Up @@ -46,17 +47,24 @@ public void set(String fingerprint, URL url) {

SharedPreferences.Editor editor = preferences.edit();
editor.putString(fingerprint, urlStr);
editor.apply();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
editor.apply();
} else {
editor.commit();
}
}

public void remove(String fingerprint) {
// Ignore empty fingerprints
if(fingerprint.length() == 0) {
return;
}

SharedPreferences.Editor editor = preferences.edit();
editor.remove(fingerprint);
editor.apply();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
editor.apply();
} else {
editor.commit();
}
}
}

0 comments on commit 0622859

Please sign in to comment.