Fixes on pR

This commit is contained in:
madwasp79 2019-01-28 15:31:22 +02:00
parent a1116dfe33
commit 4f7c662bc9

View file

@ -1707,7 +1707,6 @@ public class OsmandAidlApi {
String appPackage = entry.getKey();
for (NavDrawerItem item : entry.getValue()) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri));
boolean isCopy = false;
if (intent.resolveActivity(pm) == null) {
intent = pm.getLaunchIntentForPackage(appPackage);
}
@ -1716,25 +1715,21 @@ public class OsmandAidlApi {
intent.addFlags(item.flags);
}
final Intent finalIntent = intent;
for (String s : adapter.getItemNames()) {
if (item.name.equals(s)) {
isCopy = true;
}
}
if (!isCopy) {
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(item.getId())
.setTitle(item.name)
.setIcon(getIconId(item.iconName))
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) {
activity.startActivity(finalIntent);
return true;
}
})
.createItem());
}
adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(item.getId())
.setTitle(item.name)
.setIcon(getIconId(item.iconName))
.setListener(new ContextMenuAdapter.ItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter,
int itemId, int position, boolean isChecked,
int[] viewCoordinates) {
activity.startActivity(finalIntent);
return true;
}
})
.createItem());
}
}
}