aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-04-14 21:12:44 +0200
committerDaniel Gultsch <daniel@gultsch.de>2016-04-14 21:12:44 +0200
commit72aa10b53660fdb6e32f74a103ff1e349232a816 (patch)
tree479fb6098772a46f96b04b8562f550fa4e14ed32
parent39e717ed94de2800df587395ba77310660c2ea5c (diff)
add setting for quick sharing
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java27
-rw-r--r--src/main/res/values/strings.xml4
-rw-r--r--src/main/res/xml/preferences.xml37
3 files changed, 51 insertions, 17 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
index 8cd017bf..4ed015f4 100644
--- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java
@@ -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);
+ }
}
}
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 97ba18af..aadf81d7 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -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>
diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml
index e4b29856..d1ba6b7f 100644
--- a/src/main/res/xml/preferences.xml
+++ b/src/main/res/xml/preferences.xml
@@ -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