/** * * showProcessHUD 显示进度指示 * * @param title 显示提示title */ protected void showProcessHUD(String title) { // 加载进度条 LayoutInflater inflater = LayoutInflater.from(getActivity()); View v = inflater.inflate(R.layout.ztb_custom_dialog, null); ImageView spaceshipImage = (ImageView) v.findViewById(R.id.dialog_loading_img); TextView titleTV = (TextView) v.findViewById(R.id.dialog_loading_title); if (!TextUtils.isEmpty(title)) { titleTV.setText(title); titleTV.setVisibility(View.VISIBLE); } else { titleTV.setVisibility(View.GONE); } Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_anim); spaceshipImage.startAnimation(hyperspaceJumpAnimation); mPD = new Dialog(getActivity(), R.style.loading_dialog); mPD.addContentView( v, new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); mPD.setCancelable(true); mPD.setCanceledOnTouchOutside(false); mPD.show(); }
private void showSayhiDialog() { if (null == sayhiDialog) { sayhiView = LayoutInflater.from(mContext).inflate(R.layout.dialog_sayhi, null); final EditText etContent = (EditText) sayhiView.findViewById(R.id.et_sayhi); etContent.setText("看了你的资料,我发现你应该就是我一直在寻找的那个人,能认识吗? 期待你的回复!"); sayhiDialog = new Dialog(mContext); sayhiDialog.setTitle("向 " + mCurrentSayhiUser.getNickname() + " 打招呼"); sayhiView .findViewById(R.id.tv_send_sayhi) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (TextUtils.isEmpty(etContent.getText())) { ToastFactory.getToast(mContext, "内容不能为空").show(); return; } sendSayhi(etContent.getText().toString()); sayhiDialog.dismiss(); } }); sayhiView .findViewById(R.id.tv_cancel_send_sayhi) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { sayhiDialog.dismiss(); } }); sayhiDialog.show(); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); sayhiDialog.addContentView(sayhiView, params); } if (!sayhiDialog.isShowing()) { sayhiDialog.setTitle("向 " + mCurrentSayhiUser.getNickname() + " 打招呼"); sayhiDialog.show(); } }
private void showDialogBluetooth(final int position, View view) { try { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); dialog.setCanceledOnTouchOutside(true); dialog.setCancelable(true); LayoutInflater inflater = LayoutInflater.from(getActivity()); View view1 = inflater.inflate(R.layout.dialog_bluetooth, null); dialog.addContentView(view1, lp); DialogBluetooth bluetooth = (DialogBluetooth) dialog.findViewById(R.id.dialog_blue); encodTv = (TextView) dialog.findViewById(R.id.et_encod); bluetooth.setOnDialogListener( new OnCustomDialogListener() { @Override public void onCloseDialog() { dialog.dismiss(); } @Override public void back(String str) { /* * ScanResult ap = mWifiList.get(position); WifiCipherType * type = null; String capString = ap.capabilities; if * (capString.toUpperCase().contains("WPA")) { type = * WifiCipherType.WIFICIPHER_WPA; } else if * (capString.toUpperCase().contains("WEP")) { type = * WifiCipherType.WIFICIPHER_WEP; } else { type = * WifiCipherType.WIFICIPHER_NOPASS; } // 连接网络 boolean * connFlag = WifiUtils .connectWifi(ap.SSID, str, type); if * (connFlag) { encodTv.setText(""); dialog.cancel(); } else * { * mHandler.sendEmptyMessage(WifiApConst.WiFiConnectError); * } */ Toast.makeText(getActivity(), str.toString(), 0).show(); dialog.show(); } }); dialog.show(); } catch (Exception e) { e.printStackTrace(); } }
private void showDialogMore() { try { LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); LayoutInflater inflater = LayoutInflater.from(getActivity()); dialog.setCanceledOnTouchOutside(true); View view1 = inflater.inflate(R.layout.wifi_more_item, null); dialog.addContentView(view1, lp); DialogBluetooth dlg = (DialogBluetooth) dialog.findViewById(R.id.dialog_more); dialog.show(); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void onPreExecute() { // TODO Auto-generated method stub // this.progressComprobarVersion.show(); actionBar.setProgressBarVisibility(ProgressBar.VISIBLE); actionBar.setTitle(" Comprobando lenguajes"); LayoutInflater inflater = activity.getLayoutInflater(); View dialoglayout = inflater.inflate(R.layout.alert_loading_simple, (ViewGroup) activity.getCurrentFocus()); mDialog = new Dialog(activity, android.R.style.Theme_Translucent_NoTitleBar); downloading = (ProgressBar) dialoglayout.findViewById(R.id.progressBarDownlaod); downloading.setMax(100); accion = (TextView) dialoglayout.findViewById(R.id.textViewAccion); accion.setText("Descargando lenguajes"); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mDialog.addContentView(dialoglayout, params); mDialog.show(); super.onPreExecute(); }