Java Code Examples for android.content.DialogInterface.OnCancelListener

The following examples show how to use android.content.DialogInterface.OnCancelListener. These examples are extracted from open source projects. 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 Project: letv   Source File: ChinaMobileWebPayActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void showLoadingDialog() {
    dismisLoadingDialog();
    this.loadingDialog = new LoadingDialog((Context) this, 2131100006);
    this.loadingDialog.show();
    this.loadingDialog.setOnCancelListener(new OnCancelListener(this) {
        final /* synthetic */ ChinaMobileWebPayActivity this$0;

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

        public void onCancel(DialogInterface dialog) {
            this.this$0.showFailedDialog();
        }
    });
}
 
Example 2
Source Project: Viewer   Source File: AtHomeCameraVideolistNaoCan.java    License: Apache License 2.0 6 votes vote down vote up
private void reload()
{
	relayout_alert.setVisibility(View.GONE);
	if (pageIndex == 0)
	{
		progressDialog(R.string.loading_label);
		dialog.setOnCancelListener(new OnCancelListener()
		{

			@Override
			public void onCancel(DialogInterface arg0)
			{
				finish();
			}
		});
	}
	videoListViewHandler.getRecordVideoList(date, iCam,pageIndex,isAllCamera);
}
 
Example 3
Source Project: BigApp_Discuz_Android   Source File: ActionSheet.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @Title showSheet
 * @Description TODO(这里用一句话描述这个方法的作用)
 * @param mContext
 *            上下文环境
 * @param actionSheetConfig
 *            ActionSheet配置项
 * @param actionSheetItemSelected
 *            ActionSheet Item选中监听
 * @param cancelListener
 *            取消按钮的监听,无需监听可传null
 * @return Dialog 返回类型
 */
@SuppressLint("NewApi")
public void show(final Activity activity,
		ActionSheetConfig actionSheetConfig,
		final OnActionSheetItemSelected actionSheetItemSelected,
		OnCancelListener cancelListener) {
	switch (actionSheetConfig.actionsheetStyle) {

	case ACTIONSHEET_IOS:
		new ActionSheet4IOS().show(activity, actionSheetConfig,
				actionSheetItemSelected, cancelListener);

		break;
	case ACTIONSHEET_WECHAT:
		new ActionSheet4WeChat().show(activity, actionSheetConfig,
				actionSheetItemSelected, cancelListener);
		break;
	default:
		new ActionSheet4WeChat().show(activity, actionSheetConfig,
				actionSheetItemSelected, cancelListener);
	}
}
 
Example 4
private void showProgress() {
    if (loadingDialog == null) {
        if (splash > 0) {
            Log.i("SplashActivity Showing splash");
            setContentView(splash);
        } else {
            Log.i("SplashActivity Showing progress");
            loadingDialog = ProgressDialog.show(this, null, "Starting...", true, true);
            loadingDialog.setCanceledOnTouchOutside(false);
            loadingDialog.setOnCancelListener(new OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    dialogCancelled = true;
                    finish();
                }
            });
        }
    }
}
 
Example 5
Source Project: wechatsdk-xamarin   Source File: MMAlert.java    License: Apache License 2.0 6 votes vote down vote up
public static AlertDialog showAlert(final Context context, final String title, final String msg, final View view, final DialogInterface.OnClickListener lOk,
		final DialogInterface.OnClickListener lCancel) {
	if (context instanceof Activity && ((Activity) context).isFinishing()) {
		return null;
	}

	final Builder builder = new AlertDialog.Builder(context);
	builder.setTitle(title);
	builder.setMessage(msg);
	builder.setView(view);
	builder.setPositiveButton(R.string.app_ok, lOk);
	builder.setNegativeButton(R.string.app_cancel, lCancel);
	// builder.setCancelable(true);
	builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

		@Override
		public void onCancel(DialogInterface dialog) {
			if (lCancel != null) {
				lCancel.onClick(dialog, 0);
			}
		}
	});
	final AlertDialog alert = builder.create();
	alert.show();
	return alert;
}
 
Example 6
Source Project: physical-web   Source File: BluetoothSite.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Connects to the Gatt service of the device to download a web page and displays a progress bar
 * for the title.
 * @param deviceAddress The mac address of the bar
 * @param title The title of the web page being downloaded
 */
public void connect(String deviceAddress, String title) {
  running = true;
  String progressTitle = activity.getString(R.string.page_loading_title) + " " + title;
  progress = new ProgressDialog(activity);
  progress.setCancelable(true);
  progress.setOnCancelListener(new OnCancelListener() {
    @Override
    public void onCancel(DialogInterface dialogInterface) {
      Log.i(TAG, "Dialog box canceled");
      close();
    }
  });
  progress.setTitle(progressTitle);
  progress.setMessage(activity.getString(R.string.page_loading_message));
  progress.show();
  activity.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      mBluetoothGatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(deviceAddress)
          .connectGatt(activity, false, BluetoothSite.this);
    }
  });
}
 
Example 7
Source Project: UTubeTV   Source File: ChangeLogDialog.java    License: The Unlicense 6 votes vote down vote up
private void showDialogWithHTML(Resources resources, String htmlChangelog) {
  CharSequence title = resources.getString(R.string.title_changelog);
  title = String.format("%s v%s", title, getAppVersion());

  final WebView webView = new WebView(mActivity);
  webView.loadDataWithBaseURL(null, htmlChangelog, "text/html", "utf-8", null);

  final AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle(title)
      .setView(webView)
      .setPositiveButton(resources.getString(R.string.changelog_close), new Dialog.OnClickListener() {
        public void onClick(final DialogInterface dialogInterface, final int i) {
          dialogInterface.dismiss();
        }
      })
      .setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
          dialog.dismiss();
        }
      });
  builder.create().show();
}
 
Example 8
Source Project: fanfouapp-opensource   Source File: EditProfilePage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    this.api = AppContext.getApiClient();
    this.pd = new ProgressDialog(this.mEditProfilePage);
    this.pd.setMessage("正在更新头像...");
    this.pd.setIndeterminate(true);
    this.pd.setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(final DialogInterface dialog) {
            UpdateProfileImageTask.this.isCancelled = true;
            cancel(true);
        }
    });
    this.pd.show();
}
 
Example 9
Source Project: fanfouapp-opensource   Source File: EditProfilePage.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    this.api = AppContext.getApiClient();
    this.pd = new ProgressDialog(this.mContext);
    this.pd.setMessage("正在更新个人资料...");
    this.pd.setIndeterminate(true);
    this.pd.setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(final DialogInterface dialog) {
            UpdateProfileTask.this.isCancelled = true;
            cancel(true);
        }
    });
    this.pd.show();
}
 
Example 10
Source Project: EFRConnect-android   Source File: Dialogs.java    License: Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showProgress(CharSequence title, CharSequence message, Context context,
                                          OnCancelListener listener) {

    final ProgressDialog progressDialog = new ProgressDialog(context);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);

    progressDialog.setOnCancelListener(listener);
    progressDialog.setTitle(title);
    progressDialog.setMessage(message);
    progressDialog.show();
    return progressDialog;
}
 
Example 11
Source Project: Social   Source File: EaseBaiduMapActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void showMapWithLocationClient() {
	String str1 = getResources().getString(R.string.Making_sure_your_location);
	progressDialog = new ProgressDialog(this);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	progressDialog.setMessage(str1);

	progressDialog.setOnCancelListener(new OnCancelListener() {

		public void onCancel(DialogInterface arg0) {
			if (progressDialog.isShowing()) {
				progressDialog.dismiss();
			}
			Log.d("map", "cancel retrieve location");
			finish();
		}
	});

	progressDialog.show();

	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);

	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// 打开gps
	// option.setCoorType("bd09ll"); //设置坐标类型
	// Johnson change to use gcj02 coordination. chinese national standard
	// so need to conver to bd09 everytime when draw on baidu map
	option.setCoorType("gcj02");
	option.setScanSpan(30000);
	option.setAddrType("all");
	mLocClient.setLocOption(option);
}
 
Example 12
Source Project: BigApp_Discuz_Android   Source File: ActionSheet4WeChat.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @Title showSheet
 * @param activity
 *            上下文环境
 * @param actionSheetConfig
 *            ActionSheet配置项
 * @param actionSheetItemSelected
 *            ActionSheet Item选中监听
 * @param cancelListener
 *            取消按钮的监听,无需监听可传null
 * @return Dialog 返回类型
 */
@SuppressLint("NewApi")
public Dialog show(final Activity activity,
		ActionSheetConfig actionSheetConfig,
		final OnActionSheetItemSelected actionSheetItemSelected,
		OnCancelListener cancelListener) {
	final Dialog dlg = new Dialog(activity, R.style.ActionSheet);
	LinearLayout layout = this.getLayout(activity, dlg, actionSheetConfig,
			actionSheetItemSelected);

	TextView mCancel = (TextView) layout.findViewById(R.id.cancel);

	mCancel.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			actionSheetItemSelected.onActionSheetItemSelected(activity, 0);
			dlg.dismiss();
		}
	});

	Window w = dlg.getWindow();
	WindowManager.LayoutParams lp = w.getAttributes();
	lp.x = 0;
	final int cMakeBottom = -1000;
	lp.y = cMakeBottom;
	lp.gravity = Gravity.BOTTOM;
	dlg.onWindowAttributesChanged(lp);
	dlg.setCanceledOnTouchOutside(false);
	if (cancelListener != null)
		dlg.setOnCancelListener(cancelListener);

	dlg.setContentView(layout);
	dlg.show();

	// 设置点击弹窗外部取消actionsheet
	dlg.setCanceledOnTouchOutside(true);

	return dlg;
}
 
Example 13
Source Project: Study_Android_Demo   Source File: EaseBaiduMapActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void showMapWithLocationClient() {
	String str1 = getResources().getString(R.string.Making_sure_your_location);
	progressDialog = new ProgressDialog(this);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	progressDialog.setMessage(str1);

	progressDialog.setOnCancelListener(new OnCancelListener() {

		public void onCancel(DialogInterface arg0) {
			if (progressDialog.isShowing()) {
				progressDialog.dismiss();
			}
			Log.d("map", "cancel retrieve location");
			finish();
		}
	});

	progressDialog.show();

	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);

	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// open gps
	// option.setCoorType("bd09ll"); 
	// Johnson change to use gcj02 coordination. chinese national standard
	// so need to conver to bd09 everytime when draw on baidu map
	option.setCoorType("gcj02");
	option.setScanSpan(30000);
	option.setAddrType("all");
	mLocClient.setLocOption(option);
}
 
Example 14
private void showMapWithLocationClient() {
	progressDialog = new ProgressDialog(this);
	progressDialog.setCanceledOnTouchOutside(false);
	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
	progressDialog.setMessage("正在确定你的位置...");

	progressDialog.setOnCancelListener(new OnCancelListener() {

		public void onCancel(DialogInterface arg0) {
			if (progressDialog.isShowing()) {
				progressDialog.dismiss();
			}
			Log.d("map", "cancel retrieve location");
			finish();
		}
	});

	progressDialog.show();

	mLocClient = new LocationClient(this);
	mLocClient.registerLocationListener(myListener);

	LocationClientOption option = new LocationClientOption();
	option.setOpenGps(true);// 打开gps
	// option.setCoorType("bd09ll"); //设置坐标类型
	// Johnson change to use gcj02 coordination. chinese national standard
	// so need to conver to bd09 everytime when draw on baidu map
	option.setCoorType("gcj02");
	option.setScanSpan(30000);
	option.setAddrType("all");
	mLocClient.setLocOption(option);
}
 
Example 15
Source Project: tilt-game-android   Source File: GenericInputDialogBuilder.java    License: MIT License 5 votes vote down vote up
public GenericInputDialogBuilder(final Context pContext, final int pTitleResID, final int pMessageResID, final int pErrorResID, final int pIconResID, final String pDefaultText, final Callback<T> pSuccessCallback, final OnCancelListener pOnCancelListener) {
	this.mContext = pContext;
	this.mTitleResID = pTitleResID;
	this.mMessageResID = pMessageResID;
	this.mErrorResID = pErrorResID;
	this.mIconResID = pIconResID;
	this.mDefaultText = pDefaultText;
	this.mSuccessCallback = pSuccessCallback;
	this.mOnCancelListener = pOnCancelListener;
}
 
Example 16
Source Project: Gizwits-SmartSocket_Android   Source File: SearchDeviceActivity.java    License: MIT License 5 votes vote down vote up
/**
   * Inits the views.
   */
  private void initViews() {
      btnAddQR = (Button) findViewById(R.id.btnAddQR);
      btnAddGokit = (Button) findViewById(R.id.btnAddGokit);
      ivBack=(ImageView) findViewById(R.id.ivBack);
      lvDevices = (ListView) findViewById(R.id.lvDevices);
      tvTips = (TextView) findViewById(R.id.tvTips);
      loadingDialog = new ProgressDialog(this);
      loadingDialog.setMessage("加载中,请稍候.");
      loadingDialog.setCancelable(false);
      deviceList = new ArrayList<XPGWifiDevice>();
      adapter = new SearchListAdapter(this, deviceList);
      lvDevices.setAdapter(adapter);
      noNetworkDialog = DialogManager.getNoNetworkDialog(this);
      noNetworkDialog.setOnCancelListener(new OnCancelListener() {

          @Override
          public void onCancel(DialogInterface dialog) {
              isWaitingWifi = false;

          }
      });
      allDeviceList = new ArrayList<XPGWifiDevice>();
      
      Bundle mBundle = getIntent().getExtras();
if (mBundle != null) {
	isRegister = mBundle.getBoolean("isRegister");
}
  }
 
Example 17
Source Project: NIM_Android_UIKit   Source File: DialogMaker.java    License: MIT License 5 votes vote down vote up
@Deprecated
public static EasyProgressDialog showProgressDialog(Context context, String title, String message,
                                                    boolean canCancelable, OnCancelListener listener) {

    EasyProgressDialog dialog = getDialog();

    if (dialog != null && dialog.getContext() != context) {
        // maybe existing dialog is running in a destroyed activity cotext we should recreate one
        dismissProgressDialog();
        LogUtil.e("dialog", "there is a leaked window here,orign context: " + dialog.getContext() + " now: " + context);
        dialog = null;
    }

    if (dialog == null) {
        dialog = new EasyProgressDialog(context, message);
        sProgressDialogRef = new WeakReference<>(dialog);
    }

    if (!TextUtils.isEmpty(title)) {
        dialog.setTitle(title);
    }
    if (!TextUtils.isEmpty(message)) {
        dialog.setMessage(message);
    }
    dialog.setCancelable(canCancelable);
    dialog.setOnCancelListener(listener);
    dialog.show();
    return dialog;
}
 
Example 18
Source Project: wechatsdk-xamarin   Source File: MMAlert.java    License: Apache License 2.0 5 votes vote down vote up
public static AlertDialog showAlert(final Context context, final String title, final View view, final DialogInterface.OnCancelListener lCancel) {
	if (context instanceof Activity && ((Activity) context).isFinishing()) {
		return null;
	}

	final Builder builder = new AlertDialog.Builder(context);
	builder.setTitle(title);
	builder.setView(view);
	// builder.setCancelable(true);
	builder.setOnCancelListener(lCancel);
	final AlertDialog alert = builder.create();
	alert.show();
	return alert;
}
 
