List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
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);/*from w ww . ja v a2 s. c om*/ 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:com.entertailion.android.launcher.Dialogs.java
/** * Display the list of Spotlight web apps: * https://www.google.com/tv/spotlight-gallery.html Allow the user to launch * a web app in the browser.//from ww w . j a v a 2 s .c o m * * @param context */ public static void displayAllSpotlight(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.spotlight_grid); final GridView gridView = (GridView) dialog.findViewById(R.id.grid); final ArrayList<SpotlightInfo> spotlights = SpotlightTable.getAllSpotlights(context); gridView.setAdapter(new AllSpotlightAdapter(context, spotlights)); gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SpotlightInfo spotlightInfo = (SpotlightInfo) parent.getAdapter().getItem(position); spotlightInfo.invoke(context); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.INVOKE_SPOTLIGHT_WEB_APP); } }); gridView.setDrawingCacheEnabled(true); gridView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_SPOTLIGHT_WEB_APPS); }
From source file:com.orange.datavenue.DatasourceListFragment.java
/** * *///from w w w. j a va2 s. c om private void deleteDatasource() { final android.app.Dialog dialog = new android.app.Dialog(getActivity()); dialog.setContentView(R.layout.delete_dialog); dialog.setTitle(R.string.delete); TextView info = (TextView) dialog.findViewById(R.id.info_label); info.setText( String.format(getString(R.string.delete_datasource), Model.instance.currentDatasource.getId())); Button deleteButton = (Button) dialog.findViewById(R.id.delete_button); deleteButton.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View view) { Log.d(TAG_NAME, "datasource : " + Model.instance.currentDatasource.getId()); DeleteDatasourceOperation deleteDatasourceOperation = new DeleteDatasourceOperation( Model.instance.oapiKey, Model.instance.key, Model.instance.currentDatasource, new OperationCallback() { @Override public void process(Object object, Exception exception) { if (exception == null) { getDatasources(); // reload } else { Errors.displayError(getActivity(), exception); } } }); deleteDatasourceOperation.execute(""); dialog.dismiss(); } }); Button cancelDeleteButton = (Button) dialog.findViewById(R.id.cancel_button); cancelDeleteButton.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View arg0) { dialog.dismiss(); } }); dialog.setCancelable(false); dialog.show(); }
From source file:com.gunz.carrental.Fragments.CarsFragment.java
private void clearErrorMsg(Dialog dialog) { for (int i = 0; i < inputField.length; i++) { final MaterialEditText txTmp = (MaterialEditText) dialog.findViewById(inputField[i]); txTmp.addTextChangedListener(new TextWatcher() { @Override// ww w . j a va 2s .c o m public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (count > 0) { txTmp.setError(null); } } @Override public void afterTextChanged(Editable s) { } }); } }
From source file:edu.berkeley.boinc.ProjectDetailsFragment.java
private void showConfirmationDialog(final int operation) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_confirm); Button confirm = (Button) dialog.findViewById(R.id.confirm); TextView tvTitle = (TextView) dialog.findViewById(R.id.title); TextView tvMessage = (TextView) dialog.findViewById(R.id.message); // operation dependend texts if (operation == RpcClient.PROJECT_DETACH) { tvTitle.setText(R.string.projects_confirm_detach_title); tvMessage.setText(getString(R.string.projects_confirm_detach_message) + " " + project.project_name + " " + getString(R.string.projects_confirm_detach_message2)); confirm.setText(R.string.projects_confirm_detach_confirm); } else if (operation == RpcClient.PROJECT_RESET) { tvTitle.setText(R.string.projects_confirm_reset_title); tvMessage.setText(getString(R.string.projects_confirm_reset_message) + " " + project.project_name + getString(R.string.projects_confirm_reset_message2)); confirm.setText(R.string.projects_confirm_reset_confirm); }/*from ww w . j a v a 2s . co m*/ confirm.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new ProjectOperationAsync().execute(operation); dialog.dismiss(); } }); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:de.schildbach.wallet.ui.WalletAddressDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final Address address = (Address) args.getSerializable(KEY_ADDRESS); final String addressStr = address.toBase58(); final String addressLabel = args.getString(KEY_ADDRESS_LABEL); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.wallet_address_dialog); dialog.setCanceledOnTouchOutside(true); final String uri = BitcoinURI.convertToBitcoinURI(address, null, addressLabel, null); final BitmapDrawable bitmap = new BitmapDrawable(getResources(), Qr.bitmap(uri)); bitmap.setFilterBitmap(false);// w w w . ja v a2 s. c o m final ImageView imageView = (ImageView) dialog.findViewById(R.id.wallet_address_dialog_image); imageView.setImageDrawable(bitmap); final View labelButtonView = dialog.findViewById(R.id.wallet_address_dialog_label_button); final TextView labelView = (TextView) dialog.findViewById(R.id.wallet_address_dialog_label); final CharSequence label = WalletUtils.formatHash(addressStr, Constants.ADDRESS_FORMAT_GROUP_SIZE, Constants.ADDRESS_FORMAT_LINE_SIZE); labelView.setText(label); labelButtonView.setVisibility(View.VISIBLE); labelButtonView.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, addressStr); startActivity(Intent.createChooser(intent, getString(R.string.bitmap_fragment_share))); log.info("wallet address shared via intent: {}", addressStr); } }); final View hintView = dialog.findViewById(R.id.wallet_address_dialog_hint); hintView.setVisibility( getResources().getBoolean(R.bool.show_wallet_address_dialog_hint) ? View.VISIBLE : View.GONE); final View dialogView = dialog.findViewById(R.id.wallet_address_dialog_group); dialogView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { dismiss(); } }); return dialog; }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display the list of browser history.//ww w.j a v a 2 s .c o m * * @param context */ public static void displayBrowserHistory(final Launcher context) { final ArrayList<BookmarkInfo> bookmarks = loadBrowserHistory(context); if (bookmarks.size() > 0) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bookmarks_list); ListView listView = (ListView) dialog.findViewById(R.id.list); listView.setAdapter(new BookmarkAdapter(context, bookmarks)); listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { BookmarkInfo bookmark = (BookmarkInfo) parent.getAdapter().getItem(position); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(bookmark.getUrl())); context.startActivity(browserIntent); context.showCover(false); dialog.dismiss(); Analytics.logEvent(Analytics.INVOKE_BOOKMARK); } }); listView.setDrawingCacheEnabled(true); listView.setOnKeyListener(onKeyListener); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_BOOKMARKS); } else { displayAlert(context, context.getString(R.string.dialog_no_browser_history)); } }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display a dialog to confirm that the user wants to delete an item. * // w ww .j a va 2 s . c om * @param context */ public static void displayDeleteItem(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirmation); TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText); confirmationTextView.setText(context.getString(R.string.dialog_delete_item_message)); Button buttonYes = (Button) dialog.findViewById(R.id.button1); buttonYes.setText(context.getString(R.string.dialog_yes)); buttonYes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.deleteCurrentItem(); context.showCover(false); dialog.dismiss(); } }); Button buttonNo = (Button) dialog.findViewById(R.id.button2); buttonNo.setText(context.getString(R.string.dialog_no)); buttonNo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_DELETE_ITEM); }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Display a dialog to confirm that a user wants to delete a row. * //from w w w. jav a2 s .c om * @param context */ public static void displayDeleteRow(final Launcher context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.confirmation); TextView confirmationTextView = (TextView) dialog.findViewById(R.id.confirmationText); confirmationTextView.setText(context.getString(R.string.dialog_delete_row_message)); Button buttonYes = (Button) dialog.findViewById(R.id.button1); buttonYes.setText(context.getString(R.string.dialog_yes)); buttonYes.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.deleteCurrentRow(); context.showCover(false); dialog.dismiss(); } }); Button buttonNo = (Button) dialog.findViewById(R.id.button2); buttonNo.setText(context.getString(R.string.dialog_no)); buttonNo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { context.showCover(false); dialog.dismiss(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { context.showCover(false); } }); context.showCover(true); dialog.show(); Analytics.logEvent(Analytics.DIALOG_DELETE_ROW); }
From source file:com.rallydev.rallydroid.TaskListActivity.java
@Override protected void PrepareDetailDialog(Dialog dialog, DomainObject selected) { Artifact selectedItem = (Artifact) selected; dialog.setTitle(selectedItem.getFormattedID()); String description = selectedItem.getString("Description"); String estimate = selectedItem.getString("Estimate"); String todo = selectedItem.getString("ToDo"); String actuals = selectedItem.getString("Actuals"); boolean blocked = selectedItem.getBoolean("Blocked"); String state = selectedItem.getString("State") + " " + (blocked ? "(BLOCKED)" : "(Not blocked)"); ((TextView) dialog.findViewById(R.id.task_nameView)).setText(selectedItem.getName()); ((TextView) dialog.findViewById(R.id.story_nameView)).setText(getTaskStoryName(selectedItem)); ((TextView) dialog.findViewById(R.id.task_descriptionView)).setText(description); ((TextView) dialog.findViewById(R.id.task_stateView)).setText(state); ((TextView) dialog.findViewById(R.id.task_estimateView)).setText(estimate); ((TextView) dialog.findViewById(R.id.task_todoView)).setText(todo); ((TextView) dialog.findViewById(R.id.task_actualView)).setText(actuals); }