Skip to content

Commit

Permalink
Fix building
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed May 21, 2016
1 parent 0b7fb75 commit a1871f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import com.github.shadowsocks.utils.{Key, Utils}

object ShadowsocksSettings {
// Constants
val PREFS_NAME = "Shadowsocks"
val PROXY_PREFS = Array(Key.profileName, Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod,
private final val TAG = "ShadowsocksSettings"
private final val PREFS_NAME = "Shadowsocks"
private val PROXY_PREFS = Array(Key.profileName, Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod,
Key.isAuth)
val FEATURE_PREFS = Array(Key.route, Key.isProxyApps, Key.isUdpDns, Key.isIpv6)
private val FEATURE_PREFS = Array(Key.route, Key.isProxyApps, Key.isUdpDns, Key.isIpv6)

// Helper functions
def updateDropDownPreference(pref: Preference, value: String) {
Expand Down Expand Up @@ -81,21 +82,21 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
})

findPreference("recovery").setOnPreferenceClickListener((preference: Preference) => {
ShadowsocksApplication.track(Shadowsocks.TAG, "reset")
ShadowsocksApplication.track(TAG, "reset")
activity.recovery()
true
})

val flush = findPreference("flush_dnscache")
if (Build.VERSION.SDK_INT < 17) flush.setSummary(R.string.flush_dnscache_summary)
flush.setOnPreferenceClickListener(_ => {
ShadowsocksApplication.track(Shadowsocks.TAG, "flush_dnscache")
ShadowsocksApplication.track(TAG, "flush_dnscache")
activity.flushDnsCache()
true
})

findPreference("about").setOnPreferenceClickListener((preference: Preference) => {
ShadowsocksApplication.track(Shadowsocks.TAG, "about")
ShadowsocksApplication.track(TAG, "about")
val web = new WebView(activity)
web.loadUrl("file:///android_asset/pages/about.html")
web.setWebViewClient(new WebViewClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ import android.util.Log
import com.github.shadowsocks._
import com.github.shadowsocks.utils.Key

object ProfileManager {
private final val TAG = "ProfileManager"
}

class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
import ProfileManager._

var profileAddedListener: Profile => Any = _
def setProfileAddedListener(listener: Profile => Any) = this.profileAddedListener = listener
Expand Down Expand Up @@ -72,7 +77,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
profile
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "addProfile", ex)
Log.e(TAG, "addProfile", ex)
p
}
}
Expand All @@ -83,7 +88,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
true
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "updateProfile", ex)
Log.e(TAG, "updateProfile", ex)
false
}
}
Expand All @@ -96,7 +101,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
}
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "getProfile", ex)
Log.e(TAG, "getProfile", ex)
None
}
}
Expand All @@ -107,7 +112,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
true
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "delProfile", ex)
Log.e(TAG, "delProfile", ex)
false
}
}
Expand All @@ -118,7 +123,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
if (result.size == 1) Option(result.get(0)) else None
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "getAllProfiles", ex)
Log.e(TAG, "getAllProfiles", ex)
None
}
}
Expand All @@ -129,7 +134,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
Option(dbHelper.profileDao.query(dbHelper.profileDao.queryBuilder.orderBy("userOrder", true).prepare).toList)
} catch {
case ex: Exception =>
Log.e(Shadowsocks.TAG, "getAllProfiles", ex)
Log.e(TAG, "getAllProfiles", ex)
None
}
}
Expand Down

0 comments on commit a1871f7

Please sign in to comment.