Example 19
Source Project: wechatsdk-xamarin   Source File: MMAlert.java    License: Apache License 2.0 5 votes vote down vote up
public static ProgressDialog showProgressDlg(final Context context, final String title, final String message, final boolean indeterminate, final boolean cancelable, final OnCancelListener lCancel) {

		MMAppMgr.activate(true);

		return ProgressDialog.show(context, title, message, indeterminate, cancelable, new DialogInterface.OnCancelListener() {

			@Override
			public void onCancel(final DialogInterface dialog) {
				if (lCancel != null) {
					lCancel.onCancel(dialog);
				}
				MMAppMgr.activate(false);
			}
		});
	}
 
Example 20
public GenericInputDialogBuilder(final Context pContext, final int pTitleResID, final int pMessageResID, final int pErrorResID, final int pIconResID, final String pDefaultText, final Callback<T> pSuccessCallback, final OnCancelListener pOnCancelListener){
	this.mContext = pContext;
	this.mTitleResID = pTitleResID;
	this.mMessageResID = pMessageResID;
	this.mErrorResID = pErrorResID;
	this.mIconResID = pIconResID;
	this.mDefaultText = pDefaultText;
	this.mSuccessCallback = pSuccessCallback;
	this.mOnCancelListener = pOnCancelListener;
}
 
Example 21
private void getNC() {
	List<NameValuePair> targVar = new ArrayList<NameValuePair>();
	targVar.add(Wenku8Interface.getNovelContent(currentAid, currentCid,
			GlobalConfig.getFetchLanguage()));

	final asyncNovelContentTask ast = new asyncNovelContentTask();
	ast.execute(targVar);

	pDialog = new ProgressDialog(parentActivity);
	pDialog.setTitle(getResources().getString(R.string.load_status));
	pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	pDialog.setCancelable(true);
	pDialog.setOnCancelListener(new OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialog) {
			// TODO Auto-generated method stub
			ast.cancel(true);
			pDialog.dismiss();
			pDialog = null;
		}

	});
	pDialog.setMessage(getResources().getString(R.string.load_loading));
	pDialog.setProgress(0);
	pDialog.setMax(1);
	pDialog.show();

	return;
}
 
Example 22
private void loadSearchResultList() {
	// the result is just 10 records, so don't need "isLoading"
	List<NameValuePair> targVarList = new ArrayList<NameValuePair>();
	if (plus == 1) {
		targVarList.add(Wenku8Interface.searchNovelByNovelName(name,
				GlobalConfig.getFetchLanguage()));
	} else if (plus == 2) {
		targVarList.add(Wenku8Interface.searchNovelByAuthorName(name,
				GlobalConfig.getFetchLanguage()));

	}

	isSearching = true;
	final asyncSearchTask ast = new asyncSearchTask();
	ast.execute(targVarList);

	pDialog = new ProgressDialog(parentActivity);
	pDialog.setTitle(getResources().getString(R.string.search_ing));
	pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	pDialog.setCancelable(true);
	pDialog.setOnCancelListener(new OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialog) {
			// TODO Auto-generated method stub
			isSearching = false;
			if (pDialog != null)
				pDialog.dismiss();
			pDialog = null;
		}

	});
	pDialog.setMessage(getResources().getString(R.string.search_fetching));
	pDialog.setProgress(0);
	pDialog.setMax(1);
	pDialog.show();

	return;
}
 
Example 23
private void getNC() {
	List<NameValuePair> targVar = new ArrayList<NameValuePair>();
	targVar.add(Wenku8Interface.getNovelContent(currentAid, currentCid,
			GlobalConfig.getFetchLanguage()));

	final asyncNovelContentTask ast = new asyncNovelContentTask();
	ast.execute(targVar);

	pDialog = new ProgressDialog(parentActivity);
	pDialog.setTitle(getResources().getString(R.string.load_status));
	pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	pDialog.setCancelable(true);
	pDialog.setOnCancelListener(new OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialog) {
			// TODO Auto-generated method stub
			ast.cancel(true);
			pDialog.dismiss();
			pDialog = null;
		}

	});
	pDialog.setMessage(getResources().getString(R.string.load_loading));
	pDialog.setProgress(0);
	pDialog.setMax(1);
	pDialog.show();

	return;
}
 
Example 24
private void loadSearchResultList() {
	// the result is just 10 records, so don't need "isLoading"
	List<NameValuePair> targVarList = new ArrayList<NameValuePair>();
	if (plus == 1) {
		targVarList.add(Wenku8Interface.searchNovelByNovelName(name,
				GlobalConfig.getFetchLanguage()));
	} else if (plus == 2) {
		targVarList.add(Wenku8Interface.searchNovelByAuthorName(name,
				GlobalConfig.getFetchLanguage()));

	}

	isSearching = true;
	final asyncSearchTask ast = new asyncSearchTask();
	ast.execute(targVarList);

	pDialog = new ProgressDialog(parentActivity);
	pDialog.setTitle(getResources().getString(R.string.search_ing));
	pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
	pDialog.setCancelable(true);
	pDialog.setOnCancelListener(new OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialog) {
			// TODO Auto-generated method stub
			isSearching = false;
			if (pDialog != null)
				pDialog.dismiss();
			pDialog = null;
		}

	});
	pDialog.setMessage(getResources().getString(R.string.search_fetching));
	pDialog.setProgress(0);
	pDialog.setMax(1);
	pDialog.show();

	return;
}
 
Example 25
Source Project: glimmr   Source File: GetRequestToken.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
    super.onPreExecute();
    mProgressDialog = ProgressDialog.show(mActivity, "",
            mActivity.getString(R.string.just_a_moment));
    mProgressDialog.setCanceledOnTouchOutside(true);
    mProgressDialog.setCancelable(true);
    mProgressDialog.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dlg) {
            GetRequestToken.this.cancel(true);
        }
    });
}
 
Example 26
Source Project: ghwatch   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onPreExecute() {
  progress = ProgressDialog.show(MainActivity.this, null, getString(R.string.progress_get_view_url_title), true, true, new OnCancelListener() {

    @Override
    public void onCancel(DialogInterface dialog) {
      ShowNotificationTask.this.cancel(true);
    }
  });
}
 
Example 27
/** Connect to a chosen Bluetooth Device using whatever BLE Stack is available. **/
public static BluetoothLEStack connectToBluetoothLEStack(BluetoothDevice device, Activity hostActivity, String uuidStringRepresentation, OnCancelListener onCancelConnectionAttempt){
	bluetoothConnectionWaitWindow = new ProgressDialog(hostActivity);
	bluetoothConnectionWaitWindow.setTitle("Connecting to Bluetooth Radio " + device.getAddress());
	bluetoothConnectionWaitWindow.setMessage("Please wait...");
	bluetoothConnectionWaitWindow.setCancelable(false);
	
	if (onCancelConnectionAttempt != null){
		bluetoothConnectionWaitWindow.setCancelable(true);
		bluetoothConnectionWaitWindow.setOnCancelListener(onCancelConnectionAttempt);
	}
	bluetoothConnectionWaitWindow.setIndeterminate(true);
	bluetoothConnectionWaitWindow.show();
	
	
	if (singleton != null){
		singleton.disconnect();
		singleton.connect(device, hostActivity);
		
	} else {
	
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){
		singleton =  new AndroidBleStack(device, null, hostActivity);
		
	} else {
		//See if Samsung (Broadcom-based) Bluetooth Low Energy stack will work- works on Android 4.1 and 4.2
		singleton = new SamsungBleStack(device, hostActivity);
	}
	}
	return singleton;
}
 
Example 28
Source Project: FimiX8-RE   Source File: CustomLoadDialog.java    License: MIT License 4 votes vote down vote up
protected CustomLoadDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
    super(context, cancelable, cancelListener);
}
 
Example 29
Source Project: FimiX8-RE   Source File: DialogUtil.java    License: MIT License 4 votes vote down vote up
protected DialogUtil(Context context, boolean cancelable, OnCancelListener cancelListener) {
    super(context, cancelable, cancelListener);
}
 
Example 30
Source Project: letv   Source File: DownloadCacheDialog.java    License: Apache License 2.0 4 votes vote down vote up
protected DownloadCacheDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    super(context, cancelable, cancelListener);
}