Commit aa0d9442 authored by Max Lv's avatar Max Lv

add adview for testing servers

parent 1e6ec8c1
......@@ -6,7 +6,8 @@ libraryDependencies ++= Seq(
"com.google.android" % "support-v4" % "r12",
"com.google.android.analytics" % "analytics" % "2.0beta4",
"dnsjava" % "dnsjava" % "2.1.5",
"com.nostra13.universalimageloader" % "universal-image-loader" % "1.8.4"
"com.nostra13.universalimageloader" % "universal-image-loader" % "1.8.4",
"com.google.android.admob" % "admob" % "6.3.1"
)
libraryDependencies ++= Seq(
......
......@@ -23,7 +23,11 @@
android:label="@string/app_name">
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAI_zVxZthz2HDuz9toTvkYvL0L5GA-OjeUIfBeXg" />
android:value="AEdPqrEAAAAI_zVxZthz2HDuz9toTvkYvL0L5GA-OjeUIfBeXg"/>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<activity
android:name=".Shadowsocks"
......@@ -36,11 +40,11 @@
</intent-filter>
</activity>
<activity
android:name=".ShadowVpnActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask">
</activity>
<activity
android:name=".ShadowVpnActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask">
</activity>
<activity
android:name=".AppManager"
......
......@@ -44,10 +44,8 @@ import android.graphics.Typeface
import android.os._
import android.preference.{CheckBoxPreference, Preference, PreferenceManager}
import android.util.Log
import android.view.KeyEvent
import android.widget.CompoundButton
import android.widget.RelativeLayout
import android.widget.TextView
import android.view.{ViewParent, KeyEvent}
import android.widget.{LinearLayout, CompoundButton, RelativeLayout, TextView}
import com.actionbarsherlock.view.Menu
import com.actionbarsherlock.view.MenuItem
import com.google.analytics.tracking.android.EasyTracker
......@@ -67,6 +65,7 @@ import android.webkit.{WebViewClient, WebView}
import android.app.backup.BackupManager
import scala.concurrent.ops._
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import com.google.ads.{AdRequest, AdSize, AdView}
object Shadowsocks {
......@@ -362,6 +361,8 @@ class Shadowsocks
setHeaderRes(R.xml.shadowsocks_headers)
super.onCreate(savedInstanceState)
val switchLayout = getLayoutInflater
.inflate(R.layout.layout_switch, null)
.asInstanceOf[RelativeLayout]
......@@ -381,6 +382,21 @@ class Shadowsocks
receiver = new StateBroadcastReceiver()
registerReceiver(receiver, new IntentFilter(Action.UPDATE_STATE))
if (settings.getString(Key.proxy, "") == "198.199.101.152") {
val adView = new AdView(this, AdSize.SMART_BANNER, "a151becb8068b09")
val layoutView = {
def getLayoutView(view: ViewParent): LinearLayout = {
view match {
case layout: LinearLayout => layout
case _ => getLayoutView(view.getParent)
}
}
getLayoutView(getListView)
}
layoutView.addView(adView, 0)
adView.loadAd(new AdRequest)
}
val init: Boolean = !Shadowsocks.isServiceStarted(this)
if (init) {
if (progressDialog == null) {
......
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