From 61e3d992eec31191a51851dafd0177d360f646e5 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 17 Nov 2023 14:49:33 +0100 Subject: [PATCH 1/2] Rename .java to .kt Signed-off-by: alperozturk --- .../events/{AccountRemovedEvent.java => AccountRemovedEvent.kt} | 0 .../ui/events/{ChangeMenuEvent.java => ChangeMenuEvent.kt} | 0 .../android/ui/events/{CommentsEvent.java => CommentsEvent.kt} | 0 .../ui/events/{DummyDrawerEvent.java => DummyDrawerEvent.kt} | 0 .../ui/events/{EncryptionEvent.java => EncryptionEvent.kt} | 0 .../android/ui/events/{FavoriteEvent.java => FavoriteEvent.kt} | 0 .../android/ui/events/{TokenPushEvent.java => TokenPushEvent.kt} | 0 .../ui/events/{VCardToggleEvent.java => VCardToggleEvent.kt} | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename app/src/main/java/com/owncloud/android/ui/events/{AccountRemovedEvent.java => AccountRemovedEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{ChangeMenuEvent.java => ChangeMenuEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{CommentsEvent.java => CommentsEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{DummyDrawerEvent.java => DummyDrawerEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{EncryptionEvent.java => EncryptionEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{FavoriteEvent.java => FavoriteEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{TokenPushEvent.java => TokenPushEvent.kt} (100%) rename app/src/main/java/com/owncloud/android/ui/events/{VCardToggleEvent.java => VCardToggleEvent.kt} (100%) diff --git a/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.java b/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.java b/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.java b/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.java b/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java b/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.java b/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.java b/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt diff --git a/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.java b/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt similarity index 100% rename from app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.java rename to app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt From 4d8c97e635085498f78de297e25badddf5eb92b6 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 17 Nov 2023 14:49:34 +0100 Subject: [PATCH 2/2] Convert to kt Signed-off-by: alperozturk --- .../android/ui/events/AccountRemovedEvent.kt | 8 ++--- .../android/ui/events/ChangeMenuEvent.kt | 7 ++-- .../android/ui/events/CommentsEvent.kt | 11 ++---- .../android/ui/events/DummyDrawerEvent.kt | 7 ++-- .../android/ui/events/EncryptionEvent.kt | 21 ++++------- .../android/ui/events/FavoriteEvent.kt | 14 ++------ .../ui/events/InitiateSyncedFolder.java | 35 ------------------- .../android/ui/events/MenuItemClickEvent.java | 33 ----------------- .../android/ui/events/TokenPushEvent.kt | 5 ++- .../android/ui/events/VCardToggleEvent.kt | 12 ++----- .../ui/fragment/FileDetailFragment.java | 8 ++--- .../ui/fragment/OCFileListFragment.java | 18 +++++----- .../contactsbackup/BackupListFragment.java | 2 +- 13 files changed, 39 insertions(+), 142 deletions(-) delete mode 100644 app/src/main/java/com/owncloud/android/ui/events/InitiateSyncedFolder.java delete mode 100644 app/src/main/java/com/owncloud/android/ui/events/MenuItemClickEvent.java diff --git a/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt index bde7870b7b..38f1ea6e04 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/AccountRemovedEvent.kt @@ -18,13 +18,9 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ - -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Event that notifies that an account was removed */ - -public class AccountRemovedEvent { - -} \ No newline at end of file +class AccountRemovedEvent diff --git a/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt index a661414a70..c832ddcb0c 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/ChangeMenuEvent.kt @@ -15,12 +15,11 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see //www.gnu.org/licenses/>. */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Currently a dummy event to restore grid view, sort, and search */ -public class ChangeMenuEvent { -} +class ChangeMenuEvent diff --git a/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt index 37f8f03724..d27a7f2f33 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/CommentsEvent.kt @@ -18,16 +18,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Event for refreshing comment state of a file */ -public class CommentsEvent { - public final String remoteId; - - public CommentsEvent(String remoteId) { - this.remoteId = remoteId; - } -} +class CommentsEvent(val remoteId: String) diff --git a/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt index 4236872c0c..a6ef22f65b 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/DummyDrawerEvent.kt @@ -15,12 +15,11 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see //www.gnu.org/licenses/>. */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Dummy drawer event */ -public class DummyDrawerEvent { -} +class DummyDrawerEvent diff --git a/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt index 4d7ad5c069..dbfa525d50 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/EncryptionEvent.kt @@ -17,21 +17,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Event for set folder as encrypted/decrypted */ -public class EncryptionEvent { - public final long localId; - public final String remotePath; - public final String remoteId; - public final boolean shouldBeEncrypted; - - public EncryptionEvent(long localId, String remoteId, String remotePath, boolean shouldBeEncrypted) { - this.localId = localId; - this.remoteId = remoteId; - this.remotePath = remotePath; - this.shouldBeEncrypted = shouldBeEncrypted; - } -} +class EncryptionEvent( + val localId: Long, + val remoteId: String, + val remotePath: String, + val shouldBeEncrypted: Boolean +) diff --git a/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt index 82a74eaf11..6a51e97916 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/FavoriteEvent.kt @@ -15,19 +15,11 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see //www.gnu.org/licenses/>. */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Event for making favoriting work */ -public class FavoriteEvent { - public final String remotePath; - public final boolean shouldFavorite; - - public FavoriteEvent(String remotePath, boolean shouldFavorite) { - this.remotePath = remotePath; - this.shouldFavorite = shouldFavorite; - } -} +class FavoriteEvent(val remotePath: String, val shouldFavorite: Boolean) diff --git a/app/src/main/java/com/owncloud/android/ui/events/InitiateSyncedFolder.java b/app/src/main/java/com/owncloud/android/ui/events/InitiateSyncedFolder.java deleted file mode 100644 index 0526061435..0000000000 --- a/app/src/main/java/com/owncloud/android/ui/events/InitiateSyncedFolder.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.owncloud.android.ui.events; - -import com.owncloud.android.datamodel.SyncedFolder; - -public class InitiateSyncedFolder { - private final SyncedFolder syncedFolder; - - - public InitiateSyncedFolder(SyncedFolder syncedFolder) { - this.syncedFolder = syncedFolder; - } - - public SyncedFolder getSyncedFolder() { - return syncedFolder; - } -} diff --git a/app/src/main/java/com/owncloud/android/ui/events/MenuItemClickEvent.java b/app/src/main/java/com/owncloud/android/ui/events/MenuItemClickEvent.java deleted file mode 100644 index 46aebcd79e..0000000000 --- a/app/src/main/java/com/owncloud/android/ui/events/MenuItemClickEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.owncloud.android.ui.events; - -import android.view.MenuItem; - -/** - * Menu item click event - */ -public class MenuItemClickEvent { - public final MenuItem menuItem; - - public MenuItemClickEvent(MenuItem menuItem) { - this.menuItem = menuItem; - } -} diff --git a/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt index 8dc53ef7b4..fc93aebc31 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/TokenPushEvent.kt @@ -17,10 +17,9 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events /** * Event to send push token where it belongs */ -public class TokenPushEvent { -} +class TokenPushEvent diff --git a/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt b/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt index 6c06d40cb6..706ae9d148 100644 --- a/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt +++ b/app/src/main/java/com/owncloud/android/ui/events/VCardToggleEvent.kt @@ -15,14 +15,8 @@ * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see //www.gnu.org/licenses/>. */ -package com.owncloud.android.ui.events; +package com.owncloud.android.ui.events -public class VCardToggleEvent { - public boolean showRestoreButton; - - public VCardToggleEvent(boolean showRestore) { - this.showRestoreButton = showRestore; - } -} +class VCardToggleEvent(var showRestoreButton: Boolean) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java index 8396ceb3e8..5a16f99fb6 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java @@ -783,13 +783,13 @@ public class FileDetailFragment extends FileFragment implements OnClickListener, OwnCloudClient client = clientFactory.create(user); ToggleFavoriteRemoteOperation toggleFavoriteOperation = new ToggleFavoriteRemoteOperation( - event.shouldFavorite, event.remotePath); + event.getShouldFavorite(), event.getRemotePath()); RemoteOperationResult remoteOperationResult = toggleFavoriteOperation.execute(client); if (remoteOperationResult.isSuccess()) { - getFile().setFavorite(event.shouldFavorite); - OCFile file = storageManager.getFileByEncryptedRemotePath(event.remotePath); - file.setFavorite(event.shouldFavorite); + getFile().setFavorite(event.getShouldFavorite()); + OCFile file = storageManager.getFileByEncryptedRemotePath(event.getRemotePath()); + file.setFavorite(event.getShouldFavorite()); storageManager.saveFile(file); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 26f2ac3ecd..420cabc849 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -1588,7 +1588,7 @@ public class OCFileListFragment extends ExtendedListFragment implements @Subscribe(threadMode = ThreadMode.BACKGROUND) public void onMessageEvent(CommentsEvent event) { - mAdapter.refreshCommentsCount(event.remoteId); + mAdapter.refreshCommentsCount(event.getRemoteId()); } @Subscribe(threadMode = ThreadMode.BACKGROUND) @@ -1598,13 +1598,13 @@ public class OCFileListFragment extends ExtendedListFragment implements OwnCloudClient client = clientFactory.create(user); ToggleFavoriteRemoteOperation toggleFavoriteOperation = new ToggleFavoriteRemoteOperation( - event.shouldFavorite, event.remotePath); + event.getShouldFavorite(), event.getRemotePath()); RemoteOperationResult remoteOperationResult = toggleFavoriteOperation.execute(client); if (remoteOperationResult.isSuccess()) { - boolean removeFromList = currentSearchType == SearchType.FAVORITE_SEARCH && !event.shouldFavorite; + boolean removeFromList = currentSearchType == SearchType.FAVORITE_SEARCH && !event.getShouldFavorite(); setEmptyListMessage(SearchType.FAVORITE_SEARCH); - mAdapter.setFavoriteAttributeForItemID(event.remotePath, event.shouldFavorite, removeFromList); + mAdapter.setFavoriteAttributeForItemID(event.getRemotePath(), event.getShouldFavorite(), removeFromList); } } catch (ClientFactory.CreationException e) { @@ -1692,7 +1692,7 @@ public class OCFileListFragment extends ExtendedListFragment implements String privateKey = arbitraryDataProvider.getValue(user, EncryptionUtils.PRIVATE_KEY); FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); - OCFile file = storageManager.getFileByRemoteId(event.remoteId); + OCFile file = storageManager.getFileByRemoteId(event.getRemoteId()); if (publicKey.isEmpty() || privateKey.isEmpty()) { Log_OC.d(TAG, "no public key for " + user.getAccountName()); @@ -1706,10 +1706,10 @@ public class OCFileListFragment extends ExtendedListFragment implements dialog.show(getParentFragmentManager(), SETUP_ENCRYPTION_DIALOG_TAG); } else { encryptFolder(file, - event.localId, - event.remoteId, - event.remotePath, - event.shouldBeEncrypted, + event.getLocalId(), + event.getRemoteId(), + event.getRemotePath(), + event.getShouldBeEncrypted(), publicKey, privateKey); } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java index fed19fa241..c727a730b1 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/contactsbackup/BackupListFragment.java @@ -270,7 +270,7 @@ public class BackupListFragment extends FileFragment implements Injectable { @Subscribe(threadMode = ThreadMode.MAIN) public void onMessageEvent(VCardToggleEvent event) { - if (event.showRestoreButton) { + if (event.getShowRestoreButton()) { binding.contactlistRestoreSelectedContainer.setVisibility(View.VISIBLE); } else { binding.contactlistRestoreSelectedContainer.setVisibility(View.GONE);