Merge pull request #1261 from nextcloud/codacy

Codacy
This commit is contained in:
Andy Scherzinger 2021-05-18 09:34:23 +02:00 committed by GitHub
commit f87815753d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 638 additions and 682 deletions

View File

@ -1,7 +1,6 @@
package com.nextcloud.talk.adapters;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;

View File

@ -23,12 +23,12 @@ package com.nextcloud.talk.adapters.items;
import android.accounts.Account;
import android.net.Uri;
import android.view.View;
import android.widget.*;
import androidx.annotation.Nullable;
import androidx.emoji.widget.EmojiTextView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
@ -38,15 +38,20 @@ import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.DisplayUtils;
import java.util.List;
import java.util.regex.Pattern;
import androidx.annotation.Nullable;
import androidx.emoji.widget.EmojiTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFilterable;
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
import eu.davidea.viewholders.FlexibleViewHolder;
import java.util.List;
import java.util.regex.Pattern;
public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.UserItemViewHolder> implements
IFilterable<String> {

View File

@ -26,12 +26,7 @@ import android.text.format.DateUtils;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.emoji.widget.EmojiTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
@ -42,15 +37,20 @@ import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.conversations.Conversation;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.DisplayUtils;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import java.util.regex.Pattern;
import androidx.emoji.widget.EmojiTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFilterable;
import eu.davidea.flexibleadapter.utils.FlexibleUtils;
import eu.davidea.viewholders.FlexibleViewHolder;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import java.util.regex.Pattern;
public class CallItem extends AbstractFlexibleItem<CallItem.RoomItemViewHolder> implements IFilterable<String> {

View File

@ -35,7 +35,6 @@ import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.PopupMenu;
import android.widget.Toast;
import com.google.common.util.concurrent.ListenableFuture;
import com.nextcloud.talk.R;
@ -69,14 +68,12 @@ import androidx.work.Data;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkInfo;
import androidx.work.WorkManager;
import org.jetbrains.annotations.NotNull;
import autodagger.AutoInjector;
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;
@ -461,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) {
// unused atm
}
@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;
@ -481,7 +478,8 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM
}
@Override
public void onError(Throwable e) {
public void onError(@NonNull Throwable e) {
Log.e(TAG, "Error reading file information", e);
}
});

View File

@ -23,7 +23,6 @@ package com.nextcloud.talk.adapters.messages;
import android.view.View;
import com.nextcloud.talk.models.json.chat.ChatMessage;
import com.stfalcon.chatkit.commons.ViewHolder;
import com.stfalcon.chatkit.messages.MessageHolders;
public class MagicUnreadNoticeMessageViewHolder extends MessageHolders.SystemMessageViewHolder<ChatMessage> {

View File

@ -27,7 +27,7 @@ import com.stfalcon.chatkit.messages.MessagesListAdapter;
import java.util.List;
public class TalkMessagesListAdapter<MESSAGE extends IMessage> extends MessagesListAdapter<MESSAGE> {
public class TalkMessagesListAdapter<M extends IMessage> extends MessagesListAdapter<M> {
public TalkMessagesListAdapter(String senderId, MessageHolders holders, ImageLoader imageLoader) {
super(senderId, holders, imageLoader);

View File

@ -25,8 +25,6 @@ import android.text.Editable;
import android.text.Spanned;
import android.widget.EditText;
import androidx.emoji.text.EmojiCompat;
import com.facebook.widget.text.span.BetterImageSpan;
import com.nextcloud.talk.R;
import com.nextcloud.talk.models.database.UserEntity;

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

@ -29,12 +29,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import autodagger.AutoInjector;
import butterknife.BindView;
import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.nextcloud.talk.R;
@ -48,7 +43,6 @@ import com.nextcloud.talk.jobs.SignalingSettingsWorker;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
import com.nextcloud.talk.models.json.generic.Status;
import com.nextcloud.talk.models.json.conversations.RoomsOverall;
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.ClosedInterfaceImpl;
@ -57,19 +51,27 @@ import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.net.CookieManager;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import autodagger.AutoInjector;
import butterknife.BindView;
import io.reactivex.CompletableObserver;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import javax.inject.Inject;
import java.net.CookieManager;
import java.util.ArrayList;
import java.util.List;
@AutoInjector(NextcloudTalkApplication.class)

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

@ -261,8 +261,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
dateTimePicker(
minDateTime = Calendar.getInstance(),
requireFutureDateTime =
true,
requireFutureDateTime = true,
currentDateTime = currentTimeCalendar,
show24HoursView = true,
dateTimeCallback = { _,
@ -310,11 +309,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
fun submitLobbyChanges() {
val state = if (
(
conversationInfoLobby.findViewById<View>(
R.id.mp_checkable
) as SwitchCompat
).isChecked
(conversationInfoLobby.findViewById<View>(R.id.mp_checkable) as SwitchCompat).isChecked
) 1 else 0
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
@ -669,9 +664,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
private fun loadConversationAvatar() {
when (conversation!!.type) {
Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL -> if (
!TextUtils.isEmpty(conversation!!.name)
) {
Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL -> if (!TextUtils.isEmpty(conversation!!.name)) {
val draweeController = Fresco.newDraweeControllerBuilder()
.setOldController(conversationAvatarImageView.controller)
.setAutoPlayAnimations(true)

View File

@ -26,7 +26,6 @@ import android.animation.AnimatorInflater;
import android.annotation.SuppressLint;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@ -47,7 +46,6 @@ import android.widget.RelativeLayout;
import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler;
import com.bluelinelabs.conductor.internal.NoOpControllerChangeHandler;
import com.facebook.common.executors.UiThreadImmediateExecutorService;
import com.facebook.common.references.CloseableReference;
import com.facebook.datasource.DataSource;
@ -60,7 +58,6 @@ import com.google.android.material.button.MaterialButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.kennyc.bottomsheet.BottomSheet;
import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.MagicCallActivity;
import com.nextcloud.talk.activities.MainActivity;
import com.nextcloud.talk.adapters.items.CallItem;
import com.nextcloud.talk.adapters.items.ConversationItem;

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

@ -65,7 +65,6 @@ import com.nextcloud.talk.utils.DisplayUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
import org.jetbrains.annotations.NotNull;
import org.parceler.Parcels;
import java.io.File;
@ -122,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);
}
@ -183,23 +182,24 @@ 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) {
// unused atm
}
@Override
public void onNext(@NotNull UserProfileFieldsOverall userProfileFieldsOverall) {
public void onNext(@io.reactivex.annotations.NonNull UserProfileFieldsOverall userProfileFieldsOverall) {
editableFields = userProfileFieldsOverall.getOcs().getData();
adapter.notifyDataSetChanged();
}
@Override
public void onError(@NotNull Throwable e) {
public void onError(@io.reactivex.annotations.NonNull Throwable e) {
edit = false;
}
@Override
public void onComplete() {
// unused atm
}
});
} else {
@ -243,11 +243,12 @@ public class ProfileController extends BaseController {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() {
@Override
public void onSubscribe(@NotNull Disposable d) {
public void onSubscribe(@NonNull Disposable d) {
// unused atm
}
@Override
public void onNext(@NotNull GenericOverall genericOverall) {
public void onNext(@NonNull GenericOverall genericOverall) {
DisplayUtils.loadAvatarImage(
currentUser,
getActivity().findViewById(R.id.avatar_image),
@ -255,13 +256,13 @@ public class ProfileController extends BaseController {
}
@Override
public void onError(@NotNull Throwable e) {
public void onError(@NonNull Throwable e) {
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
}
@Override
public void onComplete() {
// unused atm
}
}));
@ -273,17 +274,18 @@ 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) {
// unused atm
}
@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),
@ -292,7 +294,7 @@ public class ProfileController extends BaseController {
@Override
public void onComplete() {
// unused atm
}
});
}
@ -349,11 +351,12 @@ 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) {
// unused atm
}
@Override
public void onNext(@NotNull UserProfileFieldsOverall userProfileFieldsOverall) {
public void onNext(@io.reactivex.annotations.NonNull UserProfileFieldsOverall userProfileFieldsOverall) {
editableFields = userProfileFieldsOverall.getOcs().getData();
getActivity().invalidateOptionsMenu();
@ -361,13 +364,13 @@ public class ProfileController extends BaseController {
}
@Override
public void onError(@NotNull Throwable e) {
public void onError(@io.reactivex.annotations.NonNull Throwable e) {
edit = false;
}
@Override
public void onComplete() {
// unused atm
}
});
}
@ -452,11 +455,12 @@ 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) {
// unused atm
}
@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) {
@ -465,7 +469,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),
@ -478,7 +482,7 @@ public class ProfileController extends BaseController {
@Override
public void onComplete() {
// unused atm
}
});
}
@ -534,7 +538,7 @@ public class ProfileController extends BaseController {
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
// unused atm
}
});
}
@ -546,7 +550,6 @@ public class ProfileController extends BaseController {
file = File.createTempFile("avatar", "png",
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM));
try (FileOutputStream out = new FileOutputStream(file)) {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
} catch (IOException e) {
@ -602,22 +605,24 @@ 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) {
// unused atm
}
@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();
Log.e(TAG, "Error uploading avatar", e);
}
@Override
public void onComplete() {
// unused atm
}
});
}
@ -634,23 +639,24 @@ 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) {
// unused atm
}
@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);
}
@Override
public void onComplete() {
// unused atm
}
});
}
@ -772,7 +778,7 @@ public class ProfileController extends BaseController {
holder.text.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// unused atm
}
@Override
@ -786,7 +792,7 @@ public class ProfileController extends BaseController {
@Override
public void afterTextChanged(Editable s) {
// unused atm
}
});

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

@ -33,17 +33,16 @@ import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.*;
import android.webkit.ClientCertRequest;
import android.webkit.CookieSyncManager;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import autodagger.AutoInjector;
import butterknife.BindView;
import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.nextcloud.talk.R;
@ -60,17 +59,8 @@ import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
import com.nextcloud.talk.utils.ssl.MagicTrustManager;
import de.cotech.hw.fido.WebViewFidoBridge;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.requery.Persistable;
import io.requery.reactivex.ReactiveEntityStore;
import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import java.lang.reflect.Field;
import java.net.CookieManager;
import java.net.URLDecoder;
@ -81,6 +71,22 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import autodagger.AutoInjector;
import butterknife.BindView;
import de.cotech.hw.fido.WebViewFidoBridge;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.requery.Persistable;
import io.requery.reactivex.ReactiveEntityStore;
@AutoInjector(NextcloudTalkApplication.class)
public class WebViewLoginController extends BaseController {

View File

@ -23,8 +23,7 @@ package com.nextcloud.talk.dagger.modules;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.github.aurae.retrofit2.LoganSquareConverterFactory;
import com.nextcloud.talk.BuildConfig;
import com.nextcloud.talk.R;
@ -38,18 +37,7 @@ import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder;
import com.nextcloud.talk.utils.ssl.MagicKeyManager;
import com.nextcloud.talk.utils.ssl.MagicTrustManager;
import com.nextcloud.talk.utils.ssl.SSLSocketFactoryCompat;
import dagger.Module;
import dagger.Provides;
import io.reactivex.schedulers.Schedulers;
import okhttp3.*;
import okhttp3.internal.tls.OkHostnameVerifier;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import javax.inject.Singleton;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.X509KeyManager;
import java.io.IOException;
import java.net.CookieManager;
import java.net.InetSocketAddress;
@ -61,6 +49,30 @@ import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.X509KeyManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import dagger.Module;
import dagger.Provides;
import io.reactivex.schedulers.Schedulers;
import okhttp3.Authenticator;
import okhttp3.Cache;
import okhttp3.Credentials;
import okhttp3.Dispatcher;
import okhttp3.Interceptor;
import okhttp3.JavaNetCookieJar;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.Route;
import okhttp3.internal.tls.OkHostnameVerifier;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
@Module(includes = DatabaseModule.class)
public class RestModule {

View File

@ -22,9 +22,7 @@ package com.nextcloud.talk.jobs;
import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.work.*;
import autodagger.AutoInjector;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication;
@ -35,15 +33,25 @@ import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOveral
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.database.user.UserUtils;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.work.Data;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import autodagger.AutoInjector;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
@AutoInjector(NextcloudTalkApplication.class)
public class SignalingSettingsWorker extends Worker {
private static final String TAG = "SignalingSettingsJob";

View File

@ -102,7 +102,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
try {
val input: InputStream = context.contentResolver.openInputStream(sourcefileUri)!!
val buf = ByteArray(input.available())
while (input.read(buf) != -1);
while (input.read(buf) != -1)
requestBody = RequestBody.create("application/octet-stream".toMediaTypeOrNull(), buf)
} catch (e: Exception) {
Log.e(javaClass.simpleName, "failed to create RequestBody for $sourcefileUri", e)

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

View File

@ -34,6 +34,8 @@ import android.os.IBinder;
public class AuthenticatorService extends Service {
private static Authenticator authenticator = null;
private static class Authenticator extends AbstractAccountAuthenticator {
public Authenticator(Context context) {
super(context);
@ -83,8 +85,6 @@ public class AuthenticatorService extends Service {
}
private static Authenticator authenticator = null;
protected Authenticator getAuthenticator() {
if (authenticator == null) {
authenticator = new Authenticator(this);

View File

@ -24,7 +24,7 @@ import android.content.Context;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import autodagger.AutoInjector;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
import com.nextcloud.talk.api.NcApi;
@ -36,14 +36,24 @@ import com.nextcloud.talk.models.json.push.PushConfigurationState;
import com.nextcloud.talk.models.json.push.PushRegistrationOverall;
import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.utils.preferences.AppPreferences;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import org.greenrobot.eventbus.EventBus;
import javax.inject.Inject;
import java.io.*;
import java.security.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
@ -51,6 +61,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import autodagger.AutoInjector;
import io.reactivex.Observer;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
@AutoInjector(NextcloudTalkApplication.class)
public class PushUtils {
private static final String TAG = "PushUtils";
@ -238,7 +256,6 @@ public class PushUtils {
if (((TextUtils.isEmpty(providerValue) || accountPushData == null) && !userEntity.getScheduledForDeletion()) ||
(accountPushData != null && !accountPushData.getPushToken().equals(token) && !userEntity.getScheduledForDeletion())) {
Map<String, String> queryMap = new HashMap<>();
queryMap.put("format", "json");
queryMap.put("pushTokenHash", pushTokenHash);
@ -247,18 +264,17 @@ public class PushUtils {
credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
String finalCredentials = credentials;
ncApi.registerDeviceForNotificationsWithNextcloud(
credentials,
ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
.subscribe(new Observer<PushRegistrationOverall>() {
@Override
public void onSubscribe(Disposable d) {
public void onSubscribe(@NonNull Disposable d) {
// unused atm
}
@Override
public void onNext(PushRegistrationOverall pushRegistrationOverall) {
public void onNext(@NonNull PushRegistrationOverall pushRegistrationOverall) {
Map<String, String> proxyMap = new HashMap<>();
proxyMap.put("pushToken", token);
proxyMap.put("deviceIdentifier", pushRegistrationOverall.getOcs().getData().
@ -268,18 +284,17 @@ public class PushUtils {
proxyMap.put("userPublicKey", pushRegistrationOverall.getOcs()
.getData().getPublicKey());
ncApi.registerDeviceForNotificationsWithProxy(
ApiUtils.getUrlPushProxy(), proxyMap)
.subscribeOn(Schedulers.io())
.subscribe(new Observer<Void>() {
@Override
public void onSubscribe(Disposable d) {
public void onSubscribe(@NonNull Disposable d) {
// unused atm
}
@Override
public void onNext(Void aVoid) {
public void onNext(@NonNull Void aVoid) {
PushConfigurationState pushConfigurationState =
new PushConfigurationState();
pushConfigurationState.setPushToken(token);
@ -302,17 +317,17 @@ public class PushUtils {
null, userEntity.getId(), null, null, null)
.subscribe(new Observer<UserEntity>() {
@Override
public void onSubscribe(Disposable d) {
public void onSubscribe(@NonNull Disposable d) {
// unused atm
}
@Override
public void onNext(UserEntity userEntity) {
public void onNext(@NonNull UserEntity userEntity) {
eventBus.post(new EventStatus(userEntity.getId(), EventStatus.EventType.PUSH_REGISTRATION, true));
}
@Override
public void onError(Throwable e) {
public void onError(@NonNull Throwable e) {
eventBus.post(new EventStatus
(userEntity.getId(),
EventStatus.EventType
@ -321,38 +336,36 @@ public class PushUtils {
@Override
public void onComplete() {
// unused atm
}
});
} catch (IOException e) {
Log.e(TAG, "IOException while updating user");
Log.e(TAG, "IOException while updating user", e);
}
}
@Override
public void onError(Throwable e) {
public void onError(@NonNull Throwable e) {
eventBus.post(new EventStatus(userEntity.getId(),
EventStatus.EventType.PUSH_REGISTRATION, false));
}
@Override
public void onComplete() {
// unused atm
}
});
}
@Override
public void onError(Throwable e) {
public void onError(@NonNull Throwable e) {
eventBus.post(new EventStatus(userEntity.getId(),
EventStatus.EventType.PUSH_REGISTRATION, false));
}
@Override
public void onComplete() {
// unused atm
}
});
}
@ -383,9 +396,9 @@ public class PushUtils {
}
} catch (NoSuchAlgorithmException e) {
Log.d("TAG", "No such algorithm while reading key from string");
Log.d(TAG, "No such algorithm while reading key from string");
} catch (InvalidKeySpecException e) {
Log.d("TAG", "Invalid key spec while reading key from string");
Log.d(TAG, "Invalid key spec while reading key from string");
}
return null;

View File

@ -21,7 +21,14 @@
package com.nextcloud.talk.utils.preferences;
import com.nextcloud.talk.R;
import net.orange_box.storebox.annotations.method.*;
import net.orange_box.storebox.annotations.method.ClearMethod;
import net.orange_box.storebox.annotations.method.DefaultValue;
import net.orange_box.storebox.annotations.method.KeyByResource;
import net.orange_box.storebox.annotations.method.KeyByString;
import net.orange_box.storebox.annotations.method.RegisterChangeListenerMethod;
import net.orange_box.storebox.annotations.method.RemoveMethod;
import net.orange_box.storebox.annotations.method.UnregisterChangeListenerMethod;
import net.orange_box.storebox.annotations.option.SaveOption;
import net.orange_box.storebox.enums.SaveMode;
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener;

View File

@ -24,8 +24,7 @@ package com.nextcloud.talk.webrtc;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import autodagger.AutoInjector;
import com.bluelinelabs.logansquare.LoganSquare;
import com.nextcloud.talk.R;
import com.nextcloud.talk.application.NextcloudTalkApplication;
@ -37,16 +36,29 @@ import com.nextcloud.talk.models.json.signaling.DataChannelMessage;
import com.nextcloud.talk.models.json.signaling.DataChannelMessageNick;
import com.nextcloud.talk.models.json.signaling.NCIceCandidate;
import com.nextcloud.talk.utils.LoggingUtils;
import org.greenrobot.eventbus.EventBus;
import org.webrtc.*;
import javax.inject.Inject;
import org.greenrobot.eventbus.EventBus;
import org.webrtc.DataChannel;
import org.webrtc.IceCandidate;
import org.webrtc.MediaConstraints;
import org.webrtc.MediaStream;
import org.webrtc.PeerConnection;
import org.webrtc.PeerConnectionFactory;
import org.webrtc.RtpReceiver;
import org.webrtc.SdpObserver;
import org.webrtc.SessionDescription;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import androidx.annotation.Nullable;
import autodagger.AutoInjector;
@AutoInjector(NextcloudTalkApplication.class)
public class MagicPeerConnectionWrapper {
private static String TAG = "MagicPeerConnectionWrapper";

View File

@ -20,18 +20,31 @@
package com.nextcloud.talk.webrtc;
import autodagger.AutoInjector;
import com.nextcloud.talk.application.NextcloudTalkApplication;
import com.nextcloud.talk.models.database.UserEntity;
import com.nextcloud.talk.models.json.signaling.NCMessageWrapper;
import com.nextcloud.talk.models.json.websocket.*;
import com.nextcloud.talk.models.json.websocket.ActorWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.AuthParametersWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.AuthWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.CallOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.CallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.HelloOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.HelloWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.RequestOfferOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.RequestOfferSignalingMessage;
import com.nextcloud.talk.models.json.websocket.RoomOverallWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.RoomWebSocketMessage;
import com.nextcloud.talk.models.json.websocket.SignalingDataWebSocketMessageForOffer;
import com.nextcloud.talk.utils.ApiUtils;
import okhttp3.OkHttpClient;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import autodagger.AutoInjector;
import okhttp3.OkHttpClient;
@AutoInjector(NextcloudTalkApplication.class)
public class WebSocketConnectionHelper {
private static Map<Long, MagicWebSocketInstance> magicWebSocketInstanceMap = new HashMap<>();

View File

@ -40,7 +40,8 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;

View File

@ -38,7 +38,7 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;

View File

@ -24,7 +24,7 @@ import com.nextcloud.talk.models.json.chat.ChatMessage;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
public class TextMatchersTest {