change stickers folder

This commit is contained in:
Arne 2024-04-05 20:35:20 +02:00
parent 453e01fb5e
commit 6d683cabff
3 changed files with 7 additions and 7 deletions

View file

@ -103,7 +103,7 @@ public class DownloadDefaultStickers extends Service {
Response r = http.newCall(new Request.Builder().url(sticker.getString("url")).build()).execute();
File file = null;
try {
file = new File(mStickerDir.getAbsolutePath() + "/" + sticker.getString("pack") + "/" + sticker.getString("name") + "." + MimeUtils.guessExtensionFromMimeType(r.headers().get("content-type")));
file = new File(mStickerDir.getAbsolutePath() + "/" + sticker.getString("name") + "." + MimeUtils.guessExtensionFromMimeType(r.headers().get("content-type")));
file.getParentFile().mkdirs();
OutputStream os = new FileOutputStream(file);
if (r.body() != null) {

View file

@ -3746,14 +3746,14 @@ public class ConversationFragment extends XmppFragment
InputStream in;
OutputStream out;
try {
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "User");
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers");
//create output directory if it doesn't exist
if (!stickerfolder.exists()) {
stickerfolder.mkdirs();
}
String filename = "user_" + getConversation().getName() + "_" + System.currentTimeMillis();
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "User" + File.separator + filename + ".jpg");
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + filename + ".jpg");
in = activity.getContentResolver().openInputStream(imageUri);
out = new FileOutputStream(newSticker);

View file

@ -190,13 +190,13 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
InputStream in;
OutputStream out;
try {
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom");
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers");
//create output directory if it doesn't exist
if (!stickerfolder.exists()) {
stickerfolder.mkdirs();
}
String filename = getFileName(imageUri);
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom" + File.separator + filename);
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + filename);
in = getContentResolver().openInputStream(imageUri);
out = new FileOutputStream(newSticker);
@ -229,13 +229,13 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
InputStream in;
OutputStream out;
try {
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom");
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers");
//create output directory if it doesn't exist
if (!stickerfolder.exists()) {
stickerfolder.mkdirs();
}
String filename = getFileName(imageUri);
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom" + File.separator + filename);
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + filename);
in = getContentResolver().openInputStream(imageUri);
out = new FileOutputStream(newSticker);