private void initftp() { sftp.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on SFTP"); port.setText(FileTransferProtocol.SFTP.standardPort() + ""); } }); ftp.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.i(I, "clicked on FTP"); port.setText(FileTransferProtocol.FTP.standardPort() + ""); } }); FileTransferConnection conn = userAccount.getConfiguration().getFileTransferConncetions().get(0); String value = ""; value = conn.getHost().getValue(); if (value != "") { host.setText(value); value = ""; } value = conn.getPassword().getValue(); if (value != "") { password.setText(value); value = ""; } value = conn.getUsername().getValue(); if (value != "") { username.setText(value); value = ""; } value = conn.getPort().getValue(); if (value != "") { port.setText(value); } value = conn.getProtocol().lowerCaseName(); if (value != "") { String name = conn.getProtocol().lowerCaseName(); if (name == "ftp") { ftp.setChecked(true); name = ""; } name = conn.getProtocol().lowerCaseName(); if (name == "sftp") { sftp.setChecked(true); } } // try to get HttpUrl-Field (only in android-accounts available) try { value = conn.getHttpUrl().getValue(); if (value != "") { httpUrl.setText(value); } else if (conn.getHost().getValue() != "") { httpUrl.setText(NamingHelper.generateHttpUrlFromFtpSettings()); } } catch (Exception e) { e.printStackTrace(); } }
private void updateHttpUrlField() { Log.i(I, "update (ftp) http-url ..."); String ftpUrl = host.getText().toString(); httpUrl.setText(NamingHelper.generateHttpUrlFromFtpUrl(ftpUrl)); }