List of usage examples for android.app Dialog setContentView
public void setContentView(@NonNull View view)
From source file:com.givon.baseproject.xinlu.act.ActRegist.java
public void showDialog(final String phone, final String code) { int resId = getStyleRes(this, "CommonDialog"); if (resId > 0) { final String phoneNum = "+" + code + " " + splitPhoneNum(phone); final Dialog dialog = new Dialog(this, resId); resId = getLayoutRes(this, "smssdk_send_msg_dialog"); if (resId > 0) { dialog.setContentView(resId); resId = getIdRes(this, "tv_phone"); ((TextView) dialog.findViewById(resId)).setText(phoneNum); resId = getIdRes(this, "tv_dialog_hint"); TextView tv = (TextView) dialog.findViewById(resId); resId = getStringRes(this, "smssdk_make_sure_mobile_detail"); if (resId > 0) { String text = this.getString(resId); tv.setText(Html.fromHtml(text)); }/*from ww w . j a v a 2 s . c o m*/ resId = getIdRes(this, "btn_dialog_ok"); if (resId > 0) { ((Button) dialog.findViewById(resId)).setOnClickListener(new OnClickListener() { public void onClick(View v) { // ??? dialog.dismiss(); Log.e("verification phone ==>>", phone); showWaitingDialog(); SMSSDK.getVerificationCode(code, phone.trim()); } }); } resId = getIdRes(this, "btn_dialog_cancel"); if (resId > 0) { ((Button) dialog.findViewById(resId)).setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); } dialog.setCanceledOnTouchOutside(true); dialog.show(); } } }
From source file:com.tutor.activity.SlidingActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (isShowLeft) { this.isShowLeft = mSlidingMenu.showLeftView(); return false; }//from w w w. ja v a2s.co m final Dialog dialog = new Dialog(this, R.style.Theme_dialog); dialog.setCanceledOnTouchOutside(true); View view = LayoutInflater.from(this).inflate(R.layout.dialog_yesno_layout, null); dialog.setContentView(view); TextView tvMessage = (TextView) dialog.findViewById(R.id.tvMessage); tvMessage.setText(""); Button confirmButton = (Button) dialog.findViewById(R.id.btnConfirm); confirmButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); android.os.Process.killProcess(android.os.Process.myPid()); } }); Button cancelButton = (Button) dialog.findViewById(R.id.btnCancel); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } return false; }
From source file:dev.dworks.apps.asecure.MainActivity.java
private void showLoginDialog() { final SharedPreferences.Editor editor = mSharedPreferences.edit(); final boolean passwordSet = !TextUtils.isEmpty(password); final String setPassword = password; LayoutInflater layoutInflater = LayoutInflater.from(this); final View loginView = layoutInflater.inflate(R.layout.dialog_login, null); TextView header = (TextView) loginView.findViewById(R.id.login_header); final EditText password = (EditText) loginView.findViewById(R.id.password); final EditText password_repeat = (EditText) loginView.findViewById(R.id.password_repeat); final Button login = (Button) loginView.findViewById(R.id.login_button); //Button cancel = (Button) loginView.findViewById(R.id.cancel_button); if (!passwordSet) { password_repeat.setVisibility(View.VISIBLE); header.setVisibility(View.VISIBLE); } else {/*from w ww . jav a 2s .co m*/ password.setVisibility(View.GONE); password_repeat.setVisibility(View.VISIBLE); password_repeat.setHint(R.string.login_pwd); } header.setText(!passwordSet ? getString(R.string.login_message) : getString(R.string.msg_login)); final Dialog dialog = new Dialog(this, R.style.Theme_Asecure_DailogLogin); dialog.setContentView(loginView); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); dialog.show(); password_repeat.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == R.id.login_button || actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE) { login.performClick(); return true; } return false; } }); login.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (passwordSet) { final String passwordString = password_repeat.getText().toString(); if (TextUtils.isEmpty(passwordString) || passwordString.compareTo(setPassword) != 0) { password_repeat.startAnimation(shake); password_repeat.setError(getString(R.string.msg_wrong_password)); return; } } else { final String passwordString = password_repeat.getText().toString(); final String passwordRepeatString = password_repeat.getText().toString(); if (TextUtils.isEmpty(passwordString)) { password.startAnimation(shake); password.setError(getString(R.string.msg_pwd_empty)); return; } if (TextUtils.isEmpty(passwordRepeatString)) { password_repeat.startAnimation(shake); password_repeat.setError(getString(R.string.msg_pwd_empty)); return; } else if (passwordString.compareTo(passwordRepeatString) != 0) { password_repeat.startAnimation(shake); password_repeat.setError(getString(R.string.msg_pwd_dont_match)); return; } editor.putString("LoginPasswordPref", password.getText().toString()); editor.commit(); } dialog.dismiss(); } }); /* cancel.setOnClickListener(new OnClickListener(){ @Override public void onClick(View arg0) { dialog.dismiss(); finish(); }});*/ }
From source file:com.adwardstark.lyricswithmusixmatchapi.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { // create a Dialog component final Dialog dialog = new Dialog(this); //tell the Dialog to use the dialog.xml as it's layout description dialog.setContentView(R.layout.aboutdialog); dialog.setTitle("About Developer"); dialog.show();//from w w w . ja va 2 s . c om return true; } return super.onOptionsItemSelected(item); }
From source file:me.isassist.isa.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_refresh) { if (!isNetworkAvailable()) { Toast.makeText(this, "No internet connection available!", Toast.LENGTH_LONG).show(); return true; }/*from w w w . ja v a 2s.c o m*/ showLoadingFragment("Updating\nThis can take a while\n Please wait!"); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } for (Bihapi b : Bihapi.values()) new FetchAPI(this, this, b, FetchAPI.FetchType.INTERNET).execute(); return true; } else if (id == R.id.action_about) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.about_dialog); dialog.setTitle("About"); TextView text = (TextView) dialog.findViewById(R.id.licensesText); text.setText(Html.fromHtml( "Building, Tall, Trading, Human graphics by <a href=\"http://www.freepik.com/\">Freepik</a> and Building graphic by <a href=\"http://www.unocha.org\">Ocha</a> and Haw Gestures Stroke graphic by <a href=\"http://yanlu.de\">Yannick</a> from <a href=\"http://www.flaticon.com/\">Flaticon</a> are licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\">CC BY 3.0</a>.Park graphic by <a href=\"http://www.freepik.com\">Freepik</a> from <a href=\"http://www.flaticon.com/\">Flaticon</a> is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" title=\"Creative Commons BY 3.0\">CC BY 3.0</a>. Made with <a href=\"http://logomakr.com\" title=\"Logo Maker\">Logo Maker</a>")); dialog.show(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.flowzr.activity.DateFilterActivity.java
@Override protected Dialog onCreateDialog(final int id) { final Dialog d = new Dialog(this); d.setCancelable(true);/*from w w w . j av a 2 s. c o m*/ d.setTitle(id == 1 ? R.string.period_from : R.string.period_to); d.setContentView(R.layout.filter_period_select); Button bOk = (Button) d.findViewById(R.id.bOK); bOk.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setDialogResult(d, id == 1 ? cFrom : cTo); d.dismiss(); } }); Button bCancel = (Button) d.findViewById(R.id.bCancel); bCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { d.cancel(); } }); return d; }
From source file:it.unicaradio.android.activities.MainActivity.java
private void showUpdatesDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.popup); dialog.setTitle(R.string.application_updated); dialog.setCancelable(true);// w w w.ja v a2 s .co m TextView textView = (TextView) dialog.findViewById(R.id.updatesText); textView.setText(R.string.updates); Button button = (Button) dialog.findViewById(R.id.updatesButton); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.hide(); } }); dialog.show(); }
From source file:no.barentswatch.fiskinfo.MyPageActivity.java
public void createSubscriptionInformationDialog(int JSONObjectIndex) { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON); dialog.setContentView(R.layout.subscription_info_dialog); TextView subscriptionNameView = (TextView) dialog.findViewById(R.id.subscription_description_text_view); TextView subscriptionOwnerView = (TextView) dialog.findViewById(R.id.subscription_owner_text_view); TextView subscriptionUpdatedView = (TextView) dialog.findViewById(R.id.subscription_last_updated_text_view); Button okButton = (Button) dialog.findViewById(R.id.dismiss_dialog_button); Button viewOnMapButton = (Button) dialog.findViewById(R.id.go_to_map_button); String subscriptionName = null; String subscriptionOwner = null; String subscriptionDescription = null; JSONArray subscriptions = getSharedCacheOfAvailableSubscriptions(); List<String> updateValues = new ArrayList<String>(); JSONObject currentSubscription;//from w w w . j a v a 2 s . c o m String lastUpdated = ""; updateValues.add("Name"); updateValues.add("DataOwner"); updateValues.add("LastUpdated"); updateValues.add("Description"); updateValues.add("UpdateFrequencyText"); if (subscriptions != null) { try { currentSubscription = getSharedCacheOfAvailableSubscriptions().getJSONObject(JSONObjectIndex); subscriptionName = currentSubscription.getString("Name"); subscriptionOwner = currentSubscription.getString("DataOwner"); subscriptionDescription = currentSubscription.getString("Description"); lastUpdated = currentSubscription.get("LastUpdated").toString(); } catch (JSONException e) { e.printStackTrace(); } } String[] updateDateAndTime = lastUpdated.split("T"); lastUpdated = updateDateAndTime[1] + " " + updateDateAndTime[0]; subscriptionNameView.setText(subscriptionDescription); subscriptionOwnerView.setText(subscriptionOwner); subscriptionUpdatedView.setText(lastUpdated); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); viewOnMapButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Do some map stuff here so we only show this layer I // guess? loadView(MapActivity.class); } }); int subscriptionIconId = getSubscriptionIconId(subscriptionName); dialog.setTitle(subscriptionName); dialog.setCanceledOnTouchOutside(false); dialog.show(); if (subscriptionIconId != 0) { dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, subscriptionIconId); } }
From source file:piuk.blockchain.android.ui.WalletActivity.java
@Override protected Dialog onCreateDialog(final int id) { final WebView webView = new WebView(this); if (id == DIALOG_HELP) webView.loadUrl("file:///android_asset/help" + languagePrefix() + ".html"); final Dialog dialog = new Dialog(WalletActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(webView); dialog.setCanceledOnTouchOutside(true); return dialog; }
From source file:com.untie.daywal.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); thisMonthTv = (TextView) findViewById(R.id.this_month_tv); Calendar now = Calendar.getInstance(); Intent intent = getIntent();/* www . j a va 2 s. c o m*/ year = intent.getIntExtra("year", now.get(Calendar.YEAR)); month = intent.getIntExtra("month", now.get(Calendar.MONTH)); order = intent.getIntExtra("order", 0); if (order == 0) { mf = MonthlyFragment.newInstance(year, month); getSupportFragmentManager().beginTransaction().add(R.id.monthly, mf).commit(); } else if (order == 1) { mf = MonthlyFragment.newInstance(year, month - 1); getSupportFragmentManager().beginTransaction().replace(R.id.monthly, mf).commit(); } mf.setOnMonthChangeListener(new MonthlyFragment.OnMonthChangeListener() { @Override public void onChange(int year, int month) { HLog.d(TAG, CLASS, "onChange " + year + "." + month); thisMonthTv.setText(year + " " + (month + 1) + ""); } @Override public void onDayClick(OneDayView dayView) { int year = dayView.get(Calendar.YEAR); int month = dayView.get(Calendar.MONTH); int day = dayView.get(Calendar.DAY_OF_MONTH); int week = dayView.get(Calendar.DAY_OF_WEEK); Intent intent = new Intent(MainActivity.this, PopupActivity.class); intent.putExtra("year", year); intent.putExtra("month", month); intent.putExtra("day", day); intent.putExtra("week", week); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); //overridePendingTransition(0, 0); } @Override public void onDayLongClick(OneDayView dayView) { if (dayView.getImage() != null) { final Dialog dayPickerDialog = new Dialog(MainActivity.this); dayPickerDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dayPickerDialog.setContentView(R.layout.dialog_image); dayPickerDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dayPickerDialog.getWindow().setBackgroundDrawable((new ColorDrawable(0x7000000))); ImageView imageView = (ImageView) dayPickerDialog.findViewById(R.id.image_popup); Uri uri = dayView.getImage(); Glide.with(MainActivity.this).load(uri).centerCrop().into(imageView); dayPickerDialog.show(); //dayPickerDialog.dismiss(); } } }); thisMonthTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showDayPicker(); } }); }