Commit 63bc4a57 authored by Mygod's avatar Mygod

Refine layout for AppManager

parent b05adbdd
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<include layout="@layout/toolbar_light_dark"/> <include layout="@layout/toolbar_light_dark"/>
<LinearLayout android:layout_width="fill_parent" <LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="40dp" android:paddingLeft="48dp"
android:paddingStart="40dp" android:paddingStart="48dp"
android:elevation="1dp" android:elevation="1dp"
android:background="@android:color/white" android:background="@android:color/white"
android:orientation="vertical" android:orientation="vertical"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="3dp" android:padding="4dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textSize="18sp" android:textSize="18sp"
android:text="@string/on"/> android:text="@string/on"/>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="3dp" android:padding="4dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textSize="18sp" android:textSize="18sp"
android:text="@string/bypass_apps"/> android:text="@string/bypass_apps"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1"> android:background="?android:attr/selectableItemBackground">
<TableRow>
<ImageView <ImageView
android:id="@+id/itemicon" android:id="@+id/itemicon"
android:layout_width="48dp" android:layout_width="60dp"
android:layout_height="48dp" android:layout_height="48dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:padding="3dp"/> android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"/>
<TextView <TextView
android:id="@+id/itemtext" android:id="@+id/itemtext"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:text="uid:packages"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLength="25" android:ellipsize="end"
android:textSize="18sp" android:textSize="18sp"/>
android:padding="3dp"/>
<Switch <Switch
android:id="@+id/itemcheck" android:id="@+id/itemcheck"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"/> android:layout_marginRight="8dp"/>
</TableRow> </LinearLayout>
</TableLayout>
...@@ -156,8 +156,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC ...@@ -156,8 +156,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
val switch = convertView.findViewById(R.id.itemcheck).asInstanceOf[Switch] val switch = convertView.findViewById(R.id.itemcheck).asInstanceOf[Switch]
val text = convertView.findViewById(R.id.itemtext).asInstanceOf[TextView] val text = convertView.findViewById(R.id.itemtext).asInstanceOf[TextView]
entry = new ListEntry(switch, text, icon) entry = new ListEntry(switch, text, icon)
entry.text.setOnClickListener(AppManager.this) convertView.setOnClickListener(AppManager.this)
entry.text.setOnClickListener(AppManager.this)
convertView.setTag(entry) convertView.setTag(entry)
entry.switch.setOnCheckedChangeListener(AppManager.this) entry.switch.setOnCheckedChangeListener(AppManager.this)
} else { } else {
...@@ -187,7 +186,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC ...@@ -187,7 +186,7 @@ class AppManager extends AppCompatActivity with OnCheckedChangeListener with OnC
} }
def onClick(v: View) { def onClick(v: View) {
val switch = v.getTag.asInstanceOf[Switch] val switch = v.getTag.asInstanceOf[ListEntry].switch
val app: ProxiedApp = switch.getTag.asInstanceOf[ProxiedApp] val app: ProxiedApp = switch.getTag.asInstanceOf[ProxiedApp]
if (app != null) { if (app != null) {
app.proxied = !app.proxied app.proxied = !app.proxied
......
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