Commit 6d3b0f34 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add a dot view to signalize current activated server

parent 98a1ec98
......@@ -9,6 +9,7 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SlidingPaneLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -251,6 +252,7 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
SimpleDraweeView serverButton = serverRow.findViewById(R.id.drawee_server_button);
TextView hostnameLabel = serverRow.findViewById(R.id.text_view_server_label);
TextView siteNameLabel = serverRow.findViewById(R.id.text_view_site_name_label);
ImageView dotView = serverRow.findViewById(R.id.selected_server_dot);
serverButton.setTag(serverHostname);
hostnameLabel.setText(serverHostname);
......@@ -258,7 +260,10 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
// Currently selected server
if (serverHostname.equalsIgnoreCase(hostname)) {
hostnameLabel.setSelected(true);
serverRow.setSelected(true);
dotView.setVisibility(View.VISIBLE);
} else {
dotView.setVisibility(View.GONE);
}
serverRow.setOnClickListener(view -> changeServerIfNeeded(serverHostname));
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/serverstatus_selected"/>
<stroke
android:width="1dp"
android:color="@color/serverstatus_outline"/>
<size
android:width="16dp"
android:height="16dp"/>
</shape>
......@@ -41,8 +41,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:ellipsize="end"
android:gravity="top"
android:maxLines="1"
......@@ -51,10 +51,25 @@
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/drawee_server_button"
app:layout_constraintTop_toBottomOf="@+id/text_view_site_name_label"
tools:text="demo.rocket.chat" />
<ImageView
android:id="@+id/selected_server_dot"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/text_view_site_name_label"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/serverstatus_selected"
tools:visibility="visible" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
......@@ -14,4 +14,6 @@
<color name="color_user_status_busy">#FFF44336</color> <!-- Red 500-->
<color name="color_user_status_away">#FFFFC107</color> <!-- Amber 500-->
<color name="color_user_status_offline">#FF607D8B</color> <!-- Blue Grey 500-->
<color name="serverstatus_selected">#FFFFFFFF</color>
<color name="serverstatus_outline">#c2c2c2</color>
</resources>
\ 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