code cleanup

This commit is contained in:
Daniel Gultsch 2015-01-08 14:45:44 +01:00
parent f8aa1bfec4
commit 0fe193b027
2 changed files with 15 additions and 14 deletions

View file

@ -388,17 +388,20 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
final String action = intent == null ? null : intent.getAction(); final String action = intent == null ? null : intent.getAction();
if (action != null) { if (action != null) {
if (action.equals(ACTION_MERGE_PHONE_CONTACTS)) { switch (action) {
PhoneHelper.loadPhoneContacts(getApplicationContext(), new CopyOnWriteArrayList<Bundle>(), this); case ACTION_MERGE_PHONE_CONTACTS:
return START_STICKY; PhoneHelper.loadPhoneContacts(getApplicationContext(), new CopyOnWriteArrayList<Bundle>(), this);
} else if (action.equals(Intent.ACTION_SHUTDOWN)) { return START_STICKY;
logoutAndSave(); case Intent.ACTION_SHUTDOWN:
return START_NOT_STICKY; logoutAndSave();
} else if (action.equals(ACTION_CLEAR_NOTIFICATION)) { return START_NOT_STICKY;
mNotificationService.clear(); case ACTION_CLEAR_NOTIFICATION:
} else if (action.equals(ACTION_DISABLE_FOREGROUND)) { mNotificationService.clear();
getPreferences().edit().putBoolean("keep_foreground_service",false).commit(); break;
toggleForegroundService(); case ACTION_DISABLE_FOREGROUND:
getPreferences().edit().putBoolean("keep_foreground_service",false).commit();
toggleForegroundService();
break;
} }
} }
this.wakeLock.acquire(); this.wakeLock.acquire();
@ -1484,7 +1487,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() != IqPacket.TYPE.ERROR) { if (packet.getType() != IqPacket.TYPE.ERROR) {
ArrayList<String> features = new ArrayList<String>(); ArrayList<String> features = new ArrayList<>();
for (Element child : packet.query().getChildren()) { for (Element child : packet.query().getChildren()) {
if (child != null && child.getName().equals("feature")) { if (child != null && child.getName().equals("feature")) {
String var = child.getAttribute("var"); String var = child.getAttribute("var");

View file

@ -233,8 +233,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
final Contact contact = user.getContact(); final Contact contact = user.getContact();
if (contact != null) { if (contact != null) {
name = contact.getDisplayName(); name = contact.getDisplayName();
} else if (user.getJid() != null) {
name = user.getJid().toBareJid().toString();
} else { } else {
name = user.getName(); name = user.getName();
} }