Skip to content

Commit 0b0796b

Browse files
committedApr 16, 2024
Fix #26
1 parent 0f96138 commit 0b0796b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed
 

‎app/src/main/java/fr/nuage/souvenirs/AlbumListActivity.java

+15-12
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,21 @@ private void updateShorcuts() {
8787
if (deltaDays > DIRECT_SHARE_MAX_DAYS) {
8888
continue;
8989
}
90-
ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(getApplicationContext(),a.getId().toString())
91-
.setShortLabel(a.getName())
92-
.setRank((int)deltaDays+1)
93-
.setLongLived(true)
94-
.setIcon(IconCompat.createWithResource(getApplicationContext(),R.drawable.ic_launcher_foreground))
95-
.setIntent(new Intent(Intent.ACTION_MAIN))
96-
.setCategories(new HashSet<>(Arrays.asList(AddImageToAlbumActivity.IMAGE_SHARE)))
97-
.setPerson(new Person.Builder()
98-
.setName(a.getName())
99-
.build())
100-
.build();
101-
shorcutsList.add(shortcutInfo);
90+
if ((a.getName() != null) && !(a.getName().equals(""))) { //if album has no name, do not create shortcut
91+
ShortcutInfoCompat shortcutInfo = new ShortcutInfoCompat.Builder(getApplicationContext(),a.getId().toString())
92+
.setShortLabel(a.getName())
93+
.setRank((int)deltaDays+1)
94+
.setLongLived(true)
95+
.setIcon(IconCompat.createWithResource(getApplicationContext(),R.drawable.ic_launcher_foreground))
96+
.setIntent(new Intent(Intent.ACTION_MAIN))
97+
.setCategories(new HashSet<>(Arrays.asList(AddImageToAlbumActivity.IMAGE_SHARE)))
98+
.setPerson(new Person.Builder()
99+
.setName(a.getName())
100+
.build())
101+
.build();
102+
shorcutsList.add(shortcutInfo);
103+
}
104+
102105
}
103106
ShortcutManagerCompat.addDynamicShortcuts(getApplicationContext(),shorcutsList);
104107
}

0 commit comments

Comments
 (0)
Failed to load comments.