Exemplo n.º 1
0
  private void startTask(final VideoModel model) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    if (wifiManager.isWifiEnabled()) {
      DownloadTaskManager.getInstance(context).startOneTask(model);
    } else {
      if (SettingUtil.getWifiDoSomeThing(context)) {
        new AlertDialog.Builder(context)
            .setTitle(context.getString(R.string.wifi_tip))
            .setMessage(context.getResources().getString(R.string.study_record_3G_tip))
            .setPositiveButton(
                context.getResources().getString(R.string.downlaod),
                new DialogInterface.OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    DownloadTaskManager.getInstance(context).startOneTask(model);
                  }
                })
            .setNegativeButton(
                context.getString(R.string.cancel),
                new DialogInterface.OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog, int which) {}
                })
            .create()
            .show();
      } else {
        new AlertDialog.Builder(context)
            .setTitle(context.getString(R.string.wifi_tip))
            .setMessage(context.getResources().getString(R.string.this_video_not_to_download))
            .setPositiveButton(
                context.getResources().getString(R.string.sure),
                new DialogInterface.OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    //										DownloadTaskManager.getInstance(context).startOneTask(model);
                  }
                })
            .create()
            .show();
      }
    }
  }
Exemplo n.º 2
0
package com.dns.taxchina.ui.fragment;