Java Code Examples for com.xunlei.downloadlib.XLTaskHelper#init()

The following examples show how to use com.xunlei.downloadlib.XLTaskHelper#init() . 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: MainActivity.java    From MiniThunder with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    XLTaskHelper.init(getApplicationContext());
    inputUrl = (EditText) findViewById(R.id.input_url);
    btnDownload = (Button) findViewById(R.id.btn_down);
    tvStatus = (TextView) findViewById(R.id.tv_status);
    btnDownload.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(!TextUtils.isEmpty(inputUrl.getText())) {
                long taskId = XLTaskHelper.instance().addThunderTask(inputUrl.getText().toString(),"/sdcard/",null);
                handler.sendMessage(handler.obtainMessage(0,taskId));
            }
        }
    });
}
 
Example 2
Source File: UrlDownLoadActivity.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setTopBarTitle(R.string.new_download);
    XLTaskHelper.init(getApplicationContext());
    urlDownLoadPresenter=new UrlDownLoadPresenterImp(this);
}
 
Example 3
Source File: App.java    From AndroidDownload with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    x.Ext.init(this);
    //x.Ext.setDebug(BuildConfig.DEBUG);
    XLTaskHelper.init(getApplicationContext());
    instance = this;
}
 
Example 4
Source File: DownloadManager.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
public void init(Context context){
    if(this.context == null) {
        XLTaskHelper.init(context);
    }
    this.context = context;
}
 
Example 5
Source File: DownLoadUtil.java    From BtPlayer with Apache License 2.0 4 votes vote down vote up
private void init() {
    LogPrinter.i(TAG, "init");
    XLTaskHelper.init(globalContext);
}
 
Example 6
Source File: IApplication.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@Override
public void onCreate() {
    super.onCreate();
    _context = this.getApplicationContext();
    _asset = _context.getAssets();

    //AndroidUtilsCode
    Utils.init(this);

    //skins
    SkinCompatManager.withoutActivity(this)                         // 基础控件换肤初始化
            .addInflater(new SkinMaterialViewInflater())            // material design 控件换肤初始化[可选]
            .addInflater(new SkinConstraintViewInflater())          // ConstraintLayout 控件换肤初始化[可选]
            .addInflater(new SkinCardViewInflater())                // CardView v7 控件换肤初始化[可选]
            .addInflater(new SkinFlycoTabLayoutInflater())
            .setSkinStatusBarColorEnable(true)                      // 关闭状态栏换肤,默认打开[可选]
            .setSkinWindowBackgroundEnable(true)                    // 关闭windowBackground换肤,默认打开[可选]
            .setSkinAllActivityEnable(true)
            .loadSkin();

    //Crash
    CaocConfig.Builder.create()
            .backgroundMode(CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM)
            .enabled(true)
            .trackActivities(true)
            .minTimeBetweenCrashesMs(2000)
            .restartActivity(SplashActivity.class)
            .errorActivity(CrashActivity.class)
            .apply();

    //Bugly
    Bugly.init(getApplicationContext(), SoUtils.getInstance().getBuglyAppId(), false);

    //Sophix
    SophixManager.getInstance().setPatchLoadStatusStub(CommonUtils.getPatchLoadListener());

    //thunder
    XLTaskHelper.init(this);

    //数据库
    DataBaseManager.init(this);

    //播放器配置
    PlayerConfigShare.initPlayerConfigShare(this);

    //检查补丁
    if (AppConfig.getInstance().isAutoQueryPatch()){
        SophixManager.getInstance().queryAndLoadNewPatch();
    }

    startCorrectlyFlag = true;

    //严格模式
    //strictMode();
}