Update dependencies
This commit is contained in:
@@ -233,8 +233,8 @@ object ConfigUtils {
|
||||
.readTimeout(2000)
|
||||
.send("sig="+sig)
|
||||
.body
|
||||
val proxies = util.Random.shuffle(list.split('|').toSeq).toSeq
|
||||
val proxy = proxies(0).split(':')
|
||||
val proxies = util.Random.shuffle(list.split('|').toSeq)
|
||||
val proxy = proxies.head.split(':')
|
||||
|
||||
val host = proxy(0).trim
|
||||
val port = proxy(1).trim.toInt
|
||||
|
||||
@@ -47,11 +47,8 @@ import android.util.{Log, Base64}
|
||||
object Parser {
|
||||
val TAG = "ShadowParser"
|
||||
|
||||
def generate (profile: Profile): String = {
|
||||
val path = "%s:%s@%s:%d".formatLocal(Locale.ENGLISH,
|
||||
profile.method, profile.password, profile.host, profile.remotePort)
|
||||
return "ss://" + Base64.encodeToString(path.getBytes, Base64.NO_PADDING)
|
||||
}
|
||||
def generate (profile: Profile): String = "ss://" + Base64.encodeToString("%s:%s@%s:%d".formatLocal(Locale.ENGLISH,
|
||||
profile.method, profile.password, profile.host, profile.remotePort).getBytes, Base64.NO_PADDING)
|
||||
|
||||
def parse (data: String): Option[Profile] = {
|
||||
try {
|
||||
|
||||
@@ -38,21 +38,21 @@
|
||||
*/
|
||||
package com.github.shadowsocks.utils
|
||||
|
||||
import android.content.{Intent, Context}
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.drawable.{BitmapDrawable, Drawable}
|
||||
import android.util.{Base64, Log}
|
||||
import java.io._
|
||||
import java.net._
|
||||
import org.xbill.DNS._
|
||||
import android.graphics._
|
||||
import java.security.MessageDigest
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.pm.{ApplicationInfo, PackageManager}
|
||||
import android.content.{Context, Intent}
|
||||
import android.graphics._
|
||||
import android.graphics.drawable.{BitmapDrawable, Drawable}
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import scala.Some
|
||||
import java.security.MessageDigest
|
||||
import com.github.shadowsocks.{BuildConfig}
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.util.{Base64, Log}
|
||||
import com.github.shadowsocks.BuildConfig
|
||||
import org.xbill.DNS._
|
||||
|
||||
|
||||
object Utils {
|
||||
@@ -146,6 +146,7 @@ object Utils {
|
||||
// + "am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false\n")
|
||||
}
|
||||
|
||||
//noinspection ScalaDeprecation
|
||||
private def toggleBelowApiLevel17(context: Context) {
|
||||
// Android 4.2 below
|
||||
Settings.System.putInt(context.getContentResolver, Settings.System.AIRPLANE_MODE_ON, 1)
|
||||
@@ -197,7 +198,7 @@ object Utils {
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
case e: Exception => None
|
||||
case e: Exception =>
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -232,7 +233,7 @@ object Utils {
|
||||
None
|
||||
}
|
||||
|
||||
lazy val isNumericMethod = classOf[InetAddress].getMethod("isNumeric", classOf[String])
|
||||
private lazy val isNumericMethod = classOf[InetAddress].getMethod("isNumeric", classOf[String])
|
||||
def isNumeric(address: String): Boolean = isNumericMethod.invoke(null, address).asInstanceOf[Boolean]
|
||||
|
||||
/**
|
||||
@@ -338,7 +339,7 @@ object Utils {
|
||||
|
||||
def getAppIcon(c: Context, packageName: String): Drawable = {
|
||||
val pm: PackageManager = c.getPackageManager
|
||||
val icon: Drawable = c.getResources.getDrawable(android.R.drawable.sym_def_app_icon)
|
||||
val icon: Drawable = ContextCompat.getDrawable(c, android.R.drawable.sym_def_app_icon)
|
||||
try {
|
||||
pm.getApplicationIcon(packageName)
|
||||
} catch {
|
||||
@@ -348,7 +349,7 @@ object Utils {
|
||||
|
||||
def getAppIcon(c: Context, uid: Int): Drawable = {
|
||||
val pm: PackageManager = c.getPackageManager
|
||||
val icon: Drawable = c.getResources.getDrawable(android.R.drawable.sym_def_app_icon)
|
||||
val icon: Drawable = ContextCompat.getDrawable(c, android.R.drawable.sym_def_app_icon)
|
||||
val packages: Array[String] = pm.getPackagesForUid(uid)
|
||||
if (packages != null) {
|
||||
if (packages.length >= 1) {
|
||||
|
||||
Reference in New Issue
Block a user