Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉Release 1.3,长按新UI文字标题可修改背景图片(BETA) #6

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}