V1.0.1(2) topon集成
This commit is contained in:
parent
1baa7241f3
commit
7064e14a99
@ -4,6 +4,8 @@ plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("io.objectbox")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -11,12 +13,12 @@ android {
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
//com.prank.sound.app
|
||||
//com.prank.sound.app.new
|
||||
applicationId = "com.prank.sound.app.new"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "Prank Sound App_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.sounds.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
@ -65,20 +67,101 @@ implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||
|
||||
// implementation ("org.greenrobot:greendao:3.2.2")
|
||||
// implementation("androidx.core:core-ktx:1.9.0")
|
||||
// implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.0")
|
||||
// implementation("androidx.activity:activity-compose:1.9.0")
|
||||
// implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
// implementation("androidx.compose.ui:ui")
|
||||
// implementation("androidx.compose.ui:ui-graphics")
|
||||
// implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
// implementation("androidx.compose.material3:material3")
|
||||
// testImplementation("junit:junit:4.13.2")
|
||||
// androidTestImplementation("androidx.sounds.ext:junit:1.1.5")
|
||||
// androidTestImplementation("androidx.sounds.espresso:espresso-core:3.5.1")
|
||||
// androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
// androidTestImplementation("androidx.compose.ui:ui-sounds-junit4")
|
||||
// debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
// debugImplementation("androidx.compose.ui:ui-sounds-manifest")
|
||||
// Import the BoM for the Firebase platform
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
|
||||
implementation("com.google.firebase:firebase-crashlytics")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
implementation("com.google.firebase:firebase-config")
|
||||
|
||||
|
||||
//-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo)
|
||||
|
||||
//Anythink (Necessary)
|
||||
implementation("com.anythink.sdk:core-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:nativead-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:banner-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:interstitial-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:rewardedvideo-tpn:6.4.07")
|
||||
implementation("com.anythink.sdk:splash-tpn:6.4.07")
|
||||
|
||||
//Androidx (Necessary)
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
//StartApp
|
||||
implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07")
|
||||
implementation("com.startapp:inapp-sdk:5.0.2")
|
||||
|
||||
//Appnext
|
||||
implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07")
|
||||
implementation("com.appnext.sdk:ads:2.7.1.473")
|
||||
implementation("com.appnext.sdk:banners:2.7.1.473")
|
||||
implementation("com.appnext.sdk:native-ads2:2.7.1.473")
|
||||
implementation("com.appnext.sdk:actions:2.4.6.472")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
|
||||
|
||||
//Vungle
|
||||
implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07")
|
||||
implementation("com.vungle:vungle-ads:7.4.0")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//UnityAds
|
||||
implementation("com.anythink.sdk:adapter-tpn-unityads:6.4.07")
|
||||
implementation("com.unity3d.ads:unity-ads:4.12.2")
|
||||
|
||||
//Ironsource
|
||||
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07")
|
||||
implementation("com.ironsource.sdk:mediationsdk:8.2.1")
|
||||
implementation("com.google.android.gms:play-services-appset:16.0.2")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
implementation("com.google.android.gms:play-services-basement:18.1.0")
|
||||
|
||||
//Bigo
|
||||
implementation("com.anythink.sdk:adapter-tpn-bigo:6.4.07")
|
||||
implementation("com.bigossp:bigo-ads:4.9.0")
|
||||
|
||||
//Pangle
|
||||
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07")
|
||||
implementation("com.pangle.global:ads-sdk:6.1.0.9")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//Inmobi
|
||||
implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07")
|
||||
implementation("com.inmobi.monetization:inmobi-ads-kotlin:10.7.5")
|
||||
|
||||
//Mintegral
|
||||
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.4.07")
|
||||
implementation("com.mbridge.msdk.oversea:reward:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:newinterstitial:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbnative:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbsplash:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbbanner:16.8.11")
|
||||
implementation("com.mbridge.msdk.oversea:mbbid:16.8.11")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
|
||||
//Chartboost
|
||||
implementation("com.anythink.sdk:adapter-tpn-chartboost:6.4.07")
|
||||
implementation("com.chartboost:chartboost-sdk:9.7.0")
|
||||
implementation("com.chartboost:chartboost-mediation-sdk:4.9.1")
|
||||
implementation("com.chartboost:chartboost-mediation-adapter-chartboost:4.9.7.0.0")
|
||||
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
|
||||
implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
||||
implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
|
||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
|
||||
|
||||
//Fyber
|
||||
implementation("com.anythink.sdk:adapter-tpn-fyber:6.4.07")
|
||||
implementation("com.fyber:marketplace-sdk:8.3.0")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
// Debugger UI Tools
|
||||
implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
|
||||
//----------------------------------------------TopOn
|
||||
|
||||
}
|
||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "783347330873",
|
||||
"project_id": "prank-sound-app-2e942",
|
||||
"storage_bucket": "prank-sound-app-2e942.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:783347330873:android:0d9bed1a0a9a696b3102e8",
|
||||
"android_client_info": {
|
||||
"package_name": "com.prank.sound.app.new"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAg6Vk-FZclMFbLaqM02Z6S3C__8XVfLTA"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
130
app/proguard-rules.pro
vendored
130
app/proguard-rules.pro
vendored
@ -49,3 +49,133 @@ java.lang.Object readResolve();
|
||||
<init>(...);
|
||||
<methods>;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------Topon
|
||||
-keep class com.startapp.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keep class com.truenet.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,
|
||||
LineNumberTable, *Annotation*, EnclosingMethod
|
||||
-dontwarn android.webkit.JavascriptInterface
|
||||
-dontwarn com.startapp.**
|
||||
|
||||
-dontwarn org.jetbrains.annotations.**
|
||||
-keep class com.appnext.** { *; }
|
||||
-dontwarn com.appnext.**
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers class com.vungle.ads.** {
|
||||
*;
|
||||
}
|
||||
-keep class com.vungle.ads.**
|
||||
|
||||
|
||||
|
||||
# Google
|
||||
-keep class com.google.android.gms.** { *; }
|
||||
-dontwarn com.google.android.gms.**
|
||||
|
||||
|
||||
|
||||
|
||||
# START OkHttp + Okio
|
||||
# JSR 305 annotations are for embedding nullability information.
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
|
||||
# A resource is loaded with a relative path so the package of this class must be preserved.
|
||||
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
|
||||
-dontwarn okhttp3.internal.platform.**
|
||||
-dontwarn org.conscrypt.**
|
||||
-dontwarn org.bouncycastle.**
|
||||
-dontwarn org.openjsse.**
|
||||
|
||||
|
||||
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
|
||||
-dontwarn org.codehaus.mojo.animal_sniffer.*
|
||||
|
||||
|
||||
# END OkHttp + Okio
|
||||
|
||||
|
||||
# START Protobuf
|
||||
-dontwarn com.google.protobuf.**
|
||||
-keepclassmembers class com.google.protobuf.** {
|
||||
*;
|
||||
}
|
||||
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
|
||||
|
||||
|
||||
# END Protobuf
|
||||
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
-keep public class com.google.android.gms.ads.** {
|
||||
public *;
|
||||
}
|
||||
-keep class com.ironsource.adapters.** { *;
|
||||
}
|
||||
-dontwarn com.ironsource.mediationsdk.**
|
||||
-dontwarn com.ironsource.adapters.**
|
||||
-keepattributes JavascriptInterface
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
-keep class com.bytedance.sdk.** { *; }
|
||||
-keep class com.inmobi.** { *; }
|
||||
-keep public class com.google.android.gms.**
|
||||
-dontwarn com.google.android.gms.**
|
||||
-dontwarn com.squareup.picasso.**
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
|
||||
public *;
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
|
||||
public *;
|
||||
}
|
||||
# skip the Picasso library classes
|
||||
-keep class com.squareup.picasso.** {*;}
|
||||
-dontwarn com.squareup.okhttp.**
|
||||
# skip Moat classes
|
||||
-keep class com.moat.** {*;}
|
||||
-dontwarn com.moat.**
|
||||
# skip IAB classes
|
||||
-keep class com.iab.** {*;}
|
||||
-dontwarn com.iab.**
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keep class com.mbridge.** {*; }
|
||||
-keep interface com.mbridge.** {*; }
|
||||
-keep class android.support.v4.** { *; }
|
||||
-dontwarn com.mbridge.**
|
||||
-keep class **.R$* { public static final int mbridge*; }
|
||||
-keep public class com.mbridge.* extends androidx.** { *; }
|
||||
-keep public class androidx.viewpager.widget.PagerAdapter{ *; }
|
||||
-keep public class androidx.viewpager.widget.ViewPager.OnPageChangeListener{ *; }
|
||||
-keep interface androidx.annotation.IntDef{ *; }
|
||||
-keep interface androidx.annotation.Nullable{ *; }
|
||||
-keep interface androidx.annotation.CheckResult{ *; }
|
||||
-keep interface androidx.annotation.NonNull{ *; }
|
||||
-keep public class androidx.fragment.app.Fragment{ *; }
|
||||
-keep public class androidx.core.content.FileProvider{ *; }
|
||||
-keep public class androidx.core.app.NotificationCompat{ *; }
|
||||
-keep public class androidx.appcompat.widget.AppCompatImageView { *; }
|
||||
-keep public class androidx.recyclerview.*{ *; }
|
||||
-keep class com.chartboost.** { *; }
|
||||
|
||||
#---------------------------------------------Topon
|
||||
@ -4,10 +4,14 @@ import android.app.Application;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.anythink.debug.api.ATDebuggerUITest;
|
||||
import com.prank.sound.app.mydata.ChildData;
|
||||
import com.prank.sound.app.mydata.Category;
|
||||
import com.prank.sound.app.myutils.ObUtils;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -18,6 +22,7 @@ public class PrankApp extends Application {
|
||||
public static PrankApp app;
|
||||
public static Typeface defaultFont;
|
||||
public static List<Category> bean;
|
||||
public static String TAG = "-------PrankApp-----";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@ -26,22 +31,57 @@ public class PrankApp extends Application {
|
||||
AssetManager assets = getAssets();
|
||||
defaultFont = Typeface.createFromAsset(assets, "115_Black.ttf");
|
||||
ObUtils.init(this);
|
||||
initAd();
|
||||
if (bean != null)
|
||||
return;
|
||||
try {
|
||||
InputStream open = getAssets().open("audio.json");
|
||||
String string = Utils.getString(open);
|
||||
if (!string.isEmpty()) {
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bean = Utils.getBean(string);
|
||||
for (Category category:bean){
|
||||
for (Category category : bean) {
|
||||
for (ChildData childData1 : category.getChildDataList()) {
|
||||
childData1.setLike(false);
|
||||
ObUtils.getBoxBean().put(childData1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initAd() {
|
||||
String APPId = "h67c1520295911";
|
||||
String AppKey = "ac7ef64e75e744dfdbd150b224460e412";
|
||||
String debug = "4e26d6fdb6029c920a512f4d896f6331f47c82d0";
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onResultCallback(boolean isEU) {
|
||||
|
||||
if (isEU && ATSDK.getGDPRDataLevel(PrankApp.this) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(PrankApp.this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorCallback(String errorMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
ATSDK.init(this, APPId, AppKey);
|
||||
// ATDebuggerUITest.showDebuggerUI(this,debug);
|
||||
AdManager.loadAllAd();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@ import com.prank.sound.app.mydata.Category;
|
||||
import com.prank.sound.app.myutils.ItemHelper;
|
||||
import com.prank.sound.app.myutils.MyValues;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
import com.prank.sound.app.topon.onActionListener;
|
||||
|
||||
public class InfoActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
@ -23,6 +25,7 @@ public class InfoActivity extends AppCompatActivity implements View.OnClickListe
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Utils.setStatusBarTextColor(this,true);
|
||||
AdManager.loadAllAd();
|
||||
activityListBinding = LayoutInfoBinding.inflate(getLayoutInflater());
|
||||
setContentView(activityListBinding.getRoot());
|
||||
data = (Category) getIntent().getSerializableExtra(MyValues.KEY_LIST_DATA);
|
||||
@ -30,6 +33,12 @@ public class InfoActivity extends AppCompatActivity implements View.OnClickListe
|
||||
activityListBinding.categoryName.setText(data.getName());
|
||||
onList();
|
||||
activityListBinding.back.setOnClickListener(this);
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void onList() {
|
||||
|
||||
@ -22,6 +22,7 @@ import com.prank.sound.app.R;
|
||||
import com.prank.sound.app.databinding.LayoutMainBinding;
|
||||
import com.prank.sound.app.myutils.MyValues;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -45,7 +46,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
activityMainBinding.frameHome.setOnClickListener(this);
|
||||
activityMainBinding.frameAdd.setOnClickListener(this);
|
||||
activityMainBinding.frameCollect.setOnClickListener(this);
|
||||
|
||||
AdManager.loadAllAd();
|
||||
|
||||
audioPickerLauncher = registerForActivityResult(new ActivityResultContracts.GetContent(),
|
||||
new ActivityResultCallback<Uri>() {
|
||||
@ -63,23 +64,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
|
||||
// audioPickerLauncher = registerForActivityResult(
|
||||
// new ActivityResultContracts.StartActivityForResult(),
|
||||
// result -> {
|
||||
// if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
||||
// Intent data = result.getData();
|
||||
// Uri selectedAudioUri = data.getData();
|
||||
// if (selectedAudioUri != null) {
|
||||
// long duration = CommonUtils.getAudioDuration(MainActivity.this, selectedAudioUri);
|
||||
// Intent intent = new Intent(MainActivity.this, SaveActivity.class);
|
||||
// intent.putExtra(SaveActivity.KEY_Path, selectedAudioUri.toString());
|
||||
// intent.putExtra(SaveActivity.KEY_Time, duration);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
}
|
||||
|
||||
private void initVp2() {
|
||||
@ -117,7 +102,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
int currentItem = activityMainBinding.vp2.getCurrentItem();
|
||||
Log.d("----------", "---------currentItem=" + currentItem);
|
||||
if (currentItem == 1) {
|
||||
recordFragment.refresh();
|
||||
} else if (currentItem == 2) {
|
||||
|
||||
@ -8,10 +8,13 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.prank.sound.app.databinding.LayoutWelBinding;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
import com.prank.sound.app.topon.CountAction;
|
||||
import com.prank.sound.app.topon.GoMainAction;
|
||||
|
||||
public class MyWelActivity extends AppCompatActivity {
|
||||
|
||||
private long time = 1000;
|
||||
private long time = 12000;
|
||||
private LayoutWelBinding binding;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@ -20,25 +23,27 @@ public class MyWelActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = LayoutWelBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
AdManager.loadAllAd();
|
||||
Utils.setStatusBarTextColor(this, true);
|
||||
countDownTimer = new CountDownTimer(time, 200) {
|
||||
countDownTimer = AdManager.showWelcomeAd(this, time, new CountAction() {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
public void onCount(long millisUntilFinished) {
|
||||
int progressPercentage = (int) ((100 * millisUntilFinished) / time);
|
||||
int Percentage = 100 - progressPercentage;
|
||||
binding.loadingPb.setProgress(Percentage);
|
||||
}
|
||||
|
||||
}, new GoMainAction() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
public void onGo() {
|
||||
welcomeMain();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void welcomeMain() {
|
||||
binding.loadingPb.setProgress(100);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
@ -23,6 +23,8 @@ import com.prank.sound.app.myutils.MyValues;
|
||||
import com.prank.sound.app.myutils.ObUtils;
|
||||
import com.prank.sound.app.myutils.OnClickTimer;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
import com.prank.sound.app.topon.onActionListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -41,13 +43,18 @@ public class PlaySoundsActivity extends AppCompatActivity implements View.OnClic
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
AdManager.loadAllAd();
|
||||
playBinding = LayoutPlaySoundsBinding.inflate(getLayoutInflater());
|
||||
setContentView(playBinding.getRoot());
|
||||
Utils.setStatusBarTextColor(this, true);
|
||||
childData = (ChildData) getIntent().getSerializableExtra(MyValues.KEY_PLAY_DATA);
|
||||
color = getIntent().getIntExtra(MyValues.KEY_PLAY_COLOR_POS, 0);
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
playBinding.frameIm.setBackground(ContextCompat.getDrawable(this, MyValues.bgs[color]));
|
||||
initAudio();
|
||||
String covert = childData.getCovert();
|
||||
@ -170,6 +177,10 @@ public class PlaySoundsActivity extends AppCompatActivity implements View.OnClic
|
||||
if (v.equals(playBinding.back)) {
|
||||
finish();
|
||||
} else if (v.equals(playBinding.linearPlay)) {
|
||||
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
boolean selected = playBinding.btnPlay.isSelected();
|
||||
if (selected) {
|
||||
if (mediaPlayer.isPlaying()) {
|
||||
@ -181,6 +192,8 @@ public class PlaySoundsActivity extends AppCompatActivity implements View.OnClic
|
||||
}
|
||||
}
|
||||
playBinding.btnPlay.setSelected(!selected);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (v.equals(playBinding.imLike)) {
|
||||
playBinding.imLike.setSelected(!playBinding.imLike.isSelected());
|
||||
@ -194,11 +207,17 @@ public class PlaySoundsActivity extends AppCompatActivity implements View.OnClic
|
||||
playBinding.imLoop.setSelected(!playBinding.imLoop.isSelected());
|
||||
mediaPlayer.setLooping(playBinding.imLoop.isSelected());
|
||||
} else if (v.equals(playBinding.imTimer)) {
|
||||
AdManager.showTopOn(PlaySoundsActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
if (dialogTimer == null) {
|
||||
dialogTimer = new DialogTimer(PlaySoundsActivity.this, this);
|
||||
dialogTimer = new DialogTimer(PlaySoundsActivity.this, PlaySoundsActivity.this);
|
||||
}
|
||||
dialogTimer.showTop(playBinding.imTimer);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@ import com.prank.sound.app.R;
|
||||
import com.prank.sound.app.databinding.LayoutRecordAudioBinding;
|
||||
import com.prank.sound.app.myutils.Recorder;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
import com.prank.sound.app.topon.onActionListener;
|
||||
|
||||
public class RecordSoundsActivity extends AppCompatActivity {
|
||||
LayoutRecordAudioBinding binding;
|
||||
@ -31,8 +33,14 @@ public class RecordSoundsActivity extends AppCompatActivity {
|
||||
setContentView(binding.getRoot());
|
||||
Utils.setStatusBarTextColor(this, true);
|
||||
recorder = new Recorder(this);
|
||||
|
||||
AdManager.loadAllAd();
|
||||
binding.audioTime.setText(R.string.time_init);
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
initEvent();
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ import com.prank.sound.app.databinding.LayoutStoreSoundsBinding;
|
||||
import com.prank.sound.app.mydata.ChildData;
|
||||
import com.prank.sound.app.myutils.ObUtils;
|
||||
import com.prank.sound.app.myutils.Utils;
|
||||
import com.prank.sound.app.topon.AdManager;
|
||||
import com.prank.sound.app.topon.onActionListener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -47,7 +49,7 @@ public class StoreSoundsActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = LayoutStoreSoundsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
AdManager.loadAllAd();
|
||||
Utils.setStatusBarTextColor(this, true);
|
||||
binding.audioTime.setText(R.string.time_init);
|
||||
initData();
|
||||
@ -136,6 +138,10 @@ public class StoreSoundsActivity extends AppCompatActivity {
|
||||
}
|
||||
});
|
||||
binding.save.setOnClickListener(v -> {
|
||||
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
String name = binding.saveEdit.getText().toString().trim();
|
||||
boolean b = ObUtils.checkName(name);
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
@ -150,6 +156,9 @@ public class StoreSoundsActivity extends AppCompatActivity {
|
||||
} else {
|
||||
Toast.makeText(StoreSoundsActivity.this, getString(R.string.save_tip), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
10
app/src/main/java/com/prank/sound/app/topon/AdListener.java
Normal file
10
app/src/main/java/com/prank/sound/app/topon/AdListener.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
public interface AdListener {
|
||||
void loadFail(String placeId);
|
||||
void showSuccess();
|
||||
|
||||
void showFail();
|
||||
|
||||
void showClose();
|
||||
}
|
||||
245
app/src/main/java/com/prank/sound/app/topon/AdManager.java
Normal file
245
app/src/main/java/com/prank/sound/app/topon/AdManager.java
Normal file
@ -0,0 +1,245 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.anythink.core.api.ATAdInfo;
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.anythink.interstitial.api.ATInterstitialListener;
|
||||
import com.prank.sound.app.PrankApp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AdManager {
|
||||
|
||||
private static final int type_no_cache = 0;
|
||||
private static final int type_has_cache = 1;
|
||||
private static final int type_show_success = 2;
|
||||
private static final int type_show_close = 3;
|
||||
private static final int type_show_fail = 4;
|
||||
|
||||
|
||||
|
||||
private static final String place1Id = "n67c15216a228c";
|
||||
private static final String place2Id = "n67c15215bed68";
|
||||
private static final String place3Id = "n67c152155eaeb";
|
||||
|
||||
|
||||
private static boolean place1LoadFail = false;
|
||||
private static boolean place2LoadFail = false;
|
||||
private static boolean place3LoadFail = false;
|
||||
|
||||
private static boolean alreadyShow = false;
|
||||
|
||||
private static List<ATInterstitial> list = new ArrayList<>();
|
||||
|
||||
|
||||
public static void loadAllAd() {
|
||||
if (list.size() == 0) {
|
||||
ATInterstitial mInterstitialAd1 = new ATInterstitial(PrankApp.app, place1Id);
|
||||
ATInterstitial mInterstitialAd2 = new ATInterstitial(PrankApp.app, place2Id);
|
||||
ATInterstitial mInterstitialAd3 = new ATInterstitial(PrankApp.app, place3Id);
|
||||
list.add(mInterstitialAd1);
|
||||
list.add(mInterstitialAd2);
|
||||
list.add(mInterstitialAd3);
|
||||
}
|
||||
for (ATInterstitial ad : list) {
|
||||
if (!ad.isAdReady()) {
|
||||
setCallBack(ad, new AdListener() {
|
||||
@Override
|
||||
public void loadFail(@NonNull String placeId) {
|
||||
if (placeId.equals(place1Id)) {
|
||||
place1LoadFail = true;
|
||||
}
|
||||
if (placeId.equals(place2Id)) {
|
||||
place2LoadFail = true;
|
||||
}
|
||||
if (placeId.equals(place3Id)) {
|
||||
place3LoadFail = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showClose() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.load();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static ATInterstitial getReadyAd() {
|
||||
Collections.shuffle(list);
|
||||
for (ATInterstitial ad : list) {
|
||||
if (ad.isAdReady()) {
|
||||
Log.d(PrankApp.TAG, "-has Cache------------");
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
Log.d(PrankApp.TAG, "-No Cache------------");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void setCallBack(ATInterstitial ad, AdListener listener) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
Log.d(PrankApp.TAG, "LoadLoaded " + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
listener.loadFail(ad.mPlacementId);
|
||||
Log.d(PrankApp.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
Log.d(PrankApp.TAG, "AdShow " + atAdInfo.getShowId());
|
||||
listener.showSuccess();
|
||||
ad.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
|
||||
listener.showClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoError(AdError adError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static CountDownTimer showWelcomeAd(
|
||||
Activity activity,
|
||||
Long totalTim,
|
||||
CountAction countAction,
|
||||
GoMainAction goMain
|
||||
) {
|
||||
Log.d(PrankApp.TAG,"----------alreadyShow="+alreadyShow);
|
||||
alreadyShow = false;
|
||||
CountDownTimer timer = new CountDownTimer(totalTim, 100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
countAction.onCount(millisUntilFinished);
|
||||
if (!alreadyShow) {
|
||||
showAD(activity, new AdStatusAction() {
|
||||
@Override
|
||||
public void onStatus(int adType) {
|
||||
if (adType == type_has_cache) {
|
||||
alreadyShow = true;
|
||||
}
|
||||
if (adType == type_show_close || adType == type_show_fail) {
|
||||
goMain.onGo();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if (!alreadyShow) {
|
||||
showTopOn(activity, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
goMain.onGo();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void showAD(Activity activity, AdStatusAction action) {
|
||||
ATInterstitial readyAd = getReadyAd();
|
||||
if (readyAd != null) {
|
||||
action.onStatus(type_has_cache);
|
||||
setCallBack(readyAd, new AdListener() {
|
||||
@Override
|
||||
public void loadFail(@NonNull String placeId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSuccess() {
|
||||
action.onStatus(type_show_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showFail() {
|
||||
action.onStatus(type_show_fail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showClose() {
|
||||
action.onStatus(type_show_close);
|
||||
}
|
||||
});
|
||||
readyAd.show(activity);
|
||||
} else {
|
||||
action.onStatus(type_no_cache);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void showTopOn(Activity activity, onActionListener listener) {
|
||||
showAD(activity, new AdStatusAction() {
|
||||
@Override
|
||||
public void onStatus(int adType) {
|
||||
if (adType == type_no_cache || adType == type_show_close || adType == type_show_fail) {
|
||||
listener.onAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
public interface AdStatusAction {
|
||||
void onStatus(int adType);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
public interface CountAction {
|
||||
void onCount(long millisUntilFinished);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
public interface GoMainAction {
|
||||
void onGo();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.prank.sound.app.topon;
|
||||
|
||||
public interface onActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.8.10" apply false
|
||||
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||
}
|
||||
|
||||
buildscript {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
||||
@ -12,6 +12,25 @@ dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
//Anythink(Core)
|
||||
maven ("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
|
||||
//Appnext
|
||||
maven ("https://dl.appnext.com")
|
||||
|
||||
//Ironsource
|
||||
maven ("https://android-sdk.is.com/")
|
||||
|
||||
//Pangle
|
||||
maven ("https://artifact.bytedance.com/repository/pangle")
|
||||
|
||||
//Mintegral
|
||||
maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||
|
||||
//Chartboost
|
||||
maven ("https://cboost.jfrog.io/artifactory/chartboost-ads")
|
||||
maven ("https://cboost.jfrog.io/artifactory/chartboost-mediation")
|
||||
maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user