master.flame.danmaku.danmaku.parser.IDataSource Java Examples

The following examples show how to use master.flame.danmaku.danmaku.parser.IDataSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoViewLiveActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private BaseDanmakuParser createParser(InputStream stream) {
    if (stream == null) {
        return new BaseDanmakuParser() {
            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }
    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #2
Source File: VideoViewActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private BaseDanmakuParser createParser(InputStream stream) {
    if (stream == null) {
        return new BaseDanmakuParser() {
            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }
    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #3
Source File: DanmakuVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 创建解析器对象,解析输入流

 @param stream
 @return
 */
private BaseDanmakuParser createParser(InputStream stream) {

    if (stream == null) {
        return new BaseDanmakuParser() {

            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }

    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);

    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #4
Source File: PoolingClientConnectionManager.java    From letv with Apache License 2.0 6 votes vote down vote up
public static HttpClient get() {
    HttpParams httpParams = new BasicHttpParams();
    ConnManagerParams.setTimeout(httpParams, 3000);
    ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(30));
    ConnManagerParams.setMaxTotalConnections(httpParams, 30);
    HttpClientParams.setRedirecting(httpParams, true);
    HttpProtocolParams.setUseExpectContinue(httpParams, true);
    HttpConnectionParams.setStaleCheckingEnabled(httpParams, false);
    HttpConnectionParams.setSoTimeout(httpParams, 2000);
    HttpConnectionParams.setConnectionTimeout(httpParams, 2000);
    HttpConnectionParams.setTcpNoDelay(httpParams, true);
    HttpConnectionParams.setSocketBufferSize(httpParams, 8192);
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme(IDataSource.SCHEME_HTTP_TAG, PlainSocketFactory.getSocketFactory(), 80));
    try {
        KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
        trustStore.load(null, null);
        SSLSocketFactory sf = new MySSLSocketFactory(trustStore);
        sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
        schemeRegistry.register(new Scheme(IDataSource.SCHEME_HTTPS_TAG, sf, 443));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, schemeRegistry), httpParams);
}
 
Example #5
Source File: WeiboSdkBrowser.java    From letv with Apache License 2.0 6 votes vote down vote up
private boolean initDataFromIntent(Intent data) {
    Bundle bundle = data.getExtras();
    this.mRequestParam = createBrowserRequestParam(bundle);
    if (this.mRequestParam != null) {
        this.mUrl = this.mRequestParam.getUrl();
        this.mSpecifyTitle = this.mRequestParam.getSpecifyTitle();
    } else {
        String url = bundle.getString("key_url");
        String specifyTitle = bundle.getString("key_specify_title");
        if (!TextUtils.isEmpty(url) && url.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
            this.mUrl = url;
            this.mSpecifyTitle = specifyTitle;
        }
    }
    if (TextUtils.isEmpty(this.mUrl)) {
        return false;
    }
    LogUtil.d(TAG, "LOAD URL : " + this.mUrl);
    return true;
}
 
Example #6
Source File: jr.java    From letv with Apache License 2.0 6 votes vote down vote up
public static String a(String str) {
    if (TextUtils.isEmpty(str)) {
        return str;
    }
    URI i = i(str);
    if (i == null) {
        return str;
    }
    String scheme = i.getScheme();
    if (TextUtils.isEmpty(scheme)) {
        return IDataSource.SCHEME_HTTP_TAG + str;
    }
    String toLowerCase = scheme.toLowerCase();
    if (scheme == null || scheme.equals(toLowerCase)) {
        return str;
    }
    int indexOf = str.indexOf(scheme);
    return indexOf >= 0 ? toLowerCase + str.substring(scheme.length() + indexOf) : str;
}
 
Example #7
Source File: AppbarActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
    boolean z = true;
    f.b(f.d, "-->(AppbarDialog)shouldOverrideUrlLoading : url = " + str);
    if (TextUtils.isEmpty(str)) {
        return false;
    }
    if (str.startsWith(IDataSource.SCHEME_HTTP_TAG) || str.startsWith(IDataSource.SCHEME_HTTPS_TAG)) {
        return super.shouldOverrideUrlLoading(webView, str);
    }
    if (str.startsWith(AppbarJsBridge.JS_BRIDGE_SCHEME)) {
        this.a.jsBridge.invoke(str);
        return true;
    } else if (!str.equals("about:blank;") && !str.equals("about:blank")) {
        return false;
    } else {
        if (VERSION.SDK_INT >= 11) {
            z = false;
        }
        return z;
    }
}
 
Example #8
Source File: AsyncHttpClient.java    From letv with Apache License 2.0 5 votes vote down vote up
public static String getUrlWithQueryString(String url, RequestParams params) {
    if (params != null) {
        String paramString = params.getParamString();
        if (url.indexOf("?") == -1) {
            url = new StringBuilder(String.valueOf(url)).append("?").append(paramString).toString();
        } else {
            url = new StringBuilder(String.valueOf(url)).append("&").append(paramString).toString();
        }
    }
    EALogger.i(IDataSource.SCHEME_HTTP_TAG, url);
    return url;
}
 
Example #9
Source File: DanmakuHelper.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
public static BaseDanmakuParser createParser(InputStream stream) {

        if (stream == null) {
            return new BaseDanmakuParser() {

                @Override
                protected Danmakus parse() {
                    return new Danmakus();
                }
            };
        }

//        ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
        ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_ACFUN);

        try {
            loader.load(stream);
        } catch (IllegalDataException e) {
            e.printStackTrace();
        }
//        BaseDanmakuParser parser = new BiliDanmukuParser();
        BaseDanmakuParser parser = new AcFunDanmakuParser();
        IDataSource<?> dataSource = loader.getDataSource();
        parser.load(dataSource);

        return parser;
    }
 
