introduced share button in contact details. remove show qr
This commit is contained in:
parent
97fe14c4be
commit
72a2622c84
|
@ -484,15 +484,6 @@ public class Contact implements ListItem, Blockable {
|
||||||
return getOption(Options.FROM) && getOption(Options.TO);
|
return getOption(Options.FROM) && getOption(Options.TO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShareableUri() {
|
|
||||||
if (getOtrFingerprints().size() >= 1) {
|
|
||||||
String otr = getOtrFingerprints().get(0);
|
|
||||||
return "xmpp:" + getJid().toBareJid().toString() + "?otr-fingerprint=" + otr;
|
|
||||||
} else {
|
|
||||||
return "xmpp:" + getJid().toBareJid().toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBlocked() {
|
public boolean isBlocked() {
|
||||||
return getAccount().isBlocked(this);
|
return getAccount().isBlocked(this);
|
||||||
|
|
|
@ -284,7 +284,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.action_share:
|
case R.id.action_share:
|
||||||
share();
|
shareUri();
|
||||||
break;
|
break;
|
||||||
case R.id.action_save_as_bookmark:
|
case R.id.action_save_as_bookmark:
|
||||||
saveAsBookmark();
|
saveAsBookmark();
|
||||||
|
@ -313,18 +313,6 @@ 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);
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
@Override
|
@Override
|
||||||
protected String getShareableUri() {
|
protected String getShareableUri() {
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
return contact.getShareableUri();
|
return "xmpp:"+contact.getJid().toBareJid().toString();
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,9 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
case R.id.action_share:
|
||||||
|
shareUri();
|
||||||
|
break;
|
||||||
case R.id.action_delete_contact:
|
case R.id.action_delete_contact:
|
||||||
builder.setTitle(getString(R.string.action_delete_contact))
|
builder.setTitle(getString(R.string.action_delete_contact))
|
||||||
.setMessage(
|
.setMessage(
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
@ -1095,6 +1096,22 @@ public abstract class XmppActivity extends Activity {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void shareUri() {
|
||||||
|
String uri = getShareableUri();
|
||||||
|
if (uri == null || uri.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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 void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -7,16 +7,18 @@
|
||||||
android:orderInCategory="10"
|
android:orderInCategory="10"
|
||||||
android:showAsAction="always"
|
android:showAsAction="always"
|
||||||
android:title="@string/action_edit_contact"/>
|
android:title="@string/action_edit_contact"/>
|
||||||
|
|
||||||
|
<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_delete_contact"
|
android:id="@+id/action_delete_contact"
|
||||||
android:icon="?attr/icon_discard"
|
|
||||||
android:orderInCategory="10"
|
android:orderInCategory="10"
|
||||||
android:showAsAction="always"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_delete_contact"/>
|
android:title="@string/action_delete_contact"/>
|
||||||
<item
|
|
||||||
android:id="@+id/action_show_qr_code"
|
|
||||||
android:title="@string/show_qr_code"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_block"
|
android:id="@+id/action_block"
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
android:orderInCategory="15"
|
android:orderInCategory="15"
|
||||||
android:title="@string/share_uri_with"/>
|
android:title="@string/share_uri_with"/>
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_show_qr_code"
|
|
||||||
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:orderInCategory="80"
|
android:orderInCategory="80"
|
||||||
|
|
Loading…
Reference in New Issue