From d0117daf6f5f0608c16d76b135e78f94ce77d800 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Thu, 14 Jul 2016 08:58:23 +0800 Subject: [PATCH 1/2] Fix #759 #760 --- .../com/github/shadowsocks/AppManager.scala | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/scala/com/github/shadowsocks/AppManager.scala b/src/main/scala/com/github/shadowsocks/AppManager.scala index 0be21374..56d4eee7 100644 --- a/src/main/scala/com/github/shadowsocks/AppManager.scala +++ b/src/main/scala/com/github/shadowsocks/AppManager.scala @@ -158,23 +158,22 @@ class AppManager extends AppCompatActivity with OnMenuItemClickListener { def onMenuItemClick(item: MenuItem): Boolean = { val clipboard = getSystemService(Context.CLIPBOARD_SERVICE).asInstanceOf[ClipboardManager] - val prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext) item.getItemId match { case R.id.action_apply_all => app.profileManager.getAllProfiles match { case Some(profiles) => - val proxiedAppString = prefs.getString(Key.individual, "") - profiles.foreach(profile => { - profile.individual = proxiedAppString - app.profileManager.updateProfile(profile) + val proxiedAppString = profile.individual + profiles.foreach(p => { + p.individual = proxiedAppString + app.profileManager.updateProfile(p) }) Toast.makeText(this, R.string.action_apply_all, Toast.LENGTH_SHORT).show case _ => Toast.makeText(this, R.string.action_export_err, Toast.LENGTH_SHORT).show } return true case R.id.action_export => - val bypass = prefs.getBoolean(Key.bypass, false) - val proxiedAppString = prefs.getString(Key.individual, "") + val bypass = profile.bypass + val proxiedAppString = profile.individual val clip = ClipData.newPlainText(Key.individual, bypass + "\n" + proxiedAppString) clipboard.setPrimaryClip(clip) Toast.makeText(this, R.string.action_export_msg, Toast.LENGTH_SHORT).show() @@ -185,13 +184,13 @@ class AppManager extends AppCompatActivity with OnMenuItemClickListener { if (proxiedAppSequence != null) { val proxiedAppString = proxiedAppSequence.toString if (!proxiedAppString.isEmpty) { - val editor = prefs.edit val i = proxiedAppString.indexOf('\n') try { val (enabled, apps) = if (i < 0) (proxiedAppString, "") else (proxiedAppString.substring(0, i), proxiedAppString.substring(i + 1)) bypassSwitch.setChecked(enabled.toBoolean) - editor.putString(Key.individual, apps).apply() + profile.individual = apps + app.profileManager.updateProfile(profile) Toast.makeText(this, R.string.action_import_msg, Toast.LENGTH_SHORT).show() appListView.setVisibility(View.GONE) loadingView.setVisibility(View.VISIBLE) From 781cfb336c4d8caaed37c553547ad8e29cdd5099 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 15 Jul 2016 09:24:33 +0800 Subject: [PATCH 2/2] Enlarge dexMaxHeap --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index eedbba28..af29cc61 100644 --- a/build.sbt +++ b/build.sbt @@ -24,6 +24,8 @@ typedResources in Android := false resConfigs in Android := Seq("ru", "zh", "zh-rCN") +dexMaxHeap in Android := "4g" + resolvers += Resolver.jcenterRepo resolvers += "JRAF" at "http://JRAF.org/static/maven/2"