Bugfix (Two AIDL items in the drawer) #6466

This commit is contained in:
madwasp79 2019-01-28 10:59:39 +02:00
parent 917cd7740d
commit a1116dfe33
2 changed files with 21 additions and 13 deletions

View file

@ -1707,6 +1707,7 @@ public class OsmandAidlApi {
String appPackage = entry.getKey(); String appPackage = entry.getKey();
for (NavDrawerItem item : entry.getValue()) { for (NavDrawerItem item : entry.getValue()) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri)); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri));
boolean isCopy = false;
if (intent.resolveActivity(pm) == null) { if (intent.resolveActivity(pm) == null) {
intent = pm.getLaunchIntentForPackage(appPackage); intent = pm.getLaunchIntentForPackage(appPackage);
} }
@ -1715,6 +1716,12 @@ public class OsmandAidlApi {
intent.addFlags(item.flags); intent.addFlags(item.flags);
} }
final Intent finalIntent = intent; final Intent finalIntent = intent;
for (String s : adapter.getItemNames()) {
if (item.name.equals(s)) {
isCopy = true;
}
}
if (!isCopy) {
adapter.addItem(new ContextMenuItem.ItemBuilder() adapter.addItem(new ContextMenuItem.ItemBuilder()
.setId(item.getId()) .setId(item.getId())
.setTitle(item.name) .setTitle(item.name)
@ -1731,6 +1738,7 @@ public class OsmandAidlApi {
} }
} }
} }
}
private int getIconId(@Nullable String iconName) { private int getIconId(@Nullable String iconName) {
if (!TextUtils.isEmpty(iconName)) { if (!TextUtils.isEmpty(iconName)) {

View file

@ -647,7 +647,7 @@ public class OsmandApplication extends MultiDexApplication {
defaultHandler.uncaughtException(thread, ex); defaultHandler.uncaughtException(thread, ex);
} catch (Exception e) { } catch (Exception e) {
// swallow all exceptions // swallow all exceptions
android.util.Log.e(PlatformUtil.TAG, "Exception while handle other exception", e); //$NON-NLS-1$ LOG.error("Exception while handle other exception" + e.getMessage(), e); //$NON-NLS-1$
} }
} }