register nfc callback in every activity that provides a proper sharable uri

This commit is contained in:
iNPUTmice 2014-11-04 17:10:35 +01:00
parent 11ecf43da7
commit b824e55277
5 changed files with 18 additions and 16 deletions

View File

@ -144,7 +144,7 @@ public class ConferenceDetailsActivity extends XmppActivity {
if (conversation!=null) { if (conversation!=null) {
return "xmpp:"+conversation.getContactJid().split("/")[0]+"?join"; return "xmpp:"+conversation.getContactJid().split("/")[0]+"?join";
} else { } else {
return super.getShareableUri(); return "";
} }
} }

View File

@ -166,7 +166,7 @@ public class ContactDetailsActivity extends XmppActivity {
if (contact!=null) { if (contact!=null) {
return "xmpp:"+contact.getJid(); return "xmpp:"+contact.getJid();
} else { } else {
return super.getShareableUri(); return "";
} }
} }

View File

@ -116,7 +116,7 @@ public class ConversationActivity extends XmppActivity implements
if (conversation!=null) { if (conversation!=null) {
return "xmpp:"+conversation.getAccount().getJid(); return "xmpp:"+conversation.getAccount().getJid();
} else { } else {
return super.getShareableUri(); return "";
} }
} }
@ -659,18 +659,6 @@ public class ConversationActivity extends XmppActivity implements
} }
} }
@Override
public void onResume() {
super.onResume();
this.registerNdefPushMessageCallback();
}
@Override
public void onPause() {
super.onPause();
this.unregisterNdefPushMessageCallback();
}
@Override @Override
protected void onStop() { protected void onStop() {
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {

View File

@ -287,7 +287,7 @@ public class EditAccountActivity extends XmppActivity {
if (mAccount!=null) { if (mAccount!=null) {
return "xmpp:"+mAccount.getJid(); return "xmpp:"+mAccount.getJid();
} else { } else {
return super.getShareableUri(); return "";
} }
} }

View File

@ -588,6 +588,20 @@ public abstract class XmppActivity extends Activity {
return null; return null;
} }
@Override
public void onResume() {
super.onResume();
if (this.getShareableUri()!=null) {
this.registerNdefPushMessageCallback();
}
}
@Override
public void onPause() {
super.onPause();
this.unregisterNdefPushMessageCallback();
}
protected void showQrCode() { protected void showQrCode() {
String uri = getShareableUri(); String uri = getShareableUri();
if (uri!=null) { if (uri!=null) {