Android Open Source - Jupiter-Broadcasting-Holo Show Notes View






From Project

Back to project page Jupiter-Broadcasting-Holo.

License

The source code is released under:

Copyright (c) 2011 Shane Quigley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Soft...

If you think the Android project Jupiter-Broadcasting-Holo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package jupiter.broadcasting.live.holo;
/*  www .  ja  v  a2s .  co  m*/
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;


/*
 * Copyright (c) 2013 Adam Szabo
 *
 * This software is MIT licensed see link for details
 * http://www.opensource.org/licenses/MIT
 *
 * @author Adam Szabo
 *
 */


public class ShowNotesView extends Fragment {

    View v;
    WebView wv;
    String link;
    ProgressBar loadingProgressBar;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        Bundle b = getArguments();
        link = b.getString("Notes");
        v = inflater.inflate(R.layout.shownotes_fragment, null);
        wv = (WebView) v.findViewById(R.id.notesview);
        loadingProgressBar = (ProgressBar) v.findViewById(R.id.progressbar_Horizontal);
        wv.getSettings().setJavaScriptEnabled(true);
        wv.setVisibility(View.INVISIBLE);
        wv.setWebChromeClient(new WebChromeClient() {

            // this will be called on page loading progress
            @Override
            public void onProgressChanged(WebView view, int newProgress) {

                super.onProgressChanged(view, newProgress);

                loadingProgressBar.setProgress(newProgress);

                // hide the progress bar if the loading is complete
                if (newProgress == 100) {
                    loadingProgressBar.setVisibility(View.GONE);
                } else {
                    loadingProgressBar.setVisibility(View.VISIBLE);
                }
            }

        });

        wv.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                wv.loadUrl("javascript:(function() {var mon = document.getElementsByTagName('div');" +
                        "for (var i = 0; i < mon.length; i++) {" +
                        "if (mon[i].id == 'footer'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'header'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'thevideo'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'sidebar'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'menubar'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'videodets'){mon[i].style.display = 'none';}" +
                        "if (mon[i].id == 'postcomments'){mon[i].style.display = 'none';}" +
                        "}})()");
                wv.loadUrl("javascript: window.CallToAnAndroidFunction.setVisible()");
            }
        });
        wv.addJavascriptInterface(new myJavaScriptInterface(), "CallToAnAndroidFunction");
        wv.loadUrl(link);


        return v;
    }

    public class myJavaScriptInterface {
        @JavascriptInterface
        public void setVisible() {
            getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    wv.setVisibility(View.VISIBLE);
                }
            });
        }
    }
}




Java Source Code List

com.google.sample.castcompanionlibrary.cast.BaseCastManager.java
com.google.sample.castcompanionlibrary.cast.CastMediaRouterCallback.java
com.google.sample.castcompanionlibrary.cast.DataCastManager.java
com.google.sample.castcompanionlibrary.cast.DeviceSelectionListener.java
com.google.sample.castcompanionlibrary.cast.VideoCastManager.java
com.google.sample.castcompanionlibrary.cast.callbacks.BaseCastConsumerImpl.java
com.google.sample.castcompanionlibrary.cast.callbacks.DataCastConsumerImpl.java
com.google.sample.castcompanionlibrary.cast.callbacks.IBaseCastConsumer.java
com.google.sample.castcompanionlibrary.cast.callbacks.IDataCastConsumer.java
com.google.sample.castcompanionlibrary.cast.callbacks.IVideoCastConsumer.java
com.google.sample.castcompanionlibrary.cast.callbacks.VideoCastConsumerImpl.java
com.google.sample.castcompanionlibrary.cast.dialog.video.VideoMediaRouteControllerDialogFragment.java
com.google.sample.castcompanionlibrary.cast.dialog.video.VideoMediaRouteControllerDialog.java
com.google.sample.castcompanionlibrary.cast.dialog.video.VideoMediaRouteDialogFactory.java
com.google.sample.castcompanionlibrary.cast.exceptions.CastException.java
com.google.sample.castcompanionlibrary.cast.exceptions.NoConnectionException.java
com.google.sample.castcompanionlibrary.cast.exceptions.OnFailedListener.java
com.google.sample.castcompanionlibrary.cast.exceptions.TransientNetworkDisconnectionException.java
com.google.sample.castcompanionlibrary.cast.player.IMediaAuthListener.java
com.google.sample.castcompanionlibrary.cast.player.IMediaAuthService.java
com.google.sample.castcompanionlibrary.cast.player.IVideoCastController.java
com.google.sample.castcompanionlibrary.cast.player.MediaAuthStatus.java
com.google.sample.castcompanionlibrary.cast.player.OnVideoCastControllerListener.java
com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerActivity.java
com.google.sample.castcompanionlibrary.cast.player.VideoCastControllerFragment.java
com.google.sample.castcompanionlibrary.notification.VideoCastNotificationService.java
com.google.sample.castcompanionlibrary.remotecontrol.RemoteControlClientCompat.java
com.google.sample.castcompanionlibrary.remotecontrol.RemoteControlHelper.java
com.google.sample.castcompanionlibrary.remotecontrol.VideoIntentReceiver.java
com.google.sample.castcompanionlibrary.utils.LogUtils.java
com.google.sample.castcompanionlibrary.utils.Utils.java
com.google.sample.castcompanionlibrary.widgets.IMiniController.java
com.google.sample.castcompanionlibrary.widgets.MiniController.java
jupiter.broadcasting.live.holo.CatalogueAdapter.java
jupiter.broadcasting.live.holo.Catalogue.java
jupiter.broadcasting.live.holo.EpisodeAdapter.java
jupiter.broadcasting.live.holo.EpisodeListFragment.java
jupiter.broadcasting.live.holo.Home.java
jupiter.broadcasting.live.holo.JBApplication.java
jupiter.broadcasting.live.holo.JBPlayer.java
jupiter.broadcasting.live.holo.MySpinnerAdapter.java
jupiter.broadcasting.live.holo.SettingsActivity.java
jupiter.broadcasting.live.holo.ShowActivity.java
jupiter.broadcasting.live.holo.ShowNotesView.java
jupiter.broadcasting.live.holo.list.BitmapLruCache.java
jupiter.broadcasting.live.holo.list.FadeImageView.java
jupiter.broadcasting.live.holo.parser.RssHandler.java
jupiter.broadcasting.live.holo.parser.SaxRssParser.java