added share uri button to conference details

This commit is contained in:
Daniel Gultsch 2016-04-12 18:30:02 +02:00
parent 2a4db01709
commit 3e654bea0e
15 changed files with 43 additions and 14 deletions

View File

@ -3,8 +3,10 @@ package eu.siacs.conversations.ui;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
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.IntentSender.SendIntentException; import android.content.IntentSender.SendIntentException;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -281,6 +283,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
quickEdit(mConversation.getName(),this.onSubjectEdited); quickEdit(mConversation.getName(),this.onSubjectEdited);
} }
break; break;
case R.id.action_share:
share();
break;
case R.id.action_save_as_bookmark: case R.id.action_save_as_bookmark:
saveAsBookmark(); saveAsBookmark();
break; break;
@ -308,6 +313,18 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
} }
private void share() {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, getShareableUri());
shareIntent.setType("text/plain");
try {
startActivity(Intent.createChooser(shareIntent, getText(R.string.share_uri_with)));
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
}
}
@Override @Override
public boolean onPrepareOptionsMenu(Menu menu) { public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark); MenuItem menuItemSaveBookmark = menu.findItem(R.id.action_save_as_bookmark);

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -7,27 +7,34 @@
android:orderInCategory="10" android:orderInCategory="10"
android:showAsAction="always" android:showAsAction="always"
android:title="@string/action_edit_subject"/> android:title="@string/action_edit_subject"/>
<item
android:id="@+id/action_share"
android:icon="?attr/icon_share"
android:showAsAction="always"
android:orderInCategory="15"
android:title="@string/share_uri_with"/>
<item <item
android:id="@+id/action_show_qr_code" android:id="@+id/action_show_qr_code"
android:title="@string/show_qr_code" android:showAsAction="never"
android:showAsAction="never" /> android:title="@string/show_qr_code"/>
<item <item
android:id="@+id/action_save_as_bookmark" android:id="@+id/action_save_as_bookmark"
android:title="@string/save_as_bookmark"
android:orderInCategory="80" android:orderInCategory="80"
android:showAsAction="never" /> android:showAsAction="never"
android:title="@string/save_as_bookmark"/>
<item <item
android:id="@+id/action_delete_bookmark" android:id="@+id/action_delete_bookmark"
android:title="@string/delete_bookmark"
android:orderInCategory="80" android:orderInCategory="80"
android:showAsAction="never" /> android:showAsAction="never"
android:title="@string/delete_bookmark"/>
<item <item
android:id="@+id/action_advanced_mode" android:id="@+id/action_advanced_mode"
android:title="@string/advanced_mode"
android:checkable="true" android:checkable="true"
android:checked="false" android:checked="false"
android:orderInCategory="85" android:orderInCategory="85"
android:showAsAction="never" /> android:showAsAction="never"
android:title="@string/advanced_mode"/>
<item <item
android:id="@+id/action_accounts" android:id="@+id/action_accounts"
android:orderInCategory="90" android:orderInCategory="90"

View File

@ -32,6 +32,7 @@
<item name="attr/icon_secure">@drawable/ic_lock_open_white_24dp</item> <item name="attr/icon_secure">@drawable/ic_lock_open_white_24dp</item>
<item name="attr/icon_settings">@drawable/ic_settings_grey600_24dp</item> <item name="attr/icon_settings">@drawable/ic_settings_grey600_24dp</item>
<item name="attr/icon_import_export">@drawable/ic_import_export_white_24dp</item> <item name="attr/icon_import_export">@drawable/ic_import_export_white_24dp</item>
<item name="attr/icon_share">@drawable/ic_share_white_24dp</item>
</style> </style>

View File

@ -24,6 +24,7 @@
<attr name="icon_search" format="reference"/> <attr name="icon_search" format="reference"/>
<attr name="icon_secure" format="reference"/> <attr name="icon_secure" format="reference"/>
<attr name="icon_settings" format="reference"/> <attr name="icon_settings" format="reference"/>
<attr name="icon_share" format="reference"/>
<attr name="icon_import_export" format="reference"/> <attr name="icon_import_export" format="reference"/>
</resources> </resources>

View File

@ -612,4 +612,6 @@
<string name="select_image_and_crop">Select image and crop</string> <string name="select_image_and_crop">Select image and crop</string>
<string name="this_account_is_disabled">You have disabled this account</string> <string name="this_account_is_disabled">You have disabled this account</string>
<string name="security_error_invalid_file_access">Security error: Invalid file access</string> <string name="security_error_invalid_file_access">Security error: Invalid file access</string>
<string name="no_application_to_share_uri">No application found to share URI</string>
<string name="share_uri_with">Share URI with…</string>
</resources> </resources>

View File

@ -30,6 +30,7 @@
<item name="attr/icon_secure">@drawable/ic_action_secure</item> <item name="attr/icon_secure">@drawable/ic_action_secure</item>
<item name="attr/icon_settings">@drawable/ic_action_settings</item> <item name="attr/icon_settings">@drawable/ic_action_settings</item>
<item name="attr/icon_import_export">@drawable/ic_stat_communication_import_export</item> <item name="attr/icon_import_export">@drawable/ic_stat_communication_import_export</item>
<item name="attr/icon_share">@drawable/ic_action_share</item>
</style> </style>
<style name="ConversationsTheme.LargerText" parent="ConversationsTheme"> <style name="ConversationsTheme.LargerText" parent="ConversationsTheme">