Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bannedbook committed Apr 17, 2020
1 parent aecc13e commit 974a302
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ release/
# release apks
*.apk
*.bak
gitupdate.bat
gitupdate.*
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
junitVersion = '4.13'
androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0'
versionCode = 5000650
versionName = '5.0.6-nightly'
versionCode = 5000660
versionName = '5.0.6.1-nightly'
resConfigs = ['ar', 'es', 'fa', 'fr', 'ja', 'ko', 'ru', 'tr', 'zh-rCN', 'zh-rTW']
}

Expand All @@ -28,7 +28,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-beta03'
classpath 'com.android.tools.build:gradle:4.0.0-beta04'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath 'com.google.gms:google-services:4.3.3'
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<string name="title_remove_invalid_servers">删除无效服务器</string>
<string name="title_sort_servers_by_speed">按测速结果排序</string>
<string name="toast_test_ended">啊!测试结束啦!</string>
<string name="toast_test_interrupted">服务器:s或前一个服务器导致测试中断,请检查之。并请确保安装了simple-obfs插件</string>
<string name="toast_test_interrupted">"服务器:%s或前一个服务器导致测试中断,请检查之。并请确保安装了simple-obfs插件"</string>
<string name="recommended_site_1">"<![CDATA[
<html xmlns='http://www.w3.org/1999/xhtml' dir='ltr' lang='zh-CN'>
<head profile='http://gmpg.org/xfn/11'>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<string name="title_remove_invalid_servers">刪除無效伺服器</string>
<string name="title_sort_servers_by_speed">按測速結果排序</string>
<string name="toast_test_ended">啊!測試結束啦!</string>
<string name="toast_test_interrupted">伺服器:s或前一個伺服器導致測試中斷,請檢查之。並請確保安裝了simple-obfs插件。</string>
<string name="toast_test_interrupted">"伺服器:%s或前一個伺服器導致測試中斷,請檢查之。並請確保安裝了simple-obfs插件。"</string>
<string name="recommended_site_1"><![CDATA[
<html>
<body style=\'margin:0;padding:0;font-size:14px;text-align:right\'>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<string name="faq">FAQ</string>
<string name="faq_url">https://github.com/bannedbook/ssvpn/blob/master/.github/faq.md</string>
<string name="about">About</string>
<string name="about_title">Shadowsocks VPN %s</string>
<string name="about_title">SS VPN %s</string>
<string name="edit">Edit</string>
<string name="share">Share</string>
<string name="add_profile">Add Profile</string>
Expand Down Expand Up @@ -176,7 +176,7 @@
<string name="title_remove_invalid_servers">Remove invalid servers</string>
<string name="title_sort_servers_by_speed">Sort servers by speed</string>
<string name="toast_test_ended">The test ended successfully</string>
<string name="toast_test_interrupted">Server:%s or the previous one caused the test to be interrupted, please check them. And please make sure that the simple-obfs plugin is installed.</string>
<string name="toast_test_interrupted">Server: %s or the previous one caused the test to be interrupted, please check them. And please make sure that the simple-obfs plugin is installed.</string>
<string name="recommended_site_1">"<![CDATA[
<html xmlns='http://www.w3.org/1999/xhtml'>
<head profile='http://gmpg.org/xfn/11'>
Expand Down
2 changes: 1 addition & 1 deletion gitupdate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ git pull origin master
git add -A
git commit -m "update"
git push origin master
git tag -a v5.0.6 -m "release v5.0.6"
git tag -a v5.0.6.1 -m "release v5.0.6.1"
git push origin --tags
pause
48 changes: 36 additions & 12 deletions mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ import android.content.ClipboardManager
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.os.SystemClock
import android.text.format.Formatter
import android.util.Log
import android.util.LongSparseArray
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.*
import androidx.appcompat.widget.PopupMenu
import androidx.appcompat.widget.Toolbar
Expand All @@ -56,7 +60,10 @@ import com.github.shadowsocks.database.ProfileManager
import com.github.shadowsocks.plugin.PluginConfiguration
import com.github.shadowsocks.plugin.showAllowingStateLoss
import com.github.shadowsocks.preference.DataStore
import com.github.shadowsocks.utils.*
import com.github.shadowsocks.utils.Action
import com.github.shadowsocks.utils.datas
import com.github.shadowsocks.utils.printLog
import com.github.shadowsocks.utils.readableMessage
import com.github.shadowsocks.widget.ListHolderListener
import com.github.shadowsocks.widget.MainListListener
import com.github.shadowsocks.widget.RecyclerViewNoBugLinearLayoutManager
Expand All @@ -72,16 +79,12 @@ import com.google.zxing.EncodeHintType
import com.google.zxing.MultiFormatWriter
import com.google.zxing.WriterException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.nio.charset.StandardCharsets
import android.os.Build
import android.os.SystemClock
import android.webkit.WebView
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.IOException
import java.net.*

import java.nio.charset.StandardCharsets

class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
companion object {
Expand Down Expand Up @@ -324,8 +327,6 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
if (id.isNotEmpty()) this += getString(R.string.profile_plugin, id)
}.joinToString("\n")
val context = requireContext()
//traffic.text = if (tx <= 0 && rx <= 0) null else getString(R.string.traffic,
//Formatter.formatFileSize(context, tx), Formatter.formatFileSize(context, rx))
traffic.text =ArrayList<String>().apply {
if (item.elapsed > 0L ) this += String.format("%dms", item.elapsed)
if (item.elapsed == -1L ) this += "failed"
Expand Down Expand Up @@ -385,12 +386,28 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {

override fun onViewAttachedToWindow(holder: ProfileViewHolder) = holder.attach()
override fun onViewDetachedFromWindow(holder: ProfileViewHolder) = holder.detach()
override fun onBindViewHolder(holder: ProfileViewHolder, position: Int) = holder.bind(profiles[position])
override fun onBindViewHolder(holder: ProfileViewHolder, position: Int) {
try {
holder.bind(profiles[position])
}
catch (e:Exception){
Log.e("speedup.vpn","",e)
}

}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProfileViewHolder = ProfileViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.layout_profile, parent, false))

override fun getItemCount(): Int = profiles.size
override fun getItemId(position: Int): Long = profiles[position].id
override fun getItemId(position: Int): Long {
try {
return profiles[position].id
}
catch (e:Exception){
Log.e("speedup.vpn","",e)
return 0
}
}

override fun onAdd(profile: Profile) {
undoManager.flush()
Expand Down Expand Up @@ -505,6 +522,13 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
var recommendedNewsView: WebView = view.findViewById(R.id.recommended_news2)
//recommendedNewsView.settings.javaScriptEnabled = true
recommendedNewsView.setBackgroundColor(Color.BLACK);
recommendedNewsView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
if(url.isNullOrEmpty() || url.isBlank()) return false
(activity as MainActivity).launchUrl(url)
return true
}
}
recommendedNewsView.loadDataWithBaseURL(null,recnews,"text/html; charset=utf-8", "UTF-8",null)

profilesList = view.findViewById(R.id.list)
Expand Down Expand Up @@ -703,7 +727,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
while (tcping("127.0.0.1", DataStore.portProxy) < 0 || tcping("127.0.0.1", VpnEncrypt.HTTP_PROXY_PORT) < 0) {
Log.e("starting", "$k try $ttt ...")
if (ttt == 5) {
activity?.runOnUiThread() {Core.alertMessage(getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
activity?.runOnUiThread() {Core.alertMessage(activity.getString(R.string.toast_test_interrupted,profilesAdapter.profiles[k].name),activity)}
Log.e("realTestProfiles","Server: "+profilesAdapter.profiles[k].name+" or the one before it caused the test to be interrupted.")
Core.stopService()
return@launch
Expand Down

0 comments on commit 974a302

Please sign in to comment.