wrap dynamic tags into multiple lines. fixes #2003

This commit is contained in:
Daniel Gultsch 2016-08-26 16:34:42 +02:00
parent 76cbb4f727
commit fd54dc5aff
5 changed files with 15 additions and 9 deletions

View File

@ -28,6 +28,8 @@ import android.widget.QuickContactBadge;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.wefika.flowlayout.FlowLayout;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
@ -113,7 +115,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
private Button addContactButton; private Button addContactButton;
private QuickContactBadge badge; private QuickContactBadge badge;
private LinearLayout keys; private LinearLayout keys;
private LinearLayout tags; private FlowLayout tags;
private boolean showDynamicTags = false; private boolean showDynamicTags = false;
private boolean showLastSeen = false; private boolean showLastSeen = false;
private String messageFingerprint; private String messageFingerprint;
@ -215,7 +217,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
} }
}); });
keys = (LinearLayout) findViewById(R.id.details_contact_keys); keys = (LinearLayout) findViewById(R.id.details_contact_keys);
tags = (LinearLayout) findViewById(R.id.tags); tags = (FlowLayout) findViewById(R.id.tags);
if (getActionBar() != null) { if (getActionBar() != null) {
getActionBar().setHomeButtonEnabled(true); getActionBar().setHomeButtonEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true);

View File

@ -16,6 +16,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.wefika.flowlayout.FlowLayout;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.RejectedExecutionException;
@ -60,7 +62,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
TextView tvName = (TextView) view.findViewById(R.id.contact_display_name); TextView tvName = (TextView) view.findViewById(R.id.contact_display_name);
TextView tvJid = (TextView) view.findViewById(R.id.contact_jid); TextView tvJid = (TextView) view.findViewById(R.id.contact_jid);
ImageView picture = (ImageView) view.findViewById(R.id.contact_photo); ImageView picture = (ImageView) view.findViewById(R.id.contact_photo);
LinearLayout tagLayout = (LinearLayout) view.findViewById(R.id.tags); FlowLayout tagLayout = (FlowLayout) view.findViewById(R.id.tags);
List<ListItem.Tag> tags = item.getTags(activity); List<ListItem.Tag> tags = item.getTags(activity);
if (tags.size() == 0 || !this.showDynamicTags) { if (tags.size() == 0 || !this.showDynamicTags) {

View File

@ -44,14 +44,15 @@
android:textSize="?attr/TextSizeHeadline" android:textSize="?attr/TextSizeHeadline"
android:textStyle="bold" /> android:textStyle="bold" />
<LinearLayout <com.wefika.flowlayout.FlowLayout
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_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginLeft="-2dp"
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:orientation="horizontal"> android:orientation="horizontal">
</LinearLayout> </com.wefika.flowlayout.FlowLayout>
<TextView <TextView
android:id="@+id/details_lastseen" android:id="@+id/details_lastseen"

View File

@ -38,13 +38,13 @@
android:singleLine="true" android:singleLine="true"
android:textColor="?attr/color_text_primary" android:textColor="?attr/color_text_primary"
android:textSize="?attr/TextSizeBody" /> android:textSize="?attr/TextSizeBody" />
<LinearLayout <com.wefika.flowlayout.FlowLayout
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_marginTop="4dp" android:layout_marginLeft="-2dp"
android:orientation="horizontal"> android:orientation="horizontal">
</LinearLayout> </com.wefika.flowlayout.FlowLayout>
<TextView <TextView
android:id="@+id/key" android:id="@+id/key"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -9,5 +9,6 @@
android:textSize="?attr/TextSizeInfo" android:textSize="?attr/TextSizeInfo"
android:textColor="@color/white" android:textColor="@color/white"
android:textAllCaps="true" android:textAllCaps="true"
android:layout_marginRight="8dp" android:maxLines="1"
android:layout_margin="2dp"
/> />