Refine traffic stat layout
This commit is contained in:
@@ -4,33 +4,23 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
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:orientation="vertical" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_marginLeft="15dip"
|
||||
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"
|
||||
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:layout_column="3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
@@ -38,7 +28,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end" />
|
||||
</TableRow>
|
||||
</LinearLayout>
|
||||
|
||||
<TableLayout
|
||||
android:stretchColumns="2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
@@ -55,21 +50,30 @@
|
||||
<TextView
|
||||
android:layout_column="1"
|
||||
android:id="@+id/tx"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="0 Byte" />
|
||||
android:gravity="end" />
|
||||
<TextView
|
||||
android:layout_column="3"
|
||||
android:id="@+id/txRate"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
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:text="▲ 0 B/s" />
|
||||
android:text="▲" />
|
||||
<TextView
|
||||
android:layout_column="3"
|
||||
android:id="@+id/txRate"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
@@ -87,21 +91,30 @@
|
||||
<TextView
|
||||
android:layout_column="1"
|
||||
android:id="@+id/rx"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="0 Byte" />
|
||||
android:gravity="end" />
|
||||
<TextView
|
||||
android:layout_column="3"
|
||||
android:id="@+id/rxRate"
|
||||
style="@style/TextAppearance.AppCompat.Caption"
|
||||
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:text="▼ 0 B/s" />
|
||||
android:text="▼" />
|
||||
<TextView
|
||||
android:layout_column="3"
|
||||
android:id="@+id/rxRate"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end" />
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
@@ -159,8 +159,8 @@ class Shadowsocks
|
||||
}
|
||||
def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) {
|
||||
trafficCache = Array(
|
||||
"▲ " + TrafficMonitor.formatTraffic(txRate) + "/s",
|
||||
"▼ " + TrafficMonitor.formatTraffic(rxRate) + "/s",
|
||||
TrafficMonitor.formatTraffic(txRate) + "/s",
|
||||
TrafficMonitor.formatTraffic(rxRate) + "/s",
|
||||
TrafficMonitor.formatTraffic(txTotal), TrafficMonitor.formatTraffic(rxTotal))
|
||||
handler.post(updateTraffic)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user