replace FlowLayout with constraint layout

This commit is contained in:
Daniel Gultsch 2024-04-15 08:33:55 +02:00
parent 699b8723e0
commit a3cc91dc11
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
20 changed files with 121 additions and 79 deletions

View file

@ -62,7 +62,7 @@ dependencies {
implementation 'me.leolin:ShortcutBadger:1.1.22@aar' implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'org.whispersystems:signal-protocol-java:2.6.2' implementation 'org.whispersystems:signal-protocol-java:2.6.2'
implementation 'com.makeramen:roundedimageview:2.3.0' implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "com.wefika:flowlayout:0.4.1"
//noinspection GradleDependency //noinspection GradleDependency
implementation('com.github.natario1:Transcoder:v0.9.1') { implementation('com.github.natario1:Transcoder:v0.9.1') {
exclude group: 'com.otaliastudios.opengl', module: 'egloo' exclude group: 'com.otaliastudios.opengl', module: 'egloo'

1
proguard-rules.pro vendored
View file

@ -34,6 +34,7 @@
-dontwarn org.openjsse.javax.net.ssl.SSLParameters -dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket -dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE -dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn org.jetbrains.annotations.**
-keepclassmembers class eu.siacs.conversations.http.services.** { -keepclassmembers class eu.siacs.conversations.http.services.** {
!transient <fields>; !transient <fields>;

View file

@ -3,6 +3,8 @@ package eu.siacs.conversations.crypto.sasl;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
@ -10,8 +12,6 @@ import com.google.common.collect.Multimap;
import com.google.common.hash.HashFunction; import com.google.common.hash.HashFunction;
import com.google.common.primitives.Bytes; import com.google.common.primitives.Bytes;
import org.jetbrains.annotations.NotNull;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -168,7 +168,7 @@ public abstract class HashedToken extends SaslMechanism implements ChannelBindin
return null; return null;
} }
@NotNull @NonNull
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) return MoreObjects.toStringHelper(this)

View file

@ -7,6 +7,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
@ -14,9 +15,6 @@ import com.google.common.base.Objects;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -254,7 +252,7 @@ public class UnifiedPushDatabase extends SQLiteOpenHelper {
this.instance = instance; this.instance = instance;
} }
@NotNull @NonNull
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) return MoreObjects.toStringHelper(this)

View file

@ -11,8 +11,6 @@ import androidx.annotation.NonNull;
import com.otaliastudios.transcoder.Transcoder; import com.otaliastudios.transcoder.Transcoder;
import com.otaliastudios.transcoder.TranscoderListener; import com.otaliastudios.transcoder.TranscoderListener;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.Objects; import java.util.Objects;
@ -167,7 +165,7 @@ public class AttachFileToConversationRunnable implements Runnable, TranscoderLis
} }
@Override @Override
public void onTranscodeFailed(@NonNull @NotNull Throwable exception) { public void onTranscodeFailed(@NonNull final Throwable exception) {
mXmppConnectionService.stopOngoingVideoTranscodingForegroundNotification(); mXmppConnectionService.stopOngoingVideoTranscodingForegroundNotification();
Log.d(Config.LOGTAG, "video transcoding failed", exception); Log.d(Config.LOGTAG, "video transcoding failed", exception);
processAsFile(); processAsFile();

View file

@ -4,7 +4,7 @@ import static eu.siacs.conversations.utils.Random.SECURE_RANDOM;
import android.util.Log; import android.util.Log;
import org.jetbrains.annotations.NotNull; import androidx.annotation.NonNull;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
@ -640,7 +640,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
} }
} }
@NotNull @NonNull
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();

View file

@ -17,6 +17,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.media.AudioAttributes; import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.Ringtone; import android.media.Ringtone;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
@ -48,10 +49,30 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import eu.siacs.conversations.AppSettings;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Conversational;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.ui.ConversationsActivity;
import eu.siacs.conversations.ui.EditAccountActivity;
import eu.siacs.conversations.ui.RtpSessionActivity;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.TorServiceUtils;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
import eu.siacs.conversations.xmpp.jingle.Media;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -67,28 +88,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import eu.siacs.conversations.AppSettings;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Conversational;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.ui.ConversationsActivity;
import eu.siacs.conversations.ui.EditAccountActivity;
import eu.siacs.conversations.ui.RtpSessionActivity;
import eu.siacs.conversations.ui.TimePreference;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility;
import eu.siacs.conversations.utils.GeoHelper;
import eu.siacs.conversations.utils.TorServiceUtils;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
import eu.siacs.conversations.xmpp.jingle.Media;
public class NotificationService { public class NotificationService {
private static final ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE = private static final ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE =
@ -518,6 +517,7 @@ public class NotificationService {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
this.currentlyPlayingRingtone.setLooping(true); this.currentlyPlayingRingtone.setLooping(true);
} }
Log.d(Config.LOGTAG,"start playing ringtone: "+uri);
this.currentlyPlayingRingtone.play(); this.currentlyPlayingRingtone.play();
} }

