@Override public void onError(int errorCode) { dismissProgressDialog(); ToastNotification.makeText( App.sInstance.getApplicationContext(), App.sInstance.getString(errorCode), Toast.LENGTH_LONG) .show(); }
public void openAvailableCloudsList() { MainPanel panel = mFileSystemController.getActivePanel(); if (NetworkUtil.isNetworkAvailable()) { showNetworksDialog(); } else { if (panel != null && panel.getActivity() != null) { ToastNotification.makeText( panel.getActivity(), App.sInstance.getString(R.string.error_no_network), Toast.LENGTH_LONG) .show(); } } }
@Override public void handleMessage(Message msg) { super.handleMessage(msg); MainPanel panel = mFileSystemController.getActivePanel(); if (msg.what == FTP_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.FTP); } else if (msg.what == SFTP_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.SFTP); } else if (msg.what == SMB_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.SMB); } else if (msg.what == YANDEX_DISK_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.YandexDisk); } else if (msg.what == SMB_SCAN_NETWORK_REQUESTED) { final Dialog dialog = new NetworkScanDialog(panel.getActivity(), mInAppAuthHandler); dialog.show(); adjustDialogSize(dialog, panel); } else if (msg.what == SMB_SCAN_CANCELED) { startSmbAuthentication(panel); } else if (msg.what == SMB_IP_SELECTED) { startSmbAuthentication((String) msg.obj, panel); } else if (msg.what == GoogleDriveAuthWindow.MSG_HIDE_LOADING_DIALOG) { GoogleDriveApi.GoogleDriveAccount account = null; if (msg.arg1 == GoogleDriveAuthWindow.MSG_ARG_SUCCESS) { GoogleDriveApi api = App.sInstance.getGoogleDriveApi(); Pair<About, Token> data = (Pair<About, Token>) msg.obj; account = (GoogleDriveApi.GoogleDriveAccount) api.saveAccount(data.first, data.second); } else { ToastNotification.makeText( App.sInstance.getApplicationContext(), App.sInstance.getString(R.string.google_drive_get_token_error), Toast.LENGTH_LONG) .show(); } dismissProgressDialog(); if (account != null) { App.sInstance.getGoogleDriveApi().setup(account); mFileSystemController.openNetworkPanel(NetworkEnum.GoogleDrive); } } else if (msg.what == GoogleDriveAuthWindow.MSG_SHOW_LOADING_DIALOG) { showProgressDialog(R.string.loading); } else if (msg.what == MEDIA_FIRE_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.MediaFire); } else if (msg.what == WEBDAV_CONNECTED) { mFileSystemController.openNetworkPanel(NetworkEnum.WebDav); } }