diff options
author | Jeremy Klein <jlklein@google.com> | 2015-10-23 10:35:48 -0700 |
---|---|---|
committer | Jeremy Klein <jlklein@google.com> | 2015-10-23 10:35:48 -0700 |
commit | dbfa00aae9c15fb6a40f73048db0bedbdfa1e28d (patch) | |
tree | 8b6377505101a4a319112217ff85a793e7108d88 /app | |
parent | 50f9c5c7089e16c161653c84a369a92a28e5502a (diff) | |
download | connectbot-dbfa00aae9c15fb6a40f73048db0bedbdfa1e28d.tar.gz connectbot-dbfa00aae9c15fb6a40f73048db0bedbdfa1e28d.tar.bz2 connectbot-dbfa00aae9c15fb6a40f73048db0bedbdfa1e28d.zip |
Remove unused add host dialog from HostListActivity.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/connectbot/HostListActivity.java | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/app/src/main/java/org/connectbot/HostListActivity.java b/app/src/main/java/org/connectbot/HostListActivity.java index 509ef80..c1af547 100644 --- a/app/src/main/java/org/connectbot/HostListActivity.java +++ b/app/src/main/java/org/connectbot/HostListActivity.java @@ -587,97 +587,4 @@ public class HostListActivity extends AppCompatListActivity implements OnHostSta return hosts.size(); } } - - public static class AddHostDialogFragment extends DialogFragment { - private TextView mAddressField; - private Spinner mSpinner; - - HostListActivity mListener; - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - mListener = (HostListActivity) activity; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - LayoutInflater inflater = getActivity().getLayoutInflater(); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - - View addHostDialog = inflater.inflate(R.layout.dia_add_host, null); - builder.setView(addHostDialog) - .setPositiveButton(R.string.button_add, null) - .setNegativeButton(R.string.button_cancel, null); - AlertDialog dialog = builder.create(); - - mAddressField = (TextView) addHostDialog.findViewById(R.id.front_quickconnect); - mAddressField.setOnKeyListener(new OnKeyListener() { - - public boolean onKey(View v, int keyCode, KeyEvent event) { - - if (event.getAction() == KeyEvent.ACTION_UP) return false; - if (keyCode != KeyEvent.KEYCODE_ENTER) return false; - - processNewUriEntered(); - return true; - } - }); - - mSpinner = (Spinner) addHostDialog.findViewById(R.id.transport_selection); - ArrayAdapter<String> transportSelection = new ArrayAdapter<String>(getActivity(), - android.R.layout.simple_spinner_item, TransportFactory.getTransportNames()); - transportSelection.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - public void onItemSelected(AdapterView<?> arg0, View view, int position, long id) { - String formatHint = TransportFactory.getFormatHint( - (String) mSpinner.getSelectedItem(), - getActivity()); - mAddressField.setHint(formatHint); - mAddressField.setError(null); - mAddressField.requestFocus(); - } - - public void onNothingSelected(AdapterView<?> arg0) { - } - }); - mSpinner.setAdapter(transportSelection); - - return dialog; - } - - @Override - public void onResume() - { - super.onResume(); - final AlertDialog alertDialog = (AlertDialog) getDialog(); - Button addButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); - addButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - processNewUriEntered(); - } - }); - } - - /** - * Processes the URI that has been entered. If it is a valid URI, adds that host - * and starts ConsoleActivity; otherwise, shows an error in the address field. - */ - private void processNewUriEntered() { - Uri uri = TransportFactory.getUri((String) mSpinner - .getSelectedItem(), mAddressField.getText().toString()); - if (uri == null) { - mAddressField.setError(getString(R.string.list_format_error, - TransportFactory.getFormatHint( - (String) mSpinner.getSelectedItem(), - getActivity()))); - mAddressField.requestFocus(); - return; - } - - mListener.startConsoleActivity(uri); - getDialog().dismiss(); - } - } } |