diff --git a/src/main/res/layout/layout_apps.xml b/src/main/res/layout/layout_apps.xml index 0f02c21a..f84d4bbd 100644 --- a/src/main/res/layout/layout_apps.xml +++ b/src/main/res/layout/layout_apps.xml @@ -1,35 +1,37 @@ - - + + + android:text="@string/bypass_apps"/> - + android:layout_marginEnd="6dp" + android:layout_marginRight="6dp"/> + - - - - + - + - - - + - - + - + diff --git a/src/main/scala/com/github/shadowsocks/AppManager.scala b/src/main/scala/com/github/shadowsocks/AppManager.scala index d6c16be8..f75a9c94 100644 --- a/src/main/scala/com/github/shadowsocks/AppManager.scala +++ b/src/main/scala/com/github/shadowsocks/AppManager.scala @@ -78,7 +78,7 @@ class ObjectArrayTools[T <: AnyRef](a: Array[T]) { } } -case class ListEntry(box: CheckBox, text: TextView, icon: ImageView) +case class ListEntry(switch: Switch, text: TextView, icon: ImageView) object AppManager { @@ -162,13 +162,13 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe if (convertView == null) { convertView = getLayoutInflater.inflate(R.layout.layout_apps_item, parent, false) val icon = convertView.findViewById(R.id.itemicon).asInstanceOf[ImageView] - val box = convertView.findViewById(R.id.itemcheck).asInstanceOf[CheckBox] + val switch = convertView.findViewById(R.id.itemcheck).asInstanceOf[Switch] val text = convertView.findViewById(R.id.itemtext).asInstanceOf[TextView] - entry = new ListEntry(box, text, icon) + entry = new ListEntry(switch, text, icon) entry.text.setOnClickListener(AppManager.this) entry.text.setOnClickListener(AppManager.this) convertView.setTag(entry) - entry.box.setOnCheckedChangeListener(AppManager.this) + entry.switch.setOnCheckedChangeListener(AppManager.this) } else { entry = convertView.getTag.asInstanceOf[ListEntry] } @@ -187,10 +187,10 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe ImageLoader.getInstance().displayImage(Scheme.APP + app.packageName, entry.icon, options) entry.text.setText(app.name) - val box: CheckBox = entry.box - box.setTag(app) - box.setChecked(app.proxied) - entry.text.setTag(box) + val switch = entry.switch + switch.setTag(app) + switch.setChecked(app.proxied) + entry.text.setTag(switch) convertView } } @@ -207,11 +207,11 @@ class AppManager extends Activity with OnCheckedChangeListener with OnClickListe } def onClick(v: View) { - val cbox: CheckBox = v.getTag.asInstanceOf[CheckBox] - val app: ProxiedApp = cbox.getTag.asInstanceOf[ProxiedApp] + val switch = v.getTag.asInstanceOf[Switch] + val app: ProxiedApp = switch.getTag.asInstanceOf[ProxiedApp] if (app != null) { app.proxied = !app.proxied - cbox.setChecked(app.proxied) + switch.setChecked(app.proxied) } saveAppSettings(this) }