don’t query packages before attaching something (Daniel Gultsch)
This commit is contained in:
parent
bd3a72b19b
commit
bb6f92b4af
2 changed files with 11 additions and 3 deletions
|
@ -1190,7 +1190,14 @@ public class FileBackend {
|
|||
}
|
||||
|
||||
public Uri getTakePhotoUri() {
|
||||
File file = new File(getTakeFromCameraPath() + "IMG_" + fileDateFormat.format(new Date()) + ".jpg");
|
||||
final String filename = String.format("IMG_%s.%s", fileDateFormat.format(new Date()),"jpg");
|
||||
File file;
|
||||
if (STORAGE_INDEX.get() == 1) {
|
||||
final File dcimCache = new File(mXmppConnectionService.getCacheDir(), "Camera");
|
||||
file = new File(dcimCache, filename);
|
||||
} else {
|
||||
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), filename);
|
||||
}
|
||||
file.getParentFile().mkdirs();
|
||||
return getUriForFile(mXmppConnectionService, file);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.app.Activity;
|
|||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
@ -2100,7 +2101,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
|||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
if (intent.resolveActivity(context.getPackageManager()) != null) {
|
||||
try {
|
||||
Log.d(Config.LOGTAG, "Attachment: " + attachmentChoice);
|
||||
if (chooser) {
|
||||
startActivityForResult(
|
||||
|
@ -2111,7 +2112,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
|||
startActivityForResult(intent, attachmentChoice);
|
||||
activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
|
||||
}
|
||||
} else {
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
//ignore ToastCompat.makeText(context, R.string.no_application_found, ToastCompat.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue