List of usage examples for android.app Dialog findViewById
@Nullable public <T extends View> T findViewById(@IdRes int id)
From source file:com.simplealertdialog.test.FragmentSupportActivityTest.java
public void test3Buttons_Neutral() throws Throwable { getInstrumentation().waitForIdleSync(); runTestOnUiThread(new Runnable() { @Override// ww w . j ava 2 s . com public void run() { Fragment f = activity.getSupportFragmentManager().findFragmentById(R.id.fragment_sample); assertNotNull(f); assertNotNull(f.getView()); f.getView().findViewById(R.id.btn_frag_3_buttons).performClick(); activity.getFragmentManager().executePendingTransactions(); } }); getInstrumentation().waitForIdleSync(); Fragment f = getActivity().getSupportFragmentManager().findFragmentByTag("dialog"); assertNotNull(f); Dialog d = ((SimpleAlertDialogSupportFragment) f).getDialog(); assertNotNull(d); final View neutral = d.findViewById(R.id.button_neutral); assertNotNull(neutral); runTestOnUiThread(new Runnable() { @Override public void run() { neutral.performClick(); } }); }
From source file:com.zpwebsites.linuxonandroid.Install_Archlinux_2.java
private void downloads(Context context) { final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.download_arch_menu); dialog.setCancelable(true);/*from w ww . j a va 2s . c om*/ Button btn_DownloadLarge = (Button) dialog.findViewById(R.id.btn_DownloadLarge); btn_DownloadLarge.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Large_ext4, CFG.imageURL_Arch_Large_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Large_ext2, CFG.imageURL_Arch_Large_ext2); } dialog.dismiss(); } }); Button btn_DownloadSmall = (Button) dialog.findViewById(R.id.btn_DownloadSmall); btn_DownloadSmall.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext4, CFG.imageURL_Arch_Small_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Small_ext2, CFG.imageURL_Arch_Small_ext2); } dialog.dismiss(); } }); Button btn_DownloadCore = (Button) dialog.findViewById(R.id.btn_DownloadCore); btn_DownloadCore.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (AppPreferences.getPrefs().getString("ANDROID", "1").equals("4.3")) { downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext4, CFG.imageURL_Arch_Core_ext4); } else { downloadImage(v.getContext(), CFG.torrentURL_Arch_Core_ext2, CFG.imageURL_Arch_Core_ext2); } dialog.dismiss(); } }); dialog.show(); }
From source file:com.zpwebsites.linuxonandroid.Install_Archlinux_2.java
private void downloadImage(Context context, final String torrentName, final String sourceforgeName) { if (torrentName.equals("")) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(sourceforgeName)); startActivity(localIntent);/*from w ww.jav a 2 s . c o m*/ return; } final Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_download_type_selector); dialog.setCancelable(true); Button btn_Torrent = (Button) dialog.findViewById(R.id.btn_Torrent); btn_Torrent.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(torrentName)); startActivity(localIntent); dialog.dismiss(); } }); Button btn_Sourceforge = (Button) dialog.findViewById(R.id.btn_Sourceforge); btn_Sourceforge.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent localIntent = new Intent("android.intent.action.VIEW"); localIntent.setData(Uri.parse(sourceforgeName)); startActivity(localIntent); dialog.dismiss(); } }); Button btn_Cancel = (Button) dialog.findViewById(R.id.btn_Cancel); btn_Cancel.setOnClickListener(new OnClickListener() { public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.app.blockydemo.ui.dialogs.NewVariableDialog.java
private void handleOnShow(final Dialog dialogNewVariable) { final Button positiveButton = ((AlertDialog) dialogNewVariable).getButton(AlertDialog.BUTTON_POSITIVE); positiveButton.setEnabled(false);/*from w w w .ja v a2 s . c o m*/ EditText dialogEditText = (EditText) dialogNewVariable .findViewById(R.id.dialog_formula_editor_variable_name_edit_text); InputMethodManager inputMethodManager = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.showSoftInput(dialogEditText, InputMethodManager.SHOW_IMPLICIT); dialogEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable editable) { String variableName = editable.toString(); if (ProjectManager.getInstance().getCurrentProject().getUserVariables() .getUserVariable(variableName, ProjectManager.getInstance().getCurrentSprite()) != null) { Toast.makeText(getActivity(), R.string.formula_editor_existing_variable, Toast.LENGTH_SHORT) .show(); positiveButton.setEnabled(false); } else { positiveButton.setEnabled(true); } if (editable.length() == 0) { positiveButton.setEnabled(false); } } }); }
From source file:com.simplealertdialog.test.FragmentSupportActivityTest.java
public void testSingleChoiceItems() throws Throwable { runTestOnUiThread(new Runnable() { @Override//from w ww. j av a 2 s .c om public void run() { Fragment f = activity.getSupportFragmentManager().findFragmentById(R.id.fragment_sample); assertNotNull(f); assertNotNull(f.getView()); f.getView().findViewById(R.id.btn_frag_single_choice_list).performClick(); activity.getFragmentManager().executePendingTransactions(); } }); getInstrumentation().waitForIdleSync(); Fragment f = getActivity().getSupportFragmentManager().findFragmentByTag("dialog"); assertNotNull(f); Dialog d = ((SimpleAlertDialogSupportFragment) f).getDialog(); assertNotNull(d); final ListView lv = (ListView) d.findViewById(R.id.list); assertNotNull(lv); runTestOnUiThread(new Runnable() { @Override public void run() { lv.performItemClick(lv, 0, 0); } }); }
From source file:com.slownet5.pgprootexplorer.filemanager.listview.FileSelectionManagement.java
void openFile(final String filename) { if (SharedData.IS_IN_COPY_MODE) { return;// w w w . jav a2s . com } if (FileUtils.isEncryptedFile(filename)) { Log.d(TAG, "openFile: File name is: " + filename); if (SharedData.KEY_PASSWORD == null) { final Dialog dialog = new Dialog(mContext); dialog.setCancelable(false); dialog.setContentView(R.layout.password_dialog_layout); dialog.show(); dialog.findViewById(R.id.cancel_decrypt_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); final EditText editText = (EditText) dialog.findViewById(R.id.key_password); dialog.findViewById(R.id.decrypt_file_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (editText.getText().length() < 1) { editText.setError("please give me your encryption password"); return; } else { SharedData.KEY_PASSWORD = editText.getText().toString(); dialog.dismiss(); new DecryptTask(mContext, mFileListAdapter, SharedData.DB_PASSWORD, SharedData.USERNAME, filename, SharedData.KEY_PASSWORD).execute(); } } }); } else { new DecryptTask(mContext, mFileListAdapter, SharedData.DB_PASSWORD, SharedData.USERNAME, filename, SharedData.KEY_PASSWORD).execute(); } } else { UiUtils.openFile(filename, mContext, mFileListAdapter); } }
From source file:com.amazon.appstream.fireclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *//*from w w w . j a va2 s . co m*/ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((FireClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }
From source file:com.amazon.appstream.sampleclient.ErrorDialogFragment.java
/** * Standard initialization. Sets up the dialog to quit the * activity on clicking its only button. *///from w w w . ja va2 s. c o m @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false); dialog.getWindow().setBackgroundDrawable(ConnectDialogFragment.mEmpty); dialog.setContentView(R.layout.fatal_error); final Button signin = (Button) dialog.findViewById(R.id.signin); final TextView message = (TextView) dialog.findViewById(R.id.message); message.setText(mMessage); signin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); ((SampleClientActivity) getActivity()).openConnectDialog(null); } }); return dialog; }
From source file:com.simplealertdialog.test.FragmentSupportActivityTest.java
public void testItems() throws Throwable { runTestOnUiThread(new Runnable() { @Override//from w ww.j ava2 s . co m public void run() { Fragment f = activity.getSupportFragmentManager().findFragmentById(R.id.fragment_sample); assertNotNull(f); assertNotNull(f.getView()); f.getView().findViewById(R.id.btn_frag_items).performClick(); activity.getFragmentManager().executePendingTransactions(); } }); getInstrumentation().waitForIdleSync(); Fragment f = getActivity().getSupportFragmentManager().findFragmentByTag("dialog"); assertNotNull(f); Dialog d = ((SimpleAlertDialogSupportFragment) f).getDialog(); assertNotNull(d); final ListView lv = (ListView) d.findViewById(R.id.list); assertNotNull(lv); assertTrue(lv.getAdapter() instanceof ArrayAdapter<?>); runTestOnUiThread(new Runnable() { @Override public void run() { lv.performItemClick(lv, 0, 0); } }); }
From source file:com.simplealertdialog.test.FragmentSupportActivityTest.java
public void testItemsWithIcons() throws Throwable { runTestOnUiThread(new Runnable() { @Override// ww w .j av a 2s .c o m public void run() { Fragment f = activity.getSupportFragmentManager().findFragmentById(R.id.fragment_sample); assertNotNull(f); assertNotNull(f.getView()); f.getView().findViewById(R.id.btn_frag_icon_items).performClick(); activity.getFragmentManager().executePendingTransactions(); } }); getInstrumentation().waitForIdleSync(); Fragment f = getActivity().getSupportFragmentManager().findFragmentByTag("dialog"); assertNotNull(f); Dialog d = ((SimpleAlertDialogSupportFragment) f).getDialog(); assertNotNull(d); final ListView lv = (ListView) d.findViewById(R.id.list); assertNotNull(lv); assertTrue(lv.getAdapter() instanceof ArrayAdapter<?>); runTestOnUiThread(new Runnable() { @Override public void run() { lv.performItemClick(lv, 0, 0); } }); }