use of com.amaze.filemanager.ui.dialogs.SftpConnectDialog in project AmazeFileManager by TeamAmaze.
the class MainActivity method showSftpDialog.
public void showSftpDialog(String name, String path, boolean edit) {
if (path.length() > 0 && name.length() == 0) {
int i = dataUtils.containsServer(new String[] { name, path });
if (i != -1)
name = dataUtils.getServers().get(i)[0];
}
SftpConnectDialog sftpConnectDialog = new SftpConnectDialog();
Uri uri = Uri.parse(path);
String userinfo = uri.getUserInfo();
Bundle bundle = new Bundle();
bundle.putString("name", name);
bundle.putString("address", uri.getHost());
bundle.putString("port", Integer.toString(uri.getPort()));
bundle.putString("path", path);
bundle.putString("username", userinfo.indexOf(':') > 0 ? userinfo.substring(0, userinfo.indexOf(':')) : userinfo);
if (userinfo.indexOf(':') < 0) {
bundle.putBoolean("hasPassword", false);
bundle.putString("keypairName", utilsHandler.getSshAuthPrivateKeyName(path));
} else {
bundle.putBoolean("hasPassword", true);
bundle.putString("password", userinfo.substring(userinfo.indexOf(':') + 1));
}
bundle.putBoolean("edit", edit);
sftpConnectDialog.setArguments(bundle);
sftpConnectDialog.show(getFragmentManager(), "sftpdialog");
}
use of com.amaze.filemanager.ui.dialogs.SftpConnectDialog in project AmazeFileManager by TeamAmaze.
the class CloudSheetFragment method onClick.
@Override
public void onClick(View v) {
Log.d(TAG_FRAGMENT, "Clicked: " + v.getId());
switch(v.getId()) {
case R.id.linear_layout_smb:
dismiss();
SmbSearchDialog smbDialog = new SmbSearchDialog();
smbDialog.show(getActivity().getFragmentManager(), "tab");
return;
case R.id.linear_layout_scp:
dismiss();
SftpConnectDialog sftpConnectDialog = new SftpConnectDialog();
Bundle args = new Bundle();
args.putBoolean("edit", false);
sftpConnectDialog.setArguments(args);
sftpConnectDialog.show(getActivity().getFragmentManager(), "tab");
return;
case R.id.linear_layout_box:
((MainActivity) getActivity()).addConnection(OpenMode.BOX);
break;
case R.id.linear_layout_dropbox:
((MainActivity) getActivity()).addConnection(OpenMode.DROPBOX);
break;
case R.id.linear_layout_google_drive:
((MainActivity) getActivity()).addConnection(OpenMode.GDRIVE);
break;
case R.id.linear_layout_onedrive:
((MainActivity) getActivity()).addConnection(OpenMode.ONEDRIVE);
break;
case R.id.linear_layout_get_cloud:
Intent cloudPluginIntent = new Intent(Intent.ACTION_VIEW);
cloudPluginIntent.setData(Uri.parse("market://details?id=com.filemanager.amazecloud"));
startActivity(cloudPluginIntent);
break;
}
// dismiss this sheet dialog
dismiss();
}
Aggregations