mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 03:32:15 -05:00
add setting for quick sharing
This commit is contained in:
parent
39e717ed94
commit
72aa10b536
@ -32,6 +32,8 @@ import eu.siacs.conversations.xmpp.jid.Jid;
|
||||
|
||||
public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
|
||||
|
||||
private boolean mReturnToPrevious = false;
|
||||
|
||||
@Override
|
||||
public void onConversationUpdate() {
|
||||
refreshUi();
|
||||
@ -80,7 +82,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||
resId = R.string.shared_file_with_x;
|
||||
}
|
||||
replaceToast(getString(resId, message.getConversation().getName()));
|
||||
if (share.uuid != null) {
|
||||
if (mReturnToPrevious) {
|
||||
finish();
|
||||
} else {
|
||||
switchToConversation(message.getConversation());
|
||||
@ -181,6 +183,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
this.mReturnToPrevious = getPreferences().getBoolean("return_to_previous", false);
|
||||
final String type = intent.getType();
|
||||
final String action = intent.getAction();
|
||||
Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type);
|
||||
@ -305,7 +308,27 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||
selectPresence(conversation, callback);
|
||||
}
|
||||
} else {
|
||||
switchToConversation(conversation, this.share.text, true);
|
||||
if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
|
||||
final OnPresenceSelected callback = new OnPresenceSelected() {
|
||||
@Override
|
||||
public void onPresenceSelected() {
|
||||
Message message = new Message(conversation,share.text, conversation.getNextEncryption());
|
||||
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
||||
message.setCounterpart(conversation.getNextCounterpart());
|
||||
}
|
||||
xmppConnectionService.sendMessage(message);
|
||||
replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
|
||||
finish();
|
||||
}
|
||||
};
|
||||
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
||||
selectPresence(conversation, callback);
|
||||
} else {
|
||||
callback.onPresenceSelected();
|
||||
}
|
||||
} else {
|
||||
switchToConversation(conversation, this.share.text, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,6 +104,9 @@
|
||||
<string name="pref_xmpp_resource_summary">The name this client identifies itself with</string>
|
||||
<string name="pref_accept_files">Accept files</string>
|
||||
<string name="pref_accept_files_summary">Automatically accept files smaller than…</string>
|
||||
<string name="pref_attachments">Attachments</string>
|
||||
<string name="pref_return_to_previous">Quick Sharing</string>
|
||||
<string name="pref_return_to_previous_summary">Immediately return to previous activity instead of opening the conversation after sharing something</string>
|
||||
<string name="pref_notification_settings">Notification</string>
|
||||
<string name="pref_notifications">Notifications</string>
|
||||
<string name="pref_notifications_summary">Notify when a new message arrives</string>
|
||||
@ -580,6 +583,7 @@
|
||||
<string name="shared_file_with_x">Shared file with %s</string>
|
||||
<string name="shared_image_with_x">Shared image with %s</string>
|
||||
<string name="shared_images_with_x">Shared images with %s</string>
|
||||
<string name="shared_text_with_x">Shared text with %s</string>
|
||||
<string name="no_storage_permission">Conversations need access to external storage</string>
|
||||
<string name="sync_with_contacts">Synchronize with contacts</string>
|
||||
<string name="sync_with_contacts_long">Conversations wants to match your XMPP roster with your contacts to show their full names and avatars.\n\nConversations will only read your contacts and match them locally without uploading them to your server.\n\nYou will now be asked to grant permission to access your contacts.</string>
|
||||
|
@ -15,20 +15,6 @@
|
||||
android:key="resource"
|
||||
android:summary="@string/pref_xmpp_resource_summary"
|
||||
android:title="@string/pref_xmpp_resource"/>
|
||||
<ListPreference
|
||||
android:defaultValue="524288"
|
||||
android:entries="@array/filesizes"
|
||||
android:entryValues="@array/filesizes_values"
|
||||
android:key="auto_accept_file_size"
|
||||
android:summary="@string/pref_accept_files_summary"
|
||||
android:title="@string/pref_accept_files"/>
|
||||
<ListPreference
|
||||
android:defaultValue="auto"
|
||||
android:entries="@array/picture_compression_entries"
|
||||
android:entryValues="@array/picture_compression_values"
|
||||
android:key="picture_compression"
|
||||
android:summary="@string/pref_picture_compression_summary"
|
||||
android:title="@string/pref_picture_compression"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="confirm_messages"
|
||||
@ -92,7 +78,28 @@
|
||||
android:ringtoneType="notification"
|
||||
android:summary="@string/pref_sound_summary"
|
||||
android:title="@string/pref_sound"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_attachments">
|
||||
<ListPreference
|
||||
android:defaultValue="524288"
|
||||
android:entries="@array/filesizes"
|
||||
android:entryValues="@array/filesizes_values"
|
||||
android:key="auto_accept_file_size"
|
||||
android:summary="@string/pref_accept_files_summary"
|
||||
android:title="@string/pref_accept_files"/>
|
||||
<ListPreference
|
||||
android:defaultValue="auto"
|
||||
android:entries="@array/picture_compression_entries"
|
||||
android:entryValues="@array/picture_compression_values"
|
||||
android:key="picture_compression"
|
||||
android:summary="@string/pref_picture_compression_summary"
|
||||
android:title="@string/pref_picture_compression"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="return_to_previous"
|
||||
android:title="@string/pref_return_to_previous"
|
||||
android:summary="@string/pref_return_to_previous_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_ui_options">
|
||||
<CheckBoxPreference
|
||||
|
Loading…
Reference in New Issue
Block a user