housekeeping: removed any use of org.jetbrains.annotations

(including a java-to-kotlin rewrite)

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-17 14:21:21 +02:00
parent 7563dc5fba
commit 2ffdd5199c
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
19 changed files with 413 additions and 527 deletions

View file

@ -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<ReadFilesystemOperation>() {
@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<BrowserFile> browserFileList = (List<BrowserFile>) davResponse.data;
@ -479,7 +478,7 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM
}
@Override
public void onError(Throwable e) {
public void onError(@NonNull Throwable e) {
}
});

View file

@ -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);

View file

@ -1,79 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 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.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;
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -1,81 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
* @author Marcel Hibbe
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
*
* 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.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;
}
}
}

View file

@ -0,0 +1,63 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Marcel Hibbe
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -1,79 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 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.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;
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -1,79 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 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.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;
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -1,79 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 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.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;
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -1,79 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 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.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;
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017-2019 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.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)
}
}

View file

@ -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<RoomOverall>() {
@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);
}

View file

@ -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);

View file

@ -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<UserProfileOverall>() {
@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<UserProfileFieldsOverall>() {
@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<GenericOverall>() {
@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<GenericOverall>() {
@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<GenericOverall>() {
@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);
}

View file

@ -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);

View file

@ -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<AdvancedUserItem> 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<UserEntity>() {
@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);
}