From 222b05f6becd5a53067bd13ede7f7ed9253a9971 Mon Sep 17 00:00:00 2001 From: kaneawk Date: Fri, 17 Feb 2017 13:44:11 +0800 Subject: [PATCH] Remove ad --- mobile/src/main/AndroidManifest.xml | 3 -- .../github/shadowsocks/ProfilesFragment.scala | 29 ------------------- 2 files changed, 32 deletions(-) diff --git a/mobile/src/main/AndroidManifest.xml b/mobile/src/main/AndroidManifest.xml index 0f77f4df34..64af27225f 100644 --- a/mobile/src/main/AndroidManifest.xml +++ b/mobile/src/main/AndroidManifest.xml @@ -148,9 +148,6 @@ android:process=":bg"/> - - - diff --git a/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala b/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala index 0fd3efa206..97b90248df 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala @@ -40,10 +40,8 @@ import com.github.shadowsocks.database.Profile import com.github.shadowsocks.plugin.PluginConfiguration import com.github.shadowsocks.utils._ import com.github.shadowsocks.widget.UndoSnackbarManager -import com.google.android.gms.ads.{AdRequest, AdSize, NativeExpressAdView} import scala.collection.mutable.{ArrayBuffer, ListBuffer} -import scala.util.Random object ProfilesFragment { var instance: ProfilesFragment = _ // used for callback from ProfileManager and stateChanged from MainActivity @@ -88,8 +86,6 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic // it will not take effect unless set in code itemView.findViewById(R.id.indicator).setBackgroundResource(R.drawable.background_profile) - private var adView: NativeExpressAdView = _ - { val share = itemView.findViewById(R.id.share) share.setOnClickListener(_ => { @@ -137,31 +133,6 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic if (selectedItem eq this) selectedItem = null } - if (item.host == "198.199.101.152") { - if (adView == null) { - val params = - new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) - params.gravity = Gravity.CENTER_HORIZONTAL - params.setMargins(0, getResources.getDimensionPixelOffset(R.dimen.margin_small), 0, 0) - adView = new NativeExpressAdView(getActivity) - adView.setLayoutParams(params) - adView.setAdUnitId("ca-app-pub-9097031975646651/5224027521") - adView.setAdSize(new AdSize(328, 132)) - itemView.findViewById(R.id.content).asInstanceOf[LinearLayout].addView(adView) - - // Demographics - val random = new Random() - val adBuilder = new AdRequest.Builder() - adBuilder.setGender(AdRequest.GENDER_MALE) - val year = 1975 + random.nextInt(40) - val month = 1 + random.nextInt(12) - val day = random.nextInt(28) - adBuilder.setBirthday(new GregorianCalendar(year, month, day).getTime) - - // Load Ad - adView.loadAd(adBuilder.build()) - } else adView.setVisibility(View.VISIBLE) - } else if (adView != null) adView.setVisibility(View.GONE) } def onClick(v: View): Unit = if (isEnabled) {