twitter card with playable video stream will be treated as tweet video

This commit is contained in:
Mariotaku Lee 2015-10-27 14:40:12 +08:00
parent 167e143f95
commit 1a8526f581
4 changed files with 14 additions and 5 deletions

View File

@ -259,7 +259,8 @@ public class ParcelableMedia implements Parcelable {
@Nullable
private static ParcelableMedia[] fromCard(@Nullable CardEntity card, @Nullable UrlEntity[] entities) {
if (card == null) return null;
if ("animated_gif".equals(card.getName())) {
final String name = card.getName();
if ("animated_gif".equals(name) || "player".equals(name)) {
final BindingValue player_stream_url = card.getBindingValue("player_stream_url");
if (!(player_stream_url instanceof StringValue))
return null;

View File

@ -326,7 +326,6 @@ public final class ContentValuesCreator implements TwidereConstants {
values.put(Statuses.STATUS_ID, orig.getId());
values.put(Statuses.STATUS_TIMESTAMP, orig.getCreatedAt().getTime());
final Status status;
if (orig.isRetweet()) {
final Status retweetedStatus = orig.getRetweetedStatus();

View File

@ -70,8 +70,16 @@ public class TwitterCardUtils {
}
public static boolean isCardSupported(ParcelableCardEntity card) {
if (card == null) return false;
return CARD_NAME_PLAYER.equals(card.name) || CARD_NAME_AUDIO.equals(card.name);
if (card == null || card.name == null) return false;
switch (card.name) {
case CARD_NAME_PLAYER: {
return ParcelableCardEntity.getValue(card, "player_stream_url") == null;
}
case CARD_NAME_AUDIO: {
return true;
}
}
return false;
}
}

View File

@ -19,6 +19,7 @@
package org.mariotaku.twidere.util.support;
import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import android.os.Build;
@ -34,7 +35,7 @@ public class DrawableSupport {
DrawableSupportLollipop.getOutline(drawable, outlineCompat);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static class DrawableSupportLollipop {
public static void getOutline(Drawable drawable, OutlineCompat outlineCompat) {