Remove all the extravagant styles

These styles are either introduced by @AnyOfYou, or exist because of a bug in Android support library. Anyway they can be removed now.
This commit is contained in:
Mygod
2016-08-19 19:49:43 +08:00
parent c9ce515cca
commit 25cfb1623a
6 changed files with 27 additions and 82 deletions
@@ -3,7 +3,6 @@ package com.github.shadowsocks.preferences
import android.app.AlertDialog
import android.content.{Context, DialogInterface}
import android.util.AttributeSet
import android.view.ViewGroup
import eu.chainfire.libsuperuser.Shell
import scala.collection.JavaConversions._
@@ -14,27 +13,21 @@ import scala.collection.JavaConversions._
class KcpCliPreference(context: Context, attrs: AttributeSet) extends SummaryEditTextPreference(context, attrs) {
override def onPrepareDialogBuilder(builder: AlertDialog.Builder) {
super.onPrepareDialogBuilder(builder)
builder.setNeutralButton("?", ((_, _) => {
val dialog = new AlertDialog.Builder(context)
.setTitle("?")
.setMessage(asScalaBuffer(Shell.SH.run(context.getApplicationInfo.dataDir + "/kcptun --help"))
.dropWhile(line => line != "GLOBAL OPTIONS:")
.drop(1)
.takeWhile(line => line.length() > 3)
.filter(line =>
!line.startsWith(" --localaddr ") &&
!line.startsWith(" --remoteaddr ") &&
!line.startsWith(" --path ") &&
!line.startsWith(" --help,") &&
!line.startsWith(" --version,"))
.mkString("\n")
.replaceAll("[ ]{2,}", "\n")
.substring(1)) // remove 1st \n
.show()
val window = dialog.getWindow
val attrs = window.getAttributes
attrs.width = ViewGroup.LayoutParams.MATCH_PARENT
window.setAttributes(attrs)
}): DialogInterface.OnClickListener)
builder.setNeutralButton("?", ((_, _) => new AlertDialog.Builder(context)
.setTitle("?")
.setMessage(asScalaBuffer(Shell.SH.run(context.getApplicationInfo.dataDir + "/kcptun --help"))
.dropWhile(line => line != "GLOBAL OPTIONS:")
.drop(1)
.takeWhile(line => line.length() > 3)
.filter(line =>
!line.startsWith(" --localaddr ") &&
!line.startsWith(" --remoteaddr ") &&
!line.startsWith(" --path ") &&
!line.startsWith(" --help,") &&
!line.startsWith(" --version,"))
.mkString("\n")
.replaceAll("[ ]{2,}", "\n")
.substring(1)) // remove 1st \n
.show()): DialogInterface.OnClickListener)
}
}