提交 2288e907 编写于 作者: J jessyan

improve DataHelper

上级 c0c823f4
......@@ -16,8 +16,8 @@ group = "me.jessyan"
bintray {
user = isHasFile ? properties.getProperty("bintray.user") : System.getenv("bintray.user")
key = isHasFile ? properties.getProperty("bintray.apikey") : System.getenv("bintray.apikey")
user = isHasFile ? properties.getProperty("bintray.user") : System.getenv("bintray_user")
key = isHasFile ? properties.getProperty("bintray.apikey") : System.getenv("bintray_apikey")
pkg {
repo = 'maven'
......
......@@ -30,7 +30,7 @@ public class DataHelper {
if (mSharedPreferences == null) {
mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
mSharedPreferences.edit().putString(key, value).commit();
mSharedPreferences.edit().putString(key, value).apply();
}
/**
......@@ -56,7 +56,7 @@ public class DataHelper {
if (mSharedPreferences == null) {
mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
mSharedPreferences.edit().putInt(key, value).commit();
mSharedPreferences.edit().putInt(key, value).apply();
}
/**
......@@ -79,7 +79,7 @@ public class DataHelper {
if (mSharedPreferences == null) {
mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
mSharedPreferences.edit().remove(key).commit();
mSharedPreferences.edit().remove(key).apply();
}
/**
......@@ -89,7 +89,7 @@ public class DataHelper {
if (mSharedPreferences == null) {
mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
}
mSharedPreferences.edit().clear().commit();
mSharedPreferences.edit().clear().apply();
}
/**
......@@ -112,7 +112,7 @@ public class DataHelper {
// 将字节流编码成base64的字符串
String oAuth_Base64 = new String(Base64.encode(baos
.toByteArray(), Base64.DEFAULT));
mSharedPreferences.edit().putString(key, oAuth_Base64).commit();
mSharedPreferences.edit().putString(key, oAuth_Base64).apply();
return true;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.3.1'
//Gradle Android Maven plugin
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
//Gradle Bintray Plugin
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册