Skip to content

Commit ef0578a

Browse files
committed
Update to v6.74
1 parent e084bfd commit ef0578a

10 files changed

Lines changed: 273 additions & 7 deletions

File tree

AnLinux/.idea/caches/deviceStreaming.xml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AnLinux/app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
minSdkVersion 24
77
targetSdkVersion 37
88
compileSdk 37
9-
versionCode 673
10-
versionName "6.73 Stable"
9+
versionCode 674
10+
versionName "6.74 Stable"
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1212
}
1313
configurations.configureEach {
@@ -28,6 +28,7 @@ dependencies {
2828
implementation 'androidx.work:work-runtime:2.11.2'
2929
implementation 'androidx.annotation:annotation:1.10.0'
3030
implementation 'androidx.appcompat:appcompat:1.7.1'
31+
implementation "androidx.core:core-splashscreen:1.2.0"
3132
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
3233
implementation("com.google.android.ump:user-messaging-platform:4.0.0")
3334
implementation 'com.google.android.material:material:1.14.0'
54.6 KB
Binary file not shown.
370 Bytes
Binary file not shown.
380 Bytes
Binary file not shown.

AnLinux/app/release/output-metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"type": "SINGLE",
1212
"filters": [],
1313
"attributes": [],
14-
"versionCode": 673,
15-
"versionName": "6.73 Stable",
14+
"versionCode": 674,
15+
"versionName": "6.74 Stable",
1616
"outputFile": "app-release.apk"
1717
}
1818
],

AnLinux/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
android:label="@string/app_name"
1717
android:roundIcon="@mipmap/ic_launcher_round"
1818
android:supportsRtl="true"
19-
android:theme="@style/AppTheme.NoActionBar">
19+
android:theme="@style/AppTheme">
2020
<meta-data
2121
android:name="com.google.android.gms.ads.APPLICATION_ID"
2222
android:value="ca-app-pub-5748356089815497~5704037803"/>
@@ -25,7 +25,7 @@
2525
android:exported="true"
2626
android:screenOrientation="portrait"
2727
android:label="@string/app_name"
28-
android:theme="@style/AppTheme.NoActionBar">
28+
android:theme="@style/Theme.MyApp.Splash">
2929
<intent-filter>
3030
<action android:name="android.intent.action.MAIN" />
3131

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
package exa.lnx.a;
2+
3+
import android.app.Activity;
4+
import android.content.Context;
5+
import android.content.SharedPreferences;
6+
import android.util.Log;
7+
8+
import androidx.annotation.NonNull;
9+
10+
import com.google.android.libraries.ads.mobile.sdk.appopen.AppOpenAd;
11+
import com.google.android.libraries.ads.mobile.sdk.appopen.AppOpenAdEventCallback;
12+
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback;
13+
import com.google.android.libraries.ads.mobile.sdk.common.AdRequest;
14+
import com.google.android.libraries.ads.mobile.sdk.common.AdValue;
15+
import com.google.android.libraries.ads.mobile.sdk.common.FullScreenContentError;
16+
import com.google.android.libraries.ads.mobile.sdk.common.LoadAdError;
17+
18+
import org.jetbrains.annotations.NotNull;
19+
20+
public class AppOpenAdManager {
21+
private static final String LOG_TAG = "AppOpenAdManager";
22+
private static final String AD_UNIT_ID = "ca-app-pub-5748356089815497/7922138881";
23+
24+
private AppOpenAd appOpenAd = null;
25+
private boolean isLoadingAd = false;
26+
private boolean isShowingAd = false;
27+
28+
private long loadTime = 0;
29+
30+
/** Constructor. */
31+
public AppOpenAdManager() {}
32+
33+
public interface OnShowAdCompleteListener {
34+
void onShowAdComplete();
35+
}
36+
37+
/** Request an ad. */
38+
public void loadAd(Context context) {
39+
// Do not load ad if there is an unused ad or one is already loading.
40+
if (isLoadingAd || isAdAvailable(context)) {
41+
return;
42+
}
43+
44+
isLoadingAd = true;
45+
AppOpenAd.load(
46+
new AdRequest.Builder(AD_UNIT_ID).build(),
47+
new AdLoadCallback<AppOpenAd>() {
48+
@Override
49+
public void onAdLoaded(@NonNull AppOpenAd ad) {
50+
// Called when an ad has loaded.
51+
ad.setAdEventCallback(new AppOpenAdEventCallback() {
52+
53+
});
54+
appOpenAd = ad;
55+
}
56+
57+
@Override
58+
public void onAdFailedToLoad(@NonNull LoadAdError adError) {
59+
// Called when ad fails to load.
60+
isShowingAd = false;
61+
}
62+
});
63+
}
64+
/** Check if ad exists and can be shown. */
65+
private boolean isAdAvailable(Context context) {
66+
final long APP_OPEN_AD_INTERVAL = 4 * 60 * 60 *1000;
67+
SharedPreferences sharedPreferences = context.getSharedPreferences("GlobalPreferences", 0);
68+
SharedPreferences.Editor editor = sharedPreferences.edit();
69+
long lastShown = sharedPreferences.getLong("LastShownTime", 0);
70+
long now = System.currentTimeMillis();
71+
if(now - lastShown >= APP_OPEN_AD_INTERVAL && appOpenAd != null){
72+
editor.putLong("LastShownTime", now).apply();
73+
return true;
74+
}
75+
return false;
76+
}
77+
public void showAdIfAvailable(
78+
@NonNull final Activity activity,
79+
@NonNull OnShowAdCompleteListener onShowAdCompleteListener){
80+
// If the app open ad is already showing, do not show the ad again.
81+
if (isShowingAd) {
82+
Log.d(LOG_TAG, "The app open ad is already showing.");
83+
return;
84+
}
85+
86+
// If the app open ad is not available yet, invoke the callback then load the ad.
87+
if (!isAdAvailable(activity)) {
88+
Log.d(LOG_TAG, "The app open ad is not ready yet.");
89+
onShowAdCompleteListener.onShowAdComplete();
90+
loadAd(activity);
91+
return;
92+
}
93+
94+
appOpenAd.setAdEventCallback(new AppOpenAdEventCallback() {
95+
@Override
96+
public void onAdClicked() {
97+
AppOpenAdEventCallback.super.onAdClicked();
98+
}
99+
100+
@Override
101+
public void onAdDismissedFullScreenContent() {
102+
// Called when fullscreen content is dismissed.
103+
// Set the reference to null so isAdAvailable() returns false.
104+
Log.d(LOG_TAG, "Ad dismissed fullscreen content.");
105+
appOpenAd = null;
106+
isShowingAd = false;
107+
108+
onShowAdCompleteListener.onShowAdComplete();
109+
loadAd(activity);
110+
}
111+
112+
@Override
113+
public void onAdFailedToShowFullScreenContent(@NotNull FullScreenContentError fullScreenContentError) {
114+
AppOpenAdEventCallback.super.onAdFailedToShowFullScreenContent(fullScreenContentError);
115+
Log.d(LOG_TAG, fullScreenContentError.getMessage());
116+
appOpenAd = null;
117+
isShowingAd = false;
118+
119+
onShowAdCompleteListener.onShowAdComplete();
120+
loadAd(activity);
121+
}
122+
123+
@Override
124+
public void onAdImpression() {
125+
AppOpenAdEventCallback.super.onAdImpression();
126+
}
127+
128+
@Override
129+
public void onAdPaid(@NotNull AdValue value) {
130+
AppOpenAdEventCallback.super.onAdPaid(value);
131+
}
132+
133+
@Override
134+
public void onAdShowedFullScreenContent() {
135+
AppOpenAdEventCallback.super.onAdShowedFullScreenContent();
136+
}
137+
});
138+
isShowingAd = true;
139+
appOpenAd.show(activity);
140+
}
141+
}

0 commit comments

Comments
 (0)