Replaced size == 0 by isEmpty when possible
This commit is contained in:
parent
b1c8219c7b
commit
245452279a
10 changed files with 21 additions and 25 deletions
|
@ -522,7 +522,7 @@ public class LinphoneManager implements SensorEventListener {
|
|||
|
||||
if (mCore.limeX3DhAvailable()) {
|
||||
String url = mCore.getLimeX3DhServerUrl();
|
||||
if (url == null || url.length() == 0) {
|
||||
if (url == null || url.isEmpty()) {
|
||||
url = getString(R.string.default_lime_x3dh_server_url);
|
||||
Log.i("[Manager] Setting LIME X3Dh server url to default value: " + url);
|
||||
mCore.setLimeX3DhServerUrl(url);
|
||||
|
|
|
@ -716,7 +716,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
Core core = LinphoneManager.getCore();
|
||||
if (mRemoteSipAddress == null
|
||||
|| mRemoteSipUri == null
|
||||
|| mRemoteSipUri.length() == 0
|
||||
|| mRemoteSipUri.isEmpty()
|
||||
|| core == null) {
|
||||
// TODO error
|
||||
return;
|
||||
|
@ -768,7 +768,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
});
|
||||
}
|
||||
|
||||
if (mParticipants.size() == 0) {
|
||||
if (mParticipants.isEmpty()) {
|
||||
// Contact not found
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(mRemoteParticipantAddress);
|
||||
mRoomLabel.setText(displayName);
|
||||
|
@ -1229,7 +1229,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
}
|
||||
|
||||
mRemoteComposing.setVisibility(View.VISIBLE);
|
||||
if (composing.size() == 0) {
|
||||
if (composing.isEmpty()) {
|
||||
mRemoteComposing.setVisibility(View.GONE);
|
||||
} else if (composing.size() == 1) {
|
||||
mRemoteComposing.setText(
|
||||
|
|
|
@ -485,7 +485,7 @@ public class ChatRoomCreationFragment extends Fragment
|
|||
}
|
||||
|
||||
private void updateLayout() {
|
||||
if (mParticipants.size() != 0) {
|
||||
if (!mParticipants.isEmpty()) {
|
||||
mSearchAdapter.setContactsSelectedList(mParticipants);
|
||||
updateList();
|
||||
updateListSelected();
|
||||
|
|
|
@ -199,7 +199,7 @@ class DevicesAdapter extends BaseExpandableListAdapter {
|
|||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
if (mParticipants.size() == 0) return 0;
|
||||
if (mParticipants.isEmpty()) return 0;
|
||||
return mOnlyDisplayChildsAsGroups
|
||||
? mParticipants.get(0).getDevices().length
|
||||
: mParticipants.size();
|
||||
|
@ -207,7 +207,7 @@ class DevicesAdapter extends BaseExpandableListAdapter {
|
|||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
if (mParticipants.size() == 0) return 0;
|
||||
if (mParticipants.isEmpty()) return 0;
|
||||
return mOnlyDisplayChildsAsGroups
|
||||
? 0
|
||||
: mParticipants.get(groupPosition).getDevices().length;
|
||||
|
@ -215,7 +215,7 @@ class DevicesAdapter extends BaseExpandableListAdapter {
|
|||
|
||||
@Override
|
||||
public Object getGroup(int groupPosition) {
|
||||
if (mParticipants.size() == 0) return null;
|
||||
if (mParticipants.isEmpty()) return null;
|
||||
return mOnlyDisplayChildsAsGroups
|
||||
? mParticipants.get(0).getDevices()[groupPosition]
|
||||
: mParticipants.get(groupPosition);
|
||||
|
@ -223,7 +223,7 @@ class DevicesAdapter extends BaseExpandableListAdapter {
|
|||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosition) {
|
||||
if (mParticipants.size() == 0) return null;
|
||||
if (mParticipants.isEmpty()) return null;
|
||||
return mParticipants.get(groupPosition).getDevices()[childPosition];
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.linphone.core.ChatRoomCapabilities;
|
|||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
import org.linphone.utils.LinphoneShortcutManager;
|
||||
import org.linphone.utils.LinphoneUtils;
|
||||
|
||||
@TargetApi(25)
|
||||
class ApiTwentyFivePlus {
|
||||
|
@ -50,13 +51,8 @@ class ApiTwentyFivePlus {
|
|||
ArrayList<ShortcutInfo> shortcuts = new ArrayList<>();
|
||||
|
||||
ChatRoom[] rooms = LinphoneManager.getCore().getChatRooms();
|
||||
ArrayList<ChatRoom> notEmptyOneToOneRooms = new ArrayList<>();
|
||||
for (ChatRoom room : rooms) {
|
||||
if (room.hasCapability(ChatRoomCapabilities.OneToOne.toInt())
|
||||
&& room.getHistorySize() > 0) {
|
||||
notEmptyOneToOneRooms.add(room);
|
||||
}
|
||||
}
|
||||
ArrayList<ChatRoom> notEmptyOneToOneRooms =
|
||||
LinphoneUtils.removeEmptyOneToOneChatRooms(rooms);
|
||||
Collections.sort(
|
||||
notEmptyOneToOneRooms,
|
||||
new Comparator<ChatRoom>() {
|
||||
|
|
|
@ -144,10 +144,10 @@ public class ContactsFragment extends Fragment
|
|||
}
|
||||
} else {
|
||||
if (!mOnlyDisplayLinphoneContacts
|
||||
&& ContactsManager.getInstance().getContacts().size() == 0) {
|
||||
&& ContactsManager.getInstance().getContacts().isEmpty()) {
|
||||
mNoContact.setVisibility(View.VISIBLE);
|
||||
} else if (mOnlyDisplayLinphoneContacts
|
||||
&& ContactsManager.getInstance().getSIPContacts().size() == 0) {
|
||||
&& ContactsManager.getInstance().getSIPContacts().isEmpty()) {
|
||||
mNoSipContact.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ public class ContactsFragment extends Fragment
|
|||
|
||||
private void searchContacts(String search) {
|
||||
boolean isEditionEnabled = false;
|
||||
if (search == null || search.length() == 0) {
|
||||
if (search == null || search.isEmpty()) {
|
||||
changeContactsAdapter();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
}
|
||||
}
|
||||
|
||||
if (mContext != null && getContacts().size() == 0 && hasReadContactsAccess()) {
|
||||
if (mContext != null && getContacts().isEmpty() && hasReadContactsAccess()) {
|
||||
fetchContactsAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class LinphoneContact extends AndroidContact
|
|||
}
|
||||
|
||||
public void setFirstNameAndLastName(String fn, String ln, boolean commitChanges) {
|
||||
if (fn != null && fn.length() == 0 && ln != null && ln.length() == 0) return;
|
||||
if (fn != null && fn.isEmpty() && ln != null && ln.isEmpty()) return;
|
||||
if (fn != null && fn.equals(mFirstName) && ln != null && ln.equals(mLastName)) return;
|
||||
|
||||
if (commitChanges) {
|
||||
|
|
|
@ -108,7 +108,7 @@ public class InAppPurchaseActivity extends Activity
|
|||
|
||||
public List<Purchasable> getPurchasedItems() {
|
||||
|
||||
if (mPurchasedItems == null || mPurchasedItems.size() == 0) {
|
||||
if (mPurchasedItems == null || mPurchasedItems.isEmpty()) {
|
||||
Log.w("nul");
|
||||
}
|
||||
return mPurchasedItems;
|
||||
|
@ -145,7 +145,7 @@ public class InAppPurchaseActivity extends Activity
|
|||
public void onPurchasedItemsQueryFinished(ArrayList<Purchasable> items) {
|
||||
mPurchasedItems = items;
|
||||
|
||||
if (items == null || items.size() == 0) {
|
||||
if (items == null || items.isEmpty()) {
|
||||
mInAppPurchaseHelper.getAvailableItemsForPurchaseAsync();
|
||||
} else {
|
||||
for (Purchasable purchasedItem : mPurchasedItems) {
|
||||
|
|
|
@ -199,7 +199,7 @@ public class LinphonePreferences {
|
|||
|
||||
public String getRingtone(String defaultRingtone) {
|
||||
String ringtone = getConfig().getString("app", "ringtone", defaultRingtone);
|
||||
if (ringtone == null || ringtone.length() == 0) ringtone = defaultRingtone;
|
||||
if (ringtone == null || ringtone.isEmpty()) ringtone = defaultRingtone;
|
||||
return ringtone;
|
||||
}
|
||||
|
||||
|
@ -817,7 +817,7 @@ public class LinphonePreferences {
|
|||
|
||||
public void setRemoteProvisioningUrl(String url) {
|
||||
if (getLc() == null) return;
|
||||
if (url != null && url.length() == 0) {
|
||||
if (url != null && url.isEmpty()) {
|
||||
url = null;
|
||||
}
|
||||
getLc().setProvisioningUri(url);
|
||||
|
|
Loading…
Reference in a new issue