Intent.EXTRA_ALLOW_MULTIPLE is now supported by minSdk
This commit is contained in:
parent
ba9596b37d
commit
f9f994c540
|
@ -135,6 +135,8 @@ import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
|
||||||
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
|
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
|
||||||
import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
|
import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
public class ConversationFragment extends XmppFragment implements EditMessage.KeyboardListener, MessageAdapter.OnContactPictureLongClicked, MessageAdapter.OnContactPictureClicked {
|
public class ConversationFragment extends XmppFragment implements EditMessage.KeyboardListener, MessageAdapter.OnContactPictureLongClicked, MessageAdapter.OnContactPictureClicked {
|
||||||
|
|
||||||
|
@ -1692,7 +1694,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
this.activity.xmppConnectionService.updateConversation(conversation);
|
this.activity.xmppConnectionService.updateConversation(conversation);
|
||||||
this.activity.onConversationsListItemUpdated();
|
this.activity.onConversationsListItemUpdated();
|
||||||
refresh();
|
refresh();
|
||||||
getActivity().invalidateOptionsMenu();
|
requireActivity().invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1702,9 +1704,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
switch (attachmentChoice) {
|
switch (attachmentChoice) {
|
||||||
case ATTACHMENT_CHOICE_CHOOSE_IMAGE:
|
case ATTACHMENT_CHOICE_CHOOSE_IMAGE:
|
||||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
}
|
|
||||||
intent.setType("image/*");
|
intent.setType("image/*");
|
||||||
chooser = true;
|
chooser = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1722,9 +1722,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
case ATTACHMENT_CHOICE_CHOOSE_FILE:
|
case ATTACHMENT_CHOICE_CHOOSE_FILE:
|
||||||
chooser = true;
|
chooser = true;
|
||||||
intent.setType("*/*");
|
intent.setType("*/*");
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
}
|
|
||||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||||
break;
|
break;
|
||||||
|
@ -1807,7 +1805,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showErrorMessage(final Message message) {
|
private void showErrorMessage(final Message message) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
||||||
builder.setTitle(R.string.error_message);
|
builder.setTitle(R.string.error_message);
|
||||||
final String errorMessage = message.getErrorMessage();
|
final String errorMessage = message.getErrorMessage();
|
||||||
final String[] errorMessageParts = errorMessage == null ? new String[0] : errorMessage.split("\\u001f");
|
final String[] errorMessageParts = errorMessage == null ? new String[0] : errorMessage.split("\\u001f");
|
||||||
|
@ -1828,7 +1826,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
|
|
||||||
|
|
||||||
private void deleteFile(final Message message) {
|
private void deleteFile(final Message message) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
|
||||||
builder.setNegativeButton(R.string.cancel, null);
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
builder.setTitle(R.string.delete_file_dialog);
|
builder.setTitle(R.string.delete_file_dialog);
|
||||||
builder.setMessage(R.string.delete_file_dialog_msg);
|
builder.setMessage(R.string.delete_file_dialog_msg);
|
||||||
|
@ -1962,7 +1960,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(@NotNull Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());
|
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());
|
||||||
|
|
Loading…
Reference in a new issue