Skip to content

Commit

Permalink
Small issue with liking songs from MainActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
indywidualny committed Jun 5, 2016
1 parent ec45059 commit b8154fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ public void openUri(Activity activity, Uri uri) {
});
}

@SuppressWarnings("deprecation")
@TargetApi(21)
@Override
public void shareTextUrl(String url, String description) {
Expand All @@ -506,10 +507,9 @@ public void shareTextUrl(String url, String description) {
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");

if (Build.VERSION.SDK_INT < 21) {
//noinspection deprecation
if (Build.VERSION.SDK_INT < 21)
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
} else
else
share.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);

// add data to the intent, the receiving app will decide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public static String constructDateQueryForDay(boolean startDay,
}

public static void addFavouriteSongFromRds(Context context, List<Rds> rds) {
if (rds == null) {
String message = context.getString(R.string.cannot_favourite_song);
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
} else {
String error = context.getString(R.string.cannot_favourite_song);
if (rds == null)
Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
else {
Rds now = rds.get(0);
if (!now.getTitle().isEmpty() && !now.getArtist().isEmpty()) {
Song song = new Song();
Expand All @@ -83,7 +83,8 @@ public static void addFavouriteSongFromRds(Context context, List<Rds> rds) {
AsyncWrapper.insertFavouriteSong(song);
String message = "\u2605 " + now.getArtist() + " – " + now.getTitle();
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
} else
Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
}
}

Expand Down

0 comments on commit b8154fa

Please sign in to comment.