Merge branch 'master' of repos.thedevstack.de:conversations-plus
This commit is contained in:
commit
0c0676b7db
7 changed files with 68 additions and 6 deletions
|
@ -1,5 +1,13 @@
|
|||
###Conversations+ ChangeLog
|
||||
|
||||
####Version 0.0.7
|
||||
* Fixes FS#139: Do not merge messages at all
|
||||
* Fixes FS#51: Change toggle in Account Management back to standard
|
||||
* Fixes FS#167: Resized images are larger than original images
|
||||
* Fixes FS#135: disable notification for received/downloaded images when link is received through mam or carbons
|
||||
* Fixes FS#156: load of mam messages result in unread messages
|
||||
* Fixes FS#166: Images cannot be opened since storing in private image folder
|
||||
|
||||
####Version 0.0.6
|
||||
* Implements FS#111: Compress resized picture with PNG format
|
||||
* Fixes FS#107: Account can be edited while online
|
||||
|
@ -30,4 +38,4 @@
|
|||
* Fixes FS#66: Add option to popup menu to open message details
|
||||
* Fixes FS#65: Message Details
|
||||
* Fixes FS#56: Create new logo
|
||||
* Fixes FS#54: Add new options to message menu
|
||||
* Fixes FS#54: Add new options to message menu
|
||||
|
|
|
@ -64,8 +64,8 @@ android {
|
|||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 133
|
||||
versionName "1.11.1"
|
||||
versionCode 8
|
||||
versionName "0.0.7"
|
||||
archivesBaseName += "-$versionName"
|
||||
}
|
||||
|
||||
|
|
|
@ -175,6 +175,15 @@
|
|||
<action android:name="android.service.chooser.ChooserTargetService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<provider
|
||||
android:authorities="de.thedevstack.conversationsplus"
|
||||
android:name=".providers.ConversationsPlusFileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/filepaths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -98,7 +98,7 @@ public class FileBackend {
|
|||
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + File.separator + ConversationsPlusPreferences.imgTransferFolder() + File.separator;
|
||||
}
|
||||
|
||||
private static String getPrivateFileDirectoryPath() {
|
||||
public static String getPrivateFileDirectoryPath() {
|
||||
return ConversationsPlusApplication.getPrivateFilesDir().getAbsolutePath();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package de.thedevstack.conversationsplus.providers;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.support.v4.content.FileProvider;
|
||||
|
||||
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
|
||||
import de.thedevstack.conversationsplus.entities.DownloadableFile;
|
||||
|
||||
/**
|
||||
* Created by lookshe on 27.03.16.
|
||||
*/
|
||||
public class ConversationsPlusFileProvider extends FileProvider {
|
||||
|
||||
private static final String SCHEME = "content";
|
||||
private static final String AUTHORITY = "de.thedevstack.conversationsplus";
|
||||
|
||||
public static Uri createUriForPrivateFile(DownloadableFile file) {
|
||||
return FileProvider.getUriForFile(ConversationsPlusApplication.getAppContext(), AUTHORITY, file);
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ import java.util.concurrent.RejectedExecutionException;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
|
||||
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
|
||||
import de.thedevstack.conversationsplus.R;
|
||||
import de.thedevstack.conversationsplus.crypto.axolotl.XmppAxolotlSession;
|
||||
|
@ -48,6 +49,7 @@ import de.thedevstack.conversationsplus.entities.Message;
|
|||
import de.thedevstack.conversationsplus.entities.Message.FileParams;
|
||||
import de.thedevstack.conversationsplus.entities.Transferable;
|
||||
import de.thedevstack.conversationsplus.persistance.FileBackend;
|
||||
import de.thedevstack.conversationsplus.providers.ConversationsPlusFileProvider;
|
||||
import de.thedevstack.conversationsplus.services.AvatarService;
|
||||
import de.thedevstack.conversationsplus.ui.ConversationActivity;
|
||||
import de.thedevstack.conversationsplus.utils.CryptoHelper;
|
||||
|
@ -652,16 +654,35 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
Toast.makeText(activity,R.string.file_deleted,Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
boolean bInPrivateStorage = false;
|
||||
if (file.getAbsolutePath().startsWith(FileBackend.getPrivateFileDirectoryPath())) {
|
||||
bInPrivateStorage = true;
|
||||
}
|
||||
Intent openIntent = new Intent(Intent.ACTION_VIEW);
|
||||
String mime = file.getMimeType();
|
||||
if (mime == null) {
|
||||
mime = "*/*";
|
||||
}
|
||||
openIntent.setDataAndType(Uri.fromFile(file), mime);
|
||||
Uri uri;
|
||||
if (bInPrivateStorage) {
|
||||
uri = ConversationsPlusFileProvider.createUriForPrivateFile(file);
|
||||
} else {
|
||||
uri = Uri.fromFile(file);
|
||||
}
|
||||
openIntent.setDataAndType(uri, mime);
|
||||
PackageManager manager = activity.getPackageManager();
|
||||
List<ResolveInfo> infos = manager.queryIntentActivities(openIntent, 0);
|
||||
if (bInPrivateStorage) {
|
||||
for (ResolveInfo info : infos) {
|
||||
ConversationsPlusApplication.getAppContext().grantUriPermission(info.activityInfo.packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
}
|
||||
if (infos.size() == 0) {
|
||||
openIntent.setDataAndType(Uri.fromFile(file),"*/*");
|
||||
openIntent.setDataAndType(uri,"*/*");
|
||||
}
|
||||
if (bInPrivateStorage) {
|
||||
openIntent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
openIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
try {
|
||||
getContext().startActivity(openIntent);
|
||||
|
|
4
src/main/res/xml/filepaths.xml
Normal file
4
src/main/res/xml/filepaths.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<files-path name="conversationsplus_images" path="Images/"/>
|
||||
<files-path name="conversationsplus_files" path="files/" />
|
||||
</paths>
|
Loading…
Reference in a new issue