Remove code for Ads, were not in use anyways after falling out of Google Play guidelines.

This commit is contained in:
2025-07-12 13:15:22 -07:00
parent fe32d063c8
commit 0627aca876
7 changed files with 12 additions and 132 deletions

View File

@ -7,14 +7,12 @@ import android.os.Bundle;
import android.app.Activity; import android.app.Activity;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.Menu; import android.view.Menu;
import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class Home extends AppCompatActivity { public class Home extends AppCompatActivity {
Resources recs; Resources recs;
@ -56,23 +54,6 @@ public class Home extends AppCompatActivity {
btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan); btnWhyVegan = (Button) findViewById(R.id.btnWhyVegan);
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
// Finally, load ads >:)
if (Build.VERSION.SDK_INT >= 9) {
// Load an ad into the AdMob banner view.
AdView adView = (AdView) findViewById(R.id.adViewHome);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
.addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
.addTestDevice("") // Cappy, even though it doesn't support ads
.setRequestAgent("android_studio:ad_template")
.build();
adView.loadAd(adRequest);
}
////////////////////////////////////////////////////////////////////////////////////////////
} }
@Override @Override

View File

@ -17,7 +17,7 @@ public class MySettings extends Activity {
Context context; Context context;
LinearLayout settingsArea; LinearLayout settingsArea;
MySettingItem quickLoad, adsEnabled, rainbowLists, whiteOnBlack; MySettingItem quickLoad, rainbowLists, whiteOnBlack;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -35,16 +35,13 @@ public class MySettings extends Activity {
// Instantiate settings // Instantiate settings
quickLoad = new MySettingItem(context, new MySettingInfo()); quickLoad = new MySettingItem(context, new MySettingInfo());
adsEnabled = new MySettingItem(context, new MySettingInfo());
// Name them // Name them
quickLoad.setName("Quick Load:"); quickLoad.setName("Quick Load:");
adsEnabled.setName("Ads Enabled:");
// Set the checkboxes // Set the checkboxes
dalih.open(); dalih.open();
quickLoad.setEnabled(dalih.getQuickLoad()); quickLoad.setEnabled(dalih.getQuickLoad());
adsEnabled.setEnabled(dalih.getAdsEnabled());
dalih.close(); dalih.close();
// Set the checkbox actions // Set the checkbox actions
@ -62,26 +59,8 @@ public class MySettings extends Activity {
} }
}); });
adsEnabled.btnItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dalih.setAdsEnabled(!dalih.getAdsEnabled());
adsEnabled.checkBox.setChecked(dalih.getAdsEnabled());
}
});
adsEnabled.checkBox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dalih.setAdsEnabled(adsEnabled.checkBox.isChecked());
}
});
// Throw them onto the screen // Throw them onto the screen
settingsArea.addView(quickLoad.getView()); settingsArea.addView(quickLoad.getView());
if (Build.VERSION.SDK_INT >= 9) {
settingsArea.addView(adsEnabled.getView());
}
} }
@Override @Override

View File