View file

@ -30,10 +30,13 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import com.google.android.material.color.MaterialColors; import com.google.android.material.color.MaterialColors;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
@ -514,12 +517,16 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.tags.setVisibility(View.GONE); binding.tags.setVisibility(View.GONE);
} else { } else {
binding.tags.setVisibility(View.VISIBLE); binding.tags.setVisibility(View.VISIBLE);
binding.tags.removeAllViewsInLayout(); binding.tags.removeViews(1, binding.tags.getChildCount() - 1);
final ImmutableList.Builder<Integer> viewIdBuilder = new ImmutableList.Builder<>();
for (final ListItem.Tag tag : tagList) { for (final ListItem.Tag tag : tagList) {
final String name = tag.getName(); final String name = tag.getName();
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false); final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false);
tv.setText(name); tv.setText(name);
tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(this,XEP0392Helper.rgbFromNick(name)))); tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(this,XEP0392Helper.rgbFromNick(name))));
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
binding.tags.addView(tv); binding.tags.addView(tv);
} }
if (contact.isBlocked()) { if (contact.isBlocked()) {
@ -529,6 +536,9 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
R.layout.list_item_tag, binding.tags, false); R.layout.list_item_tag, binding.tags, false);
tv.setText(R.string.blocked); tv.setText(R.string.blocked);
tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(tv.getContext(), ContextCompat.getColor(tv.getContext(),R.color.gray_800)))); tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(tv.getContext(), ContextCompat.getColor(tv.getContext(),R.color.gray_800))));
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
binding.tags.addView(tv); binding.tags.addView(tv);
} else { } else {
final Presence.Status status = contact.getShownStatus(); final Presence.Status status = contact.getShownStatus();
@ -538,9 +548,13 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
inflater.inflate( inflater.inflate(
R.layout.list_item_tag, binding.tags, false); R.layout.list_item_tag, binding.tags, false);
UIHelper.setStatus(tv, status); UIHelper.setStatus(tv, status);
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
binding.tags.addView(tv); binding.tags.addView(tv);
} }
} }
binding.flowWidget.setReferencedIds(Ints.toArray(viewIdBuilder.build()));
} }
} }

View file

@ -59,7 +59,6 @@ import android.widget.Toast;
import androidx.annotation.IdRes; import androidx.annotation.IdRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.inputmethod.InputConnectionCompat; import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat; import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
@ -131,7 +130,6 @@ import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession;
import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -2314,7 +2312,7 @@ public class ConversationFragment extends XmppFragment
} }
@Override @Override
public void onSaveInstanceState(@NotNull Bundle outState) { public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
if (conversation != null) { if (conversation != null) {
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid()); outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());

View file

@ -17,7 +17,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import org.jetbrains.annotations.NotNull;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import java.util.HashMap; import java.util.HashMap;
@ -151,7 +150,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
} }
@Override @Override
public boolean onCreateOptionsMenu(@NotNull final Menu menu) { public boolean onCreateOptionsMenu(@NonNull final Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present. // Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_show_location, menu); getMenuInflater().inflate(R.menu.menu_show_location, menu);
updateUi(); updateUi();
@ -230,7 +229,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
} }
@Override @Override
public void onLocationChanged(@NotNull final Location location) { public void onLocationChanged(@NonNull final Location location) {
if (LocationHelper.isBetterLocation(location, this.myLoc)) { if (LocationHelper.isBetterLocation(location, this.myLoc)) {
this.myLoc = location; this.myLoc = location;
updateLocationMarkers(); updateLocationMarkers();
@ -241,8 +240,8 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
public void onStatusChanged(final String provider, final int status, final Bundle extras) {} public void onStatusChanged(final String provider, final int status, final Bundle extras) {}
@Override @Override
public void onProviderEnabled(@NotNull final String provider) {} public void onProviderEnabled(@NonNull final String provider) {}
@Override @Override
public void onProviderDisabled(@NotNull final String provider) {} public void onProviderDisabled(@NonNull final String provider) {}
} }

View file

@ -11,8 +11,8 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
@ -35,8 +35,6 @@ import okhttp3.HttpUrl;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
import org.jetbrains.annotations.NotNull;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -218,13 +216,13 @@ public class UriHandlerActivity extends BaseActivity {
this.call.enqueue( this.call.enqueue(
new Callback() { new Callback() {
@Override @Override
public void onFailure(@NotNull Call call, @NotNull IOException e) { public void onFailure(@NonNull Call call, @NonNull IOException e) {
Log.d(Config.LOGTAG, "unable to check HTTP url", e); Log.d(Config.LOGTAG, "unable to check HTTP url", e);
showError(R.string.no_xmpp_adddress_found); showError(R.string.no_xmpp_adddress_found);
} }
@Override @Override
public void onResponse(@NotNull Call call, @NotNull Response response) { public void onResponse(@NonNull Call call, @NonNull Response response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
final String linkHeader = response.header("Link"); final String linkHeader = response.header("Link");
if (linkHeader != null && processLinkHeader(linkHeader)) { if (linkHeader != null && processLinkHeader(linkHeader)) {

View file

@ -899,12 +899,9 @@ public abstract class XmppActivity extends ActionBarActivity {
final Point size = new Point(); final Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size); getWindowManager().getDefaultDisplay().getSize(size);
final int width = Math.min(size.x, size.y); final int width = Math.min(size.x, size.y);
final boolean nightMode = (this.getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
final int black; final int black;
final int white; final int white;
if (nightMode) { if (Activities.isNightMode(this)) {
black = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceContainerHighest,"No surface color configured"); black = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceContainerHighest,"No surface color configured");
white = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceInverse,"No inverse surface color configured"); white = MaterialColors.getColor(this, com.google.android.material.R.attr.colorSurfaceInverse,"No inverse surface color configured");
} else { } else {

View file

@ -12,11 +12,15 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.constraintlayout.helper.widget.Flow;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import com.google.android.material.color.MaterialColors; import com.google.android.material.color.MaterialColors;
import com.wefika.flowlayout.FlowLayout; import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints;
import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.AppSettings;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -85,13 +89,17 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
viewHolder.tags.setVisibility(View.GONE); viewHolder.tags.setVisibility(View.GONE);
} else { } else {
viewHolder.tags.setVisibility(View.VISIBLE); viewHolder.tags.setVisibility(View.VISIBLE);
viewHolder.tags.removeAllViewsInLayout(); viewHolder.tags.removeViews(1, viewHolder.tags.getChildCount() - 1);
final ImmutableList.Builder<Integer> viewIdBuilder = new ImmutableList.Builder<>();
for (final ListItem.Tag tag : tags) { for (final ListItem.Tag tag : tags) {
final String name = tag.getName(); final String name = tag.getName();
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, viewHolder.tags, false); final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, viewHolder.tags, false);
tv.setText(name); tv.setText(name);
tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(getContext(),XEP0392Helper.rgbFromNick(name)))); tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(getContext(),XEP0392Helper.rgbFromNick(name))));
tv.setOnClickListener(this.onTagTvClick); tv.setOnClickListener(this.onTagTvClick);
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
viewHolder.tags.addView(tv); viewHolder.tags.addView(tv);
} }
if (item instanceof Contact contact) { if (item instanceof Contact contact) {
@ -102,6 +110,9 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
R.layout.list_item_tag, viewHolder.tags, false); R.layout.list_item_tag, viewHolder.tags, false);
tv.setText(R.string.blocked); tv.setText(R.string.blocked);
tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(tv.getContext(),ContextCompat.getColor(tv.getContext(),R.color.gray_800)))); tv.setBackgroundTintList(ColorStateList.valueOf(MaterialColors.harmonizeWithPrimary(tv.getContext(),ContextCompat.getColor(tv.getContext(),R.color.gray_800))));
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
viewHolder.tags.addView(tv); viewHolder.tags.addView(tv);
} else { } else {
final Presence.Status status = contact.getShownStatus(); final Presence.Status status = contact.getShownStatus();
@ -111,10 +122,14 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
inflater.inflate( inflater.inflate(
R.layout.list_item_tag, viewHolder.tags, false); R.layout.list_item_tag, viewHolder.tags, false);
UIHelper.setStatus(tv, status); UIHelper.setStatus(tv, status);
final int id = ViewCompat.generateViewId();
tv.setId(id);
viewIdBuilder.add(id);
viewHolder.tags.addView(tv); viewHolder.tags.addView(tv);
} }
} }
} }
viewHolder.flowWidget.setReferencedIds(Ints.toArray(viewIdBuilder.build()));
} }
final Jid jid = item.getJid(); final Jid jid = item.getJid();
if (jid != null) { if (jid != null) {
@ -141,7 +156,8 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
private TextView name; private TextView name;
private TextView jid; private TextView jid;
private ImageView avatar; private ImageView avatar;
private FlowLayout tags; private ConstraintLayout tags;
private Flow flowWidget;
private ViewHolder() { private ViewHolder() {
@ -153,6 +169,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
viewHolder.jid = binding.contactJid; viewHolder.jid = binding.contactJid;
viewHolder.avatar = binding.contactPhoto; viewHolder.avatar = binding.contactPhoto;
viewHolder.tags = binding.tags; viewHolder.tags = binding.tags;
viewHolder.flowWidget = binding.flowWidget;
binding.getRoot().setTag(viewHolder); binding.getRoot().setTag(viewHolder);
return viewHolder; return viewHolder;
} }

View file

@ -36,13 +36,13 @@ import android.net.Uri;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import androidx.annotation.NonNull;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.utils.MimeUtils; import eu.siacs.conversations.utils.MimeUtils;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -92,7 +92,7 @@ public class Attachment implements Parcelable {
return type; return type;
} }
@NotNull @NonNull
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) return MoreObjects.toStringHelper(this)

View file

@ -44,6 +44,7 @@ import com.google.android.material.color.MaterialColors;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Presence; import eu.siacs.conversations.entities.Presence;
import eu.siacs.conversations.ui.Activities;
import eu.siacs.conversations.ui.ConversationFragment; import eu.siacs.conversations.ui.ConversationFragment;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
@ -110,9 +111,7 @@ public class SendButtonTool {
} }
public @ColorInt static int getSendButtonColor(final View view, final Presence.Status status) { public @ColorInt static int getSendButtonColor(final View view, final Presence.Status status) {
final boolean nightMode = final boolean nightMode = Activities.isNightMode(view.getContext());
(view.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK)
== Configuration.UI_MODE_NIGHT_YES;
return switch (status) { return switch (status) {
case OFFLINE -> MaterialColors.getColor( case OFFLINE -> MaterialColors.getColor(
view, com.google.android.material.R.attr.colorOnSurface); view, com.google.android.material.R.attr.colorOnSurface);

View file

@ -1,10 +1,10 @@
package eu.siacs.conversations.xml; package eu.siacs.conversations.xml;
import androidx.annotation.NonNull;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
@ -177,7 +177,7 @@ public class Element {
return this.attributes; return this.attributes;
} }
@NotNull @NonNull
public String toString() { public String toString() {
final StringBuilder elementOutput = new StringBuilder(); final StringBuilder elementOutput = new StringBuilder();
if ((content == null) && (children.size() == 0)) { if ((content == null) && (children.size() == 0)) {

View file

@ -1,6 +1,6 @@
package eu.siacs.conversations.xml; package eu.siacs.conversations.xml;
import org.jetbrains.annotations.NotNull; import androidx.annotation.NonNull;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -80,7 +80,7 @@ public class Tag {
return (this.type == NO); return (this.type == NO);
} }
@NotNull @NonNull
public String toString() { public String toString() {
final StringBuilder tagOutput = new StringBuilder(); final StringBuilder tagOutput = new StringBuilder();
tagOutput.append('<'); tagOutput.append('<');

View file

@ -66,14 +66,25 @@
android:text="@string/account_settings_example_jabber_id" android:text="@string/account_settings_example_jabber_id"
android:textAppearance="?textAppearanceTitleMedium" /> android:textAppearance="?textAppearanceTitleMedium" />
<com.wefika.flowlayout.FlowLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/tags" android:id="@+id/tags"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="-2dp" android:layout_marginTop="8sp">
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" <androidx.constraintlayout.helper.widget.Flow
android:orientation="horizontal" /> android:id="@+id/flow_widget"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:flow_horizontalBias="0"
app:flow_horizontalGap="8sp"
app:flow_horizontalStyle="packed"
app:flow_verticalGap="4sp"
app:flow_wrapMode="chain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:id="@+id/details_lastseen" android:id="@+id/details_lastseen"

View file

@ -41,12 +41,26 @@
android:textAppearance="?textAppearanceBodyMedium" android:textAppearance="?textAppearanceBodyMedium"
tools:text="juliet@capulet.example" /> tools:text="juliet@capulet.example" />
<com.wefika.flowlayout.FlowLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/tags" android:id="@+id/tags"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="-2dp" android:layout_marginTop="4sp">
android:orientation="horizontal"/>
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/flow_widget"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:flow_horizontalBias="0"
app:flow_horizontalGap="8sp"
app:flow_horizontalStyle="packed"
app:flow_verticalGap="4sp"
app:flow_wrapMode="chain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
android:id="@+id/key" android:id="@+id/key"

View file

@ -3,8 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="2dp"
android:layout_marginVertical="4dp"
android:background="@drawable/background_label" android:background="@drawable/background_label"
android:backgroundTint="@color/green_700" android:backgroundTint="@color/green_700"
android:maxLines="1" android:maxLines="1"