mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-13 20:45:12 -05:00
OverviewFragment: Use connected/disconnected icons from navigation drawer.
This commit is contained in:
parent
91c0d23ac2
commit
3f4b2f2de3
@ -24,6 +24,7 @@ import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.yaaic.R;
|
||||
@ -48,7 +49,7 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final TextView titleView;
|
||||
public final TextView hostView;
|
||||
public final View connectionView;
|
||||
public final ImageView connectionView;
|
||||
public final View menuView;
|
||||
public final ServerPopupMenu popupMenu;
|
||||
|
||||
@ -57,7 +58,7 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
||||
|
||||
titleView = (TextView) view.findViewById(R.id.title);
|
||||
hostView = (TextView) view.findViewById(R.id.host);
|
||||
connectionView = view.findViewById(R.id.connection);
|
||||
connectionView = (ImageView) view.findViewById(R.id.connection);
|
||||
menuView = view.findViewById(R.id.menu);
|
||||
|
||||
popupMenu = new ServerPopupMenu(
|
||||
@ -94,7 +95,11 @@ public class ServersAdapter extends RecyclerView.Adapter<ServersAdapter.ViewHold
|
||||
|
||||
holder.titleView.setText(server.getTitle());
|
||||
holder.titleView.setTextColor(color);
|
||||
holder.connectionView.setBackgroundColor(color);
|
||||
holder.connectionView.setImageResource(
|
||||
server.isConnected()
|
||||
? R.drawable.ic_navigation_server_connected
|
||||
: R.drawable.ic_navigation_server_disconnected
|
||||
);
|
||||
holder.hostView.setText(String.format("%s @ %s : %d",
|
||||
server.getIdentity().getNickname(),
|
||||
server.getHost(),
|
||||
|
@ -19,52 +19,50 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
card_view:cardBackgroundColor="@color/cardview_background">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp">
|
||||
|
||||
<View
|
||||
<ImageView
|
||||
android:id="@+id/connection"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="4dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Server"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="irc.example.com"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Body1" />
|
||||
</LinearLayout>
|
||||
android:src="@drawable/ic_navigation_server_disconnected"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:clickable="true"
|
||||
android:src="@drawable/ic_action_menu" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/connection"
|
||||
android:layout_toLeftOf="@id/menu"
|
||||
android:text="Server"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_toRightOf="@id/connection"
|
||||
android:layout_toLeftOf="@id/menu"
|
||||
android:text="irc.example.com"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Body1" />
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
|
Loading…
Reference in New Issue
Block a user