Correctly view user profile image and banner in MediaViewer

This commit is contained in:
Eric Liu 2016-01-17 15:03:39 +08:00
parent 55fc8b7030
commit 58f97b74a8
1 changed files with 7 additions and 2 deletions

View File

@ -44,6 +44,7 @@ import android.nfc.NfcAdapter.CreateNdefMessageCallback;
import android.nfc.NfcEvent; import android.nfc.NfcEvent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
@ -1222,7 +1223,9 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
} }
case R.id.profile_image: { case R.id.profile_image: {
final String url = Utils.getOriginalTwitterProfileImage(user.profile_image_url); final String url = Utils.getOriginalTwitterProfileImage(user.profile_image_url);
final ParcelableMedia[] media = {ParcelableMedia.image(url)}; ParcelableMedia profileImage = ParcelableMedia.image(url);
profileImage.type = ParcelableMedia.Type.TYPE_IMAGE;
final ParcelableMedia[] media = {profileImage};
Bundle options = Utils.createMediaViewerActivityOption(view); Bundle options = Utils.createMediaViewerActivityOption(view);
Utils.openMedia(activity, user.account_id, false, null, media, options); Utils.openMedia(activity, user.account_id, false, null, media, options);
break; break;
@ -1230,7 +1233,9 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
case R.id.profile_banner: { case R.id.profile_banner: {
if (user.profile_banner_url == null) return; if (user.profile_banner_url == null) return;
final String url = user.profile_banner_url + "/ipad_retina"; final String url = user.profile_banner_url + "/ipad_retina";
final ParcelableMedia[] media = {ParcelableMedia.image(url)}; ParcelableMedia profileBanner = ParcelableMedia.image(url);
profileBanner.type = ParcelableMedia.Type.TYPE_IMAGE;
final ParcelableMedia[] media = {profileBanner};
Bundle options = Utils.createMediaViewerActivityOption(view); Bundle options = Utils.createMediaViewerActivityOption(view);
Utils.openMedia(activity, user.account_id, false, null, media, options); Utils.openMedia(activity, user.account_id, false, null, media, options);
break; break;