1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -87,18 +87,21 @@ private void updateShorcuts() {
87
87
if (deltaDays > DIRECT_SHARE_MAX_DAYS ) {
88
88
continue ;
89
89
}
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
+
102
105
}
103
106
ShortcutManagerCompat .addDynamicShortcuts (getApplicationContext (),shorcutsList );
104
107
}
0 commit comments