Selaa lähdekoodia

Merge pull request #9866 from nextcloud/migrateParcelerToKotlinParcelize

Migrate from Parceler to kotlin-parcelize
Álvaro Brey 3 vuotta sitten
vanhempi
commit
3b1dbe2301
34 muutettua tiedostoa jossa 281 lisäystä ja 484 poistoa
  1. 1 2
      build.gradle
  2. 1 2
      src/androidTest/java/com/owncloud/android/ui/activity/UserInfoActivityIT.java
  3. 3 3
      src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java
  4. 2 6
      src/gplay/java/com/owncloud/android/utils/PushUtils.java
  5. 2 2
      src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java
  6. 2 2
      src/main/java/com/nextcloud/client/jobs/NotificationWork.kt
  7. 0 110
      src/main/java/com/owncloud/android/datamodel/DecryptedPushMessage.java
  8. 40 0
      src/main/java/com/owncloud/android/datamodel/DecryptedPushMessage.kt
  9. 8 8
      src/main/java/com/owncloud/android/datamodel/ExternalLinksProvider.java
  10. 0 55
      src/main/java/com/owncloud/android/datamodel/SignatureVerification.java
  11. 28 0
      src/main/java/com/owncloud/android/datamodel/SignatureVerification.kt
  12. 0 106
      src/main/java/com/owncloud/android/datamodel/Template.java
  13. 49 0
      src/main/java/com/owncloud/android/datamodel/Template.kt
  14. 2 2
      src/main/java/com/owncloud/android/files/FetchTemplateOperation.java
  15. 4 4
      src/main/java/com/owncloud/android/files/FileMenuFilter.java
  16. 12 13
      src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java
  17. 7 8
      src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java
  18. 2 3
      src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java
  19. 6 6
      src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java
  20. 3 4
      src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java
  21. 8 8
      src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java
  22. 4 2
      src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java
  23. 2 2
      src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java
  24. 1 1
      src/main/java/com/owncloud/android/ui/asynctasks/TextEditorLoadUrlTask.java
  25. 2 4
      src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java
  26. 5 5
      src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.java
  27. 0 58
      src/main/java/com/owncloud/android/ui/events/SearchEvent.java
  28. 9 23
      src/main/java/com/owncloud/android/ui/events/SearchEvent.kt
  29. 27 0
      src/main/java/com/owncloud/android/ui/events/SyncEventFinished.kt
  30. 1 14
      src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java
  31. 1 1
      src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java
  32. 30 28
      src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
  33. 17 0
      src/main/java/com/owncloud/android/ui/fragment/SearchType.kt
  34. 2 2
      src/main/java/com/owncloud/android/utils/DisplayUtils.java

+ 1 - 2
build.gradle

@@ -36,6 +36,7 @@ apply plugin: 'com.android.application'
 
 apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-kapt'
+apply plugin: 'kotlin-parcelize'
 apply plugin: 'checkstyle'
 apply plugin: 'pmd'
 apply plugin: 'com.hiya.jacoco-android'
