add qr code

This commit is contained in:
Max Lv
2015-04-29 13:06:27 +08:00
parent 33ed5c65c5
commit 5aae822cdd
6 changed files with 93 additions and 9 deletions
@@ -40,11 +40,19 @@
package com.github.shadowsocks.utils
import com.github.shadowsocks.database.Profile
import java.util.Locale
import android.net.Uri
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 parse (data: String): Option[Profile] = {
try {
Log.d(TAG, data)