mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-29 00:14:12 +01:00
Change sticker directory + long press to save sticker of others + save received/send image as sticker
This commit is contained in:
parent
38bd934895
commit
9a1c33c1a3
5 changed files with 32 additions and 22 deletions
|
@ -28,19 +28,6 @@
|
|||
"versionName": "1.7.8.5",
|
||||
"outputFile": "monocles chat-1.7.8.5-git-x86-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
{
|
||||
"filterType": "ABI",
|
||||
"value": "armeabi-v7a"
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 15601,
|
||||
"versionName": "1.7.8.5",
|
||||
"outputFile": "monocles chat-1.7.8.5-git-armeabi-v7a-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
|
@ -66,6 +53,19 @@
|
|||
"versionCode": 15604,
|
||||
"versionName": "1.7.8.5",
|
||||
"outputFile": "monocles chat-1.7.8.5-git-arm64-v8a-release.apk"
|
||||
},
|
||||
{
|
||||
"type": "ONE_OF_MANY",
|
||||
"filters": [
|
||||
{
|
||||
"filterType": "ABI",
|
||||
"value": "armeabi-v7a"
|
||||
}
|
||||
],
|
||||
"attributes": [],
|
||||
"versionCode": 15601,
|
||||
"versionName": "1.7.8.5",
|
||||
"outputFile": "monocles chat-1.7.8.5-git-armeabi-v7a-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
|
|
|
@ -121,6 +121,16 @@ public class DownloadDefaultStickers extends Service {
|
|||
mDatabaseBackend.saveCid(cid, file, sticker.getString("url"));
|
||||
}
|
||||
|
||||
File nomediastickers = new File(mStickerDir.getAbsolutePath() + "/" + sticker.getString("pack") + "/" + ".nomedia");
|
||||
File nomediastickersfolder = new File(mStickerDir.getAbsolutePath() + "/" + ".nomedia");
|
||||
try {
|
||||
nomediastickers.createNewFile();
|
||||
nomediastickersfolder.createNewFile();
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (file != null) {
|
||||
MediaScannerConnection.scanFile(
|
||||
getBaseContext(),
|
||||
|
@ -187,7 +197,7 @@ public class DownloadDefaultStickers extends Service {
|
|||
}
|
||||
|
||||
private File stickerDir() {
|
||||
return new File(this.getFilesDir() + File.separator + "Stickers");
|
||||
return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -779,7 +779,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
private File stickerDir() {
|
||||
return new File(this.getFilesDir() + File.separator + "Stickers");
|
||||
return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers");
|
||||
}
|
||||
|
||||
public void rescanStickers() {
|
||||
|
|
|
@ -2014,7 +2014,7 @@ public class ConversationFragment extends XmppFragment
|
|||
final String path = m.getRelativeFilePath();
|
||||
Log.d(Config.LOGTAG, "Path = " + path);
|
||||
if (path == null || !path.startsWith("/") || path.contains(getConversationsDirectory(this.activity, "null").getAbsolutePath())) {
|
||||
//saveAsSticker.setVisible(true); TODO: Enable it again with better storage handling
|
||||
saveAsSticker.setVisible(true);
|
||||
blockMedia.setVisible(true);
|
||||
deleteFile.setVisible(true);
|
||||
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
|
||||
|
@ -3236,14 +3236,14 @@ public class ConversationFragment extends XmppFragment
|
|||
InputStream in;
|
||||
OutputStream out;
|
||||
try {
|
||||
File stickerfolder = new File(activity.getFilesDir() + File.separator + "Stickers" + File.separator + "User");
|
||||
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "User");
|
||||
//create output directory if it doesn't exist
|
||||
if (!stickerfolder.exists()) {
|
||||
stickerfolder.mkdirs();
|
||||
}
|
||||
|
||||
String filename = "user_" + getConversation().getName() + "_" + System.currentTimeMillis();
|
||||
File newSticker = new File(activity.getFilesDir() + File.separator + "Stickers" + File.separator + "User" + File.separator + filename);
|
||||
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "User" + File.separator + filename);
|
||||
|
||||
in = activity.getContentResolver().openInputStream(imageUri);
|
||||
out = new FileOutputStream(newSticker);
|
||||
|
|
|
@ -186,13 +186,13 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
|
|||
InputStream in;
|
||||
OutputStream out;
|
||||
try {
|
||||
File stickerfolder = new File(this.getFilesDir() + File.separator + STICKER_DIR + File.separator + "Custom");
|
||||
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom");
|
||||
//create output directory if it doesn't exist
|
||||
if (!stickerfolder.exists()) {
|
||||
stickerfolder.mkdirs();
|
||||
}
|
||||
String filename = getFileName(imageUri);
|
||||
File newSticker = new File(this.getFilesDir() + File.separator + STICKER_DIR + File.separator + "Custom" + File.separator + filename);
|
||||
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom" + File.separator + filename);
|
||||
|
||||
in = getContentResolver().openInputStream(imageUri);
|
||||
out = new FileOutputStream(newSticker);
|
||||
|
@ -225,13 +225,13 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
|
|||
InputStream in;
|
||||
OutputStream out;
|
||||
try {
|
||||
File stickerfolder = new File(this.getFilesDir() + File.separator + STICKER_DIR + File.separator + "Custom");
|
||||
File stickerfolder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom");
|
||||
//create output directory if it doesn't exist
|
||||
if (!stickerfolder.exists()) {
|
||||
stickerfolder.mkdirs();
|
||||
}
|
||||
String filename = getFileName(imageUri);
|
||||
File newSticker = new File(this.getFilesDir() + File.separator + STICKER_DIR + File.separator + "Custom" + File.separator + filename);
|
||||
File newSticker = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) + File.separator + APP_DIRECTORY + File.separator + "Stickers" + File.separator + "Custom" + File.separator + filename);
|
||||
|
||||
in = getContentResolver().openInputStream(imageUri);
|
||||
out = new FileOutputStream(newSticker);
|
||||
|
|
Loading…
Add table
Reference in a new issue