mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03:00
properly theme adapter filter highlighting
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
8c266fe229
commit
34d6da68a1
7 changed files with 22 additions and 23 deletions
|
@ -32,6 +32,7 @@ import autodagger.AutoInjector
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.events.CertificateEvent
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.SecurityUtils
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
import com.nextcloud.talk.utils.ssl.MagicTrustManager
|
||||
|
@ -53,6 +54,9 @@ open class BaseActivity : AppCompatActivity() {
|
|||
@Inject
|
||||
lateinit var appPreferences: AppPreferences
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
@Inject
|
||||
lateinit var context: Context
|
||||
|
||||
|
@ -113,7 +117,7 @@ open class BaseActivity : AppCompatActivity() {
|
|||
LovelyStandardDialog(this)
|
||||
.setTopColorRes(R.color.nc_darkRed)
|
||||
.setNegativeButtonColorRes(R.color.nc_darkRed)
|
||||
.setPositiveButtonColorRes(R.color.colorPrimary)
|
||||
.setPositiveButtonColor(viewThemeUtils.getScheme(this).primary)
|
||||
.setIcon(R.drawable.ic_security_white_24dp)
|
||||
.setTitle(R.string.nc_certificate_dialog_title)
|
||||
.setMessage(dialogText)
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|||
import com.nextcloud.talk.data.user.model.User;
|
||||
import com.nextcloud.talk.databinding.AccountItemBinding;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
|
||||
|
@ -54,11 +55,16 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||
private final User user;
|
||||
@Nullable
|
||||
private final Account account;
|
||||
private final ViewThemeUtils viewThemeUtils;
|
||||
|
||||
public AdvancedUserItem(Participant participant, User user, @Nullable Account account) {
|
||||
public AdvancedUserItem(Participant participant,
|
||||
User user,
|
||||
@Nullable Account account,
|
||||
ViewThemeUtils viewThemeUtils) {
|
||||
this.participant = participant;
|
||||
this.user = user;
|
||||
this.account = account;
|
||||
this.viewThemeUtils = viewThemeUtils;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,9 +116,7 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||
holder.binding.userName,
|
||||
participant.getDisplayName(),
|
||||
String.valueOf(adapter.getFilter(String.class)),
|
||||
NextcloudTalkApplication.Companion.getSharedApplication()
|
||||
.getResources()
|
||||
.getColor(R.color.colorPrimary));
|
||||
viewThemeUtils.getScheme(holder.binding.userName.getContext()).getPrimary());
|
||||
} else {
|
||||
holder.binding.userName.setText(participant.getDisplayName());
|
||||
}
|
||||
|
|
|
@ -135,19 +135,15 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
|
|||
holder.binding.avatarDraweeView.setAlpha(1.0f);
|
||||
}
|
||||
|
||||
holder.binding.nameText.setText(participant.getDisplayName());
|
||||
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.binding.nameText,
|
||||
participant.getDisplayName(),
|
||||
String.valueOf(adapter.getFilter(String.class)),
|
||||
NextcloudTalkApplication
|
||||
.Companion
|
||||
.getSharedApplication()
|
||||
.getResources()
|
||||
.getColor(R.color.colorPrimary));
|
||||
viewThemeUtils.getScheme(holder.binding.nameText.getContext()).getPrimary());
|
||||
}
|
||||
|
||||
holder.binding.nameText.setText(participant.getDisplayName());
|
||||
|
||||
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
||||
(participant.getType().equals(Participant.ParticipantType.GUEST) ||
|
||||
participant.getType().equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {
|
||||
|
|
|
@ -131,16 +131,14 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
|
|||
holder.binding.avatarDraweeView.setAlpha(1.0f);
|
||||
}
|
||||
|
||||
holder.binding.nameText.setText(participant.getDisplayName());
|
||||
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.binding.nameText, participant.getDisplayName(),
|
||||
String.valueOf(adapter.getFilter(String.class)),
|
||||
NextcloudTalkApplication.Companion.getSharedApplication()
|
||||
.getResources()
|
||||
.getColor(R.color.colorPrimary));
|
||||
viewThemeUtils.getScheme(holder.binding.nameText.getContext()).getPrimary());
|
||||
}
|
||||
|
||||
holder.binding.nameText.setText(participant.getDisplayName());
|
||||
|
||||
if (TextUtils.isEmpty(participant.getDisplayName()) &&
|
||||
(participant.getType().equals(Participant.ParticipantType.GUEST) ||
|
||||
participant.getType().equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {
|
||||
|
|
|
@ -138,7 +138,7 @@ class SwitchAccountController(args: Bundle? = null) :
|
|||
participant.actorType = Participant.ActorType.USERS
|
||||
participant.actorId = userId
|
||||
participant.displayName = user.displayName
|
||||
userItems.add(AdvancedUserItem(participant, user, null))
|
||||
userItems.add(AdvancedUserItem(participant, user, null, viewThemeUtils))
|
||||
}
|
||||
}
|
||||
adapter!!.addListener(onSwitchItemClickListener)
|
||||
|
@ -156,7 +156,7 @@ class SwitchAccountController(args: Bundle? = null) :
|
|||
participant.displayName = importAccount.getUsername()
|
||||
user = User()
|
||||
user.baseUrl = importAccount.getBaseUrl()
|
||||
userItems.add(AdvancedUserItem(participant, user, account))
|
||||
userItems.add(AdvancedUserItem(participant, user, account, viewThemeUtils))
|
||||
}
|
||||
adapter!!.addListener(onImportItemClickListener)
|
||||
adapter!!.updateDataSet(userItems, false)
|
||||
|
|
|
@ -65,9 +65,6 @@ class MessageSearchActivity : BaseActivity() {
|
|||
@Inject
|
||||
lateinit var userProvider: CurrentUserProviderNew
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private lateinit var binding: ActivityMessageSearchBinding
|
||||
private lateinit var searchView: SearchView
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ public class ChooseAccountDialogFragment extends DialogFragment {
|
|||
participant.setActorType(Participant.ActorType.USERS);
|
||||
participant.setActorId(userId);
|
||||
participant.setDisplayName(userEntity.getDisplayName());
|
||||
userItems.add(new AdvancedUserItem(participant, userEntity, null));
|
||||
userItems.add(new AdvancedUserItem(participant, userEntity, null, viewThemeUtils));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue