Loading app/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ http://www.gnu.org/licenses/gpl.html <service android:name=".services.ObserverService" android:enabled="true" /> <service android:name=".services.OperationManagerService" /> <service android:name=".services.SynchronizationService" /> <receiver android:name=".receivers.PackageEventReceiver" Loading app/src/main/java/foundation/e/drive/EdriveApplication.java +12 −7 Original line number Diff line number Diff line Loading @@ -12,12 +12,14 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.app.Application; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Environment; import android.util.Log; import foundation.e.drive.FileObservers.FileEventListener; import foundation.e.drive.FileObservers.RecursiveFileObserver; import foundation.e.drive.services.SynchronizationService; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; Loading Loading @@ -46,17 +48,20 @@ public class EdriveApplication extends Application { if (prefs.getString(AccountManager.KEY_ACCOUNT_NAME, null) != null) { Log.d(TAG, "Account already registered"); startRecursiveFileObserver(); Intent SynchronizationServiceIntent = new Intent(getApplicationContext(), SynchronizationService.class); startService(SynchronizationServiceIntent); } else { Account mAccount = CommonUtils.getAccount(getString(R.string.eelo_account_type), AccountManager.get(this)); if (mAccount != null) { if (mAccount == null) {return ;} String accountName = mAccount.name; String accountType = mAccount.type; prefs.edit().putString(AccountManager.KEY_ACCOUNT_NAME, accountName) .putString(AccountManager.KEY_ACCOUNT_TYPE, accountType) .apply(); } } } Loading app/src/main/java/foundation/e/drive/models/DownloadRequest.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.models; import com.owncloud.android.lib.resources.files.model.RemoteFile; /** * @author vincent Bourgmayer */ public class DownloadRequest extends SyncRequest { private final RemoteFile remoteFile; public DownloadRequest (RemoteFile remoteFile, SyncedFileState syncedFileState) { super(syncedFileState, Type.DOWNLOAD); this.remoteFile = remoteFile; } public RemoteFile getRemoteFile() { return remoteFile; } } app/src/main/java/foundation/e/drive/models/SyncRequest.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.models; import androidx.annotation.Nullable; public class SyncRequest { public enum Type { UPLOAD, DOWNLOAD, REMOTE_DELETE}; private final SyncedFileState syncedFileState; private final Type operationType; public SyncRequest(SyncedFileState syncedFileState, Type operationType) { this.syncedFileState = syncedFileState; this.operationType = operationType; } public Type getOperationType() { return operationType; } public SyncedFileState getSyncedFileState() { return syncedFileState; } @Override public boolean equals(@Nullable Object obj) { if (obj instanceof SyncRequest) { return (syncedFileState.getId() == ((SyncRequest) obj).syncedFileState.getId() ); } return super.equals(obj); } } app/src/main/java/foundation/e/drive/operations/ComparableOperation.javadeleted 100644 → 0 +0 −18 Original line number Diff line number Diff line package foundation.e.drive.operations; import com.owncloud.android.lib.common.operations.RemoteOperation; public interface ComparableOperation { /** * Say if File affected by operation is a media or a settings * @return */ public boolean isMediaType(); /** * Cast instance to generic remoteOperation Type * @return RemoteOperation this instance */ public RemoteOperation toRemoteOperation(); } Loading
app/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ http://www.gnu.org/licenses/gpl.html <service android:name=".services.ObserverService" android:enabled="true" /> <service android:name=".services.OperationManagerService" /> <service android:name=".services.SynchronizationService" /> <receiver android:name=".receivers.PackageEventReceiver" Loading
app/src/main/java/foundation/e/drive/EdriveApplication.java +12 −7 Original line number Diff line number Diff line Loading @@ -12,12 +12,14 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.app.Application; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Environment; import android.util.Log; import foundation.e.drive.FileObservers.FileEventListener; import foundation.e.drive.FileObservers.RecursiveFileObserver; import foundation.e.drive.services.SynchronizationService; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; Loading Loading @@ -46,17 +48,20 @@ public class EdriveApplication extends Application { if (prefs.getString(AccountManager.KEY_ACCOUNT_NAME, null) != null) { Log.d(TAG, "Account already registered"); startRecursiveFileObserver(); Intent SynchronizationServiceIntent = new Intent(getApplicationContext(), SynchronizationService.class); startService(SynchronizationServiceIntent); } else { Account mAccount = CommonUtils.getAccount(getString(R.string.eelo_account_type), AccountManager.get(this)); if (mAccount != null) { if (mAccount == null) {return ;} String accountName = mAccount.name; String accountType = mAccount.type; prefs.edit().putString(AccountManager.KEY_ACCOUNT_NAME, accountName) .putString(AccountManager.KEY_ACCOUNT_TYPE, accountType) .apply(); } } } Loading
app/src/main/java/foundation/e/drive/models/DownloadRequest.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.models; import com.owncloud.android.lib.resources.files.model.RemoteFile; /** * @author vincent Bourgmayer */ public class DownloadRequest extends SyncRequest { private final RemoteFile remoteFile; public DownloadRequest (RemoteFile remoteFile, SyncedFileState syncedFileState) { super(syncedFileState, Type.DOWNLOAD); this.remoteFile = remoteFile; } public RemoteFile getRemoteFile() { return remoteFile; } }
app/src/main/java/foundation/e/drive/models/SyncRequest.java 0 → 100644 +39 −0 Original line number Diff line number Diff line /* * Copyright © Vincent Bourgmayer (/e/ foundation). * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.drive.models; import androidx.annotation.Nullable; public class SyncRequest { public enum Type { UPLOAD, DOWNLOAD, REMOTE_DELETE}; private final SyncedFileState syncedFileState; private final Type operationType; public SyncRequest(SyncedFileState syncedFileState, Type operationType) { this.syncedFileState = syncedFileState; this.operationType = operationType; } public Type getOperationType() { return operationType; } public SyncedFileState getSyncedFileState() { return syncedFileState; } @Override public boolean equals(@Nullable Object obj) { if (obj instanceof SyncRequest) { return (syncedFileState.getId() == ((SyncRequest) obj).syncedFileState.getId() ); } return super.equals(obj); } }
app/src/main/java/foundation/e/drive/operations/ComparableOperation.javadeleted 100644 → 0 +0 −18 Original line number Diff line number Diff line package foundation.e.drive.operations; import com.owncloud.android.lib.common.operations.RemoteOperation; public interface ComparableOperation { /** * Say if File affected by operation is a media or a settings * @return */ public boolean isMediaType(); /** * Cast instance to generic remoteOperation Type * @return RemoteOperation this instance */ public RemoteOperation toRemoteOperation(); }