don’t query packages before attaching something
This commit is contained in:
parent
2cc49e5ba6
commit
6fb465f91a
|
@ -1147,19 +1147,13 @@ public class FileBackend {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Uri getTakePhotoUri() {
|
public Uri getTakePhotoUri() {
|
||||||
|
final String filename = String.format("IMG_%s.%s", IMAGE_DATE_FORMAT.format(new Date()),"jpg");
|
||||||
File file;
|
File file;
|
||||||
if (Config.ONLY_INTERNAL_STORAGE) {
|
if (Config.ONLY_INTERNAL_STORAGE) {
|
||||||
file =
|
final File dcimCache = new File(mXmppConnectionService.getCacheDir(), "Camera");
|
||||||
new File(
|
file = new File(dcimCache, filename);
|
||||||
mXmppConnectionService.getCacheDir().getAbsolutePath(),
|
|
||||||
"Camera/IMG_" + IMAGE_DATE_FORMAT.format(new Date()) + ".jpg");
|
|
||||||
} else {
|
} else {
|
||||||
file =
|
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), filename);
|
||||||
new File(
|
|
||||||
getTakePhotoPath()
|
|
||||||
+ "IMG_"
|
|
||||||
+ IMAGE_DATE_FORMAT.format(new Date())
|
|
||||||
+ ".jpg");
|
|
||||||
}
|
}
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
return getUriForFile(mXmppConnectionService, file);
|
return getUriForFile(mXmppConnectionService, file);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.app.Activity;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -1744,7 +1745,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (intent.resolveActivity(context.getPackageManager()) != null) {
|
try {
|
||||||
if (chooser) {
|
if (chooser) {
|
||||||
startActivityForResult(
|
startActivityForResult(
|
||||||
Intent.createChooser(intent, getString(R.string.perform_action_with)),
|
Intent.createChooser(intent, getString(R.string.perform_action_with)),
|
||||||
|
@ -1752,7 +1753,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
} else {
|
} else {
|
||||||
startActivityForResult(intent, attachmentChoice);
|
startActivityForResult(intent, attachmentChoice);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (final ActivityNotFoundException e) {
|
||||||
Toast.makeText(context, R.string.no_application_found, Toast.LENGTH_LONG).show();
|
Toast.makeText(context, R.string.no_application_found, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue