Commit 3dfd5163 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add hostname with more outstanding color to show active server

parent dd508b7a
package chat.rocket.android.activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
......@@ -10,6 +11,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
......@@ -123,6 +125,9 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
public void onPanelClosed(View panel) {
toolbar.setNavigationIconVerticalMirror(false);
closeUserActionContainer();
if (subPane != null) {
subPane.closePane();
}
}
});
}
......@@ -263,17 +268,26 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
if (serverListContainer.findViewWithTag(server.first) == null) {
int serverCount = serverListContainer.getChildCount();
SimpleDraweeView serverButton =
(SimpleDraweeView) LayoutInflater.from(this).inflate(R.layout.server_button, serverListContainer, false);
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);
// Currently selected server
if (server.first.equalsIgnoreCase(hostname)) {
serverLabel.setSelected(true);
serverLabel.setTypeface(Typeface.DEFAULT_BOLD);
}
serverButton.setOnClickListener(view -> changeServerIfNeeded(server.first));
serverRow.setOnClickListener(view -> changeServerIfNeeded(server.first));
Drawable drawable = AvatarHelper.INSTANCE.getTextDrawable(server.first,this);
FrescoHelper.INSTANCE.loadImage(serverButton, server.second, drawable);
serverListContainer.addView(serverButton, serverCount - 1);
serverListContainer.addView(serverRow, serverCount - 1);
serverListContainer.requestLayout();
}
}
......
......@@ -7,14 +7,14 @@
android:theme="@style/AppTheme.Dark">
<android.support.v4.widget.NestedScrollView
android:layout_width="96dp"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/colorPrimaryDark">
<LinearLayout
android:id="@+id/server_list_bar"
android:layout_width="match_parent"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:orientation="vertical">
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
android:color="@android:color/white" />
<item android:color="@color/color_timestamp"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.facebook.drawee.view.SimpleDraweeView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:id="@+id/drawee_server_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="8dp"
fresco:actualImageScaleType="fitXY" />
\ No newline at end of file
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="80dp">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/drawee_server_button"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="80dp"
android:layout_height="80dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:layout_marginTop="8dp"
fresco:actualImageScaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_view_server_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:textColor="@color/selector_text_color_multiserver"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/drawee_server_button"
app:layout_constraintTop_toTopOf="parent"
tools:text="demo.rocket.chat" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
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