Fix a few theming issues

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-10-11 10:49:33 +02:00
parent b83931c13a
commit 95c0e2daff
10 changed files with 29 additions and 51 deletions

View File

@ -20,6 +20,7 @@
package com.nextcloud.talk.adapters.items;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.text.TextUtils;
@ -54,12 +55,15 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
private Participant participant;
private UserEntity userEntity;
private GenericTextHeaderItem header;
private Context activityContext;
public boolean isOnline = true;
public UserItem(Participant participant, UserEntity userEntity, GenericTextHeaderItem genericTextHeaderItem) {
public UserItem(Participant participant, UserEntity userEntity,
GenericTextHeaderItem genericTextHeaderItem, Context activityContext) {
this.participant = participant;
this.userEntity = userEntity;
this.header = genericTextHeaderItem;
this.activityContext = activityContext;
}
@Override
@ -132,8 +136,7 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
if (adapter.hasFilter()) {
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getDisplayName(),
String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.Companion.getSharedApplication()
.getResources().getColor(R.color.colorPrimary));
String.valueOf(adapter.getFilter(String.class)), activityContext.getResources().getColor(R.color.colorPrimary));
}
holder.contactDisplayName.setText(participant.getDisplayName());
@ -146,8 +149,7 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
if (TextUtils.isEmpty(participant.getSource()) || participant.getSource().equals("users")) {
if (Participant.ParticipantType.GUEST.equals(participant.getType()) ||
Participant.ParticipantType.USER_FOLLOWING_LINK.equals(participant.getType())) {
String displayName = NextcloudTalkApplication.Companion.getSharedApplication()
.getResources().getString(R.string.nc_guest);
String displayName = NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_guest);
if (!TextUtils.isEmpty(participant.getDisplayName())) {
displayName = participant.getDisplayName();
@ -173,10 +175,10 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
}
} else if ("groups".equals(participant.getSource())) {
holder.simpleDraweeView.getHierarchy().setImage(new BitmapDrawable(DisplayUtils.getRoundedBitmapFromVectorDrawableResource(NextcloudTalkApplication.Companion.getSharedApplication().getResources(), R.drawable.ic_people_group_white_24px)), 100, true);
holder.simpleDraweeView.getHierarchy().setImage(new BitmapDrawable(DisplayUtils.getRoundedBitmapFromVectorDrawableResource(activityContext.getResources(), R.drawable.ic_people_group_white_24px)), 100, true);
}
Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources();
Resources resources = activityContext.getResources();
if (header == null) {
Participant.ParticipantFlags participantFlags = participant.getParticipantFlags();
@ -184,7 +186,7 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
case NOT_IN_CALL:
holder.voiceOrSimpleCallImageView.setVisibility(View.GONE);
holder.videoCallImageView.setVisibility(View.GONE);
break;
//break;
case IN_CALL:
holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble));
holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
@ -239,7 +241,7 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
if (!holder.contactMentionId.getText().equals(userType)) {
holder.contactMentionId.setText(userType);
holder.contactMentionId.setTextColor(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getColor(R.color.colorPrimary));
holder.contactMentionId.setTextColor(activityContext.getResources().getColor(R.color.colorPrimary));
}
}
}

View File

@ -545,7 +545,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
participant.setUserId(sharee.getValue().getShareWith());
UserItem newContactItem = new UserItem(participant, currentUser,
userHeaderItems.get(headerTitle));
userHeaderItems.get(headerTitle), getActivity());
if (!contactItems.contains(newContactItem)) {
newUserItemList.add(newContactItem);
@ -582,7 +582,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
UserItem newContactItem = new UserItem(participant, currentUser,
userHeaderItems.get(headerTitle));
userHeaderItems.get(headerTitle), getActivity());
if (!contactItems.contains(newContactItem)) {
newUserItemList.add(newContactItem);

View File

@ -384,7 +384,7 @@ class ConversationInfoController(args: Bundle) : BaseController(), FlexibleAdapt
for (i in participants.indices) {
participant = participants[i]
userItem = UserItem(participant, conversationUser, null)
userItem = UserItem(participant, conversationUser, null, activity)
userItem.isOnline = !participant.sessionId.equals("0")
if (!TextUtils.isEmpty(participant.userId) && participant.userId == conversationUser!!.userId) {
ownUserItem = userItem

View File

@ -1,27 +0,0 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24"
android:width="20.57dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#000000" android:fillType="nonZero"
android:pathData="M0.8571,0C0.3771,0 0,0.3771 0,0.8571L0,23.1429C0,23.6229 0.3771,24 0.8571,24L19.7143,24C20.1943,24 20.5714,23.6229 20.5714,23.1429L20.5714,5.1429L15.4286,0L0.8571,0ZM3.4286,3.4286L13.7143,3.4286L13.7143,5.1429L3.4286,5.1429L3.4286,3.4286ZM3.4286,8.5714L12,8.5714L12,10.2857L3.4286,10.2857L3.4286,8.5714ZM3.4286,13.7143L17.1429,13.7143L17.1429,15.4286L3.4286,15.4286L3.4286,13.7143ZM3.4286,18.8571L10.2857,18.8571L10.2857,20.5714L3.4286,20.5714L3.4286,18.8571Z"
android:strokeColor="#00000000" android:strokeWidth="1"/>
</vector>

View File

@ -23,7 +23,7 @@
<item>
<shape
android:shape="oval">
<solid android:color="@color/white"/>
<solid android:color="@color/bg_message_list_incoming_bubble"/>
</shape>
</item>
<item android:drawable="@drawable/ic_call_grey_600_24dp"/>

View File

@ -23,7 +23,7 @@
<item>
<shape
android:shape="oval">
<solid android:color="@color/white"/>
<solid android:color="@color/bg_message_list_incoming_bubble"/>
</shape>
</item>
<item android:drawable="@drawable/ic_star_black_24dp" android:tint="@color/grey_600"/>

View File

@ -23,7 +23,7 @@
<item>
<shape
android:shape="oval">
<solid android:color="@color/white"/>
<solid android:color="@color/bg_message_list_incoming_bubble"/>
</shape>
</item>
<item android:drawable="@drawable/ic_lock_grey600_24px"/>

View File

@ -23,7 +23,7 @@
<item>
<shape
android:shape="oval">
<solid android:color="@color/bg_default"/>
<solid android:color="@color/bg_message_list_incoming_bubble"/>
</shape>
</item>
<item android:drawable="@drawable/ic_videocam_grey_600_24dp"/>

View File

@ -23,7 +23,7 @@
<item>
<shape
android:shape="oval">
<solid android:color="@color/bg_default"/>
<solid android:color="@color/bg_message_list_incoming_bubble"/>
</shape>
</item>
<item android:drawable="@drawable/ic_mic_grey_600_24dp"/>

View File

@ -32,13 +32,21 @@
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/activity_horizontal_margin">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simple_drawee_view"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
app:roundAsCircle="true"
tools:background="@tools:sample/avatars[1]"
/>
<ImageView
android:id="@+id/voiceOrSimpleCallImageView"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="bottom|end"
android:background="@drawable/shape_lock_bubble"
android:visibility="gone" />
android:visibility="visible" />
<ImageView
android:id="@+id/videoCallImageView"
@ -46,13 +54,8 @@
android:layout_height="12dp"
android:layout_gravity="top|end"
android:background="@drawable/shape_favorite_bubble"
android:visibility="gone" />
android:visibility="visible" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/simple_drawee_view"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
app:roundAsCircle="true" />
</FrameLayout>