List of usage examples for android.app Dialog getWindow
public @Nullable Window getWindow()
From source file:com.jiandanbaoxian.fragment.DialogFragmentCreater.java
private Dialog showRegionChoiceDialog(final Context mContext) { View convertView = LayoutInflater.from(mContext).inflate(R.layout.dialog_region_choice, null); final Dialog dialog = new Dialog(mContext, R.style.CustomDialog); View.OnClickListener listener = new View.OnClickListener() { @Override//from ww w . ja v a 2 s . co m public void onClick(View v) { switch (v.getId()) { case R.id.layout_back: if (onDialogBackClickLisenter != null) { onDialogBackClickLisenter.onClickBack(titleText, regionBeans, v); } break; } } }; tvTitle = (TextView) convertView.findViewById(R.id.tv_region_name); listView = (ListView) convertView.findViewById(R.id.list_view); layoutBack = (LinearLayout) convertView.findViewById(R.id.layout_back); adapter = new RegionListAdapter(regionBeans, mContext); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (onDialogBackClickLisenter != null) { onDialogBackClickLisenter.onItemClickListener(position, id); } } }); tvTitle.setText(titleText); layoutBack.setOnClickListener(listener); dialog.setContentView(convertView); dialog.getWindow().setWindowAnimations(R.style.dialog_right_control_style); return dialog; }
From source file:dong.lan.tuyi.activity.MainActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.toolbar_community: startActivity(new Intent(MainActivity.this, TuyiHomeActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break;//from w w w . j a v a 2 s . c om case R.id.toolbar_tuyi: startActivity(new Intent(MainActivity.this, TuMapActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.my_Favorite: startActivity(new Intent(MainActivity.this, FavoriteActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_des: isGetWeather = true; break; case R.id.offline_tuyi: startActivityForResult(new Intent(MainActivity.this, OfflineTuyiActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_community: Lock.canPop = false; startActivityForResult(new Intent(MainActivity.this, TuyiCommunityActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_head: if (Config.tUser == null) { Show("????"); return; } Lock.canPop = false; final Dialog dialog = new AlertDialog.Builder(MainActivity.this).create(); dialog.setCancelable(true); dialog.show(); dialog.getWindow().setContentView(R.layout.dialog_set_head_img); TextView msg = (TextView) dialog.findViewById(R.id.dialog_msg); msg.setText("?"); TextView dialog_left = (TextView) dialog.findViewById(R.id.dialog_left); TextView dialog_right = (TextView) dialog.findViewById(R.id.dialog_right); dialog_left.setText(""); dialog_right.setText(""); dialog_left.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); File dir = new File(Constant.PICTURE_PATH); if (!dir.exists()) { dir.mkdirs(); } // File file = new File(dir, username + "_head_" + new SimpleDateFormat(TimeUtil.FORMAT_NORMAL).format(new Date())); filePath = file.getAbsolutePath();// ?? Uri imageUri = Uri.fromFile(file); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_CAMERA); } }); dialog_right.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_LOCATION); } }); break; case R.id.user_center: if (Config.tUser != null) { Lock.canPop = false; startActivityForResult( new Intent(MainActivity.this, UserCenter.class).putExtra("USER", Config.tUser), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); } break; case R.id.user_albums: startActivityForResult(new Intent(MainActivity.this, TuyiPlayActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_setting: startActivityForResult(new Intent(MainActivity.this, MyRadarActivity.class), 100); break; case R.id.my_interested: startActivityForResult(new Intent(MainActivity.this, MyInterestedActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; } }
From source file:com.jiandanbaoxian.fragment.DialogFragmentCreater.java
/** * ?=item ?// ww w .j av a2 s .co m * * @param mContext * @return */ private Dialog showConfirmOrCancelDialog(final Context mContext) { View convertView = LayoutInflater.from(mContext).inflate(R.layout.dialog_double_choice, null); final Dialog dialog = new Dialog(mContext, R.style.mystyle); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.tv_cancel: if (onDialogClickLisenter != null) onDialogClickLisenter.viewClick(StringConstant.tv_cancel); dismiss(); break; case R.id.tv_confirm: if (onDialogClickLisenter != null) onDialogClickLisenter.viewClick(StringConstant.tv_confirm); dismiss(); break; default: break; } } }; TextView tv_cancel = (TextView) convertView.findViewById(R.id.tv_cancel); TextView tv_confirm = (TextView) convertView.findViewById(R.id.tv_confirm); TextView tv_title = (TextView) convertView.findViewById(R.id.tv_title); TextView tv_content = (TextView) convertView.findViewById(R.id.tv_content); if (onDialogClickLisenter != null) { onDialogClickLisenter.controlView(tv_confirm, tv_cancel, tv_title, tv_content); } tv_cancel.setOnClickListener(listener); tv_confirm.setOnClickListener(listener); dialog.setContentView(convertView); dialog.getWindow().setWindowAnimations(R.style.dialog_right_control_style); return dialog; }
From source file:co.taqat.call.LinphoneActivity.java
public Dialog displayDialog(String text) { Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); d.setAlpha(200);/*from w ww . j a v a 2 s . c om*/ dialog.setContentView(R.layout.dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(d); TextView customText = (TextView) dialog.findViewById(R.id.customText); customText.setText(text); return dialog; }
From source file:co.taqat.call.LinphoneActivity.java
public Dialog displayWrongPasswordDialog(final String username, final String realm, final String domain) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); d.setAlpha(200);/*w w w . j av a2 s . c o m*/ dialog.setContentView(R.layout.input_dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(d); TextView customText = (TextView) dialog.findViewById(R.id.customText); customText.setText(getString(R.string.error_bad_credentials)); Button retry = (Button) dialog.findViewById(R.id.retry); Button cancel = (Button) dialog.findViewById(R.id.cancel); retry.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String newPassword = ((EditText) dialog.findViewById(R.id.password)).getText().toString(); LinphoneAuthInfo authInfo = LinphoneCoreFactory.instance().createAuthInfo(username, null, newPassword, null, realm, domain); LinphoneManager.getLc().addAuthInfo(authInfo); LinphoneManager.getLc().refreshRegisters(); dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); return dialog; }
From source file:fr.cph.chicago.activity.MainActivity.java
private void displayUpdatePanel() { try {/*from w ww . j a va2 s . co m*/ String versionName = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName; SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); String versionNamePreferences = sharedPref.getString("version.name", null); if (versionNamePreferences == null || !versionNamePreferences.equals(versionName)) { SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("version.name", versionName); editor.commit(); final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.update); dialog.setTitle("Update"); InputStreamReader is = new InputStreamReader( ChicagoTracker.getAppContext().getAssets().open("update.txt")); BufferedReader br = new BufferedReader(is); String read = br.readLine(); StringBuilder sb = new StringBuilder(); while (read != null) { sb.append(read + "\n"); read = br.readLine(); } TextView text = (TextView) dialog.findViewById(R.id.updateText); text.setText(sb.toString()); Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK); dialogButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int newWidth = width - (width * 20 / 100); int height = size.y; int newHeight = height - (height * 20 / 100); dialog.getWindow().setLayout(newWidth, newHeight); dialog.show(); } } catch (NameNotFoundException e) { Log.w(TAG, e.getMessage(), e); } catch (IOException e) { Log.w(TAG, e.getMessage(), e); } }
From source file:com.thingsee.tracker.MainActivity.java
@Override public void onBackPressed() { if (touchActive) { if (onChildOnMapView) { if ((trackerModelWithMarker != null) && (trackerModelWithMarker.getMarker().isInfoWindowShown())) { trackerModelWithMarker.getMarker().hideInfoWindow(); }// ww w . j a v a2 s. c o m displayTrackers(); trackerList.setVisibility(View.VISIBLE); onChildOnMapView = false; userZoomAndPanOnMap = false; zoomToBoundingBox(); } else { final Dialog exitQuery = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); exitQuery.requestWindowFeature(Window.FEATURE_NO_TITLE); exitQuery.setCancelable(true); exitQuery.setContentView(R.layout.exit_app_query); ClearTextView cancel = (ClearTextView) exitQuery.findViewById(R.id.cancel); cancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { exitQuery.cancel(); } }); ClearTextView exit = (ClearTextView) exitQuery.findViewById(R.id.exit); exit.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { exitApplication(); startupDone = false; exitQuery.cancel(); } }); exitQuery.show(); exitQuery.getWindow().setDimAmount(0.5f); exitQuery.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); } } }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * "Coach mark" (help overlay image)//from ww w . j a v a 2 s . c o m * * @param context * @param coachMarkLayoutId Is "Help overlay" layout id in UX talk :-) * [coach_mark.xml is your coach mark layout] * @param coachMarkMasterViewId is the id of the top most view in coach_mark.xml */ public static void dialog_onCoachMark(Context context, int coachMarkLayoutId, int coachMarkMasterViewId, int bgColor) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(bgColor)); dialog.setContentView(coachMarkLayoutId); dialog.setCanceledOnTouchOutside(true); //for dismissing anywhere you touch View masterView = dialog.findViewById(coachMarkMasterViewId); masterView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public boolean onMarkerClick(final Marker theMarker) { if (theMarker.equals(MyAppConstants.myMarker)) { return false; }/*from w ww . j a v a 2s.c o m*/ // Normal Marker if (!theMarker.equals(MyAppConstants.myMarker) && (theMarker.getTitle() != null)) { final Dialog aMemberDialog = new Dialog(TeamViewActivity.this, R.style.DialogSlideAnim); aMemberDialog.setContentView(R.layout.member_dialog); TextView aMemberTextName = (TextView) aMemberDialog.findViewById(R.id.tvMemberName); Button aTextButton = (Button) aMemberDialog.findViewById(R.id.bMemberText); Button aPushButton = (Button) aMemberDialog.findViewById(R.id.bMemberPush); Button aCallButton = (Button) aMemberDialog.findViewById(R.id.bMemberCall); Button aRemoveButton = (Button) aMemberDialog.findViewById(R.id.bMemberRemove); String[] res = theMarker.getTitle().split("~"); String title = res[0]; final String phone = res[1]; aMemberTextName.setText("Say hello to " + title + "!"); aMemberDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); aMemberDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); aMemberDialog.getWindow().setGravity(Gravity.BOTTOM); aMemberDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); aMemberDialog.show(); ImageView aCancelButton = (ImageView) aMemberDialog.findViewById(R.id.bCancelMemberDialog); aCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { aMemberDialog.dismiss(); } }); aTextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri sms_uri = Uri.parse("smsto:" + phone); Intent sms_intent = new Intent(Intent.ACTION_SENDTO, sms_uri); startActivity(sms_intent); } }); // aPushButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // // startActivity(new Intent(Intent.ACTION_VIEW, // // Uri.parse("sms:" // // + theMarker.getSnippet()))); // } // }); aCallButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + phone)); startActivity(callIntent); } }); // aRemoveButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // } // }); } else { StickyMarkerBehaviorDialog dialog = new StickyMarkerBehaviorDialog(this); dialog.show(); } return true; }
From source file:com.mitre.holdshort.MainActivity.java
private void showDisclaimer() { final Dialog dialog = new Dialog(MainActivity.this); OnClickListener disclaimerBtnClick;/*from w w w. ja va 2s . c o m*/ dialog.setContentView(R.layout.legal_stuff_dialog); dialog.setTitle("RIPPLE - Informed Consent"); dialog.setCancelable(false); dialog.getWindow().setLayout(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); TextView consent = (TextView) dialog.findViewById(R.id.disclaimerAccept); TextView reject = (TextView) dialog.findViewById(R.id.disclaimerReject); disclaimerBtnClick = new OnClickListener() { @Override public void onClick(View v) { if (v.getId() == R.id.disclaimerAccept) { settings.edit().putBoolean("consent", true).commit(); dialog.dismiss(); waiverAccept = true; startUp(); } else { finish(); } } }; consent.setOnClickListener(disclaimerBtnClick); reject.setOnClickListener(disclaimerBtnClick); dialog.show(); }