@ -15,9 +15,6 @@ import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
/** /**
* Created by usb on 9/28/14. * Created by usb on 9/28/14.
* *
@ -35,7 +32,6 @@ public class Tab1 extends Activity{
Button btnCreate; Button btnCreate;
LinearLayout layListArea; LinearLayout layListArea;
TextView tvLeft, tvRight, selectHeader; TextView tvLeft, tvRight, selectHeader;
AdView mAdView;
// The lists! // The lists!
ArrayList<List> lists = new ArrayList<List>(); ArrayList<List> lists = new ArrayList<List>();
@ -58,7 +54,6 @@ public class Tab1 extends Activity{
tvLeft = (TextView) findViewById(R.id.leftEditView); tvLeft = (TextView) findViewById(R.id.leftEditView);
tvRight = (TextView) findViewById(R.id.rightEditView); tvRight = (TextView) findViewById(R.id.rightEditView);
selectHeader = (TextView) findViewById(R.id.selectListHeader); selectHeader = (TextView) findViewById(R.id.selectListHeader);
mAdView = (AdView) findViewById(R.id.adView);
return; return;
} }
@ -266,26 +261,6 @@ public class Tab1 extends Activity{
dalih.open(); dalih.open();
if (Build.VERSION.SDK_INT >= 9) {
if (dalih.getAdsEnabled()) {
if (mAdView.getVisibility() != View.VISIBLE) {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
.addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
.addTestDevice("") // Cappy, even though it can't get ads
.build();
mAdView.setVisibility(View.VISIBLE);
mAdView.loadAd(adRequest);
}
}
else{
if (mAdView.getVisibility() == View.VISIBLE) {
mAdView.setVisibility(View.GONE);
}
}
}
setButtonInsert(); setButtonInsert();
super.onResume(); super.onResume();

View File

@ -11,9 +11,6 @@ import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
@ -35,7 +32,6 @@ public class Tab2 extends Activity{
LinearLayout layListArea; LinearLayout layListArea;
EditText txtName, txtCost, txtServings, txtCalories, txtCarbs, txtFiber; EditText txtName, txtCost, txtServings, txtCalories, txtCarbs, txtFiber;
Button btnClear, btnAdd; Button btnClear, btnAdd;
AdView mAdView;
// List // List
ArrayList<ListItem> items = new ArrayList<ListItem>(); ArrayList<ListItem> items = new ArrayList<ListItem>();
@ -61,7 +57,6 @@ public class Tab2 extends Activity{
txtFiber = (EditText) findViewById(R.id.etItemFiber); txtFiber = (EditText) findViewById(R.id.etItemFiber);
btnClear = (Button) findViewById(R.id.btnClear); btnClear = (Button) findViewById(R.id.btnClear);
btnAdd = (Button) findViewById(R.id.btnAddToList); btnAdd = (Button) findViewById(R.id.btnAddToList);
mAdView = (AdView) findViewById(R.id.adView);
// Give the Buttons their power // Give the Buttons their power
btnClear.setOnClickListener(new View.OnClickListener() { btnClear.setOnClickListener(new View.OnClickListener() {
@ -91,26 +86,6 @@ public class Tab2 extends Activity{
dalih.open(); dalih.open();
if (Build.VERSION.SDK_INT >= 9) {
if (dalih.getAdsEnabled()) {
if (mAdView.getVisibility() != View.VISIBLE) {
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // nexus 7
.addTestDevice("B8B7561B850A9AB24E0D5B560FC50628") // Moto G
.addTestDevice("") // Cappy, even though it can't get ads
.build();
mAdView.setVisibility(View.VISIBLE);
mAdView.loadAd(adRequest);
}
}
else{
if (mAdView.getVisibility() == View.VISIBLE) {
mAdView.setVisibility(View.GONE);
}
}
}
setButtonInsert(); setButtonInsert();
super.onResume(); super.onResume();

View File

@ -50,7 +50,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_weight=".45" android:layout_weight=".45"
android:weightSum="1"> android:weightSum="1"
style="?android:attr/buttonBarStyle">
<Button <Button
android:layout_width="match_parent" android:layout_width="match_parent"
@ -64,7 +65,8 @@
android:text="Why High Carb?" android:text="Why High Carb?"
android:textColor="@color/textPrimaryInverse" android:textColor="@color/textPrimaryInverse"
android:textAllCaps="false" android:textAllCaps="false"
android:id="@+id/btnWhyHCLF"/> android:id="@+id/btnWhyHCLF"
style="?android:attr/buttonBarButtonStyle" />
<Button <Button
android:layout_width="match_parent" android:layout_width="match_parent"
@ -78,17 +80,9 @@
android:text="Why Vegan?" android:text="Why Vegan?"
android:textColor="@color/textAccentInverse" android:textColor="@color/textAccentInverse"
android:textAllCaps="false" android:textAllCaps="false"
android:id="@+id/btnWhyVegan"/> android:id="@+id/btnWhyVegan"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout> </LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adViewHome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".1"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_home">
</com.google.android.gms.ads.AdView>
</LinearLayout> </LinearLayout>

View File

@ -68,22 +68,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
android:visibility="gone"
ads:adUnitId="@string/banner_ad_tab1">
</com.google.android.gms.ads.AdView>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentTop="true" android:layout_alignParentTop="true">
android:layout_above="@+id/adView">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -96,4 +84,4 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View File

@ -97,22 +97,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
android:visibility="gone"
ads:adUnitId="@string/banner_ad_tab2">
</com.google.android.gms.ads.AdView>
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentTop="true" android:layout_alignParentTop="true">
android:layout_above="@+id/adView">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -125,4 +113,4 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>