Example #10
Source File: AndroidFileSource.java    From letv with Apache License 2.0 5 votes vote down vote up
public void fillStreamFromUri(Uri uri) {
    String scheme = uri.getScheme();
    if (IDataSource.SCHEME_HTTP_TAG.equalsIgnoreCase(scheme) || IDataSource.SCHEME_HTTPS_TAG.equalsIgnoreCase(scheme)) {
        fillStreamFromHttpFile(uri);
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(scheme)) {
        fillStreamFromFile(new File(uri.getPath()));
    }
}
 
Example #11
Source File: JSONSource.java    From letv with Apache License 2.0 5 votes vote down vote up
public JSONSource(Uri uri) throws IOException, JSONException {
    String scheme = uri.getScheme();
    if (IDataSource.SCHEME_HTTP_TAG.equalsIgnoreCase(scheme) || IDataSource.SCHEME_HTTPS_TAG.equalsIgnoreCase(scheme)) {
        HttpURLConnection conn = (HttpURLConnection) new URL(uri.toString()).openConnection();
        conn.setConnectTimeout(6000);
        conn.setReadTimeout(6000);
        init(conn.getInputStream());
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(scheme)) {
        init(new FileInputStream(uri.getPath()));
    }
}
 
Example #12
Source File: jr.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean h(String str) {
    if (TextUtils.isEmpty(str)) {
        return false;
    }
    URI i = i(str);
    if (i == null) {
        return false;
    }
    if (i.getScheme() == null || IDataSource.SCHEME_HTTP_TAG.equalsIgnoreCase(i.getScheme()) || IDataSource.SCHEME_HTTPS_TAG.equalsIgnoreCase(i.getScheme())) {
        return true;
    }
    return false;
}
 
Example #13
Source File: jr.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean f(String str) {
    if (TextUtils.isEmpty(str)) {
        return false;
    }
    Uri parse = Uri.parse(str);
    if (parse.getHost() == null || !parse.getHost().equals("play.google.com") || parse.getScheme() == null || !parse.getScheme().startsWith(IDataSource.SCHEME_HTTP_TAG)) {
        return false;
    }
    return true;
}
 
Example #14
Source File: jr.java    From letv with Apache License 2.0 5 votes vote down vote up
public static boolean e(String str) {
    if (TextUtils.isEmpty(str)) {
        return false;
    }
    Uri parse = Uri.parse(str);
    if (parse.getScheme() == null) {
        return false;
    }
    if (parse.getScheme().equals(IDataSource.SCHEME_HTTP_TAG) || parse.getScheme().equals(IDataSource.SCHEME_HTTPS_TAG)) {
        return true;
    }
    return false;
}
 
Example #15
Source File: StatisticsUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static String getPlayInfoRef(int type) {
    String ref = NetworkUtils.DELIMITER_LINE;
    switch (type) {
        case 0:
            return sFrom;
        case 1:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "h214" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "4";
        case 2:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "h212" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "3";
        case 3:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "h214" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "1";
        case 4:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "h214" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "3";
        case 5:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "c683" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "1";
        case 6:
            return PageIdConstant.fullPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "c683" + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + "1";
        case 7:
            return PageIdConstant.halpPlayPage + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + NetworkUtils.DELIMITER_LINE + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + NetworkUtils.DELIMITER_LINE;
        case 8:
            return "001_1c_1";
        default:
            if (!TextUtils.isEmpty(mActionProperty.fl) && !mActionProperty.fl.equals(NetworkUtils.DELIMITER_LINE) && mActionProperty.fl.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
                return mActionProperty.fl;
            }
            if (TextUtils.isEmpty(mActionProperty.pageId)) {
                return ref;
            }
            return mActionProperty.pageId + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + mActionProperty.fl + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + mActionProperty.wz + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + DataUtils.getUnEmptyData(mActionProperty.scid) + EventsFilesManager.ROLL_OVER_FILE_NAME_SEPARATOR + DataUtils.getUnEmptyData(mActionProperty.fragId);
    }
}
 
Example #16
Source File: LemallPlatform.java    From letv with Apache License 2.0 5 votes vote down vote up
public TitleStatus getTitleInfo(String pageflag) {
    if (!(this.titleList == null || this.titleList.size() <= 0 || TextUtils.isEmpty(pageflag))) {
        for (int i = 0; i < this.titleList.size(); i++) {
            if (pageflag.equals(((TitleStatus) this.titleList.get(i)).getPageFlag())) {
                TitleStatus titleStatus = (TitleStatus) this.titleList.get(i);
                EALogger.i(IDataSource.SCHEME_HTTP_TAG, "标题栏信息:" + titleStatus.getPageFlag() + titleStatus.getTitle() + titleStatus.getHasShare() + titleStatus.getHasMore() + titleStatus.getMenuList().size());
                return titleStatus;
            }
        }
    }
    return null;
}
 
Example #17
Source File: MyDownloadActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void registerSdCardReceiver() {
    if (this.mSdcardMountReceiver == null) {
        this.mSdcardMountReceiver = new BroadcastReceiver(this) {
            final /* synthetic */ MyDownloadActivity this$0;

            {
                if (HotFix.PREVENT_VERIFY) {
                    System.out.println(VerifyLoad.class);
                }
                this.this$0 = this$0;
            }

            public void onReceive(Context context, Intent intent) {
                L.v(MyDownloadActivity.TAG, "BroadcastReceiver onReceive >>");
                this.this$0.updateStoreSpace();
            }
        };
    }
    if (this.mIntentFilter == null) {
        this.mIntentFilter = new IntentFilter("android.intent.action.MEDIA_MOUNTED");
        this.mIntentFilter.addAction("android.intent.action.MEDIA_REMOVED");
        this.mIntentFilter.addAction("android.intent.action.MEDIA_BAD_REMOVAL");
        this.mIntentFilter.addAction("android.intent.action.MEDIA_UNMOUNTED");
        this.mIntentFilter.addAction("android.intent.action.MEDIA_EJECT");
        this.mIntentFilter.addAction("android.intent.action.MEDIA_SHARED");
        this.mIntentFilter.addDataScheme(IDataSource.SCHEME_FILE_TAG);
        this.mIntentFilter.setPriority(1000);
    }
    try {
        registerReceiver(this.mSdcardMountReceiver, this.mIntentFilter);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #18
Source File: ParserCashier.java    From letv with Apache License 2.0 5 votes vote down vote up
public BaseBean Json2Entity(String content) {
    this.cashierInfo = new CashierInfo();
    EALogger.i(IDataSource.SCHEME_HTTP_TAG, "收银台接口数据:" + content);
    try {
        JSONObject jo = new JSONObject(content);
        this.cashierInfo.setStatus(jo.optString("status"));
        this.cashierInfo.setMessage(jo.optString("message"));
        JSONObject result = jo.optJSONObject("result");
        if (result == null) {
            return this.cashierInfo;
        }
        JSONObject object = result.optJSONObject("payMentResult");
        if (object != null) {
            this.cashierInfo.setVersion(object.optString("version"));
            this.cashierInfo.setService(object.optString(NotificationCompat.CATEGORY_SERVICE));
            this.cashierInfo.setMerchant_business_id(object.optString("merchantBusinessId"));
            this.cashierInfo.setUser_id(object.optString(UserInfoDb.USER_ID));
            this.cashierInfo.setNotify_url(object.optString("notifyUrl"));
            this.cashierInfo.setMerchant_no(object.optString("merchantNo"));
            this.cashierInfo.setOut_trade_no(object.optString("outTradeNo"));
            this.cashierInfo.setPrice(object.optString("price"));
            this.cashierInfo.setCurrency(object.optString("currency"));
            this.cashierInfo.setPay_expire(object.optString("payExpire"));
            this.cashierInfo.setProduct_id(object.optString("productId"));
            this.cashierInfo.setProduct_name(object.optString("productName"));
            this.cashierInfo.setProduct_desc(object.optString("productDesc"));
            this.cashierInfo.setTimestamp(object.optString("timestamp"));
            this.cashierInfo.setKey_index(object.optString("keyIndex"));
            this.cashierInfo.setInput_charset(object.optString("inputCharset"));
            this.cashierInfo.setIp(object.optString("ip"));
            this.cashierInfo.setSign_type(object.optString("signType"));
            this.cashierInfo.setSign(object.optString(TradeInfo.SIGN));
            this.cashierInfo.setHb_fq(object.optString("hbFq"));
        }
        return this.cashierInfo;
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #19
Source File: LetvSearchWebViewActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    LogInfo.log("zhuqiao", "shouldOverrideUrlLoading:" + url);
    if (TextUtils.isEmpty(url)) {
        return true;
    }
    if (!url.contains("://") || url.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    try {
        LetvSearchWebViewActivity.this.mContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
        return true;
    } catch (Exception e) {
        return true;
    }
}
 
Example #20
Source File: HttpEngine.java    From letv with Apache License 2.0 5 votes vote down vote up
public DefaultHttpClient createHttpClient() {
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(new Scheme(IDataSource.SCHEME_HTTP_TAG, PlainSocketFactory.getSocketFactory(), 80));
    registry.register(new Scheme(IDataSource.SCHEME_HTTPS_TAG, SSLSocketFactory.getSocketFactory(), 443));
    HttpParams params = createHttpParams();
    return new DefaultHttpClient(new ThreadSafeClientConnManager(params, registry), params);
}
 
Example #21
Source File: BasePlayActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void initDataFromIntent() {
    Intent intent = getIntent();
    this.mPlayType = intent.getIntExtra(PlayConstant.PLAY_TYPE, 0);
    this.mLaunchMode = intent.getIntExtra("launchMode", 0);
    this.mFromLaunch = intent.getIntExtra("from", 0);
    this.mFull = intent.getBooleanExtra(PlayConstant.LIVE_FULL_ONLY, false);
    this.mIsPanoramaVideo = intent.getSerializableExtra(PlayConstant.VIDEO_TYPE) == VideoType.Panorama;
    if (this.mLaunchMode == 0) {
        String path = null;
        if (!(getIntent() == null || getIntent().getData() == null)) {
            Uri uriPath = getIntent().getData();
            String scheme = uriPath.getScheme();
            path = (scheme == null || scheme.equals(IDataSource.SCHEME_FILE_TAG)) ? uriPath.getPath() : uriPath.toString();
        }
        this.mLaunchMode = 1;
        intent.putExtra("launchMode", 1);
        intent.putExtra(PlayConstant.URI, path);
        intent.putExtra("seek", 0);
        intent.putExtra(PlayConstant.PLAY_MODE, 1);
    }
    if (this.mFromLaunch == 13) {
        LetvApplication.getInstance().setPush(true);
    } else if (intent.getBooleanExtra("isFromPush", false)) {
        LetvApplication.getInstance().setPush(true);
    } else if (intent.getBooleanExtra("isLiveFromPush", false)) {
        LetvApplication.getInstance().setPush(true);
    }
}
 
Example #22
Source File: ProtocolBuilder.java    From letv with Apache License 2.0 4 votes vote down vote up
protected Builder getBuilder(String host, String path) {
    Builder ub = new Builder().scheme(IDataSource.SCHEME_HTTP_TAG).authority(host);
    ub.appendEncodedPath(path);
    addCommonParam(ub);
    return ub;
}
 
Example #23
Source File: AsyncHttpClient.java    From letv with Apache License 2.0 4 votes vote down vote up
public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
    this.httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme(IDataSource.SCHEME_HTTPS_TAG, sslSocketFactory, 443));
}
 
Example #24
Source File: AlbumPlayBaseFlow.java    From letv with Apache License 2.0 4 votes vote down vote up
public boolean isLocalFile() {
    return this.mIsDownloadFile || !(TextUtils.isEmpty(this.mAlbumUrl.realUrl) || this.mAlbumUrl.realUrl.startsWith(IDataSource.SCHEME_HTTP_TAG));
}
 
Example #25
Source File: FeedBackImageView.java    From letv with Apache License 2.0 4 votes vote down vote up
@SuppressLint({"NewApi"})
public String getPath(Context context, Uri uri) {
    boolean isKitKat;
    if (VERSION.SDK_INT >= 19) {
        isKitKat = true;
    } else {
        isKitKat = false;
    }
    if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
        String[] split;
        if (isExternalStorageDocument(uri)) {
            split = DocumentsContract.getDocumentId(uri).split(NetworkUtils.DELIMITER_COLON);
            if ("primary".equalsIgnoreCase(split[0])) {
                return Environment.getExternalStorageDirectory() + "/" + split[1];
            }
            return null;
        } else if (isDownloadsDocument(uri)) {
            return getDataColumn(context, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(DocumentsContract.getDocumentId(uri)).longValue()), null, null);
        } else if (!isMediaDocument(uri)) {
            return null;
        } else {
            String type = DocumentsContract.getDocumentId(uri).split(NetworkUtils.DELIMITER_COLON)[0];
            Uri contentUri = null;
            if ("image".equals(type)) {
                contentUri = Media.EXTERNAL_CONTENT_URI;
            } else if ("video".equals(type)) {
                contentUri = Video.Media.EXTERNAL_CONTENT_URI;
            } else if ("audio".equals(type)) {
                contentUri = Audio.Media.EXTERNAL_CONTENT_URI;
            }
            String selection = "_id=?";
            return getDataColumn(context, contentUri, "_id=?", new String[]{split[1]});
        }
    } else if (WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT.equalsIgnoreCase(uri.getScheme())) {
        if (isGooglePhotosUri(uri)) {
            return uri.getLastPathSegment();
        }
        return getDataColumn(context, uri, null, null);
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(uri.getScheme())) {
        return uri.getPath();
    } else {
        return null;
    }
}
 
Example #26
Source File: LetvWeixinShare.java    From letv with Apache License 2.0 4 votes vote down vote up
public static Bitmap returnBitMap(String url) {
    URL url2;
    MalformedURLException e;
    IOException e2;
    Bitmap bitmap = null;
    InputStream is = null;
    if (shareMode == 4) {
        shareMode = -1;
        if (!(TextUtils.isEmpty(url) || url.contains(IDataSource.SCHEME_HTTP_TAG))) {
            try {
                bitmap = FileUtils.getBitmapByPath(url, LeMessageIds.MSG_ALBUM_HALF_FETCH_EXPEND_VIEWPAGER_LAYOUT, LeMessageIds.MSG_ALBUM_HALF_FETCH_EXPEND_VIEWPAGER_LAYOUT);
            } catch (FileNotFoundException e3) {
                e3.printStackTrace();
            }
        }
    } else {
        try {
            URL myFileUrl = new URL(url);
            try {
                HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();
                conn.setDoInput(true);
                conn.connect();
                is = conn.getInputStream();
                bitmap = BitmapFactory.decodeStream(is);
                is.close();
                url2 = myFileUrl;
            } catch (MalformedURLException e4) {
                e = e4;
                url2 = myFileUrl;
                e.printStackTrace();
                LogInfo.log("fornia", "addparam bitmap:" + bitmap);
                return bitmap;
            } catch (IOException e5) {
                e2 = e5;
                url2 = myFileUrl;
                e2.printStackTrace();
                if (is != null) {
                    try {
                        is.close();
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
                LogInfo.log("fornia", "addparam bitmap:" + bitmap);
                return bitmap;
            }
        } catch (MalformedURLException e6) {
            e = e6;
            e.printStackTrace();
            LogInfo.log("fornia", "addparam bitmap:" + bitmap);
            return bitmap;
        } catch (IOException e7) {
            e2 = e7;
            e2.printStackTrace();
            if (is != null) {
                is.close();
            }
            LogInfo.log("fornia", "addparam bitmap:" + bitmap);
            return bitmap;
        }
    }
    LogInfo.log("fornia", "addparam bitmap:" + bitmap);
    return bitmap;
}
 
Example #27
Source File: AlbumPlayActivity.java    From letv with Apache License 2.0 4 votes vote down vote up
private void initDataFromIntent(Intent intent) {
    if (intent != null && intent.getExtras() != null) {
        boolean z;
        if (intent.getBooleanExtra(PlayConstant.NO_COPYRIGHT, false) && PreferencesManager.getInstance().getCopyright() == 1) {
            z = true;
        } else {
            z = false;
        }
        this.mIsPlayingNonCopyright = z;
        this.mNonCopyrightUrl = intent.getStringExtra(PlayConstant.NO_COPYRIGHT_URL);
        this.mHaptUrl = intent.getStringExtra(PlayConstant.HAPT_URL);
        this.mLaunchMode = intent.getIntExtra("launchMode", 0);
        if (TextUtils.isEmpty(getIntent().getStringExtra(PlayConstant.HAPT_URL))) {
            z = false;
        } else {
            z = true;
        }
        this.mIs4dVideo = z;
        if (getIntent().getSerializableExtra(PlayConstant.VIDEO_TYPE) == VideoType.Panorama) {
            z = true;
        } else {
            z = false;
        }
        this.mIsPanoramaVideo = z;
        if (getIntent().getSerializableExtra(PlayConstant.VIDEO_TYPE) == VideoType.Dolby) {
            z = true;
        } else {
            z = false;
        }
        this.mIsDolbyVideo = z;
        this.mIsForceFull = getIntent().getBooleanExtra(PlayConstant.FORCE_FULL, false);
        if (this.mLaunchMode == 7) {
            z = true;
        } else {
            z = false;
        }
        this.mIsLebox = z;
        int from = intent.getIntExtra("from", 0);
        String ref = intent.getStringExtra(PlayConstant.REF);
        if (!TextUtils.isEmpty(ref)) {
            StatisticsUtils.sLoginRef = ref;
            StatisticsUtils.sFrom = ref;
        }
        if (from != 18) {
            BaseApplication.getInstance().setLiveLunboBundle(null);
        }
        if (this.mLaunchMode == 0) {
            String path = null;
            if (!(intent == null || intent.getData() == null)) {
                Uri uriPath = intent.getData();
                String scheme = uriPath.getScheme();
                path = (scheme == null || scheme.equals(IDataSource.SCHEME_FILE_TAG)) ? uriPath.getPath() : uriPath.toString();
            }
            this.mLaunchMode = 1;
            intent.putExtra("launchMode", 1);
            intent.putExtra(PlayConstant.URI, path);
            intent.putExtra("seek", 0);
            intent.putExtra(PlayConstant.PLAY_MODE, 1);
        }
    }
}
 
Example #28
Source File: AlbumPlayActivity.java    From letv with Apache License 2.0 4 votes vote down vote up
public void startFlow(Intent intent, boolean onNewIntent) {
    if (intent != null && intent.getExtras() != null) {
        this.mPlayAlbumFlow = AlbumFlowUtils.getPlayFlow(this, this.mLaunchMode, intent.getExtras());
        if (this.mPlayAlbumFlow != null) {
            if (!onNewIntent) {
                this.mPlayAlbumFlow.mPlayInfo.type14 = System.currentTimeMillis() - StatisticsUtils.mClickImageForPlayTime;
            }
            this.mPlayAlbumFlow.mIsNonCopyright = this.mIsPlayingNonCopyright;
            this.mPlayAlbumFlow.mShouldWaitDrmPluginInstall = this.mShouldWaitDrmPluginInstall;
            this.mPlayObservable.addObserver(this.mPlayAlbumFlow);
            this.mPlayAlbumFlow.setObservable(this.mFlowObservable);
            this.mPlayAlbumFlow.setLoadListener(this.mLoadController);
            this.mPlayAlbumFlow.setAdListener(this.mPlayAdController);
            this.mPlayAlbumFlow.setVideoListener(this.mAlbumPlayFragment);
            this.mPlayAlbumFlow.setAlbumVipTrailListener(this.mVipTrailController);
            if (!this.mIsPlayingNonCopyright || TextUtils.equals(this.mNonCopyrightUrl, "-1")) {
                if (intent.getBooleanExtra(PlayConstant.IS_PAY, false) && PreferencesManager.getInstance().isLogin()) {
                    this.mController.syncUserInfo();
                } else if (!this.mController.checkPanoramaTip() && !this.mShouldWaitDrmPluginInstall) {
                    this.mPlayAlbumFlow.start();
                } else if (this.mShouldWaitDrmPluginInstall && !NetworkUtils.isNetworkAvailable()) {
                    this.mPlayAlbumFlow.showNoNet();
                }
                LogInfo.log("zhaosumin", "AlbumPlayAcitivity pid == " + this.mPlayAlbumFlow.mAid + " vid = " + this.mPlayAlbumFlow.mVid);
                downloadBackground();
            } else if (!LetvUtils.isGooglePlay()) {
                this.mWebView.setVisibility(0);
                if (!TextUtils.isEmpty(this.mNonCopyrightUrl)) {
                    String str;
                    if (this.mNonCopyrightUrl.startsWith(IDataSource.SCHEME_HTTP_TAG)) {
                        str = this.mNonCopyrightUrl;
                    } else {
                        str = "http://" + this.mNonCopyrightUrl;
                    }
                    this.mNonCopyrightUrl = str;
                    this.mWebView.loadUrl(this.mNonCopyrightUrl);
                }
                this.mHandler.postDelayed(new Runnable() {
                    public void run() {
                        AlbumPlayActivity.this.mWebView.setVisibility(8);
                        AlbumPlayActivity.this.mController.fullLock();
                        if (!AlbumPlayActivity.this.mShouldWaitDrmPluginInstall) {
                            AlbumPlayActivity.this.mPlayAlbumFlow.start();
                        } else if (!NetworkUtils.isNetworkAvailable()) {
                            AlbumPlayActivity.this.mPlayAlbumFlow.showNoNet();
                        }
                    }
                }, 1000);
            }
        }
    }
}
 
Example #29
Source File: LetvBaseWebViewActivity.java    From letv with Apache License 2.0 4 votes vote down vote up
@TargetApi(19)
private String getPicPathFromUri(Uri uri) {
    boolean isKitKat;
    if (VERSION.SDK_INT >= 19) {
        isKitKat = true;
    } else {
        isKitKat = false;
    }
    if (isKitKat && DocumentsContract.isDocumentUri(this, uri)) {
        String[] split;
        if (isExternalStorageDocument(uri)) {
            split = DocumentsContract.getDocumentId(uri).split(com.letv.pp.utils.NetworkUtils.DELIMITER_COLON);
            if ("primary".equalsIgnoreCase(split[0])) {
                return Environment.getExternalStorageDirectory() + "/" + split[1];
            }
            return null;
        } else if (isDownloadsDocument(uri)) {
            return getDataColumn(this, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(DocumentsContract.getDocumentId(uri)).longValue()), null, null);
        } else if (!isMediaDocument(uri)) {
            return null;
        } else {
            String type = DocumentsContract.getDocumentId(uri).split(com.letv.pp.utils.NetworkUtils.DELIMITER_COLON)[0];
            Uri contentUri = null;
            if ("image".equals(type)) {
                contentUri = Media.EXTERNAL_CONTENT_URI;
            } else if ("video".equals(type)) {
                contentUri = Video.Media.EXTERNAL_CONTENT_URI;
            } else if ("audio".equals(type)) {
                contentUri = Audio.Media.EXTERNAL_CONTENT_URI;
            }
            String selection = "_id=?";
            return getDataColumn(this, contentUri, "_id=?", new String[]{split[1]});
        }
    } else if (WidgetRequestParam.REQ_PARAM_COMMENT_CONTENT.equalsIgnoreCase(uri.getScheme())) {
        if (isGooglePhotosUri(uri)) {
            return uri.getLastPathSegment();
        }
        return getDataColumn(this, uri, null, null);
    } else if (IDataSource.SCHEME_FILE_TAG.equalsIgnoreCase(uri.getScheme())) {
        return uri.getPath();
    } else {
        return null;
    }
}
 
Example #30
Source File: AppbarActivity.java    From letv with Apache License 2.0 4 votes vote down vote up
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
    super.onPageStarted(webView, str, bitmap);
    this.a.setSupportZoom(false);
    if (!str.startsWith(IDataSource.SCHEME_HTTP_TAG) && !str.startsWith(IDataSource.SCHEME_HTTPS_TAG)) {
    }
}