Commit 834a7855 authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

parents e67caf28 c32f5064
......@@ -6,6 +6,8 @@ import android.util.Log;
import com.base.datarecovery.MyApplication;
import java.util.Set;
public class AppPreferences {
private static AppPreferences sInstance;
private SharedPreferences sharedPreferences;
......@@ -35,6 +37,8 @@ public class AppPreferences {
sharedPreferences.edit().putString(key, (String) value).apply();
} else if (value instanceof Double){
sharedPreferences.edit().putString(key, (String) value.toString()).apply();
} else if(value instanceof Set){
sharedPreferences.edit().putStringSet(key, (Set<String>) value).apply();
}else {
throw new IllegalArgumentException("Unsupported type: " + value.getClass());
}
......@@ -52,6 +56,8 @@ public class AppPreferences {
editor.putBoolean(key, (Boolean) value);
} else if (value instanceof String) {
editor.putString(key, (String) value);
} else if(value instanceof Set){
sharedPreferences.edit().putStringSet(key, (Set<String>) value).apply();
} else {
throw new IllegalArgumentException("Unsupported type: " + value.getClass());
}
......@@ -67,6 +73,13 @@ public class AppPreferences {
public void putInt(String key, int value) {
sharedPreferences.edit().putInt(key, value).apply();
}
public void putStringSet(String key, Set value) {
sharedPreferences.edit().putStringSet(key, value).apply();
}
public Set<String> getStringSet(String key, Set<String> defaultValue){
return sharedPreferences.getStringSet(key, defaultValue);
}
// 获取整数
public int getInt(String key, int defaultValue) {
......
package com.base.datarecovery.utils;
import java.util.ArrayList;
import java.util.List;
public class PhotoRecoveryStringManager {
private static final List<String> photoRecoveryCopies = new ArrayList<>();
private static int currentRecoveryIndex = 0;
static {
// 添加照片恢复功能的推送文案到列表
photoRecoveryCopies.add("Lost a precious photo? Our recovery tool can help you find it!");
photoRecoveryCopies.add("Accidentally deleted a photo? Recover it easily with our app.");
photoRecoveryCopies.add("Bring back lost memories: Use our photo recovery feature now.");
photoRecoveryCopies.add("Don't let deleted photos stay lost. Restore them with a few taps.");
photoRecoveryCopies.add("Regret deleting a photo? Try our recovery service to get it back today.");
}
public static String getNextRecoveryCopy() {
if (photoRecoveryCopies.isEmpty()) {
return null; // 或者根据您的需要处理错误情况
}
String copy = photoRecoveryCopies.get(currentRecoveryIndex);
currentRecoveryIndex = (currentRecoveryIndex + 1) % photoRecoveryCopies.size();
return copy;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment