Android Open Source - Viz Content Source






From Project

Back to project page Viz.

License

The source code is released under:

GNU General Public License

If you think the Android project Viz 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

/*
 * Copyright 2012-2014, First Three LLC/* w w w . ja v a  2  s .co  m*/
 *
 * This file is a part of Viz.
 *
 * Viz is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * Viz is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Viz.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.first3.viz.content;

import com.first3.viz.builders.BlinkxResourceBuilder;
import com.first3.viz.builders.DailyMotionResourceBuilder;
import com.first3.viz.builders.FunnyOrDieResourceBuilder;
import com.first3.viz.builders.GenericResourceBuilder;
import com.first3.viz.builders.GoGoAnimeResourceBuilder;
import com.first3.viz.builders.LiveleakResourceBuilder;
import com.first3.viz.builders.MetacafeResourceBuilder;
import com.first3.viz.builders.NovamovResourceBuilder;
import com.first3.viz.builders.Play44ResourceBuilder;
import com.first3.viz.builders.PornHubBuilder;
import com.first3.viz.builders.RedtubeBuilder;
import com.first3.viz.builders.ResourceBuilder;
import com.first3.viz.builders.VevoResourceBuilder;
import com.first3.viz.builders.Video44ResourceBuilder;
import com.first3.viz.builders.VideoFunResourceBuilder;
import com.first3.viz.builders.VidzurResourceBuilder;
import com.first3.viz.builders.VimeoResourceBuilder;
import com.first3.viz.builders.YouruploadResourceBuilder;
import com.first3.viz.utils.Utils;

public class ContentSource {
    private final String fSite;
    private final String[] fHostnames;
    private final ResourceBuilder fResourceBuilder;
    private final String fURL;
    private final int fRank;
    private final boolean addToFavorites;

    /**
     * @param rank position in bookmarks (if added)
     * @param site  Display name to user, can be anything.
     * @param hostname the string (minus http://) that will be used to match
     *                 content against this source
     * @param url the url to redirect the user to the site when selected on
     *            favorites
     * @param addToFavorites whether the ContentSource should be displayed as
     *      a default bookmark.  If true, the favorite will be added on app
     *      upgrade.
     */
    private ContentSource(int rank, String site, String[] hostnames, String url,
                          ResourceBuilder builder, boolean addToFavorites) {
        this.fRank = rank;
        this.fSite = site;
        this.fHostnames = hostnames;
        this.fResourceBuilder = builder;
        this.fURL = url;
        this.addToFavorites = addToFavorites;
    }

    public boolean addToFavorites() {
        return addToFavorites;
    }

    /**
     * A name for this ContentSource that is suitable for user display.
     */
    @Override
    public String toString() { return getSite(); }

    public String getSite() { return this.fSite; }

    /**
     * Relative position of this ContentSource when displayed as a Favorite.
     */
    public int getRank() { return this.fRank; }

    /**
     * These are the strings that are used to see if a url matches this particular
     * ContentSource.  It is compared directly against the url.getHost().
     */
    public String[] getHostnames()     { return this.fHostnames;  }

    /**
     * The ResourceBuilder that can construct a Resource from this
     * ContentSource.
     */
    public ResourceBuilder getResourceBuilder() {
        return this.fResourceBuilder;
    }

    /**
     * The URL that should be loaded if a user wanted to go directly to
     * this ContentSource.  In many cases this will be the same as the
     * hostname with only the necessary http:// added.
     */
    public String getURL() {
        return fURL;
    }

    /**
     * The GENERIC content source is not added as a content source; it is used if a
     * match isn't found among the remaining ContentSources.
     */
    public static final ContentSource GENERIC =
        new ContentSource(0, "Generic", new String[] { "anyhost" }, "anyurl",
                new GenericResourceBuilder(), false);

    public static final ContentSource VIMEO =
        new ContentSource(1, "Vimeo", new String[] { "vimeo.com" }, "http://vimeo.com/m",
                new VimeoResourceBuilder(), true);

    public static final ContentSource DM =
            new ContentSource(2, "Dailymotion", new String[] { "touch.dailymotion.com",
                "www.dailymotion.com" }, "http://touch.dailymotion.com",
                new DailyMotionResourceBuilder(), true);

    public static final ContentSource VEVO =
            new ContentSource(3, "Vevo", new String[] { "www.vevo.com" },
                    "http://www.vevo.com", new VevoResourceBuilder(), Utils.isKitkatOrHigher());

    public static final ContentSource FOD =
            new ContentSource(4, "Funny or Die", new String[] { "www.funnyordie.com" },
                    "http://www.funnyordie.com", new FunnyOrDieResourceBuilder(), true);

    public static final ContentSource MCAFE =
            new ContentSource(5, "Metacafe", new String[] { "www.metacafe.com" },
                    "http://www.metacafe.com", new MetacafeResourceBuilder(), true);

    public static final ContentSource BLINKX =
            new ContentSource(6, "Blinkx", new String[] { "www.blinkx.com","blinkx.com","cdn.blinkx.com" },
                    "http://www.blinkx.com", new BlinkxResourceBuilder(), true);

    public static final ContentSource LIVELEAK =
            new ContentSource(7, "LiveLeak", new String[] { "www.liveleak.com" },
                    "http://www.liveleak.com", new LiveleakResourceBuilder(), true);

    public static final ContentSource GOGOANIME = new ContentSource(3, "GoGoAnime",
                    new String[] { "www.gogoanime.com" }, "http://www.gogoanime.com/",
                    new GoGoAnimeResourceBuilder(), true);

    public static final ContentSource REDTUBE = new ContentSource(8, "Redtube", new String[] { "redtube.com",
                    "www.redtube.com" }, "http://www.redtube.com", new RedtubeBuilder(), false);

    public static final ContentSource PORNHUB = new ContentSource(0, "Pornhub", new String[] { "m.pornhub.com" },
                    "http://m.pornhub.com", new PornHubBuilder(), false);

    public static final ContentSource VIDEOFUN = new ContentSource(0, "", new String[] { "videofun.me" },
                    "http://www.videofun.me/", new VideoFunResourceBuilder(), false);

    public static final ContentSource VIDEO44 = new ContentSource(0, "", new String[] { "www.video44.net" },
                    "http://www.video44.net/", new Video44ResourceBuilder(), false);

    public static final ContentSource VIDZUR = new ContentSource(0, "", new String[] { "vidzur.com" },
                    "http://www.vidzur.com/", new VidzurResourceBuilder(), false);

    public static final ContentSource YOURUPLOAD = new ContentSource(0, "", new String[] { "embed.yourupload.com" },
                    "http://yourupload.com", new YouruploadResourceBuilder(), false);

    public static final ContentSource NOVAMOV = new ContentSource(0, "", new String[] { "embed.novamov.com" },
                    "http://www.novamov.com/", new NovamovResourceBuilder(), false);

    public static final ContentSource PLAY44 = new ContentSource(0, "", new String[] { "play44.net" },
                    "http://www.play44.com/", new Play44ResourceBuilder(), false);
}




Java Source Code List

com.actionbarsherlock.BuildConfig.java
com.first3.viz.Config.java
com.first3.viz.Config.java
com.first3.viz.Constants.java
com.first3.viz.Preferences.java
com.first3.viz.VersionChangeNotifier.java
com.first3.viz.VizApp.java
com.first3.viz.browser.Browser.java
com.first3.viz.browser.VizWebChromeClient.java
com.first3.viz.browser.VizWebViewClient.java
com.first3.viz.builders.BlinkxResourceBuilder.java
com.first3.viz.builders.CombinedResourceBuilder.java
com.first3.viz.builders.ContainerResourceBuilder.java
com.first3.viz.builders.DailyMotionResourceBuilder.java
com.first3.viz.builders.FlashPlayerResourceBuilder.java
com.first3.viz.builders.FunnyOrDieResourceBuilder.java
com.first3.viz.builders.GenericResourceBuilder.java
com.first3.viz.builders.GoGoAnimeResourceBuilder.java
com.first3.viz.builders.JSResourceBuilder.java
com.first3.viz.builders.LiveleakResourceBuilder.java
com.first3.viz.builders.MetacafeResourceBuilder.java
com.first3.viz.builders.NovamovResourceBuilder.java
com.first3.viz.builders.Play44ResourceBuilder.java
com.first3.viz.builders.PornHubBuilder.java
com.first3.viz.builders.RedtubeBuilder.java
com.first3.viz.builders.ResourceBuilder.java
com.first3.viz.builders.VevoResourceBuilder.java
com.first3.viz.builders.Video44ResourceBuilder.java
com.first3.viz.builders.VideoFunResourceBuilder.java
com.first3.viz.builders.VidzurResourceBuilder.java
com.first3.viz.builders.VimeoResourceBuilder.java
com.first3.viz.builders.YouruploadResourceBuilder.java
com.first3.viz.content.ContentSource.java
com.first3.viz.content.ContentSources.java
com.first3.viz.content.ContentType.java
com.first3.viz.content.ContentTypes.java
com.first3.viz.download.Container.java
com.first3.viz.download.DownloadManager.java
com.first3.viz.download.StringContainer.java
com.first3.viz.models.Favorite.java
com.first3.viz.models.Resource.java
com.first3.viz.players.VideoPlayer.java
com.first3.viz.provider.VizContract.java
com.first3.viz.provider.VizDatabase.java
com.first3.viz.provider.VizProvider.java
com.first3.viz.ui.ActivityDelegate.java
com.first3.viz.ui.DirectoryListAdapter.java
com.first3.viz.ui.DownloadDirectoryDialogPreference.java
com.first3.viz.ui.Downloads.java
com.first3.viz.ui.FastBitmapDrawable.java
com.first3.viz.ui.Favorites.java
com.first3.viz.ui.FileManager.java
com.first3.viz.ui.PinSelectorDialogFragment.java
com.first3.viz.ui.ProgressDialogFragment.java
com.first3.viz.ui.Settings.java
com.first3.viz.ui.VizMediaPlayer.java
com.first3.viz.utils.AbstractPauseHandler.java
com.first3.viz.utils.ActivityParent.java
com.first3.viz.utils.DownloadTask.java
com.first3.viz.utils.FetchContainerTask.java
com.first3.viz.utils.FragmentParent.java
com.first3.viz.utils.IOUtilities.java
com.first3.viz.utils.ImageUtilities.java
com.first3.viz.utils.Lists.java
com.first3.viz.utils.Log.java
com.first3.viz.utils.Maps.java
com.first3.viz.utils.SelectionBuilder.java
com.first3.viz.utils.StringBuffer.java
com.first3.viz.utils.TabsAdapter.java
com.first3.viz.utils.Utils.java
com.first3.viz.utils.VizUtils.java