|
@@ -46,7 +46,6 @@ import android.preference.PreferenceManager;
|
|
|
import android.provider.OpenableColumns;
|
|
|
import android.support.design.widget.Snackbar;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
-import android.support.v4.app.FragmentManager;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
import android.support.v4.content.ContextCompat;
|
|
|
import android.support.v4.view.GravityCompat;
|
|
@@ -66,7 +65,6 @@ import com.owncloud.android.files.services.FileDownloader;
|
|
|
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
|
|
|
import com.owncloud.android.files.services.FileUploader;
|
|
|
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
|
|
|
-import com.owncloud.android.lib.common.network.CertificateCombinedException;
|
|
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
|
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
|
@@ -81,9 +79,6 @@ import com.owncloud.android.operations.SynchronizeFileOperation;
|
|
|
import com.owncloud.android.operations.UploadFileOperation;
|
|
|
import com.owncloud.android.services.observer.FileObserverService;
|
|
|
import com.owncloud.android.syncadapter.FileSyncAdapter;
|
|
|
-import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
|
|
|
-import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
|
|
|
-import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
|
|
|
import com.owncloud.android.ui.fragment.FileDetailFragment;
|
|
|
import com.owncloud.android.ui.fragment.FileFragment;
|
|
|
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
|
@@ -104,9 +99,9 @@ import java.io.File;
|
|
|
* Displays, what files the user has available in his ownCloud. This is the main view.
|
|
|
*/
|
|
|
|
|
|
-public class FileDisplayActivity extends HookActivity implements
|
|
|
- FileFragment.ContainerActivity,
|
|
|
- OnSslUntrustedCertListener, OnEnforceableRefreshListener {
|
|
|
+public class FileDisplayActivity extends HookActivity
|
|
|
+ implements FileFragment.ContainerActivity,
|
|
|
+ OnEnforceableRefreshListener {
|
|
|
|
|
|
private SyncBroadcastReceiver mSyncBroadcastReceiver;
|
|
|
private UploadFinishReceiver mUploadFinishReceiver;
|
|
@@ -138,10 +133,6 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
|
|
|
private boolean mSyncInProgress = false;
|
|
|
|
|
|
- private static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT";
|
|
|
- private static String DIALOG_UPLOAD_SOURCE = "DIALOG_UPLOAD_SOURCE";
|
|
|
- private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
|
|
|
-
|
|
|
private OCFile mWaitingToSend;
|
|
|
|
|
|
|
|
@@ -1036,7 +1027,6 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
synchResult != null && !synchResult.isSuccess()) {
|
|
|
|
|
|
if(ResultCode.UNAUTHORIZED.equals(synchResult.getCode()) ||
|
|
|
- synchResult.isIdPRedirection() ||
|
|
|
(synchResult.isException() && synchResult.getException()
|
|
|
instanceof AuthenticatorException)) {
|
|
|
|
|
@@ -1370,25 +1360,6 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void onSavedCertificate() {
|
|
|
- startSyncFolderOperation(getCurrentDir(), false);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onFailedSavingCertificate() {
|
|
|
- ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(
|
|
|
- R.string.ssl_validator_not_saved, new String[]{}, R.string.common_ok, -1, -1
|
|
|
- );
|
|
|
- dialog.show(getSupportFragmentManager(), DIALOG_CERT_NOT_SAVED);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onCancelCertificate() {
|
|
|
- // nothing to do
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Updates the view associated to the activity after the finish of some operation over files
|
|
|
* in the current account.
|
|
@@ -1451,8 +1422,8 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
private void onRemoveFileOperationFinish(RemoveFileOperation operation,
|
|
|
RemoteOperationResult result) {
|
|
|
Toast msg = Toast.makeText(this,
|
|
|
- ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
|
|
|
- Toast.LENGTH_LONG);
|
|
|
+ ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
|
|
|
+ Toast.LENGTH_LONG);
|
|
|
msg.show();
|
|
|
|
|
|
if (result.isSuccess()) {
|
|
@@ -1652,19 +1623,9 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private OCFile getCurrentDir() {
|
|
|
- OCFile file = getFile();
|
|
|
- if (file != null) {
|
|
|
- if (file.isFolder()) {
|
|
|
- return file;
|
|
|
- } else if (getStorageManager() != null) {
|
|
|
- String parentPath = file.getRemotePath().substring(0,
|
|
|
- file.getRemotePath().lastIndexOf(file.getFileName()));
|
|
|
- return getStorageManager().getFileByPath(parentPath);
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
+ @Override
|
|
|
+ public void onSavedCertificate() {
|
|
|
+ startSyncFolderOperation(getCurrentDir(), false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1723,21 +1684,6 @@ public class FileDisplayActivity extends HookActivity implements
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Show untrusted cert dialog
|
|
|
- */
|
|
|
- public void showUntrustedCertDialog(RemoteOperationResult result) {
|
|
|
- // Show a dialog with the certificate info
|
|
|
- FragmentManager fm = getSupportFragmentManager();
|
|
|
- SslUntrustedCertDialog dialog = (SslUntrustedCertDialog) fm.findFragmentByTag(DIALOG_UNTRUSTED_CERT);
|
|
|
- if(dialog == null) {
|
|
|
- dialog = SslUntrustedCertDialog.newInstanceForFullSslError(
|
|
|
- (CertificateCombinedException) result.getException());
|
|
|
- FragmentTransaction ft = fm.beginTransaction();
|
|
|
- dialog.show(ft, DIALOG_UNTRUSTED_CERT);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void requestForDownload(OCFile file) {
|
|
|
Account account = getAccount();
|
|
|
if (!mDownloaderBinder.isDownloading(account, mWaitingToPreview)) {
|