Added version check for app shortcuts

As mentioned by @arkon 2e1a453e8d (commitcomment-21247880)
This commit is contained in:
Adrian Campos 2017-03-09 21:54:06 -08:00 committed by Karim Abou Zeid
commit b14ba65a5b
2 changed files with 6 additions and 3 deletions

View file

@ -7,6 +7,7 @@ import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.graphics.Color;
import android.graphics.drawable.Icon;
import android.os.Build;
import com.kabouzeid.gramophone.appshortcuts.shortcuttype.LastAddedShortcutType;
import com.kabouzeid.gramophone.appshortcuts.shortcuttype.ShuffleAllShortcutType;
@ -20,7 +21,7 @@ import java.util.List;
* @author Adrian Campos
*/
@TargetApi(25)
@TargetApi(Build.VERSION_CODES.N_MR1)
public class DynamicShortcutManager {
Context mContext;

View file

@ -114,8 +114,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
checkShowChangelog();
}
//Set up dynamic shortcuts if needed
new DynamicShortcutManager(getApplicationContext()).initDynamicShortcuts();
//Set up dynamic shortcuts
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(getApplicationContext()).initDynamicShortcuts();
}
}
private void setMusicChooser(int key) {