diff --git a/app/src/gplay/AndroidManifest.xml b/app/src/gplay/AndroidManifest.xml index 1474521d4..2f388c5f5 100644 --- a/app/src/gplay/AndroidManifest.xml +++ b/app/src/gplay/AndroidManifest.xml @@ -11,11 +11,12 @@ android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:theme="@style/AppTheme" - tools:replace="label, icon, theme, name, allowBackup"> + tools:replace="label, icon, theme, name, allowBackup" + tools:ignore="UnusedAttribute, ExportedService"> - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 06906a3c3..196a9b162 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -43,7 +43,8 @@ android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:theme="@style/AppTheme" - tools:replace="label, icon, theme, name, allowBackup"> + tools:replace="label, icon, theme, name, allowBackup" + tools:ignore="UnusedAttribute"> if (header != null) { return R.layout.rv_item_contact; } else { - return R.layout.rv_item_mention; + return R.layout.rv_item_conversation_info_participant; } } @@ -177,22 +177,45 @@ public class UserItem extends AbstractFlexibleItem holder.itemView.setAlpha(1.0f); } - // TODO: show what the user is doing currently - long participantFlags = participant.getParticipantFlags(); - if (participantFlags == 0) { - } else if (participantFlags == 1) { - // do nothing, just in call - } else if (participantFlags == 2) { - // with audio - } else if (participantFlags == 4) { - // with video - } else if (participantFlags == 7) { - // video and audio - } - - String userType = ""; + Resources resources = NextcloudTalkApplication.getSharedApplication().getResources(); if (header == null) { + Participant.ParticipantFlags participantFlags = participant.getParticipantFlags(); + switch (participantFlags) { + case NOT_IN_CALL: + holder.voiceOrSimpleCallImageView.setVisibility(View.GONE); + holder.videoCallImageView.setVisibility(View.GONE); + break; + case IN_CALL: + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.GONE); + break; + case IN_CALL_WITH_AUDIO: + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.GONE); + break; + case IN_CALL_WITH_VIDEO: + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble)); + holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.VISIBLE); + break; + case IN_CALL_WITH_AUDIO_AND_VIDEO: + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble)); + holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.VISIBLE); + break; + default: + holder.voiceOrSimpleCallImageView.setVisibility(View.GONE); + holder.videoCallImageView.setVisibility(View.GONE); + break; + } + + String userType = ""; + switch (new EnumParticipantTypeConverter().convertToInt(participant.getType())) { case 1: userType = NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_owner); @@ -210,11 +233,11 @@ public class UserItem extends AbstractFlexibleItem userType = NextcloudTalkApplication.getSharedApplication().getString(R.string.nc_following_link); break; default: - // do nothing + break; } holder.contactMentionId.setText(userType); - holder.contactMentionId.setTextColor(NextcloudTalkApplication.getSharedApplication().getColor(R.color.colorPrimary)); + holder.contactMentionId.setTextColor(NextcloudTalkApplication.getSharedApplication().getResources().getColor(R.color.colorPrimary)); } } @@ -244,6 +267,12 @@ public class UserItem extends AbstractFlexibleItem @Nullable @BindView(R.id.secondary_text) public TextView contactMentionId; + @Nullable + @BindView(R.id.voiceOrSimpleCallImageView) + ImageView voiceOrSimpleCallImageView; + @Nullable + @BindView(R.id.videoCallImageView) + ImageView videoCallImageView; /** * Default constructor. diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java index daab3ad7c..434f352af 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java @@ -50,7 +50,6 @@ import javax.inject.Singleton; import androidx.lifecycle.LifecycleObserver; import androidx.multidex.MultiDex; import androidx.multidex.MultiDexApplication; -import androidx.work.Configuration; import androidx.work.OneTimeWorkRequest; import androidx.work.PeriodicWorkRequest; import androidx.work.WorkManager; diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java index 5abe89da7..0bb90d974 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java @@ -216,7 +216,7 @@ public class CallNotificationController extends BaseController { boolean inCallOnDifferentDevice = false; List participantList = participantsOverall.getOcs().getData(); for (Participant participant : participantList) { - if (participant.isInCall() || (userBeingCalled.hasSpreedCapabilityWithName("in-call-flags") && participant.getParticipantFlags() != 0)) { + if (participant.getParticipantFlags() != Participant.ParticipantFlags.NOT_IN_CALL) { hasParticipantsInCall = true; if (participant.getUserId().equals(userBeingCalled.getUserId())) { @@ -436,38 +436,38 @@ public class CallNotificationController extends BaseController { (getActivity()).getBitmapPool(), resource, avatarSize, avatarSize)); } - if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 && - userBeingCalled.hasSpreedCapabilityWithName("no-ping")) { - final Allocation input = Allocation.createFromBitmap(renderScript, resource); - final Allocation output = Allocation.createTyped(renderScript, input.getType()); - final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(renderScript, Element - .U8_4(renderScript)); - script.setRadius(15f); - script.setInput(input); - script.forEach(output); - output.copyTo(resource); + if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 200 && + userBeingCalled.hasSpreedCapabilityWithName("no-ping")) { + final Allocation input = Allocation.createFromBitmap(renderScript, resource); + final Allocation output = Allocation.createTyped(renderScript, input.getType()); + final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(renderScript, Element + .U8_4(renderScript)); + script.setRadius(15f); + script.setInput(input); + script.forEach(output); + output.copyTo(resource); - if (getResources() != null) { - incomingTextRelativeLayout.setBackground(getResources().getDrawable(R.drawable - .incoming_gradient)); - constraintLayout.setBackground(new BitmapDrawable(resource)); + if (getResources() != null) { + incomingTextRelativeLayout.setBackground(getResources().getDrawable(R.drawable + .incoming_gradient)); + constraintLayout.setBackground(new BitmapDrawable(resource)); + } + } else if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 201) { + Palette palette = Palette.from(resource).generate(); + if (getResources() != null) { + int color = palette.getDominantColor(getResources().getColor(R.color.grey950)); + + if (color != getResources().getColor(R.color.grey950)) { + float[] hsv = new float[3]; + Color.colorToHSV(color, hsv); + hsv[2] *= 0.75f; + color = Color.HSVToColor(hsv); } - } else if (AvatarStatusCodeHolder.getInstance().getStatusCode() == 201) { - Palette palette = Palette.from(resource).generate(); - if (getResources() != null) { - int color = palette.getDominantColor(getResources().getColor(R.color.grey950)); - if (color != getResources().getColor(R.color.grey950)) { - float[] hsv = new float[3]; - Color.colorToHSV(color, hsv); - hsv[2] *= 0.75f; - color = Color.HSVToColor(hsv); - } - - constraintLayout.setBackgroundColor(color); - } + constraintLayout.setBackgroundColor(color); } } + } }); diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java index 3a129e4db..ebe83ef68 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ConversationInfoController.java @@ -42,7 +42,6 @@ import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.controllers.base.BaseController; import com.nextcloud.talk.models.database.UserEntity; import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter; -import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter; import com.nextcloud.talk.models.json.participants.Participant; import com.nextcloud.talk.models.json.participants.ParticipantsOverall; import com.nextcloud.talk.models.json.rooms.Conversation; @@ -58,9 +57,6 @@ import com.yarolegovich.mp.MaterialPreferenceScreen; import org.parceler.Parcels; import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; import java.util.List; import javax.inject.Inject; diff --git a/app/src/main/java/com/nextcloud/talk/models/database/ArbitraryStorage.java b/app/src/main/java/com/nextcloud/talk/models/database/ArbitraryStorage.java index 77ae21451..c095f0e53 100644 --- a/app/src/main/java/com/nextcloud/talk/models/database/ArbitraryStorage.java +++ b/app/src/main/java/com/nextcloud/talk/models/database/ArbitraryStorage.java @@ -26,7 +26,6 @@ import java.io.Serializable; import io.requery.Entity; import io.requery.Key; -import io.requery.Nullable; import io.requery.Persistable; @Entity diff --git a/app/src/main/java/com/nextcloud/talk/models/json/converters/ObjectParcelConverter.java b/app/src/main/java/com/nextcloud/talk/models/json/converters/ObjectParcelConverter.java new file mode 100644 index 000000000..d536d8816 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/converters/ObjectParcelConverter.java @@ -0,0 +1,38 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.models.json.converters; + +import android.os.Parcel; + +import org.parceler.ParcelConverter; +import org.parceler.Parcels; + +public class ObjectParcelConverter implements ParcelConverter { + @Override + public void toParcel(Object input, Parcel parcel) { + parcel.writeParcelable(Parcels.wrap(input), 0); + } + + @Override + public Object fromParcel(Parcel parcel) { + return parcel.readParcelable(Object.class.getClassLoader()); + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java index 60eaa3950..07bbec190 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java @@ -23,8 +23,10 @@ package com.nextcloud.talk.models.json.participants; import com.bluelinelabs.logansquare.annotation.JsonField; import com.bluelinelabs.logansquare.annotation.JsonObject; import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter; +import com.nextcloud.talk.models.json.converters.ObjectParcelConverter; import org.parceler.Parcel; +import org.parceler.ParcelPropertyConverter; import lombok.Data; @@ -53,12 +55,26 @@ public class Participant { @JsonField(name = "roomId") long roomId; + @ParcelPropertyConverter(ObjectParcelConverter.class) @JsonField(name = "inCall") - boolean inCall; + Object inCall; - @JsonField(name = "participantFlags") - long participantFlags; + public ParticipantFlags getParticipantFlags() { + ParticipantFlags participantFlags = ParticipantFlags.NOT_IN_CALL; + if (inCall != null) { + if (inCall instanceof Long) { + participantFlags = ParticipantFlags.fromValue((Long) inCall); + } else if (inCall instanceof Boolean) { + if ((boolean) inCall) { + participantFlags = ParticipantFlags.IN_CALL; + } else { + participantFlags = ParticipantFlags.NOT_IN_CALL; + } + } + } + return participantFlags; + } String source; public enum ParticipantType { @@ -69,4 +85,39 @@ public class Participant { GUEST, USER_FOLLOWING_LINK } + + public enum ParticipantFlags { + NOT_IN_CALL (0), + IN_CALL (1), + IN_CALL_WITH_AUDIO (3), + IN_CALL_WITH_VIDEO (5), + IN_CALL_WITH_AUDIO_AND_VIDEO (7); + + private long value; + + ParticipantFlags(long value) { + this.value = value; + } + + public long getValue() { + return value; + } + + public static ParticipantFlags fromValue(long value) { + if (value == 0) { + return NOT_IN_CALL; + } else if (value == 1) { + return IN_CALL; + } else if (value == 3) { + return IN_CALL_WITH_AUDIO; + } else if (value == 5) { + return IN_CALL_WITH_VIDEO; + } else if (value == 7) { + return IN_CALL_WITH_AUDIO_AND_VIDEO; + } else { + return NOT_IN_CALL; + } + } + + } } diff --git a/app/src/main/java/com/nextcloud/talk/utils/database/arbitrarystorage/ArbitraryStorageUtils.java b/app/src/main/java/com/nextcloud/talk/utils/database/arbitrarystorage/ArbitraryStorageUtils.java index 930cdf4aa..94ead9dab 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/database/arbitrarystorage/ArbitraryStorageUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/database/arbitrarystorage/ArbitraryStorageUtils.java @@ -19,21 +19,11 @@ */ package com.nextcloud.talk.utils.database.arbitrarystorage; -import android.text.TextUtils; - import com.nextcloud.talk.models.database.ArbitraryStorage; import com.nextcloud.talk.models.database.ArbitraryStorageEntity; -import com.nextcloud.talk.models.database.User; -import com.nextcloud.talk.models.database.UserEntity; - -import java.util.List; import androidx.annotation.Nullable; -import io.reactivex.Completable; import io.reactivex.Observable; -import io.reactivex.Observer; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; import io.requery.Persistable; import io.requery.query.Result; diff --git a/app/src/main/res/drawable/ic_call_grey_600_24dp.xml b/app/src/main/res/drawable/ic_call_grey_600_24dp.xml new file mode 100644 index 000000000..7cf4380b5 --- /dev/null +++ b/app/src/main/res/drawable/ic_call_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_group_grey600_24px.xml b/app/src/main/res/drawable/ic_group_grey600_24px.xml index 69b45ba78..4acc0cfd2 100644 --- a/app/src/main/res/drawable/ic_group_grey600_24px.xml +++ b/app/src/main/res/drawable/ic_group_grey600_24px.xml @@ -1,7 +1,9 @@ - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_link_black_24px.xml b/app/src/main/res/drawable/ic_link_black_24px.xml index 9f52bcc60..d1e8a70fa 100644 --- a/app/src/main/res/drawable/ic_link_black_24px.xml +++ b/app/src/main/res/drawable/ic_link_black_24px.xml @@ -18,10 +18,12 @@ ~ along with this program. If not, see . --> - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_link_grey600_24px.xml b/app/src/main/res/drawable/ic_link_grey600_24px.xml index b5386a5de..fcd044183 100644 --- a/app/src/main/res/drawable/ic_link_grey600_24px.xml +++ b/app/src/main/res/drawable/ic_link_grey600_24px.xml @@ -1,7 +1,9 @@ - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_link_white_24px.xml b/app/src/main/res/drawable/ic_link_white_24px.xml index 68f853464..d59f2cf40 100644 --- a/app/src/main/res/drawable/ic_link_white_24px.xml +++ b/app/src/main/res/drawable/ic_link_white_24px.xml @@ -1,4 +1,5 @@ - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml b/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml new file mode 100644 index 000000000..5a4a52926 --- /dev/null +++ b/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_people_group_black_24px.xml b/app/src/main/res/drawable/ic_people_group_black_24px.xml index f1fd901a0..da3d845e3 100644 --- a/app/src/main/res/drawable/ic_people_group_black_24px.xml +++ b/app/src/main/res/drawable/ic_people_group_black_24px.xml @@ -18,30 +18,12 @@ ~ along with this program. If not, see . --> - - - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_people_group_white_24px.xml b/app/src/main/res/drawable/ic_people_group_white_24px.xml index e0cbf81fe..0f39f7bfe 100644 --- a/app/src/main/res/drawable/ic_people_group_white_24px.xml +++ b/app/src/main/res/drawable/ic_people_group_white_24px.xml @@ -1,4 +1,5 @@ - + android:strokeColor="#00000000" android:strokeWidth="1" + tools:ignore="VectorPath" /> diff --git a/app/src/main/res/drawable/ic_settings_black_24dp.xml b/app/src/main/res/drawable/ic_settings_black_24dp.xml index b1ed64c70..4fbe2f6f5 100644 --- a/app/src/main/res/drawable/ic_settings_black_24dp.xml +++ b/app/src/main/res/drawable/ic_settings_black_24dp.xml @@ -18,8 +18,10 @@ ~ along with this program. If not, see . --> - - + diff --git a/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml b/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml new file mode 100644 index 000000000..24f2e644f --- /dev/null +++ b/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/shape_call_bubble.xml b/app/src/main/res/drawable/shape_call_bubble.xml new file mode 100644 index 000000000..c41afbad1 --- /dev/null +++ b/app/src/main/res/drawable/shape_call_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/shape_video_bubble.xml b/app/src/main/res/drawable/shape_video_bubble.xml new file mode 100644 index 000000000..d02c78df9 --- /dev/null +++ b/app/src/main/res/drawable/shape_video_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable/shape_voice_bubble.xml b/app/src/main/res/drawable/shape_voice_bubble.xml new file mode 100644 index 000000000..618be4047 --- /dev/null +++ b/app/src/main/res/drawable/shape_voice_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/app/src/main/res/layout/controller_conversation_info.xml b/app/src/main/res/layout/controller_conversation_info.xml index 69f6d5ab5..8b8218cd0 100644 --- a/app/src/main/res/layout/controller_conversation_info.xml +++ b/app/src/main/res/layout/controller_conversation_info.xml @@ -18,7 +18,7 @@ ~ along with this program. If not, see . --> - - + + - - - + android:layout_height="wrap_content"> - - - - - - - - - - - - - - + android:animateLayoutChanges="true" + android:visibility="gone"> - + - - + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/rv_item_contact.xml b/app/src/main/res/layout/rv_item_contact.xml index fefd40ce0..4d3becac2 100644 --- a/app/src/main/res/layout/rv_item_contact.xml +++ b/app/src/main/res/layout/rv_item_contact.xml @@ -29,7 +29,6 @@ android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/rv_item_mention.xml b/app/src/main/res/layout/rv_item_mention.xml index 636e51793..a52fe39dc 100644 --- a/app/src/main/res/layout/rv_item_mention.xml +++ b/app/src/main/res/layout/rv_item_mention.xml @@ -36,7 +36,6 @@ android:layout_marginStart="@dimen/activity_horizontal_margin"> - Lint Report: 2 errors and 126 warnings + Lint Report: 2 errors and 122 warnings