Search in sources :

Example 1 with MediaVideoView

use of me.ccrama.redditslide.Views.MediaVideoView in project Slide by ccrama.

the class MediaView method doLoadGif.

public void doLoadGif(final String dat) {
    isGif = true;
    findViewById(R.id.hq).setVisibility(View.GONE);
    videoView = (MediaVideoView) findViewById(R.id.gif);
    findViewById(R.id.black).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (findViewById(R.id.gifheader).getVisibility() == View.GONE) {
                animateIn(findViewById(R.id.gifheader));
                fadeOut(findViewById(R.id.black));
            }
        }
    });
    videoView.clearFocus();
    findViewById(R.id.gifarea).setVisibility(View.VISIBLE);
    findViewById(R.id.submission_image).setVisibility(View.GONE);
    final ProgressBar loader = (ProgressBar) findViewById(R.id.gifprogress);
    findViewById(R.id.progress).setVisibility(View.GONE);
    gif = new GifUtils.AsyncLoadGif(this, (MediaVideoView) findViewById(R.id.gif), loader, findViewById(R.id.placeholder), doOnClick, true, false, true, ((TextView) findViewById(R.id.size)), subreddit);
    if (contentType != ContentType.Type.GIF) {
        videoView.mute = findViewById(R.id.mute);
        if (contentType != ContentType.Type.VREDDIT_DIRECT) {
            videoView.mute.setVisibility(View.VISIBLE);
        }
        gif.setMute(videoView.mute);
    }
    gif.execute(dat);
    findViewById(R.id.more).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showBottomSheetImage();
        }
    });
}
Also used : GifUtils(me.ccrama.redditslide.util.GifUtils) ImageView(android.widget.ImageView) SubmissionsView(me.ccrama.redditslide.Fragments.SubmissionsView) View(android.view.View) TextView(android.widget.TextView) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView) SubsamplingScaleImageView(me.ccrama.redditslide.Views.SubsamplingScaleImageView) ProgressBar(android.widget.ProgressBar) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView)

Example 2 with MediaVideoView

use of me.ccrama.redditslide.Views.MediaVideoView in project Slide by ccrama.

the class MediaFragmentComment method doLoadGif.

public void doLoadGif(final String dat) {
    isGif = true;
    videoView = (MediaVideoView) rootView.findViewById(R.id.gif);
    videoView.clearFocus();
    rootView.findViewById(R.id.gifarea).setVisibility(View.VISIBLE);
    rootView.findViewById(R.id.submission_image).setVisibility(View.GONE);
    final ProgressBar loader = (ProgressBar) rootView.findViewById(R.id.gifprogress);
    rootView.findViewById(R.id.progress).setVisibility(View.GONE);
    gif = new GifUtils.AsyncLoadGif(getActivity(), (MediaVideoView) rootView.findViewById(R.id.gif), loader, rootView.findViewById(R.id.placeholder), false, false, true, sub);
    gif.execute(dat);
}
Also used : GifUtils(me.ccrama.redditslide.util.GifUtils) ProgressBar(android.widget.ProgressBar) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView)

Example 3 with MediaVideoView

use of me.ccrama.redditslide.Views.MediaVideoView in project Slide by ccrama.

the class MediaFragment method doLoadGif.

public void doLoadGif(final Submission s) {
    isGif = true;
    videoView = (MediaVideoView) rootView.findViewById(R.id.gif);
    videoView.clearFocus();
    rootView.findViewById(R.id.gifarea).setVisibility(View.VISIBLE);
    rootView.findViewById(R.id.submission_image).setVisibility(View.GONE);
    final ProgressBar loader = (ProgressBar) rootView.findViewById(R.id.gifprogress);
    gif = new GifUtils.AsyncLoadGif(getActivity(), (MediaVideoView) rootView.findViewById(R.id.gif), loader, rootView.findViewById(R.id.placeholder), false, false, !(getActivity() instanceof Shadowbox) || ((Shadowbox) (getActivity())).pager.getCurrentItem() == i, sub);
    GifUtils.AsyncLoadGif.VideoType t = GifUtils.AsyncLoadGif.getVideoType(s.getUrl());
    String toLoadURL;
    if (t.shouldLoadPreview() && s.getDataNode().has("preview") && s.getDataNode().get("preview").get("images").get(0).has("variants") && s.getDataNode().get("preview").get("images").get(0).get("variants").has("mp4")) {
        toLoadURL = StringEscapeUtils.unescapeJson(s.getDataNode().get("preview").get("images").get(0).get("variants").get("mp4").get("source").get("url").asText()).replace("&", "&");
    } else if (t == GifUtils.AsyncLoadGif.VideoType.DIRECT && s.getDataNode().has("media") && s.getDataNode().get("media").has("reddit_video") && s.getDataNode().get("media").get("reddit_video").has("fallback_url")) {
        toLoadURL = StringEscapeUtils.unescapeJson(s.getDataNode().get("media").get("reddit_video").get("fallback_url").asText()).replace("&", "&");
    } else if (t != GifUtils.AsyncLoadGif.VideoType.OTHER) {
        toLoadURL = s.getUrl();
    } else {
        doLoadImage(firstUrl);
        return;
    }
    gif.execute(toLoadURL);
    rootView.findViewById(R.id.progress).setVisibility(View.GONE);
}
Also used : Shadowbox(me.ccrama.redditslide.Activities.Shadowbox) GifUtils(me.ccrama.redditslide.util.GifUtils) ProgressBar(android.widget.ProgressBar) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView)

