-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉Release 1.3,长按新UI文字标题可修改背景图片(BETA)
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/haohanyh/linmengjia/nearlink/nlchat/fun/ChatCore/ChatFileUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* 受Haohanyh Computer Software Products Open Source LICENSE保护 https://github.com/Hny0305Lin/LICENSE/blob/main/LICENSE */ | ||
package com.haohanyh.linmengjia.nearlink.nlchat.fun.ChatCore; | ||
|
||
import android.content.Context; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
|
||
public class ChatFileUtils { | ||
private static final String FILE_NAME = "background_path.txt"; | ||
|
||
public static void saveBackgroundPath(Context context, String path) { | ||
File file = new File(context.getFilesDir(), FILE_NAME); | ||
try (FileWriter writer = new FileWriter(file)) { | ||
writer.write(path); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static String getBackgroundPath(Context context) { | ||
File file = new File(context.getFilesDir(), FILE_NAME); | ||
if (!file.exists()) { | ||
return null; | ||
} | ||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) { | ||
return reader.readLine(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
} |