From 2ffdd5199cc650dbcb223581588d492e30a9eecd Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Mon, 17 May 2021 14:21:21 +0200 Subject: [PATCH] housekeeping: removed any use of org.jetbrains.annotations (including a java-to-kotlin rewrite) Signed-off-by: Andy Scherzinger --- .../MagicPreviewMessageViewHolder.java | 9 +-- .../controllers/BrowserController.java | 3 +- .../models/properties/NCEncrypted.java | 79 ------------------ .../models/properties/NCEncrypted.kt | 61 ++++++++++++++ .../models/properties/NCPermission.java | 81 ------------------- .../models/properties/NCPermission.kt | 63 +++++++++++++++ .../models/properties/NCPreview.java | 79 ------------------ .../models/properties/NCPreview.kt | 61 ++++++++++++++ .../models/properties/OCFavorite.java | 79 ------------------ .../models/properties/OCFavorite.kt | 61 ++++++++++++++ .../filebrowser/models/properties/OCId.java | 79 ------------------ .../filebrowser/models/properties/OCId.kt | 61 ++++++++++++++ .../filebrowser/models/properties/OCSize.java | 79 ------------------ .../filebrowser/models/properties/OCSize.kt | 61 ++++++++++++++ .../CallNotificationController.java | 7 +- .../talk/controllers/LockedController.java | 23 +++--- .../talk/controllers/ProfileController.java | 34 ++++---- .../ServerSelectionController.java | 5 +- .../dialog/ChooseAccountDialogFragment.java | 15 ++-- 19 files changed, 413 insertions(+), 527 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.java create mode 100644 app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.kt diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java index 216310853..75436ef02 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java @@ -54,8 +54,6 @@ import com.nextcloud.talk.utils.DrawableUtils; import com.nextcloud.talk.utils.bundle.BundleKeys; import com.stfalcon.chatkit.messages.MessageHolders; -import org.jetbrains.annotations.NotNull; - import java.io.File; import java.util.List; import java.util.concurrent.Callable; @@ -75,6 +73,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import io.reactivex.Single; import io.reactivex.SingleObserver; +import io.reactivex.annotations.NonNull; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; import okhttp3.OkHttpClient; @@ -459,12 +458,12 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM }).observeOn(Schedulers.io()) .subscribe(new SingleObserver() { @Override - public void onSubscribe(Disposable d) { + public void onSubscribe(@NonNull Disposable d) { } @Override - public void onSuccess(@NotNull ReadFilesystemOperation readFilesystemOperation) { + public void onSuccess(@NonNull ReadFilesystemOperation readFilesystemOperation) { DavResponse davResponse = readFilesystemOperation.readRemotePath(); if (davResponse.data != null) { List browserFileList = (List) davResponse.data; @@ -479,7 +478,7 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM } @Override - public void onError(Throwable e) { + public void onError(@NonNull Throwable e) { } }); diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/controllers/BrowserController.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/controllers/BrowserController.java index 379968e2d..16e581041 100644 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/controllers/BrowserController.java +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/controllers/BrowserController.java @@ -45,7 +45,6 @@ import com.nextcloud.talk.models.database.UserEntity; import com.nextcloud.talk.utils.bundle.BundleKeys; import com.nextcloud.talk.utils.database.user.UserUtils; -import org.jetbrains.annotations.NotNull; import org.parceler.Parcel; import org.parceler.Parcels; @@ -117,7 +116,7 @@ public abstract class BrowserController extends BaseController implements Listin selectedPaths = Collections.synchronizedSet(new TreeSet<>()); } - @NotNull + @NonNull @Override protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { return inflater.inflate(R.layout.controller_browser, container, false); diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.java deleted file mode 100644 index 457f8b84e..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class NCEncrypted implements Property { - public static final Name NAME = new Name(DavUtils.NC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_IS_ENCRYPTED); - - private boolean ncEncrypted; - - private NCEncrypted(boolean isEncrypted) { - ncEncrypted = isEncrypted; - } - - public boolean isNcEncrypted() { - return this.ncEncrypted; - } - - public void setNcEncrypted(boolean ncEncrypted) { - this.ncEncrypted = ncEncrypted; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new NCEncrypted("1".equals(text)); - } - } catch (IOException | XmlPullParserException e) { - Log.e("NCEncrypted", "failed to create property", e); - } - - return new NCEncrypted(false); - } - - @NotNull - @Override - public Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.kt new file mode 100644 index 000000000..adf28329e --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCEncrypted.kt @@ -0,0 +1,61 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class NCEncrypted private constructor(var isNcEncrypted: Boolean) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return NCEncrypted("1" == text) + } + } catch (e: IOException) { + Log.e("NCEncrypted", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("NCEncrypted", "failed to create property", e) + } + return NCEncrypted(false) + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME: Property.Name = Property.Name(DavUtils.NC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_IS_ENCRYPTED) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.java deleted file mode 100644 index c40c4b679..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * @author Marcel Hibbe - * Copyright (C) 2021 Marcel Hibbe - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class NCPermission implements Property { - public static final Name NAME = new Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_PERMISSIONS); - - private String ncPermission; - - private NCPermission(String p) { - ncPermission = p; - } - - public String getNcPermission() { - return this.ncPermission; - } - - public void setNcPermission(String ncPermission) { - this.ncPermission = ncPermission; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new NCPermission(text); - } - } catch (IOException | XmlPullParserException e) { - Log.e("NCPermission", "failed to create property", e); - } - - return new NCPermission(""); - } - - @NotNull - @Override - public Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.kt new file mode 100644 index 000000000..1b888183f --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPermission.kt @@ -0,0 +1,63 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2021 Marcel Hibbe + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class NCPermission private constructor(var ncPermission: String?) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return NCPermission(text) + } + } catch (e: IOException) { + Log.e("NCPermission", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("NCPermission", "failed to create property", e) + } + return NCPermission("") + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME: Property.Name = Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_PERMISSIONS) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.java deleted file mode 100644 index b65bb4121..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class NCPreview implements Property { - public static final Property.Name NAME = new Property.Name(DavUtils.NC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_HAS_PREVIEW); - - private boolean ncPreview; - - private NCPreview(boolean hasPreview) { - ncPreview = hasPreview; - } - - public boolean isNcPreview() { - return this.ncPreview; - } - - public void setNcPreview(boolean ncPreview) { - this.ncPreview = ncPreview; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new NCPreview(Boolean.parseBoolean(text)); - } - } catch (IOException | XmlPullParserException e) { - Log.e("NCPreview", "failed to create property", e); - } - - return new OCFavorite(false); - } - - @NotNull - @Override - public Property.Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.kt new file mode 100644 index 000000000..a8bb67a6e --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/NCPreview.kt @@ -0,0 +1,61 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class NCPreview private constructor(var isNcPreview: Boolean) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return NCPreview(java.lang.Boolean.parseBoolean(text)) + } + } catch (e: IOException) { + Log.e("NCPreview", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("NCPreview", "failed to create property", e) + } + return OCFavorite(false) + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME: Property.Name = Property.Name(DavUtils.NC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_HAS_PREVIEW) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.java deleted file mode 100644 index 10dff0e4a..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class OCFavorite implements Property { - public static final Property.Name NAME = new Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_FAVORITE); - - private boolean ocFavorite; - - OCFavorite(boolean isFavorite) { - ocFavorite = isFavorite; - } - - public boolean isOcFavorite() { - return this.ocFavorite; - } - - public void setOcFavorite(boolean ocFavorite) { - this.ocFavorite = ocFavorite; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new OCFavorite("1".equals(text)); - } - } catch (IOException | XmlPullParserException e) { - Log.e("OCFavorite", "failed to create property", e); - } - - return new OCFavorite(false); - } - - @NotNull - @Override - public Property.Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.kt new file mode 100644 index 000000000..3094a786e --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCFavorite.kt @@ -0,0 +1,61 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class OCFavorite internal constructor(var isOcFavorite: Boolean) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return OCFavorite("1" == text) + } + } catch (e: IOException) { + Log.e("OCFavorite", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("OCFavorite", "failed to create property", e) + } + return OCFavorite(false) + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME: Property.Name = Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_FAVORITE) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.java deleted file mode 100644 index 87f58ce26..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class OCId implements Property { - public static final Name NAME = new Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_REMOTE_ID); - - private String ocId; - - private OCId(String id) { - ocId = id; - } - - public String getOcId() { - return this.ocId; - } - - public void setOcId(String ocId) { - this.ocId = ocId; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new OCId(text); - } - } catch (IOException | XmlPullParserException e) { - Log.e("OCId", "failed to create property", e); - } - - return new OCId(""); - } - - @NotNull - @Override - public Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.kt new file mode 100644 index 000000000..0eb92461b --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCId.kt @@ -0,0 +1,61 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class OCId private constructor(var ocId: String?) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return OCId(text) + } + } catch (e: IOException) { + Log.e("OCId", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("OCId", "failed to create property", e) + } + return OCId("") + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME: Property.Name = Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_REMOTE_ID) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.java b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.java deleted file mode 100644 index f2a0a2f96..000000000 --- a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -package com.nextcloud.talk.components.filebrowser.models.properties; - -import android.text.TextUtils; -import android.util.Log; - -import com.nextcloud.talk.components.filebrowser.webdav.DavUtils; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; - -import at.bitfire.dav4jvm.Property; -import at.bitfire.dav4jvm.PropertyFactory; -import at.bitfire.dav4jvm.XmlUtils; - -public class OCSize implements Property { - public static final Property.Name NAME = new Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_SIZE); - - private long ocSize; - - private OCSize(long size) { - ocSize = size; - } - - public long getOcSize() { - return this.ocSize; - } - - public void setOcSize(long ocSize) { - this.ocSize = ocSize; - } - - public static class Factory implements PropertyFactory { - - @Nullable - @Override - public Property create(@NotNull XmlPullParser xmlPullParser) { - try { - String text = XmlUtils.INSTANCE.readText(xmlPullParser); - if (!TextUtils.isEmpty(text)) { - return new OCSize(Long.parseLong(text)); - } - } catch (IOException | XmlPullParserException e) { - Log.e("OCSize", "failed to create property", e); - } - - return new OCSize(-1); - } - - @NotNull - @Override - public Name getName() { - return NAME; - } - } -} diff --git a/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.kt b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.kt new file mode 100644 index 000000000..32b0179ea --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/components/filebrowser/models/properties/OCSize.kt @@ -0,0 +1,61 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2021 Andy Scherzinger + * Copyright (C) 2017-2019 Mario Danic + * + * 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 . + */ + +package com.nextcloud.talk.components.filebrowser.models.properties + +import android.text.TextUtils +import android.util.Log +import at.bitfire.dav4jvm.Property +import at.bitfire.dav4jvm.PropertyFactory +import at.bitfire.dav4jvm.XmlUtils.readText +import com.nextcloud.talk.components.filebrowser.webdav.DavUtils +import org.xmlpull.v1.XmlPullParser +import org.xmlpull.v1.XmlPullParserException +import java.io.IOException + +class OCSize private constructor(var ocSize: Long) : Property { + + class Factory : PropertyFactory { + override fun create(parser: XmlPullParser): Property { + try { + val text = readText(parser) + if (!TextUtils.isEmpty(text)) { + return OCSize(text!!.toLong()) + } + } catch (e: IOException) { + Log.e("OCSize", "failed to create property", e) + } catch (e: XmlPullParserException) { + Log.e("OCSize", "failed to create property", e) + } + return OCSize(-1) + } + + override fun getName(): Property.Name { + return NAME + } + } + + companion object { + @JvmField + val NAME:Property. Name = Property.Name(DavUtils.OC_NAMESPACE, DavUtils.EXTENDED_PROPERTY_NAME_SIZE) + } +} diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java index 939b04eef..35ff72f70 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java @@ -79,7 +79,6 @@ import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import org.jetbrains.annotations.NotNull; import org.michaelevans.colorart.library.ColorArt; import org.parceler.Parcels; @@ -269,12 +268,12 @@ public class CallNotificationController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { disposablesList.add(d); } @Override - public void onNext(@NotNull RoomOverall roomOverall) { + public void onNext(@io.reactivex.annotations.NonNull RoomOverall roomOverall) { currentConversation = roomOverall.getOcs().data; runAllThings(); @@ -294,7 +293,7 @@ public class CallNotificationController extends BaseController { @SuppressLint("LongLogTag") @Override - public void onError(Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { Log.e(TAG, e.getMessage(), e); } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/LockedController.java b/app/src/main/java/com/nextcloud/talk/controllers/LockedController.java index 637d8eefe..c34c2cbe3 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/LockedController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/LockedController.java @@ -33,13 +33,7 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; -import androidx.biometric.BiometricPrompt; -import androidx.core.content.res.ResourcesCompat; -import androidx.fragment.app.FragmentActivity; -import autodagger.AutoInjector; -import butterknife.OnClick; + import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.controllers.base.BaseController; @@ -47,12 +41,19 @@ import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.SecurityUtils; import com.nextcloud.talk.utils.preferences.AppPreferences; -import org.jetbrains.annotations.NotNull; - -import javax.inject.Inject; import java.util.concurrent.Executor; import java.util.concurrent.Executors; +import javax.inject.Inject; + +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.biometric.BiometricPrompt; +import androidx.core.content.res.ResourcesCompat; +import androidx.fragment.app.FragmentActivity; +import autodagger.AutoInjector; +import butterknife.OnClick; + @AutoInjector(NextcloudTalkApplication.class) public class LockedController extends BaseController { public static final String TAG = "LockedController"; @@ -61,7 +62,7 @@ public class LockedController extends BaseController { @Inject AppPreferences appPreferences; - @NotNull + @NonNull @Override protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { return inflater.inflate(R.layout.controller_locked, container, false); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.java b/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.java index 96953dff9..fe6f87852 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ProfileController.java @@ -121,8 +121,8 @@ public class ProfileController extends BaseController { super(); } - @NotNull - protected View inflateView(@NotNull LayoutInflater inflater, @NotNull ViewGroup container) { + @NonNull + protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { return inflater.inflate(R.layout.controller_profile, container, false); } @@ -272,17 +272,17 @@ public class ProfileController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { } @Override - public void onNext(@NotNull UserProfileOverall userProfileOverall) { + public void onNext(@io.reactivex.annotations.NonNull UserProfileOverall userProfileOverall) { userInfo = userProfileOverall.getOcs().getData(); showUserProfile(); } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { setErrorMessageForMultiList( getActivity().getString(R.string.userinfo_no_info_headline), getActivity().getString(R.string.userinfo_error_text), @@ -348,11 +348,11 @@ public class ProfileController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { } @Override - public void onNext(@NotNull UserProfileFieldsOverall userProfileFieldsOverall) { + public void onNext(@io.reactivex.annotations.NonNull UserProfileFieldsOverall userProfileFieldsOverall) { editableFields = userProfileFieldsOverall.getOcs().getData(); getActivity().invalidateOptionsMenu(); @@ -360,7 +360,7 @@ public class ProfileController extends BaseController { } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { edit = false; } @@ -451,11 +451,11 @@ public class ProfileController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { } @Override - public void onNext(@NotNull GenericOverall userProfileOverall) { + public void onNext(@io.reactivex.annotations.NonNull GenericOverall userProfileOverall) { Log.d(TAG, "Successfully saved: " + item.text + " as " + item.field); if (item.field == Field.DISPLAYNAME) { @@ -464,7 +464,7 @@ public class ProfileController extends BaseController { } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { item.text = userInfo.getValueByField(item.field); Toast.makeText(getApplicationContext(), String.format(getResources().getString(R.string.failed_to_save), @@ -601,16 +601,16 @@ public class ProfileController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { } @Override - public void onNext(@NotNull GenericOverall genericOverall) { + public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOverall) { DisplayUtils.loadAvatarImage(currentUser, getActivity().findViewById(R.id.avatar_image), true); } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show(); } @@ -633,16 +633,16 @@ public class ProfileController extends BaseController { .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { } @Override - public void onNext(@NotNull GenericOverall userProfileOverall) { + public void onNext(@io.reactivex.annotations.NonNull GenericOverall userProfileOverall) { Log.d(TAG, "Successfully saved: " + item.scope + " as " + item.field); } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { item.scope = userInfo.getScopeByField(item.field); Log.e(TAG, "Failed to saved: " + item.scope + " as " + item.field, e); } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.java b/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.java index f957ec38e..9974b0fb6 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.java @@ -58,9 +58,6 @@ import javax.inject.Inject; import androidx.annotation.NonNull; import androidx.core.content.res.ResourcesCompat; - -import org.jetbrains.annotations.NotNull; - import autodagger.AutoInjector; import butterknife.BindView; import butterknife.OnClick; @@ -99,7 +96,7 @@ public class ServerSelectionController extends BaseController { private Disposable statusQueryDisposable; - @NotNull + @NonNull @Override protected View inflateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { return inflater.inflate(R.layout.controller_server_selection, container, false); diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java index 391ccfb45..2c710483b 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/ChooseAccountDialogFragment.java @@ -49,14 +49,13 @@ import com.nextcloud.talk.utils.ApiUtils; import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.database.user.UserUtils; -import org.jetbrains.annotations.NotNull; - import java.net.CookieManager; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; +import androidx.annotation.NonNull; import androidx.fragment.app.DialogFragment; import androidx.recyclerview.widget.LinearLayoutManager; import autodagger.AutoInjector; @@ -82,7 +81,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { private final List userItems = new ArrayList<>(); @SuppressLint("InflateParams") - @NotNull + @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { binding = DialogChooseAccountBinding.inflate(LayoutInflater.from(requireContext())); @@ -92,7 +91,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { } @Override - public void onViewCreated(@NotNull View view, Bundle savedInstanceState) { + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this); @@ -183,7 +182,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { } @Override - public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return dialogView; } @@ -211,12 +210,12 @@ public class ChooseAccountDialogFragment extends DialogFragment { null) .subscribe(new Observer() { @Override - public void onSubscribe(@NotNull Disposable d) { + public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) { // unused at the moment } @Override - public void onNext(@NotNull UserEntity userEntity) { + public void onNext(@io.reactivex.annotations.NonNull UserEntity userEntity) { cookieManager.getCookieStore().removeAll(); userUtils.disableAllUsersWithoutId(userEntity.getId()); if (getActivity() != null) { @@ -227,7 +226,7 @@ public class ChooseAccountDialogFragment extends DialogFragment { } @Override - public void onError(@NotNull Throwable e) { + public void onError(@io.reactivex.annotations.NonNull Throwable e) { Log.w(TAG, "Error updating user", e); }