diff --git a/mobile/src/main/res/layout/layout_profile.xml b/mobile/src/main/res/layout/layout_profile.xml
index 35cd1447..aacb3bd8 100644
--- a/mobile/src/main/res/layout/layout_profile.xml
+++ b/mobile/src/main/res/layout/layout_profile.xml
@@ -24,7 +24,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:id="@+id/container">
-
-
-
+ android:layout_marginTop="4dp">
+
-
+
diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml
index 1320f57c..8e78ddf6 100644
--- a/mobile/src/main/res/values/strings.xml
+++ b/mobile/src/main/res/values/strings.xml
@@ -142,4 +142,5 @@
Configureā¦
Disabled
Unknown plugin %s
+ Plugin: %s
diff --git a/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala b/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
index 517950e6..7c0981ad 100644
--- a/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
+++ b/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
@@ -37,11 +37,12 @@ import android.view._
import android.widget.{LinearLayout, PopupMenu, TextView, Toast}
import com.github.shadowsocks.ShadowsocksApplication.app
import com.github.shadowsocks.database.Profile
+import com.github.shadowsocks.plugin.PluginConfiguration
import com.github.shadowsocks.utils._
import com.github.shadowsocks.widget.UndoSnackbarManager
import com.google.android.gms.ads.{AdRequest, AdSize, NativeExpressAdView}
-import scala.collection.mutable.ArrayBuffer
+import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.Random
object ProfilesFragment {
@@ -77,8 +78,8 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
var item: Profile = _
- private val title = itemView.findViewById(R.id.title).asInstanceOf[TextView]
- private val address = itemView.findViewById(R.id.address).asInstanceOf[TextView]
+ private val text1 = itemView.findViewById(android.R.id.text1).asInstanceOf[TextView]
+ private val text2 = itemView.findViewById(android.R.id.text2).asInstanceOf[TextView]
private val traffic = itemView.findViewById(R.id.traffic).asInstanceOf[TextView]
private val edit = itemView.findViewById(R.id.edit)
edit.setOnClickListener(_ => startConfig(item.id))
@@ -111,10 +112,22 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
tx += txTotal
rx += rxTotal
}
- title.setText(item.getName)
- address.setText(if (item.nameIsEmpty) "" else item.formattedAddress)
- traffic.setText(if (tx <= 0 && rx <= 0) null else getString(R.string.stat_profiles,
- TrafficMonitor.formatTraffic(tx), TrafficMonitor.formatTraffic(rx)))
+ text1.setText(item.getName)
+ val t2 = new ListBuffer[String]
+ if (!item.nameIsEmpty) t2 += item.formattedAddress
+ new PluginConfiguration(item.plugin).selected match {
+ case "" =>
+ case id => t2 += app.getString(R.string.profile_plugin, id)
+ }
+ if (t2.isEmpty) text2.setVisibility(View.GONE) else {
+ text2.setVisibility(View.VISIBLE)
+ text2.setText(t2.mkString("\n"))
+ }
+ if (tx <= 0 && rx <= 0) traffic.setVisibility(View.GONE) else {
+ traffic.setVisibility(View.VISIBLE)
+ traffic.setText(getString(R.string.stat_profiles,
+ TrafficMonitor.formatTraffic(tx), TrafficMonitor.formatTraffic(rx)))
+ }
if (item.id == app.profileId) {
itemView.setSelected(true)
diff --git a/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala b/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala
index 84178df9..5be8ccfc 100644
--- a/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala
+++ b/mobile/src/main/scala/com/github/shadowsocks/plugin/PluginManager.scala
@@ -11,6 +11,7 @@ import com.github.shadowsocks.utils.{Commandline, IOUtils}
import eu.chainfire.libsuperuser.Shell
import scala.collection.JavaConversions._
+import scala.collection.mutable.ListBuffer
/**
* @author Mygod
@@ -80,14 +81,14 @@ object PluginManager {
IOUtils.deleteRecursively(pluginDir)
if (!pluginDir.mkdirs()) throw new FileNotFoundException("Unable to create plugin directory")
val pluginDirPath = pluginDir.getAbsolutePath + '/'
- var list: List[String] = Nil
+ val list = new ListBuffer[String]
do {
val path = cursor.getString(0)
val file = new File(pluginDir, path)
assert(file.getAbsolutePath.startsWith(pluginDirPath))
autoClose(cr.openInputStream(builder.path(path).build()))(in =>
autoClose(new FileOutputStream(file))(out => IOUtils.copy(in, out)))
- list +:= Commandline.toString(Array("chmod", cursor.getString(1), file.getAbsolutePath))
+ list += Commandline.toString(Array("chmod", cursor.getString(1), file.getAbsolutePath))
if (path == id) initialized = true
} while (cursor.moveToNext())
if (!initialized) entryNotFound()