Commit 6a0955c0 authored by Max Lv's avatar Max Lv

Merge pull request #491 from Mygod/master

Hide adview if default profile is no longer active
parents 0282975e 92c8e085
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-feature <uses-feature
android:name="android.hardware.touchscreen" android:name="android.hardware.touchscreen"
......
...@@ -450,13 +450,13 @@ class Shadowsocks ...@@ -450,13 +450,13 @@ class Shadowsocks
private def updatePreferenceScreen() { private def updatePreferenceScreen() {
val profile = currentProfile val profile = currentProfile
if (profile.host == "198.199.101.152" && adView == null) { if (profile.host == "198.199.101.152") if (adView == null) {
adView = new AdView(this) adView = new AdView(this)
adView.setAdUnitId("ca-app-pub-9097031975646651/7760346322") adView.setAdUnitId("ca-app-pub-9097031975646651/7760346322")
adView.setAdSize(AdSize.SMART_BANNER) adView.setAdSize(AdSize.SMART_BANNER)
preferences.getView.asInstanceOf[ViewGroup].addView(adView, 0) preferences.getView.asInstanceOf[ViewGroup].addView(adView, 0)
adView.loadAd(new AdRequest.Builder().build()) adView.loadAd(new AdRequest.Builder().build())
} } else adView.setVisibility(View.VISIBLE) else if (adView != null) adView.setVisibility(View.GONE)
preferences.update(profile) preferences.update(profile)
} }
......
...@@ -110,16 +110,11 @@ class DBHelper(val context: Context) ...@@ -110,16 +110,11 @@ class DBHelper(val context: Context)
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN rx LONG;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN rx LONG;")
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN date VARCHAR;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN date VARCHAR;")
} }
if (oldVersion < 14) {
for (profile <- profileDao.queryForAll.asScala) {
profile.individual = updateProxiedApps(context, profile.individual)
profileDao.update(profile)
}
}
if (oldVersion < 15) { if (oldVersion < 15) {
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN userOrder LONG;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN userOrder LONG;")
var i = 0 var i = 0
for (profile <- profileDao.queryForAll.asScala) { for (profile <- profileDao.queryForAll.asScala) {
if (oldVersion < 14) profile.individual = updateProxiedApps(context, profile.individual)
profile.userOrder = i profile.userOrder = i
profileDao.update(profile) profileDao.update(profile)
i += 1 i += 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment