Gradle version updates, remove ads, and other changes for successful compilations.

This commit is contained in:
2025-07-21 20:28:06 -07:00
parent eedf4e22e7
commit 9c895c1d72
11 changed files with 41 additions and 129 deletions
@@ -7,11 +7,9 @@ import android.util.Log;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.gms.ads.AdView;
public class HighScoreActivity extends AppCompatActivity {
private String sharedPreferencesKey, adsKey, TAG, html;
private String sharedPreferencesKey, TAG, html;
private String[] allBirdScoreKeys, allChickenScoreKeys;
private SharedPreferences sharedPreferences;
@@ -29,7 +27,6 @@ public class HighScoreActivity extends AppCompatActivity {
sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
allBirdScoreKeys = getResources().getStringArray(R.array.allBirdScoreKeys);
allChickenScoreKeys = getResources().getStringArray(R.array.allChickenScoreKeys);
adsKey = getString(R.string.adsKey);
// Shared preferences
sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE);
@@ -89,7 +86,6 @@ public class HighScoreActivity extends AppCompatActivity {
@Override
protected void onResume() {
leaderboardHelper = new LeaderboardHelper();
displayAds();
super.onResume();
Runnable getHTML = new Runnable() {
@@ -106,10 +102,6 @@ public class HighScoreActivity extends AppCompatActivity {
Log.d(TAG, "HighScoreActivity.onResume() html=" + html);
}
private void displayAds(){
AdsHelper.toggleAds(sharedPreferences, adsKey, getApplicationContext(), (AdView) findViewById(R.id.adViewHighScores));
}
private boolean isNumeric(char c){
try{
String s = "" + c;
@@ -8,13 +8,11 @@ import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.google.android.gms.ads.AdView;
public class MainActivity extends AppCompatActivity {
private Button btnGameBird, btnGameCow, btnGamePig, btnGameChicken, btnGameCat, btnGameSquirrel, btnOptions, btnHighScores, btnHelp;
private String TAG, sharedPreferencesKey, adsKey, birdScoreKey, chickenScoreKey;
private String TAG, sharedPreferencesKey, birdScoreKey, chickenScoreKey;
private SharedPreferences sharedPreferences;
@@ -28,7 +26,6 @@ public class MainActivity extends AppCompatActivity {
// Keys
sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
adsKey = getString(R.string.adsKey);
birdScoreKey = getString(R.string.birdScoreKey);
chickenScoreKey = getString(R.string.chickenScoreKey);
@@ -101,8 +98,6 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
displayAds();
// Append high scores to button text
int score;
String newText;
@@ -160,10 +155,6 @@ public class MainActivity extends AppCompatActivity {
startActivity(options);
}
private void displayAds(){
AdsHelper.toggleAds(sharedPreferences, adsKey, getApplicationContext(), (AdView) findViewById(R.id.adViewMain));
}
private void doHighScoresButton(){
Intent highScores = new Intent(MainActivity.this, HighScoreActivity.class);
startActivity(highScores);
@@ -10,23 +10,19 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.RelativeLayout;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
/**
* Created by ling on 12/22/16.
*/
public class OptionsActivity extends AppCompatActivity {
private String sharedPreferencesKey, adsKey, higherQualityKey, fpsKey;
private String sharedPreferencesKey, higherQualityKey, fpsKey;
private SharedPreferences sharedPreferences;
private RelativeLayout layoutAds, layoutHigherQuality, layoutFPS;
private CheckBox cbAds, cbHigherQuality, cbFPS;
private boolean adsEnabled, higherQualityEnabled, fpsEnabled;
private RelativeLayout layoutHigherQuality, layoutFPS;
private CheckBox cbHigherQuality, cbFPS;
private boolean higherQualityEnabled, fpsEnabled;
private Button btnDeletePreferences, btnConfirmDeletePreferences;
@@ -42,24 +38,6 @@ public class OptionsActivity extends AppCompatActivity {
sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE);
// Set up Ads
adsKey = getString(R.string.adsKey);
layoutAds = (RelativeLayout) findViewById(R.id.optionAdsLayout);
cbAds = (CheckBox) findViewById(R.id.optionAdsCheckBox);
layoutAds.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
flipOption(adsKey);
}
});
cbAds.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
flipOption(adsKey);
}
});
setAds();
// Higher Quality Content
higherQualityKey = getString(R.string.higherQualityKey);
layoutHigherQuality = (RelativeLayout) findViewById(R.id.optionHigherQualityLayout);
@@ -123,10 +101,7 @@ public class OptionsActivity extends AppCompatActivity {
editor.apply();
// Change the box
if (key.equals(adsKey)){
setAds();
}
else if (key.equals(higherQualityKey)){
if (key.equals(higherQualityKey)){
setHigherQuality();
}
else if (key.equals(fpsKey)){
@@ -134,31 +109,6 @@ public class OptionsActivity extends AppCompatActivity {
}
}
private void setAds(){
adsEnabled = sharedPreferences.getBoolean(adsKey, false);
cbAds.setChecked(adsEnabled);
toggleAds();
}
private void toggleAds(){
// Enable ads?
adsEnabled = sharedPreferences.getBoolean(adsKey, false);
AdView mAdView = (AdView) findViewById(R.id.adViewOptions);
if (adsEnabled) {
mAdView.setVisibility(View.VISIBLE);
MobileAds.initialize(getApplicationContext(), "ca-app-pub-3940256099942544~3347511713");
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("C6A494DC6E7C9AC29102694D48487084") // Nexus 7
.addTestDevice("6545BCC9B60A394005546783687339B7") // Moto G
.build();
mAdView.loadAd(adRequest);
}
else{
mAdView.setVisibility(View.GONE);
}
}
public void setHigherQuality() {
higherQualityEnabled = sharedPreferences.getBoolean(higherQualityKey, false);
cbHigherQuality.setChecked(higherQualityEnabled);