@@ -262,8 +263,6 @@ dependencies {
     implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
     implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.4' // 'com.github.blikoon:QRCodeScanner:0.1.2'
     implementation 'com.google.android:flexbox:2.0.1'
-    implementation 'org.parceler:parceler-api:1.1.13'
-    kapt 'org.parceler:parceler:1.1.13'
     implementation('com.github.bumptech.glide:glide:3.8.0') {
         exclude group: "com.android.support"
     }

+ 1 - 2
src/androidTest/java/com/owncloud/android/ui/activity/UserInfoActivityIT.java

@@ -28,7 +28,6 @@ import com.owncloud.android.utils.ScreenshotTest;
 
 import org.junit.Rule;
 import org.junit.Test;
-import org.parceler.Parcels;
 
 import androidx.test.espresso.intent.rule.IntentsTestRule;
 
@@ -54,7 +53,7 @@ public class UserInfoActivityIT extends AbstractIT {
                                          null,
                                          null
         );
-        intent.putExtra(UserInfoActivity.KEY_USER_DATA, Parcels.wrap(userInfo));
+        intent.putExtra(UserInfoActivity.KEY_USER_DATA, userInfo);
         UserInfoActivity sut = activityRule.launchActivity(intent);
 
         shortSleep();

+ 3 - 3
src/androidTest/java/com/owncloud/android/ui/dialog/DialogFragmentIT.java

@@ -358,21 +358,21 @@ public class DialogFragmentIT extends AbstractIT {
 
         // add direct editing info
         DirectEditing directEditing = new DirectEditing();
-        directEditing.creators.put("1", new Creator("1",
+        directEditing.getCreators().put("1", new Creator("1",
                                                     "text",
                                                     "text file",
                                                     ".md",
                                                     "application/octet-stream",
                                                     false));
 
-        directEditing.creators.put("2", new Creator("2",
+        directEditing.getCreators().put("2", new Creator("2",
                                                     "md",
                                                     "markdown file",
                                                     ".md",
                                                     "application/octet-stream",
                                                     false));
 
-        directEditing.editors.put("text",
+        directEditing.getEditors().put("text",
                                   new Editor("1",
                                              "Text",
                                              new ArrayList<>(Collections.singletonList(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN)),

+ 2 - 6
src/gplay/java/com/owncloud/android/utils/PushUtils.java

@@ -416,8 +416,6 @@ public final class PushUtils {
     ) {
         Signature signature;
         PublicKey publicKey;
-        SignatureVerification signatureVerification = new SignatureVerification();
-        signatureVerification.setSignatureValid(false);
 
         Account[] accounts = accountManager.getAccounts();
 
@@ -437,9 +435,7 @@ public final class PushUtils {
                             signature.initVerify(publicKey);
                             signature.update(subjectBytes);
                             if (signature.verify(signatureBytes)) {
-                                signatureVerification.setSignatureValid(true);
-                                signatureVerification.setAccount(account);
-                                return signatureVerification;
+                                return new SignatureVerification(true, account);
                             }
                         }
                     }
@@ -453,7 +449,7 @@ public final class PushUtils {
             Log.d(TAG, "Signature exception while trying to verify");
         }
 
-        return signatureVerification;
+        return new SignatureVerification(false, null);
     }
 
     private static Key readKeyFromString(boolean readPublicKey, String keyString) {

+ 2 - 2
src/main/java/com/nextcloud/client/account/UserAccountManagerImpl.java

@@ -369,8 +369,8 @@ public class UserAccountManagerImpl implements UserAccountManager {
 
                 if (result.isSuccess()) {
                     UserInfo userInfo = result.getResultData();
-                    userId = userInfo.id;
-                    displayName = userInfo.displayName;
+                    userId = userInfo.getId();
+                    displayName = userInfo.getDisplayName();
                 } else {
                     // skip account, try it next time
                     Log_OC.e(TAG, "Error while getting username for account: " + account.name);

+ 2 - 2
src/main/java/com/nextcloud/client/jobs/NotificationWork.kt

@@ -105,7 +105,7 @@ class NotificationWork constructor(
                         base64DecodedSignature,
                         base64DecodedSubject
                     )
-                    if (signatureVerification != null && signatureVerification.isSignatureValid) {
+                    if (signatureVerification != null && signatureVerification.signatureValid) {
                         val cipher = Cipher.getInstance("RSA/None/PKCS1Padding")
                         cipher.init(Cipher.DECRYPT_MODE, privateKey)
                         val decryptedSubject = cipher.doFinal(base64DecodedSubject)
@@ -119,7 +119,7 @@ class NotificationWork constructor(
                         } else if (decryptedPushMessage.deleteAll) {
                             notificationManager.cancelAll()
                         } else {
-                            val user = accountManager.getUser(signatureVerification.getAccount().name)
+                            val user = accountManager.getUser(signatureVerification.account?.name)
                                 .orElseThrow { RuntimeException() }
                             fetchCompleteNotification(user, decryptedPushMessage)
                         }

+ 0 - 110
src/main/java/com/owncloud/android/datamodel/DecryptedPushMessage.java

@@ -1,110 +0,0 @@
-/*
- * Nextcloud application
- *
- * @author Mario Danic
- * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.owncloud.android.datamodel;
-
-import com.google.gson.annotations.SerializedName;
-
-import org.parceler.Parcel;
-
-/*
- * Push data from server, https://github.com/nextcloud/notifications/blob/master/docs/push-v2.md#encrypted-subject-data
- */
-@Parcel
-public class DecryptedPushMessage {
-    public String app;
-    public String type;
-    public String subject;
-    public String id;
-    public int nid;
-    public boolean delete;
-    @SerializedName("delete-all")
-    public boolean deleteAll;
-
-    public DecryptedPushMessage(String app, String type, String subject, String id, int nid, boolean delete, boolean deleteAll) {
-        this.app = app;
-        this.type = type;
-        this.subject = subject;
-        this.id = id;
-        this.nid = nid;
-        this.delete = delete;
-        this.deleteAll = deleteAll;
-    }
-
-    public DecryptedPushMessage() {
-        // empty constructor
-    }
-
-    public String getApp() {
-        return this.app;
-    }
-
-    public String getType() {
-        return this.type;
-    }
-
-    public String getSubject() {
-        return this.subject;
-    }
-
-    public String getId() {
-        return this.id;
-    }
-
-    public int getNid() {
-        return this.nid;
-    }
-
-    public boolean isDelete() {
-        return this.delete;
-    }
-
-    public boolean isDeleteAll() {
-        return this.deleteAll;
-    }
-
-    public void setApp(String app) {
-        this.app = app;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public void setSubject(String subject) {
-        this.subject = subject;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public void setNid(int nid) {
-        this.nid = nid;
-    }
-
-    public void setDelete(boolean delete) {
-        this.delete = delete;
-    }
-
-    public void setDeleteAll(boolean deleteAll) {
-        this.deleteAll = deleteAll;
-    }
-}

+ 40 - 0
src/main/java/com/owncloud/android/datamodel/DecryptedPushMessage.kt

@@ -0,0 +1,40 @@
+/*
+ * Nextcloud application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android.datamodel
+
+import android.os.Parcelable
+import com.google.gson.annotations.SerializedName
+import kotlinx.parcelize.Parcelize
+
+/*
+ * Push data from server, https://github.com/nextcloud/notifications/blob/master/docs/push-v2.md#encrypted-subject-data
+ */
+@Parcelize
+data class DecryptedPushMessage(
+    val app: String,
+    val type: String,
+    val subject: String,
+    val id: String,
+    val nid: Int,
+    val delete: Boolean,
+    @SerializedName("delete-all")
+    val deleteAll: Boolean
+) : Parcelable

+ 8 - 8
src/main/java/com/owncloud/android/datamodel/ExternalLinksProvider.java

@@ -57,7 +57,7 @@ public class ExternalLinksProvider {
      * @return external link id, -1 if the insert process fails.
      */
     public long storeExternalLink(ExternalLink externalLink) {
-        Log_OC.v(TAG, "Adding " + externalLink.name);
+        Log_OC.v(TAG, "Adding " + externalLink.getName());
 
         ContentValues cv = createContentValuesFromExternalLink(externalLink);
 
@@ -66,7 +66,7 @@ public class ExternalLinksProvider {
         if (result != null) {
             return Long.parseLong(result.getPathSegments().get(1));
         } else {
-            Log_OC.e(TAG, "Failed to insert item " + externalLink.name + " into external link db.");
+            Log_OC.e(TAG, "Failed to insert item " + externalLink.getName() + " into external link db.");
             return -1;
         }
     }
@@ -126,12 +126,12 @@ public class ExternalLinksProvider {
     @NonNull
     private ContentValues createContentValuesFromExternalLink(ExternalLink externalLink) {
         ContentValues cv = new ContentValues();
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_ICON_URL, externalLink.iconUrl);
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_LANGUAGE, externalLink.language);
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_TYPE, externalLink.type.toString());
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_NAME, externalLink.name);
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_URL, externalLink.url);
-        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_REDIRECT, externalLink.redirect);
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_ICON_URL, externalLink.getIconUrl());
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_LANGUAGE, externalLink.getLanguage());
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_TYPE, externalLink.getType().toString());
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_NAME, externalLink.getName());
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_URL, externalLink.getUrl());
+        cv.put(ProviderMeta.ProviderTableMeta.EXTERNAL_LINKS_REDIRECT, externalLink.getRedirect());
         return cv;
     }
 

+ 0 - 55
src/main/java/com/owncloud/android/datamodel/SignatureVerification.java

@@ -1,55 +0,0 @@
-/*
- * Nextcloud application
- *
- * @author Mario Danic
- * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.owncloud.android.datamodel;
-
-import android.accounts.Account;
-
-import org.parceler.Parcel;
-
-@Parcel
-public class SignatureVerification {
-    public boolean signatureValid;
-    public Account account;
-
-    public SignatureVerification(boolean signatureValid, Account account) {
-        this.signatureValid = signatureValid;
-        this.account = account;
-    }
-
-    public SignatureVerification() {
-        // empty constructor
-    }
-
-    public boolean isSignatureValid() {
-        return this.signatureValid;
-    }
-
-    public Account getAccount() {
-        return this.account;
-    }
-
-    public void setSignatureValid(boolean signatureValid) {
-        this.signatureValid = signatureValid;
-    }
-
-    public void setAccount(Account account) {
-        this.account = account;
-    }
-}

+ 28 - 0
src/main/java/com/owncloud/android/datamodel/SignatureVerification.kt

@@ -0,0 +1,28 @@
+/*
+ * Nextcloud application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.datamodel
+
+import android.accounts.Account
+import android.os.Parcelable
+
+import kotlinx.parcelize.Parcelize
+
+@Parcelize
+data class SignatureVerification(val signatureValid: Boolean, val account: Account?) : Parcelable

+ 0 - 106
src/main/java/com/owncloud/android/datamodel/Template.java

@@ -1,106 +0,0 @@
-/*
- * Nextcloud Android client application
- *
- * @author Tobias Kaminsky
- * Copyright (C) 2018 Tobias Kaminsky
- * Copyright (C) 2018 Nextcloud GmbH.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-package com.owncloud.android.datamodel;
-
-import org.parceler.Parcel;
-
-import java.util.Locale;
-
-/**
- * Template for creating a file from it via RichDocuments app
- */
-@Parcel
-public class Template {
-    public int id;
-    public String name;
-    public String thumbnailLink;
-    public Type type;
-    public String extension;
-
-    public Template() {
-        // empty constructor
-    }
-
-    public Template(int id, String name, String thumbnailLink, Type type, String extension) {
-        this.id = id;
-        this.name = name;
-        this.thumbnailLink = thumbnailLink;
-        this.type = type;
-        this.extension = extension;
-    }
-
-    public enum Type {
-        DOCUMENT, SPREADSHEET, PRESENTATION, UNKNOWN
-    }
-
-    public static Type parse(String type) {
-        switch (type.toLowerCase(Locale.US)) {
-            case "document":
-                return Type.DOCUMENT;
-            case "spreadsheet":
-                return Type.SPREADSHEET;
-            case "presentation":
-                return Type.PRESENTATION;
-            default:
-                return Type.UNKNOWN;
-        }
-    }
-
-    public int getId() {
-        return this.id;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public String getThumbnailLink() {
-        return this.thumbnailLink;
-    }
-
-    public Type getType() {
-        return this.type;
-    }
-
-    public String getExtension() {
-        return this.extension;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setThumbnailLink(String thumbnailLink) {
-        this.thumbnailLink = thumbnailLink;
-    }
-
-    public void setType(Type type) {
-        this.type = type;
-    }
-
-    public void setExtension(String extension) {
-        this.extension = extension;
-    }
-}

+ 49 - 0
src/main/java/com/owncloud/android/datamodel/Template.kt

@@ -0,0 +1,49 @@
+/*
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2018 Tobias Kaminsky
+ * Copyright (C) 2018 Nextcloud GmbH.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.datamodel
+
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+/**
+ * Template for creating a file from it via RichDocuments app
+ */
+@Parcelize
+data class Template(
+    val id: Int,
+    val name: String,
+    val thumbnailLink: String,
+    val type: Type,
+    val extension: String
+) : Parcelable {
+    enum class Type {
+        DOCUMENT, SPREADSHEET, PRESENTATION, UNKNOWN;
+
+        companion object {
+            @JvmStatic
+            fun parse(name: String) = try {
+                valueOf(name.uppercase())
+            } catch (_: IllegalArgumentException) {
+                UNKNOWN
+            }
+        }
+    }
+}

+ 2 - 2
src/main/java/com/owncloud/android/files/FetchTemplateOperation.java

@@ -81,8 +81,8 @@ public class FetchTemplateOperation extends RemoteOperation {
                     templateArray.add(new Template(templateObject.getInt("id"),
                                                    templateObject.getString("name"),
                                                    templateObject.optString("preview"),
-                                                   Template.parse(templateObject.getString("type")
-                                                                             .toUpperCase(Locale.ROOT)),
+                                                   Template.Type.parse(templateObject.getString("type")
+                                                                            .toUpperCase(Locale.ROOT)),
                                                    templateObject.getString("extension")));
                 }
 

+ 4 - 4
src/main/java/com/owncloud/android/files/FileMenuFilter.java

@@ -312,14 +312,14 @@ public class FileMenuFilter {
 
         DirectEditing directEditing = new Gson().fromJson(json, DirectEditing.class);
 
-        for (Editor editor : directEditing.editors.values()) {
-            if (editor.mimetypes.contains(mimeType)) {
+        for (Editor editor : directEditing.getEditors().values()) {
+            if (editor.getMimetypes().contains(mimeType)) {
                 return editor;
             }
         }
 
-        for (Editor editor : directEditing.editors.values()) {
-            if (editor.optionalMimetypes.contains(mimeType)) {
+        for (Editor editor : directEditing.getEditors().values()) {
+            if (editor.getOptionalMimetypes().contains(mimeType)) {
                 return editor;
             }
         }

+ 12 - 13
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -120,7 +120,6 @@ import com.owncloud.android.utils.theme.ThemeMenuUtils;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
-import org.parceler.Parcels;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -545,7 +544,7 @@ public abstract class DrawerActivity extends ToolbarActivity
         Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
         intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         intent.setAction(Intent.ACTION_SEARCH);
-        intent.putExtra(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
+        intent.putExtra(OCFileListFragment.SEARCH_EVENT, searchEvent);
         intent.putExtra(FileDisplayActivity.DRAWER_MENU_ID, menuItemId);
         startActivity(intent);
     }
@@ -566,14 +565,14 @@ public abstract class DrawerActivity extends ToolbarActivity
 
     private void externalLinkClicked(MenuItem menuItem) {
         for (ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.LINK)) {
-            if (menuItem.getTitle().toString().equalsIgnoreCase(link.name)) {
-                if (link.redirect) {
-                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link.url));
+            if (menuItem.getTitle().toString().equalsIgnoreCase(link.getName())) {
+                if (link.getRedirect()) {
+                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getUrl()));
                     DisplayUtils.startIntentIfAppAvailable(intent, this, R.string.no_browser_available);
                 } else {
                     Intent externalWebViewIntent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
-                    externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, link.name);
-                    externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, link.url);
+                    externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, link.getName());
+                    externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, link.getUrl());
                     externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, true);
                     externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, menuItem.getItemId());
                     startActivity(externalWebViewIntent);
@@ -713,13 +712,13 @@ public abstract class DrawerActivity extends ToolbarActivity
 
                 if (quotas.size() > 0) {
                     final ExternalLink firstQuota = quotas.get(0);
-                    mQuotaTextLink.setText(firstQuota.name);
+                    mQuotaTextLink.setText(firstQuota.getName());
                     mQuotaTextLink.setClickable(true);
                     mQuotaTextLink.setVisibility(View.VISIBLE);
                     mQuotaTextLink.setOnClickListener(v -> {
                         Intent externalWebViewIntent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
-                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, firstQuota.name);
-                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, firstQuota.url);
+                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, firstQuota.getName());
+                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, firstQuota.getUrl());
                         externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, true);
                         externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
                         startActivity(externalWebViewIntent);
@@ -748,7 +747,7 @@ public abstract class DrawerActivity extends ToolbarActivity
                     DisplayUtils.downloadIcon(getUserAccountManager(),
                                               clientFactory,
                                               this,
-                                              firstQuota.iconUrl,
+                                              firstQuota.getIconUrl(),
                                               target,
                                               R.drawable.ic_link,
                                               size,
@@ -871,7 +870,7 @@ public abstract class DrawerActivity extends ToolbarActivity
 
             for (final ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.LINK)) {
                 int id = mNavigationView.getMenu().add(R.id.drawer_menu_external_links,
-                                                       MENU_ITEM_EXTERNAL_LINK + link.id, MENU_ORDER_EXTERNAL_LINKS, link.name)
+                                                       MENU_ITEM_EXTERNAL_LINK + link.getId(), MENU_ORDER_EXTERNAL_LINKS, link.getName())
                     .setCheckable(true).getItemId();
 
                 MenuSimpleTarget target = new MenuSimpleTarget<Drawable>(id) {
@@ -890,7 +889,7 @@ public abstract class DrawerActivity extends ToolbarActivity
                 DisplayUtils.downloadIcon(getUserAccountManager(),
                                           clientFactory,
                                           this,
-                                          link.iconUrl,
+                                          link.getIconUrl(),
                                           target,
                                           R.drawable.ic_link,
                                           size,

+ 7 - 8
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -95,11 +95,11 @@ import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
 import com.owncloud.android.ui.events.SearchEvent;
 import com.owncloud.android.ui.events.SyncEventFinished;
 import com.owncloud.android.ui.events.TokenPushEvent;
-import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.FileDetailFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.GalleryFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
+import com.owncloud.android.ui.fragment.SearchType;
 import com.owncloud.android.ui.fragment.TaskRetainerFragment;
 import com.owncloud.android.ui.fragment.UnifiedSearchFragment;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
@@ -127,7 +127,6 @@ import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
-import org.parceler.Parcels;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -522,14 +521,14 @@ public class FileDisplayActivity extends FileActivity
             if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
                 setIntent(intent);
 
-                SearchEvent searchEvent = Parcels.unwrap(intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT));
+                SearchEvent searchEvent = intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT);
                 if (searchEvent != null) {
-                    if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.searchType)) {
+                    if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.getSearchType())) {
                         Log_OC.d(this, "Switch to photo search fragment");
 
                         GalleryFragment photoFragment = new GalleryFragment();
                         Bundle bundle = new Bundle();
-                        bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
+                        bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, searchEvent);
                         photoFragment.setArguments(bundle);
                         setLeftFragment(photoFragment);
                     } else {
@@ -537,7 +536,7 @@ public class FileDisplayActivity extends FileActivity
 
                         OCFileListFragment photoFragment = new OCFileListFragment();
                         Bundle bundle = new Bundle();
-                        bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
+                        bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, searchEvent);
                         photoFragment.setArguments(bundle);
                         setLeftFragment(photoFragment);
                     }
@@ -1451,7 +1450,7 @@ public class FileDisplayActivity extends FileActivity
                                                               R.drawable.ic_list_empty_folder,
                                                               true);
                 } else {
-                    ocFileListFragment.setEmptyListMessage(ExtendedListFragment.SearchType.NO_SEARCH);
+                    ocFileListFragment.setEmptyListMessage(SearchType.NO_SEARCH);
                 }
             }
         } else {
@@ -2399,7 +2398,7 @@ public class FileDisplayActivity extends FileActivity
 
     @Subscribe(threadMode = ThreadMode.BACKGROUND)
     public void onMessageEvent(final SearchEvent event) {
-        if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.searchType) {
+        if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.getSearchType()) {
             Log_OC.d(this, "Switch to photo search fragment");
 
             setLeftFragment(new GalleryFragment());

+ 2 - 3
src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java

@@ -62,7 +62,6 @@ import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
-import org.parceler.Parcels;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -168,7 +167,7 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
         if (resultCode == KEY_DELETE_CODE && data != null) {
             Bundle bundle = data.getExtras();
             if (bundle != null && bundle.containsKey(UserInfoActivity.KEY_ACCOUNT)) {
-                final Account account = Parcels.unwrap(bundle.getParcelable(UserInfoActivity.KEY_ACCOUNT));
+                final Account account = bundle.getParcelable(UserInfoActivity.KEY_ACCOUNT);
                 if (account != null) {
                     User user = accountManager.getUser(account.name).orElseThrow(RuntimeException::new);
                     accountName = account.name;
@@ -477,7 +476,7 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
         OwnCloudAccount oca = user.toOwnCloudAccount();
         intent.putExtra(UserInfoActivity.KEY_ACCOUNT, user);
         intent.putExtra(KEY_DISPLAY_NAME, oca.getDisplayName());
-        intent.putExtra(KEY_USER_DATA, Parcels.wrap(userInfo));
+        intent.putExtra(KEY_USER_DATA, userInfo);
         startActivityForResult(intent, KEY_USER_INFO_REQUEST_CODE);
     }
 

+ 6 - 6
src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

@@ -964,17 +964,17 @@ public class SettingsActivity extends ThemedPreferenceActivity
             for (final ExternalLink link : externalLinksProvider.getExternalLink(ExternalLinkType.SETTINGS)) {
 
                 // only add if it does not exist, in case activity is re-used
-                if (findPreference(link.id.toString()) == null) {
+                if (findPreference(String.valueOf(link.getId())) == null) {
                     Preference p = new Preference(this);
-                    p.setTitle(link.name);
-                    p.setKey(link.id.toString());
+                    p.setTitle(link.getName());
+                    p.setKey(String.valueOf(link.getId()));
 
                     p.setOnPreferenceClickListener(preference -> {
                         Intent externalWebViewIntent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
-                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, link.name);
-                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, link.url);
+                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TITLE, link.getName());
+                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, link.getUrl());
                         externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
-                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, link.id);
+                        externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, link.getId());
                         startActivity(externalWebViewIntent);
 
                         return true;

+ 3 - 4
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -66,7 +66,6 @@ import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
-import org.parceler.Parcels;
 
 import java.util.LinkedList;
 import java.util.List;
@@ -118,9 +117,9 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
         }
 
         if (savedInstanceState != null && savedInstanceState.containsKey(KEY_USER_DATA)) {
-            userInfo = Parcels.unwrap(savedInstanceState.getParcelable(KEY_USER_DATA));
+            userInfo = savedInstanceState.getParcelable(KEY_USER_DATA);
         } else if (bundle.containsKey(KEY_ACCOUNT)) {
-            userInfo = Parcels.unwrap(bundle.getParcelable(KEY_USER_DATA));
+            userInfo = bundle.getParcelable(KEY_USER_DATA);
         }
 
         mCurrentAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.user_icon_radius);
@@ -352,7 +351,7 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
     protected void onSaveInstanceState(@NonNull Bundle outState) {
         super.onSaveInstanceState(outState);
         if (userInfo != null) {
-            outState.putParcelable(KEY_USER_DATA, Parcels.wrap(userInfo));
+            outState.putParcelable(KEY_USER_DATA, userInfo);
         }
     }
 

+ 8 - 8
src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

@@ -75,7 +75,7 @@ import com.owncloud.android.operations.RemoteOperationFailedException;
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.ui.AvatarGroupLayout;
 import com.owncloud.android.ui.activity.ComponentsGetter;
-import com.owncloud.android.ui.fragment.ExtendedListFragment;
+import com.owncloud.android.ui.fragment.SearchType;
 import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
 import com.owncloud.android.ui.preview.PreviewTextFragment;
 import com.owncloud.android.utils.BitmapUtils;
@@ -865,7 +865,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
     }
 
     public void setData(List<Object> objects,
-                        ExtendedListFragment.SearchType searchType,
+                        SearchType searchType,
                         FileDataStorageManager storageManager,
                         @Nullable OCFile folder,
                         boolean clear) {
@@ -903,17 +903,17 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
 
         // early exit
         if (objects.size() > 0 && mStorageManager != null) {
-            if (searchType == ExtendedListFragment.SearchType.SHARED_FILTER) {
+            if (searchType == SearchType.SHARED_FILTER) {
                 parseShares(objects);
             } else {
-                if (searchType != ExtendedListFragment.SearchType.GALLERY_SEARCH) {
+                if (searchType != SearchType.GALLERY_SEARCH) {
                     parseVirtuals(objects, searchType);
                 }
             }
         }
 
-        if (searchType != ExtendedListFragment.SearchType.GALLERY_SEARCH &&
-            searchType != ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH) {
+        if (searchType != SearchType.GALLERY_SEARCH &&
+            searchType != SearchType.RECENTLY_MODIFIED_SEARCH) {
             FileSortOrder sortOrder = preferences.getSortOrderByFolder(folder);
             mFiles = sortOrder.sortCloudFiles(mFiles);
         } else {
@@ -971,7 +971,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
         mStorageManager.saveShares(shares);
     }
 
-    private void parseVirtuals(List<Object> objects, ExtendedListFragment.SearchType searchType) {
+    private void parseVirtuals(List<Object> objects, SearchType searchType) {
         VirtualFolderType type;
         boolean onlyMedia = false;
 
@@ -1007,7 +1007,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             try {
                 ocFile = mStorageManager.saveFileWithParent(ocFile, activity);
 
-                if (ExtendedListFragment.SearchType.GALLERY_SEARCH != searchType) {
+                if (SearchType.GALLERY_SEARCH != searchType) {
                     // also sync folder content
                     if (ocFile.isFolder()) {
                         long currentSyncTime = System.currentTimeMillis();

+ 4 - 2
src/main/java/com/owncloud/android/ui/adapter/TemplateAdapter.java

@@ -41,6 +41,8 @@ import com.owncloud.android.utils.MimeTypeUtil;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.glide.CustomGlideStreamLoader;
 
+import java.util.ArrayList;
+
 import androidx.annotation.NonNull;
 import androidx.recyclerview.widget.RecyclerView;
 
@@ -87,7 +89,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
 
     @Override
     public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
-        holder.setData(templateList.getTemplateList().get(position));
+        holder.setData(new ArrayList<>(templateList.getTemplates().values()).get(position));
     }
 
     public void setTemplateList(TemplateList templateList) {
@@ -105,7 +107,7 @@ public class TemplateAdapter extends RecyclerView.Adapter<TemplateAdapter.ViewHo
 
     @Override
     public int getItemCount() {
-        return templateList.getTemplateList().size();
+        return templateList.getTemplates().size();
     }
 
     public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

+ 2 - 2
src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java

@@ -32,8 +32,8 @@ import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
 import com.owncloud.android.lib.resources.files.model.RemoteFile;
 import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.operations.RefreshFolderOperation;
-import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.GalleryFragment;
+import com.owncloud.android.ui.fragment.SearchType;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import java.lang.ref.WeakReference;
@@ -118,7 +118,7 @@ public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.R
             photoFragment.searchCompleted(result.emptySearch, result.lastTimestamp);
 
             if (!result.success) {
-                photoFragment.setEmptyListMessage(ExtendedListFragment.SearchType.GALLERY_SEARCH);
+                photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH);
             }
         }
     }

+ 1 - 1
src/main/java/com/owncloud/android/ui/asynctasks/TextEditorLoadUrlTask.java

@@ -61,7 +61,7 @@ public class TextEditorLoadUrlTask extends AsyncTask<Void, Void, String> {
             return "";
         }
 
-        RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(file.getRemotePath(), editor.id)
+        RemoteOperationResult result = new DirectEditingOpenFileRemoteOperation(file.getRemotePath(), editor.getId())
             .execute(account, editorWebViewWeakReference.get());
 
 

+ 2 - 4
src/main/java/com/owncloud/android/ui/dialog/ChooseRichDocumentsTemplateDialogFragment.java

@@ -60,8 +60,6 @@ import com.owncloud.android.utils.theme.ThemeButtonUtils;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 import com.owncloud.android.utils.theme.ThemeTextInputUtils;
 
-import org.parceler.Parcels;
-
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.List;
@@ -240,7 +238,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
     private void prefillFilenameIfEmpty(Template template) {
         String name = binding.filename.getText().toString();
         if (name.isEmpty() || name.equalsIgnoreCase(DOT + template.getExtension())) {
-            binding.filename.setText(String.format("%s.%s", template.name, template.extension));
+            binding.filename.setText(String.format("%s.%s", template.getName(), template.getExtension()));
         }
         binding.filename.setSelection(binding.filename.getText().toString().lastIndexOf('.'));
     }
@@ -317,7 +315,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
                     collaboraWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, url);
                     collaboraWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_FILE, file);
                     collaboraWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
-                    collaboraWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TEMPLATE, Parcels.wrap(template));
+                    collaboraWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_TEMPLATE, template);
                     fragment.startActivity(collaboraWebViewIntent);
 
                     fragment.dismiss();

+ 5 - 5
src/main/java/com/owncloud/android/ui/dialog/ChooseTemplateDialogFragment.java

@@ -247,7 +247,7 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
     private void prefillFilenameIfEmpty(Template template) {
         String name = binding.filename.getText().toString();
         if (name.isEmpty() || name.equalsIgnoreCase(DOT + template.getExtension())) {
-            binding.filename.setText(String.format("%s.%s", template.title, template.extension));
+            binding.filename.setText(String.format("%s.%s", template.getTitle(), template.getExtension()));
             name = binding.filename.getText().toString();
             int dotPos = name.lastIndexOf('.');
             binding.filename.setSelection((dotPos != -1) ? dotPos : name.length());
@@ -416,14 +416,14 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
             ChooseTemplateDialogFragment fragment = chooseTemplateDialogFragmentWeakReference.get();
 
             if (fragment != null && fragment.isAdded()) {
-                if (templateList.templates.isEmpty()) {
+                if (templateList.getTemplates().isEmpty()) {
                     DisplayUtils.showSnackMessage(fragment.binding.list, R.string.error_retrieving_templates);
                 } else {
-                    if (templateList.templates.size() == SINGLE_TEMPLATE) {
-                        fragment.onTemplateChosen(templateList.templates.values().iterator().next());
+                    if (templateList.getTemplates().size() == SINGLE_TEMPLATE) {
+                        fragment.onTemplateChosen(templateList.getTemplates().values().iterator().next());
                         fragment.binding.list.setVisibility(View.GONE);
                     } else {
-                        String name = DOT + templateList.templates.values().iterator().next().getExtension();
+                        String name = DOT + templateList.getTemplates().values().iterator().next().getExtension();
                         fragment.binding.filename.setText(name);
                         fragment.binding.helperText.setVisibility(View.VISIBLE);
                     }

+ 0 - 58
src/main/java/com/owncloud/android/ui/events/SearchEvent.java

@@ -1,58 +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 <http://www.gnu.org/licenses/>.
- */
-package com.owncloud.android.ui.events;
-
-import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
-
-import org.parceler.Parcel;
-
-/**
- * Search event
- */
-@Parcel
-public class SearchEvent {
-    public String searchQuery;
-    public SearchRemoteOperation.SearchType searchType;
-
-    public SearchEvent(String searchQuery, SearchRemoteOperation.SearchType searchType) {
-        this.searchQuery = searchQuery;
-        this.searchType = searchType;
-    }
-
-    public SearchEvent() {
-        // empty constructor to create empty object
-    }
-
-    public String getSearchQuery() {
-        return this.searchQuery;
-    }
-
-    public SearchRemoteOperation.SearchType getSearchType() {
-        return this.searchType;
-    }
-
-    public void setSearchQuery(String searchQuery) {
-        this.searchQuery = searchQuery;
-    }
-
-    public void setSearchType(SearchRemoteOperation.SearchType searchType) {
-        this.searchType = searchType;
-    }
-}

+ 9 - 23
src/main/java/com/owncloud/android/ui/events/SyncEventFinished.java → src/main/java/com/owncloud/android/ui/events/SearchEvent.kt

@@ -17,29 +17,15 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package com.owncloud.android.ui.events;
+package com.owncloud.android.ui.events
 
-import android.content.Intent;
+import android.os.Parcelable
+import com.owncloud.android.lib.resources.files.SearchRemoteOperation
+import kotlinx.parcelize.Parcelize
 
-import org.parceler.Parcel;
-
-@Parcel
-public class SyncEventFinished {
-    public Intent intent;
-
-    public SyncEventFinished(Intent intent) {
-        this.intent = intent;
-    }
-
-    public SyncEventFinished() {
-        // empty constructor
-    }
-
-    public Intent getIntent() {
-        return intent;
-    }
+/**
+ * Search event
+ */
 
-    public void setIntent(Intent intent) {
-        this.intent = intent;
-    }
-}
+@Parcelize
+data class SearchEvent(val searchQuery: String, val searchType: SearchRemoteOperation.SearchType) : Parcelable

+ 27 - 0
src/main/java/com/owncloud/android/ui/events/SyncEventFinished.kt

@@ -0,0 +1,27 @@
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.ui.events
+
+import android.content.Intent
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+@Parcelize
+data class SyncEventFinished(val intent: Intent) : Parcelable

+ 1 - 14
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -75,7 +75,6 @@ import com.owncloud.android.utils.theme.ThemeLayoutUtils;
 import com.owncloud.android.utils.theme.ThemeToolbarUtils;
 
 import org.greenrobot.eventbus.EventBus;
-import org.parceler.Parcel;
 
 import java.util.ArrayList;
 
@@ -145,18 +144,6 @@ public class ExtendedListFragment extends Fragment implements
 
     private ListFragmentBinding binding;
 
-    @Parcel
-    public enum SearchType {
-        NO_SEARCH,
-        REGULAR_FILTER,
-        FILE_SEARCH,
-        FAVORITE_SEARCH,
-        GALLERY_SEARCH,
-        RECENTLY_MODIFIED_SEARCH,
-        // not a real filter, but nevertheless
-        SHARED_FILTER
-    }
-
     protected void setRecyclerViewAdapter(RecyclerView.Adapter recyclerViewAdapter) {
         mRecyclerView.setAdapter(recyclerViewAdapter);
     }
@@ -270,7 +257,7 @@ public class ExtendedListFragment extends Fragment implements
                                                    R.drawable.ic_list_empty_folder,
                                                    true);
                         } else {
-                            setEmptyListMessage(ExtendedListFragment.SearchType.NO_SEARCH);
+                            setEmptyListMessage(SearchType.NO_SEARCH);
                         }
                     }
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java

@@ -149,7 +149,7 @@ public class GalleryFragment extends OCFileListFragment {
         mAdapter.notifyDataSetChanged();
 
         if (mAdapter.isEmpty()) {
-            setEmptyListMessage(ExtendedListFragment.SearchType.GALLERY_SEARCH);
+            setEmptyListMessage(SearchType.GALLERY_SEARCH);
         }
 
         if (emptySearch && getAdapter().getItemCount() > 0) {

+ 30 - 28
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -112,7 +112,6 @@ import org.apache.commons.httpclient.HttpStatus;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
-import org.parceler.Parcels;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -137,6 +136,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
 import androidx.recyclerview.widget.RecyclerView;
 
 import static com.owncloud.android.datamodel.OCFile.ROOT_PATH;
+import static com.owncloud.android.ui.fragment.SearchType.*;
 import static com.owncloud.android.utils.DisplayUtils.openSortingOrderDialogFragment;
 
 /**
@@ -223,8 +223,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
         mMultiChoiceModeListener = new MultiChoiceModeListener();
 
         if (savedInstanceState != null) {
-            currentSearchType = Parcels.unwrap(savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE));
-            searchEvent = Parcels.unwrap(savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT));
+            currentSearchType = savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE);
+            searchEvent = savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT);
             mFile = savedInstanceState.getParcelable(KEY_FILE);
         }
 
@@ -240,7 +240,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
         Intent intent = getActivity().getIntent();
 
         if (intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT) != null) {
-            searchEvent = Parcels.unwrap(intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT));
+            searchEvent = intent.getParcelableExtra(OCFileListFragment.SEARCH_EVENT);
         }
 
         if (isSearchEventSet(searchEvent)) {
@@ -284,13 +284,13 @@ public class OCFileListFragment extends ExtendedListFragment implements
         View v = super.onCreateView(inflater, container, savedInstanceState);
 
         if (savedInstanceState != null
-                && Parcels.unwrap(savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE)) != null &&
-                Parcels.unwrap(savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT)) != null) {
+                && savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE) != null &&
+                savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT) != null) {
             searchFragment = true;
-            currentSearchType = Parcels.unwrap(savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE));
-            searchEvent = Parcels.unwrap(savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT));
+            currentSearchType = savedInstanceState.getParcelable(KEY_CURRENT_SEARCH_TYPE);
+            searchEvent = savedInstanceState.getParcelable(OCFileListFragment.SEARCH_EVENT);
         } else {
-            currentSearchType = SearchType.NO_SEARCH;
+            currentSearchType = NO_SEARCH;
         }
 
         Bundle args = getArguments();
@@ -372,7 +372,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
             if (getArguments() == null) {
                 searchEvent = null;
             } else {
-                searchEvent = Parcels.unwrap(getArguments().getParcelable(OCFileListFragment.SEARCH_EVENT));
+                searchEvent = getArguments().getParcelable(OCFileListFragment.SEARCH_EVENT);
             }
         }
         prepareCurrentSearch(searchEvent);
@@ -408,19 +408,19 @@ public class OCFileListFragment extends ExtendedListFragment implements
 
             switch (event.getSearchType()) {
                 case FILE_SEARCH:
-                    currentSearchType = SearchType.FILE_SEARCH;
+                    currentSearchType = FILE_SEARCH;
                     break;
 
                 case FAVORITE_SEARCH:
-                    currentSearchType = SearchType.FAVORITE_SEARCH;
+                    currentSearchType = FAVORITE_SEARCH;
                     break;
 
                 case RECENTLY_MODIFIED_SEARCH:
-                    currentSearchType = SearchType.RECENTLY_MODIFIED_SEARCH;
+                    currentSearchType = RECENTLY_MODIFIED_SEARCH;
                     break;
 
                 case SHARED_FILTER:
-                    currentSearchType = SearchType.SHARED_FILTER;
+                    currentSearchType = SHARED_FILTER;
                     break;
 
                 default:
@@ -487,8 +487,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
             fileDisplayActivity.getFileOperationsHelper()
                 .scanFromCamera(fileDisplayActivity, FileDisplayActivity.REQUEST_CODE__UPLOAD_SCAN_DOC_FROM_CAMERA);
         } else {
-            Toast.makeText(getContext(), 
-                           getString(R.string.error_starting_direct_camera_upload), 
+            Toast.makeText(getContext(),
+                           getString(R.string.error_starting_direct_camera_upload),
                            Toast.LENGTH_SHORT)
                 .show();
         }
@@ -781,9 +781,9 @@ public class OCFileListFragment extends ExtendedListFragment implements
 
         outState.putParcelable(KEY_FILE, mFile);
         if (searchFragment) {
-            outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, Parcels.wrap(currentSearchType));
+            outState.putParcelable(KEY_CURRENT_SEARCH_TYPE, currentSearchType);
             if (isSearchEventSet(searchEvent)) {
-                outState.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
+                outState.putParcelable(OCFileListFragment.SEARCH_EVENT, searchEvent);
             }
         }
         mMultiChoiceModeListener.storeStateIn(outState);
@@ -1456,7 +1456,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(ChangeMenuEvent changeMenuEvent) {
         searchFragment = false;
-        searchEvent = new SearchEvent();
+        searchEvent = null;
 
         menuItemAddRemoveValue = MenuItemAddRemove.ADD_GRID_AND_SORT_WITH_SEARCH;
         if (getActivity() != null) {
@@ -1500,7 +1500,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
         super.onViewStateRestored(savedInstanceState);
 
         if (savedInstanceState != null) {
-            searchEvent = Parcels.unwrap(savedInstanceState.getParcelable(SEARCH_EVENT));
+            searchEvent = savedInstanceState.getParcelable(SEARCH_EVENT);
         }
     }
 
@@ -1510,7 +1510,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
     }
 
     private void handleSearchEvent(SearchEvent event) {
-        if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.searchType) {
+        if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.getSearchType()) {
             return;
         }
 
@@ -1741,13 +1741,15 @@ public class OCFileListFragment extends ExtendedListFragment implements
     }
 
     private boolean isSearchEventSet(SearchEvent event) {
-        return event != null &&
-            event.getSearchType() != null &&
-            (!TextUtils.isEmpty(event.getSearchQuery()) ||
-                event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH ||
-                event.searchType == SearchRemoteOperation.SearchType.SHARED_FILTER ||
-                event.searchType == SearchRemoteOperation.SearchType.FAVORITE_SEARCH ||
-                event.searchType == SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH);
+        if (event == null) {
+            return false;
+        }
+        SearchRemoteOperation.SearchType searchType = event.getSearchType();
+        return !TextUtils.isEmpty(event.getSearchQuery()) ||
+            searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH ||
+            searchType == SearchRemoteOperation.SearchType.SHARED_FILTER ||
+            searchType == SearchRemoteOperation.SearchType.FAVORITE_SEARCH ||
+            searchType == SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH;
     }
 
     private void syncAndCheckFiles(Collection<OCFile> files) {

+ 17 - 0
src/main/java/com/owncloud/android/ui/fragment/SearchType.kt

@@ -0,0 +1,17 @@
+package com.owncloud.android.ui.fragment
+
+import android.os.Parcelable
+import kotlinx.parcelize.Parcelize
+
+@Parcelize
+enum class SearchType : Parcelable {
+    NO_SEARCH,
+    REGULAR_FILTER,
+    FILE_SEARCH,
+    FAVORITE_SEARCH,
+    GALLERY_SEARCH,
+    RECENTLY_MODIFIED_SEARCH,
+
+    // not a real filter, but nevertheless
+    SHARED_FILTER
+}

+ 2 - 2
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -78,7 +78,6 @@ import com.owncloud.android.utils.svg.SvgDrawableTranscoder;
 import com.owncloud.android.utils.theme.ThemeColorUtils;
 
 import org.greenrobot.eventbus.EventBus;
-import org.parceler.Parcels;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -100,6 +99,7 @@ import androidx.annotation.Nullable;
 import androidx.annotation.StringRes;
 import androidx.appcompat.widget.AppCompatDrawableManager;
 import androidx.core.content.res.ResourcesCompat;
+import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 
@@ -613,7 +613,7 @@ public final class DisplayUtils {
             EventBus.getDefault().post(event);
         } else {
             Intent recentlyAddedIntent = new Intent(activity.getBaseContext(), FileDisplayActivity.class);
-            recentlyAddedIntent.putExtra(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(event));
+            recentlyAddedIntent.putExtra(OCFileListFragment.SEARCH_EVENT, event);
             recentlyAddedIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
             activity.startActivity(recentlyAddedIntent);
         }