Commit 0cf15857 authored by Mygod's avatar Mygod

Refine traffic stat layout

parent b8d97dde
...@@ -4,33 +4,23 @@ ...@@ -4,33 +4,23 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight" android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingEnd="?android:attr/scrollbarSize" android:paddingLeft="15dip"
android:paddingRight="15dip"
android:paddingTop="6dip"
android:paddingBottom="6dip"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:orientation="vertical" > android:orientation="vertical" >
<TableLayout <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
android:layout_marginLeft="15dip" <TextView
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:stretchColumns="3"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_column="0"
android:layout_span="2"
android:id="@android:id/title" android:id="@android:id/title"
android:textSize="16sp" android:textSize="16sp"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"
<TextView android:layout_weight="1"/>
android:layout_column="3" <TextView
android:id="@android:id/summary" android:id="@android:id/summary"
android:textSize="14sp" android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
...@@ -38,7 +28,12 @@ ...@@ -38,7 +28,12 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end" /> android:gravity="end" />
</TableRow> </LinearLayout>
<TableLayout
android:stretchColumns="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow <TableRow
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -55,21 +50,30 @@ ...@@ -55,21 +50,30 @@
<TextView <TextView
android:layout_column="1" android:layout_column="1"
android:id="@+id/tx" android:id="@+id/tx"
style="@style/TextAppearance.AppCompat.Caption" android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end" />
<TextView
android:layout_column="2"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end" android:gravity="end"
android:text="0 Byte" /> android:text="" />
<TextView <TextView
android:layout_column="3" android:layout_column="3"
android:id="@+id/txRate" android:id="@+id/txRate"
style="@style/TextAppearance.AppCompat.Caption" android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end" android:gravity="end" />
android:text="▲ 0 B/s" />
</TableRow> </TableRow>
<TableRow <TableRow
...@@ -87,21 +91,30 @@ ...@@ -87,21 +91,30 @@
<TextView <TextView
android:layout_column="1" android:layout_column="1"
android:id="@+id/rx" android:id="@+id/rx"
style="@style/TextAppearance.AppCompat.Caption" android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end" />
<TextView
android:layout_column="2"
android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end" android:gravity="end"
android:text="0 Byte" /> android:text="" />
<TextView <TextView
android:layout_column="3" android:layout_column="3"
android:id="@+id/rxRate" android:id="@+id/rxRate"
style="@style/TextAppearance.AppCompat.Caption" android:textSize="14sp"
android:textColor="?android:attr/textColorSecondary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end" android:gravity="end" />
android:text="▼ 0 B/s" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
......
...@@ -159,8 +159,8 @@ class Shadowsocks ...@@ -159,8 +159,8 @@ class Shadowsocks
} }
def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) { def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
trafficCache = Array( trafficCache = Array(
"▲ " + TrafficMonitor.formatTraffic(txRate) + "/s", TrafficMonitor.formatTraffic(txRate) + "/s",
"▼ " + TrafficMonitor.formatTraffic(rxRate) + "/s", TrafficMonitor.formatTraffic(rxRate) + "/s",
TrafficMonitor.formatTraffic(txTotal), TrafficMonitor.formatTraffic(rxTotal)) TrafficMonitor.formatTraffic(txTotal), TrafficMonitor.formatTraffic(rxTotal))
handler.post(updateTraffic) handler.post(updateTraffic)
} }
......
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