package com.yeshi.makemoney.video.app.utils;
|
|
import android.content.Context;
|
import android.content.SharedPreferences;
|
|
import com.google.gson.Gson;
|
import com.google.gson.reflect.TypeToken;
|
import com.demo.lib.common.util.common.StringUtils;
|
|
import java.lang.reflect.Type;
|
import java.util.HashSet;
|
import java.util.Set;
|
|
public class AppConfigUtil {
|
|
public enum ConfigKey {
|
kefu,
|
unRegister,
|
privacyComplain,
|
helpLink,
|
disclaimerLink,
|
}
|
|
|
public static void saveConfig(ConfigKey key, String value, Context context) {
|
saveConfig(key.name(), value, context);
|
}
|
|
public static String getConfig(ConfigKey key, Context context) {
|
return getConfig(key.name(), context);
|
}
|
|
|
/**
|
* 保存联系我们链接
|
*
|
* @param context
|
* @param link
|
*/
|
public static void saveConcatUsLink(Context context, String link) {
|
saveConfig("contactUs", link, context);
|
}
|
|
public static String getConcatUsLink(Context context) {
|
return getConfig("contactUs", context);
|
}
|
|
/**
|
* 保存注销链接
|
*
|
* @param context
|
* @param link
|
*/
|
public static void saveUnRegisterLink(Context context, String link) {
|
saveConfig("unRegister", link, context);
|
}
|
|
public static String getUnRegisterLink(Context context) {
|
return getConfig("unRegister", context);
|
}
|
|
|
/**
|
* 保存关于我们的链接
|
*
|
* @param context
|
* @param link
|
*/
|
public static void saveAboutUsLink(Context context, String link) {
|
saveConfig("aboutUs", link, context);
|
}
|
|
public static String getAboutUsLink(Context context) {
|
return getConfig("aboutUs", context);
|
}
|
|
|
/**
|
* 隐私投诉
|
*
|
* @param context
|
* @param link
|
*/
|
public static void saveFeedBackLink(Context context, String link) {
|
saveConfig("feedBack", link, context);
|
}
|
|
public static String getFeedBackLink(Context context) {
|
return getConfig("feedBack", context);
|
}
|
|
|
/**
|
* 帮助中心
|
*
|
* @param context
|
* @param link
|
*/
|
public static void saveHelpLink(Context context, String link) {
|
saveConfig("helpLink", link, context);
|
}
|
|
public static String getHelpLink(Context context) {
|
return getConfig("helpLink", context);
|
}
|
|
|
private static void saveConfig(String key, String value, Context context) {
|
SharedPreferences.Editor editor = context.getSharedPreferences("config", Context.MODE_PRIVATE).edit();
|
editor.putString(key, value);
|
editor.commit();
|
}
|
|
|
private static String getConfig(String key, Context context) {
|
if (context == null)
|
return null;
|
SharedPreferences share = context.getSharedPreferences("config", Context.MODE_PRIVATE);
|
return share.getString(key, "");
|
}
|
|
|
}
|