新增:隐私政策对话框(合规化,同意后才能使用软件)
优化:build.gradle 依赖升级 优化:增加 Android 12.x 支持(待验证) 修复:友盟统计失效pull/100/head
parent
edb39867c1
commit
263a9fb6c3
@ -0,0 +1,87 @@
|
||||
package com.idormy.sms.forwarder.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SharedPreferencesHelper {
|
||||
|
||||
private final SharedPreferences sharedPreferences;
|
||||
private final SharedPreferences.Editor editor;
|
||||
|
||||
public SharedPreferencesHelper(Context context, String FILE_NAME) {
|
||||
sharedPreferences = context.getSharedPreferences(FILE_NAME,
|
||||
Context.MODE_PRIVATE);
|
||||
editor = sharedPreferences.edit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储
|
||||
*/
|
||||
public void put(String key, Object object) {
|
||||
if (object instanceof String) {
|
||||
editor.putString(key, (String) object);
|
||||
} else if (object instanceof Integer) {
|
||||
editor.putInt(key, (Integer) object);
|
||||
} else if (object instanceof Boolean) {
|
||||
editor.putBoolean(key, (Boolean) object);
|
||||
} else if (object instanceof Float) {
|
||||
editor.putFloat(key, (Float) object);
|
||||
} else if (object instanceof Long) {
|
||||
editor.putLong(key, (Long) object);
|
||||
} else {
|
||||
editor.putString(key, object.toString());
|
||||
}
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取保存的数据
|
||||
*/
|
||||
public Object getSharedPreference(String key, Object defaultObject) {
|
||||
if (defaultObject instanceof String) {
|
||||
return sharedPreferences.getString(key, (String) defaultObject);
|
||||
} else if (defaultObject instanceof Integer) {
|
||||
return sharedPreferences.getInt(key, (Integer) defaultObject);
|
||||
} else if (defaultObject instanceof Boolean) {
|
||||
return sharedPreferences.getBoolean(key, (Boolean) defaultObject);
|
||||
} else if (defaultObject instanceof Float) {
|
||||
return sharedPreferences.getFloat(key, (Float) defaultObject);
|
||||
} else if (defaultObject instanceof Long) {
|
||||
return sharedPreferences.getLong(key, (Long) defaultObject);
|
||||
} else {
|
||||
return sharedPreferences.getString(key, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除某个key值已经对应的值
|
||||
*/
|
||||
public void remove(String key) {
|
||||
editor.remove(key);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有数据
|
||||
*/
|
||||
public void clear() {
|
||||
editor.clear();
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某个key是否存在
|
||||
*/
|
||||
public Boolean contain(String key) {
|
||||
return sharedPreferences.contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回所有的键值对
|
||||
*/
|
||||
public Map<String, ?> getAll() {
|
||||
return sharedPreferences.getAll();
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="#fff"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="Overdraw">
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/privacy_policy"
|
||||
android:textColor="#000"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textlike"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:textColor="#000"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/privacy_policy_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="#514E4E" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<TextView
|
||||
android:textColor="#000"
|
||||
android:id="@+id/succsebtn"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/agree"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="0.5dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#5F6063" />
|
||||
|
||||
<TextView
|
||||
android:textColor="#000"
|
||||
android:id="@+id/caclebtn"
|
||||
android:textSize="20sp"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/disagree" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -1,3 +1,3 @@
|
||||
#Fri Jul 16 10:33:23 CST 2021
|
||||
versionName=2.3.0
|
||||
versionCode=32
|
||||
versionName=2.4.0
|
||||
versionCode=33
|
||||
|
Loading…
Reference in New Issue