diff --git a/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntry.java b/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntry.java index ab00a64cf37cdce5a305b80605d217807b8da817..d2e1d982d826375274f9d5130f66dba7b7bdcc2d 100644 --- a/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntry.java +++ b/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntry.java @@ -209,16 +209,29 @@ public class TunnelEntry { public Drawable getStatusIcon() { switch (getStatus()) { case STANDBY: - case STARTING: return mContext.getResources() - .getDrawable(R.drawable.local_inprogress); + .getDrawable(R.drawable.ic_schedule_black_24dp); + case STARTING: case RUNNING: - return mContext.getResources() - .getDrawable(R.drawable.local_up); case NOT_RUNNING: default: - return mContext.getResources() - .getDrawable(R.drawable.local_down); + return null; + } + } + + public Drawable getStatusBackground() { + switch (getStatus()) { + case STANDBY: + case STARTING: + return mContext.getResources() + .getDrawable(R.drawable.tunnel_yellow); + case RUNNING: + return mContext.getResources() + .getDrawable(R.drawable.tunnel_green); + case NOT_RUNNING: + default: + return mContext.getResources() + .getDrawable(R.drawable.tunnel_red); } } } diff --git a/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntryAdapter.java b/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntryAdapter.java index fe8461723db38572dbf02a0527bbc6e1d62688fb..b1139969dc5bb1c77a77ed09825f001184c670f7 100644 --- a/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntryAdapter.java +++ b/app/src/main/java/net/i2p/android/i2ptunnel/TunnelEntryAdapter.java @@ -33,21 +33,19 @@ public class TunnelEntryAdapter extends ArrayAdapter<TunnelEntry> { View v = mInflater.inflate(R.layout.listitem_i2ptunnel, parent, false); TunnelEntry tunnel = getItem(position); + ImageView status = (ImageView) v.findViewById(R.id.tunnel_status); + status.setImageDrawable(tunnel.getStatusIcon()); + status.setBackground(tunnel.getStatusBackground()); + TextView name = (TextView) v.findViewById(R.id.tunnel_name); name.setText(tunnel.getName()); - TextView type = (TextView) v.findViewById(R.id.tunnel_type); - type.setText(tunnel.getType()); + TextView type = (TextView) v.findViewById(R.id.tunnel_description); + type.setText(tunnel.getDescription()); TextView ifacePort = (TextView) v.findViewById(R.id.tunnel_interface_port); ifacePort.setText(tunnel.getIfacePort()); - TextView details = (TextView) v.findViewById(R.id.tunnel_details); - details.setText(tunnel.getDetails()); - - ImageView status = (ImageView) v.findViewById(R.id.tunnel_status); - status.setImageDrawable(tunnel.getStatusIcon()); - return v; } } diff --git a/app/src/main/res/drawable-hdpi/ic_schedule_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_schedule_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..3bc6860f5bb9046462cbb220edb9ab6ce42e42e8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_schedule_black_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_schedule_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_schedule_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..b3e28319cc01a64f3671839e5da44c702ec5ee5e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_schedule_black_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_schedule_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_schedule_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..8902009996b9fe081580701e115e72f4f54de538 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_schedule_black_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_schedule_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_schedule_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..4485fdba622d7bf850320632bcf152e371037aaa Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_schedule_black_24dp.png differ diff --git a/app/src/main/res/layout/listitem_i2ptunnel.xml b/app/src/main/res/layout/listitem_i2ptunnel.xml index 529bd69f5fededa88a4388970490dee676aedb54..afb8192261c20d425ebfdcf5f99bfc63f790ed7a 100644 --- a/app/src/main/res/layout/listitem_i2ptunnel.xml +++ b/app/src/main/res/layout/listitem_i2ptunnel.xml @@ -1,49 +1,65 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:padding="5dp" > + android:layout_height="@dimen/listitem_height_two_lines" + android:paddingEnd="@dimen/listitem_horizontal_margin" + android:paddingRight="@dimen/listitem_horizontal_margin"> - <!-- The name of the tunnel --> - <TextView android:id="@+id/tunnel_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="3dp" - android:textSize="16sp" + <!-- Tunnel status --> + <ImageView + android:id="@+id/tunnel_status" + android:layout_width="@dimen/listitem_icon_size" + android:layout_height="@dimen/listitem_icon_size" android:layout_alignParentLeft="true" - android:layout_marginRight="5dp" - android:text="Tunnel name" /> - - <!-- The type of tunnel --> - <TextView android:id="@+id/tunnel_type" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_below="@id/tunnel_name" - android:text="Tunnel type" /> + android:layout_alignParentStart="true" + android:layout_centerVertical="true" + android:layout_marginLeft="@dimen/listitem_horizontal_margin" + android:layout_marginStart="@dimen/listitem_horizontal_margin" + android:contentDescription="Status" /> - <!-- Additional tunnel details --> - <TextView android:id="@+id/tunnel_details" + <!-- The name of the tunnel --> + <TextView + android:id="@+id/tunnel_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_below="@id/tunnel_type" - android:text="Tunnel details" /> + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_marginLeft="@dimen/listitem_text_left_margin" + android:layout_marginStart="@dimen/listitem_text_left_margin" + android:layout_marginTop="@dimen/listitem_text_top_margin_two_lines" + android:text="Tunnel name" + android:textAppearance="@style/TextAppearance.AppCompat.Primary" /> <!-- Interface:port the tunnel listens on or points to --> - <TextView android:id="@+id/tunnel_interface_port" + <TextView + android:id="@+id/tunnel_interface_port" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_toRightOf="@id/tunnel_name" + android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignTop="@id/tunnel_name" + android:layout_marginLeft="4dp" + android:layout_marginStart="4dp" + android:layout_toEndOf="@id/tunnel_name" + android:layout_toRightOf="@id/tunnel_name" + android:ellipsize="start" android:gravity="right" - android:text="Interface:port" /> + android:maxLines="1" + android:text="Interface:port" + android:textAppearance="@style/TextAppearance.AppCompat.Secondary" /> - <!-- Status star --> - <ImageView android:id="@+id/tunnel_status" + <!-- The tunnel description --> + <TextView + android:id="@+id/tunnel_description" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:contentDescription="Status" /> + android:layout_alignLeft="@+id/tunnel_name" + android:layout_alignParentBottom="true" + android:layout_alignStart="@+id/tunnel_name" + android:layout_marginBottom="@dimen/listitem_text_bottom_margin_two_lines" + android:ellipsize="end" + android:maxLines="1" + android:text="Tunnel description" + android:textAppearance="@style/TextAppearance.AppCompat.Secondary" /> </RelativeLayout> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 519f42f869d6672d5045ab7a6c7b4358b6c84b84..e3b9beface8b5d77bcb68ddeb440739ffd5026f0 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -6,13 +6,22 @@ <dimen name="nav_horizontal_margin">16dp</dimen> <dimen name="nav_entry_height">48dp</dimen> + <dimen name="text_size_primary">16sp</dimen> + <dimen name="text_size_secondary">14sp</dimen> + <dimen name="list_vertical_padding">8dp</dimen> - <dimen name="listitem_height_one_line">56dp</dimen> <dimen name="listitem_horizontal_margin">16dp</dimen> <dimen name="listitem_picture_size">40dp</dimen> + <dimen name="listitem_icon_size">24dp</dimen> <dimen name="listitem_text_left_margin">72dp</dimen> <dimen name="listitem_icon_left_margin">8dp</dimen> + <dimen name="listitem_height_one_line">56dp</dimen> + + <dimen name="listitem_height_two_lines">72dp</dimen> + <dimen name="listitem_text_top_margin_two_lines">16dp</dimen> + <dimen name="listitem_text_bottom_margin_two_lines">18dp</dimen> + <dimen name="tunnel_indicator">20dp</dimen> <dimen name="step_pager_tab_width">32dp</dimen> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 67eaeb7fe909662e4bad58c1486217fa165f5eb1..693c62875ee18ba5136dca1df4da5c5bbd6cd819 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -19,6 +19,16 @@ <!-- The rest of your attributes --> </style> + <style name="TextAppearance.AppCompat.Primary" parent="TextAppearance.AppCompat.Body1"> + <item name="android:textColor">@color/primary_text_default_material_dark</item> + <item name="android:textSize">@dimen/text_size_primary</item> + </style> + + <style name="TextAppearance.AppCompat.Secondary" parent="TextAppearance.AppCompat.Body1"> + <item name="android:textColor">@color/secondary_text_default_material_dark</item> + <item name="android:textSize">@dimen/text_size_secondary</item> + </style> + <style name="WizardPageContainer"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item>