Replace LinkedHashSet with List

This commit is contained in:
Alex Sytnyk 2018-07-31 13:54:20 +03:00
parent b9b4f55e48
commit 5139c9fe5a
4 changed files with 12 additions and 18 deletions

View file

@ -5,31 +5,29 @@ import android.os.Parcelable;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
public class AddNavDrawerItemsParams implements Parcelable {
private String appPackage;
private LinkedHashSet<NavDrawerItem> items;
private List<NavDrawerItem> items;
public AddNavDrawerItemsParams(@NonNull String appPackage, @NonNull LinkedHashSet<NavDrawerItem> items) {
public AddNavDrawerItemsParams(@NonNull String appPackage, @NonNull List<NavDrawerItem> items) {
this.appPackage = appPackage;
this.items = items;
}
protected AddNavDrawerItemsParams(Parcel in) {
appPackage = in.readString();
List<NavDrawerItem> list = new ArrayList<>();
in.readTypedList(list, NavDrawerItem.CREATOR);
items = new LinkedHashSet<>(list);
items = new ArrayList<>();
in.readTypedList(items, NavDrawerItem.CREATOR);
}
public String getAppPackage() {
return appPackage;
}
public LinkedHashSet<NavDrawerItem> getItems() {
public List<NavDrawerItem> getItems() {
return items;
}

View file

@ -43,7 +43,6 @@ import net.osmand.aidl.note.StopRecordingParams
import net.osmand.aidl.note.TakePhotoNoteParams
import java.io.File
import java.util.*
import kotlin.collections.LinkedHashSet
class OsmandAidlHelper(private val app: Application) {
@ -873,7 +872,7 @@ class OsmandAidlHelper(private val app: Application) {
fun addOpenAppNavDrawerItem(appPackage: String, names: List<String>, uris: List<String>, iconNames: List<String>, flags: List<Int>): Boolean {
if (mIOsmAndAidlInterface != null) {
try {
val items = LinkedHashSet<NavDrawerItem>()
val items = mutableListOf<NavDrawerItem>()
for (i in names.indices) {
items.add(NavDrawerItem(names[i], uris[i], iconNames[i], flags[i]))
}

View file

@ -77,7 +77,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
@ -1201,7 +1200,7 @@ public class OsmandAidlApi {
return true;
}
boolean addNavDrawerItems(String appPackage, Set<net.osmand.aidl.navdrawer.NavDrawerItem> items) {
boolean addNavDrawerItems(String appPackage, List<net.osmand.aidl.navdrawer.NavDrawerItem> items) {
if (!TextUtils.isEmpty(appPackage) && items != null && !items.isEmpty()) {
List<NavDrawerItem> existing = getNavDrawerItems();
for (Iterator<NavDrawerItem> it = existing.iterator(); it.hasNext(); ) {

View file

@ -5,31 +5,29 @@ import android.os.Parcelable;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
public class AddNavDrawerItemsParams implements Parcelable {
private String appPackage;
private LinkedHashSet<NavDrawerItem> items;
private List<NavDrawerItem> items;
public AddNavDrawerItemsParams(@NonNull String appPackage, @NonNull LinkedHashSet<NavDrawerItem> items) {
public AddNavDrawerItemsParams(@NonNull String appPackage, @NonNull List<NavDrawerItem> items) {
this.appPackage = appPackage;
this.items = items;
}
protected AddNavDrawerItemsParams(Parcel in) {
appPackage = in.readString();
List<NavDrawerItem> list = new ArrayList<>();
in.readTypedList(list, NavDrawerItem.CREATOR);
items = new LinkedHashSet<>(list);
items = new ArrayList<>();
in.readTypedList(items, NavDrawerItem.CREATOR);
}
public String getAppPackage() {
return appPackage;
}
public LinkedHashSet<NavDrawerItem> getItems() {
public List<NavDrawerItem> getItems() {
return items;
}