Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Data Recovery White
Commits
834a7855
Commit
834a7855
authored
Jul 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
e67caf28
c32f5064
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
AppPreferences.java
...main/java/com/base/datarecovery/utils/AppPreferences.java
+13
-0
PhotoRecoveryStringManager.java
...m/base/datarecovery/utils/PhotoRecoveryStringManager.java
+27
-0
No files found.
app/src/main/java/com/base/datarecovery/utils/AppPreferences.java
View file @
834a7855
...
...
@@ -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
)
{
...
...
app/src/main/java/com/base/datarecovery/utils/PhotoRecoveryStringManager.java
0 → 100644
View file @
834a7855
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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment