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

View File

@@ -1,8 +1,8 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
namespace "com.hyperling.apps.games"
compileSdkVersion 36 compileSdkVersion 36
buildToolsVersion "24.0.2"
defaultConfig { defaultConfig {
applicationId "apps.hyperling.com.platformer" applicationId "apps.hyperling.com.platformer"
minSdkVersion 14 minSdkVersion 14
@@ -20,11 +20,19 @@ android {
} }
dependencies { dependencies {
/*
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services-ads:9.8.0'
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
*/
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// https://mvnrepository.com/artifact/com.android.support/appcompat-v7
implementation group: 'com.android.support', name: 'appcompat-v7', version: '28.0.0'
} }

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.hyperling.apps.games"> package="com.hyperling.apps.games">
<!-- Include required permissions for Google Mobile Ads to run. --> <!-- Include required permissions for Google Mobile Ads to run. -->
@@ -9,21 +10,17 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:roundIcon="@drawable/icon"
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"> android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
<!-- android:configChanges="orientation|keyboardHidden|screenSize" --> <!-- android:configChanges="orientation|keyboardHidden|screenSize" -->
<!-- This meta-data tag is required to use Google Play Services. --> <activity android:name="com.hyperling.apps.games.MainActivity"
<meta-data android:exported="true">
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.hyperling.apps.games.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>

View File

@@ -7,11 +7,9 @@ import android.util.Log;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.gms.ads.AdView;
public class HighScoreActivity extends AppCompatActivity { public class HighScoreActivity extends AppCompatActivity {
private String sharedPreferencesKey, adsKey, TAG, html; private String sharedPreferencesKey, TAG, html;
private String[] allBirdScoreKeys, allChickenScoreKeys; private String[] allBirdScoreKeys, allChickenScoreKeys;
private SharedPreferences sharedPreferences; private SharedPreferences sharedPreferences;
@@ -29,7 +27,6 @@ public class HighScoreActivity extends AppCompatActivity {
sharedPreferencesKey = getString(R.string.sharedPreferencesKey); sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
allBirdScoreKeys = getResources().getStringArray(R.array.allBirdScoreKeys); allBirdScoreKeys = getResources().getStringArray(R.array.allBirdScoreKeys);
allChickenScoreKeys = getResources().getStringArray(R.array.allChickenScoreKeys); allChickenScoreKeys = getResources().getStringArray(R.array.allChickenScoreKeys);
adsKey = getString(R.string.adsKey);
// Shared preferences // Shared preferences
sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE); sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE);
@@ -89,7 +86,6 @@ public class HighScoreActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
leaderboardHelper = new LeaderboardHelper(); leaderboardHelper = new LeaderboardHelper();
displayAds();
super.onResume(); super.onResume();
Runnable getHTML = new Runnable() { Runnable getHTML = new Runnable() {
@@ -106,10 +102,6 @@ public class HighScoreActivity extends AppCompatActivity {
Log.d(TAG, "HighScoreActivity.onResume() html=" + html); 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){ private boolean isNumeric(char c){
try{ try{
String s = "" + c; String s = "" + c;

View File

@@ -8,13 +8,11 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import com.google.android.gms.ads.AdView;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private Button btnGameBird, btnGameCow, btnGamePig, btnGameChicken, btnGameCat, btnGameSquirrel, btnOptions, btnHighScores, btnHelp; 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; private SharedPreferences sharedPreferences;
@@ -28,7 +26,6 @@ public class MainActivity extends AppCompatActivity {
// Keys // Keys
sharedPreferencesKey = getString(R.string.sharedPreferencesKey); sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
adsKey = getString(R.string.adsKey);
birdScoreKey = getString(R.string.birdScoreKey); birdScoreKey = getString(R.string.birdScoreKey);
chickenScoreKey = getString(R.string.chickenScoreKey); chickenScoreKey = getString(R.string.chickenScoreKey);
@@ -101,8 +98,6 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onResume() { protected void onResume() {
displayAds();
// Append high scores to button text // Append high scores to button text
int score; int score;
String newText; String newText;
@@ -160,10 +155,6 @@ public class MainActivity extends AppCompatActivity {
startActivity(options); startActivity(options);
} }
private void displayAds(){
AdsHelper.toggleAds(sharedPreferences, adsKey, getApplicationContext(), (AdView) findViewById(R.id.adViewMain));
}
private void doHighScoresButton(){ private void doHighScoresButton(){
Intent highScores = new Intent(MainActivity.this, HighScoreActivity.class); Intent highScores = new Intent(MainActivity.this, HighScoreActivity.class);
startActivity(highScores); startActivity(highScores);

View File

@@ -10,23 +10,19 @@ import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.RelativeLayout; 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. * Created by ling on 12/22/16.
*/ */
public class OptionsActivity extends AppCompatActivity { public class OptionsActivity extends AppCompatActivity {
private String sharedPreferencesKey, adsKey, higherQualityKey, fpsKey; private String sharedPreferencesKey, higherQualityKey, fpsKey;
private SharedPreferences sharedPreferences; private SharedPreferences sharedPreferences;
private RelativeLayout layoutAds, layoutHigherQuality, layoutFPS; private RelativeLayout layoutHigherQuality, layoutFPS;
private CheckBox cbAds, cbHigherQuality, cbFPS; private CheckBox cbHigherQuality, cbFPS;
private boolean adsEnabled, higherQualityEnabled, fpsEnabled; private boolean higherQualityEnabled, fpsEnabled;
private Button btnDeletePreferences, btnConfirmDeletePreferences; private Button btnDeletePreferences, btnConfirmDeletePreferences;
@@ -42,24 +38,6 @@ public class OptionsActivity extends AppCompatActivity {
sharedPreferencesKey = getString(R.string.sharedPreferencesKey); sharedPreferencesKey = getString(R.string.sharedPreferencesKey);
sharedPreferences = getSharedPreferences(sharedPreferencesKey, MODE_PRIVATE); 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 // Higher Quality Content
higherQualityKey = getString(R.string.higherQualityKey); higherQualityKey = getString(R.string.higherQualityKey);
layoutHigherQuality = (RelativeLayout) findViewById(R.id.optionHigherQualityLayout); layoutHigherQuality = (RelativeLayout) findViewById(R.id.optionHigherQualityLayout);
@@ -123,10 +101,7 @@ public class OptionsActivity extends AppCompatActivity {
editor.apply(); editor.apply();
// Change the box // Change the box
if (key.equals(adsKey)){ if (key.equals(higherQualityKey)){
setAds();
}
else if (key.equals(higherQualityKey)){
setHigherQuality(); setHigherQuality();
} }
else if (key.equals(fpsKey)){ 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() { public void setHigherQuality() {
higherQualityEnabled = sharedPreferences.getBoolean(higherQualityKey, false); higherQualityEnabled = sharedPreferences.getBoolean(higherQualityKey, false);
cbHigherQuality.setChecked(higherQualityEnabled); cbHigherQuality.setChecked(higherQualityEnabled);

View File

@@ -9,25 +9,16 @@
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:layout_marginTop="?android:actionBarSize"
tools:context="com.hyperling.apps.games.HighScoreActivity"> tools:context="com.hyperling.apps.games.HighScoreActivity">
<com.google.android.gms.ads.AdView
android:id="@+id/adViewHighScores"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="gone"
ads:adSize="BANNER"
ads:adUnitId="@string/interstitial_ad_unit_id_high_score" />
<ScrollView <ScrollView
android:id="@+id/scrollViewHighScore" android:id="@+id/scrollViewHighScore"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_above="@+id/adViewHighScores"> android:layout_alignParentBottom="true">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -9,25 +9,16 @@
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:layout_marginTop="?android:actionBarSize"
tools:context="com.hyperling.apps.games.MainActivity"> tools:context="com.hyperling.apps.games.MainActivity">
<com.google.android.gms.ads.AdView
android:id="@+id/adViewMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="gone"
ads:adSize="BANNER"
ads:adUnitId="@string/interstitial_ad_unit_id_main" />
<ScrollView <ScrollView
android:id="@+id/scrollViewMain" android:id="@+id/scrollViewMain"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_above="@+id/adViewMain"> android:layout_alignParentBottom="true">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@@ -10,23 +10,14 @@
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:layout_marginTop="?android:actionBarSize"
tools:context="com.hyperling.apps.games.OptionsActivity"> tools:context="com.hyperling.apps.games.OptionsActivity">
<com.google.android.gms.ads.AdView
android:id="@+id/adViewOptions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="gone"
ads:adSize="BANNER"
ads:adUnitId="@string/interstitial_ad_unit_id_options" />
<ScrollView <ScrollView
android:id="@+id/scrollViewOptions" android:id="@+id/scrollViewOptions"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/adViewOptions" android:layout_alignParentBottom="true"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_alignParentTop="true"> android:layout_alignParentTop="true">
@@ -35,6 +26,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<!--
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -77,6 +69,7 @@
<Space <Space
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/spaceSize" /> android:layout_height="@dimen/spaceSize" />
-->
<TextView <TextView
android:text="@string/optionGroupInGame" android:text="@string/optionGroupInGame"

View File

@@ -36,7 +36,6 @@
<string name="optionGroupOnline">Online</string> <string name="optionGroupOnline">Online</string>
<string name="optionGroupOther">Other</string> <string name="optionGroupOther">Other</string>
<string name="optionAds">Allow Ads on Menu Screens?</string>
<string name="optionPracticeRound">Play Practice Round when Starting New Games?</string> <string name="optionPracticeRound">Play Practice Round when Starting New Games?</string>
<string name="optionHigherQuality">Allow Higher Quality Images and Animations?</string> <string name="optionHigherQuality">Allow Higher Quality Images and Animations?</string>
<string name="optionFPS">Display FPS?</string> <string name="optionFPS">Display FPS?</string>
@@ -52,7 +51,6 @@
<!-- Shared Preferences --> <!-- Shared Preferences -->
<string name="sharedPreferencesKey">HyperGames</string> <string name="sharedPreferencesKey">HyperGames</string>
<!-- Options --> <!-- Options -->
<string name="adsKey">Ads</string>
<string name="practiceRoundKey">Practice</string> <string name="practiceRoundKey">Practice</string>
<string name="higherQualityKey">HigherQuality</string> <string name="higherQualityKey">HigherQuality</string>
<string name="fpsKey">FPS</string> <string name="fpsKey">FPS</string>
@@ -82,11 +80,4 @@
<item>ChickenScore008(Alpha)</item> <item>ChickenScore008(Alpha)</item>
</string-array> </string-array>
<!-- -
This is an ad unit ID for an interstitial test ad. Replace with your own interstitial ad unit id.
For more information, see https://support.google.com/admob/answer/3052638
<!- -->
<string name="interstitial_ad_unit_id_main">ca-app-pub-9712416021907617/7877767281</string>
<string name="interstitial_ad_unit_id_options">ca-app-pub-9712416021907617/3307966880</string>
<string name="interstitial_ad_unit_id_high_score">ca-app-pub-9712416021907617/4784700088</string>
</resources> </resources>

View File

@@ -2,11 +2,18 @@
buildscript { buildscript {
repositories { repositories {
jcenter() mavenCentral()
maven {
url 'https://jitpack.io'
}
google() google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.android.tools.build:gradle:8.11.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@@ -15,7 +22,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
jcenter() mavenCentral()
google()
} }
} }

View File

@@ -1,6 +1,6 @@
#Thu Jan 10 06:49:36 CST 2019 #Thu Jan 10 06:49:36 CST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip