Commit 0d37954e authored by Leonardo Aramaki's avatar Leonardo Aramaki

Fix margins and ellipsize hostname on server list

parent 3d325cdf
......@@ -265,27 +265,29 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
if (subPane != null) {
LinearLayout serverListContainer = subPane.findViewById(R.id.server_list_bar);
for (Pair<String, String> server : serverList) {
if (serverListContainer.findViewWithTag(server.first) == null) {
String serverHostname = server.first;
String serverLogoUrl = server.second;
if (serverListContainer.findViewWithTag(serverHostname) == null) {
int serverCount = serverListContainer.getChildCount();
View serverRow = LayoutInflater.from(this).inflate(R.layout.server_row, serverListContainer, false);
SimpleDraweeView serverButton = serverRow.findViewById(R.id.drawee_server_button);
TextView serverLabel = serverRow.findViewById(R.id.text_view_server_label);
serverButton.setTag(server.first);
serverLabel.setText(server.first);
serverButton.setTag(serverHostname);
serverLabel.setText(serverHostname);
// Currently selected server
if (server.first.equalsIgnoreCase(hostname)) {
if (serverHostname.equalsIgnoreCase(hostname)) {
serverLabel.setSelected(true);
serverLabel.setTypeface(Typeface.DEFAULT_BOLD);
}
serverRow.setOnClickListener(view -> changeServerIfNeeded(server.first));
serverRow.setOnClickListener(view -> changeServerIfNeeded(serverHostname));
Drawable drawable = AvatarHelper.INSTANCE.getTextDrawable(server.first,this);
Drawable placeholder = AvatarHelper.INSTANCE.getTextDrawable(serverHostname,this);
FrescoHelper.INSTANCE.loadImage(serverButton, server.second, drawable);
FrescoHelper.INSTANCE.loadImage(serverButton, serverLogoUrl, placeholder);
serverListContainer.addView(serverRow, serverCount - 1);
serverListContainer.requestLayout();
......
......@@ -7,14 +7,14 @@
android:theme="@style/AppTheme.Dark">
<android.support.v4.widget.NestedScrollView
android:layout_width="280dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/colorPrimaryDark">
<LinearLayout
android:id="@+id/server_list_bar"
android:layout_width="280dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="80dp">
......@@ -11,20 +11,23 @@
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="80dp"
android:layout_height="80dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
fresco:actualImageScaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
fresco:actualImageScaleType="fitXY" />
<TextView
android:id="@+id/text_view_server_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:textColor="@color/selector_text_color_multiserver"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment