Skip to content

Commit

Permalink
Remove ad
Browse files Browse the repository at this point in the history
  • Loading branch information
kaneawk committed Feb 17, 2017
1 parent 11d827c commit 222b05f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
3 changes: 0 additions & 3 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@
android:process=":bg"/>
<receiver android:name="com.evernote.android.job.JobBootReceiver"
android:process=":bg"/>

<!-- Strip useless components -->
<activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity" tools:node="remove"/>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(_ => {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 222b05f

Please sign in to comment.