Search in sources :

Example 1 with SftpConnectDialog

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");
}
Also used : SftpConnectDialog(com.amaze.filemanager.ui.dialogs.SftpConnectDialog) Bundle(android.os.Bundle) Uri(android.net.Uri)

Example 2 with SftpConnectDialog

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();
}
Also used : SftpConnectDialog(com.amaze.filemanager.ui.dialogs.SftpConnectDialog) Bundle(android.os.Bundle) Intent(android.content.Intent) MainActivity(com.amaze.filemanager.activities.MainActivity) SmbSearchDialog(com.amaze.filemanager.ui.dialogs.SmbSearchDialog)

Aggregations

Bundle (android.os.Bundle)2 SftpConnectDialog (com.amaze.filemanager.ui.dialogs.SftpConnectDialog)2 Intent (android.content.Intent)1 Uri (android.net.Uri)1 MainActivity (com.amaze.filemanager.activities.MainActivity)1 SmbSearchDialog (com.amaze.filemanager.ui.dialogs.SmbSearchDialog)1