Example 4 with MediaVideoView

use of me.ccrama.redditslide.Views.MediaVideoView in project Slide by ccrama.

the class MediaFragment method doLoadGifDirect.

public void doLoadGifDirect(final String s) {
    isGif = true;
    videoView = (MediaVideoView) rootView.findViewById(R.id.gif);
    videoView.clearFocus();
    rootView.findViewById(R.id.gifarea).setVisibility(View.VISIBLE);
    rootView.findViewById(R.id.submission_image).setVisibility(View.GONE);
    final ProgressBar loader = (ProgressBar) rootView.findViewById(R.id.gifprogress);
    gif = new GifUtils.AsyncLoadGif(getActivity(), (MediaVideoView) rootView.findViewById(R.id.gif), loader, rootView.findViewById(R.id.placeholder), false, false, !(getActivity() instanceof Shadowbox) || ((Shadowbox) (getActivity())).pager.getCurrentItem() == i, sub);
    gif.execute(s);
    rootView.findViewById(R.id.progress).setVisibility(View.GONE);
}
Also used : Shadowbox(me.ccrama.redditslide.Activities.Shadowbox) GifUtils(me.ccrama.redditslide.util.GifUtils) ProgressBar(android.widget.ProgressBar) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView)

Example 5 with MediaVideoView

use of me.ccrama.redditslide.Views.MediaVideoView in project Slide by ccrama.

the class ForceTouchLink method onCreate.

@Override
public void onCreate(Bundle savedInstance) {
    overridePendingTransition(0, 0);
    super.onCreate(savedInstance);
    applyColorTheme();
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_force_touch_content);
    findViewById(android.R.id.content).setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_POINTER_UP) {
                finish();
            }
            return false;
        }
    });
    final String url = getIntent().getExtras().getString("url");
    ContentType.Type t = ContentType.getContentType(url);
    final ImageView mainImage = (ImageView) findViewById(R.id.image);
    MediaVideoView mainVideo = (MediaVideoView) findViewById(R.id.gif);
    mainVideo.setVisibility(View.GONE);
    switch(t) {
        case REDDIT:
            break;
        case IMGUR:
            break;
        case IMAGE:
            ((Reddit) getApplication()).getImageLoader().displayImage(url, mainImage);
            break;
        case GIF:
            mainVideo.setVisibility(View.VISIBLE);
            new GifUtils.AsyncLoadGif(this, mainVideo, null, null, false, true, true, "").execute(url);
            break;
        case ALBUM:
            break;
        case VIDEO:
            break;
        case LINK:
            new AsyncTask<Void, Void, Void>() {

                String urlGotten;

                @Override
                protected Void doInBackground(Void... params) {
                    /*try {
                           urlGotten =  ImageExtractor.extractImageUrl(url);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }*/
                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    ((Reddit) getApplication()).getImageLoader().displayImage(urlGotten, mainImage);
                }
            }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
            break;
    }
}
Also used : ContentType(me.ccrama.redditslide.ContentType) ImageView(android.widget.ImageView) View(android.view.View) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView) MotionEvent(android.view.MotionEvent) MediaVideoView(me.ccrama.redditslide.Views.MediaVideoView) Reddit(me.ccrama.redditslide.Reddit) GifUtils(me.ccrama.redditslide.util.GifUtils) ImageView(android.widget.ImageView)

Aggregations

MediaVideoView (me.ccrama.redditslide.Views.MediaVideoView)5 GifUtils (me.ccrama.redditslide.util.GifUtils)5 ProgressBar (android.widget.ProgressBar)4 View (android.view.View)2 ImageView (android.widget.ImageView)2 Shadowbox (me.ccrama.redditslide.Activities.Shadowbox)2 MotionEvent (android.view.MotionEvent)1 TextView (android.widget.TextView)1 ContentType (me.ccrama.redditslide.ContentType)1 SubmissionsView (me.ccrama.redditslide.Fragments.SubmissionsView)1 Reddit (me.ccrama.redditslide.Reddit)1 SubsamplingScaleImageView (me.ccrama.redditslide.Views.SubsamplingScaleImageView)1