V1.0.1(2)接入topon加firebase
This commit is contained in:
parent
2084bf9314
commit
67d2dc9f1c
@ -4,8 +4,8 @@ import java.text.SimpleDateFormat
|
|||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
// id("com.google.gms.google-services")
|
id("com.google.gms.google-services")
|
||||||
// id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
id("io.objectbox")
|
id("io.objectbox")
|
||||||
}
|
}
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
@ -18,8 +18,8 @@ android {
|
|||||||
applicationId = "com.trace.ar.drawing"
|
applicationId = "com.trace.ar.drawing"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.1"
|
||||||
setProperty(
|
setProperty(
|
||||||
"archivesBaseName",
|
"archivesBaseName",
|
||||||
"AR Drawing_V" + versionName + "(${versionCode})_$timestamp"
|
"AR Drawing_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
@ -78,5 +78,106 @@ dependencies {
|
|||||||
// implementation("com.google.firebase:firebase-crashlytics")
|
// implementation("com.google.firebase:firebase-crashlytics")
|
||||||
// implementation("com.google.firebase:firebase-analytics")
|
// implementation("com.google.firebase:firebase-analytics")
|
||||||
|
|
||||||
|
// Import the BoM for the Firebase platform
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
|
||||||
|
|
||||||
|
// Add the dependencies for the Crashlytics and Analytics libraries
|
||||||
|
// When using the BoM, you don't specify versions in Firebase library dependencies
|
||||||
|
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.1.0")
|
||||||
|
|
||||||
|
//----------------------------------------------TopOn
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "135545732715",
|
||||||
|
"project_id": "ar-drawing-7f4dc",
|
||||||
|
"storage_bucket": "ar-drawing-7f4dc.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:135545732715:android:b5c65cbfd0461b9b803b2e",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.trace.ar.drawing"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAoo0FdO-4vu80M9BbrCtDqMi16h9kO9do"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
132
app/proguard-rules.pro
vendored
132
app/proguard-rules.pro
vendored
@ -147,4 +147,134 @@
|
|||||||
-keep class androidx.recyclerview.widget.RecyclerView$OnScrollListener { *;}
|
-keep class androidx.recyclerview.widget.RecyclerView$OnScrollListener { *;}
|
||||||
#For Android
|
#For Android
|
||||||
-keep class * extends android.app.Activity
|
-keep class * extends android.app.Activity
|
||||||
#-----------------------------------------------------ironSource SDK
|
#-----------------------------------------------------ironSource SDK
|
||||||
|
|
||||||
|
#---------------------------------------------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,8 +4,13 @@ import android.app.Application;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.anythink.core.api.ATSDK;
|
||||||
|
import com.anythink.core.api.NetTrafficeCallback;
|
||||||
|
import com.google.firebase.FirebaseApp;
|
||||||
import com.trace.ar.drawing.helper.ObjectBox;
|
import com.trace.ar.drawing.helper.ObjectBox;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
|
||||||
public class ARApp extends Application {
|
public class ARApp extends Application {
|
||||||
public static String Key_ViewDir = "pre_dir";
|
public static String Key_ViewDir = "pre_dir";
|
||||||
@ -21,13 +26,16 @@ public class ARApp extends Application {
|
|||||||
|
|
||||||
public static ARApp app;
|
public static ARApp app;
|
||||||
// public static String APP_KEY = "";
|
// public static String APP_KEY = "";
|
||||||
private static Context context;
|
public static Context context;
|
||||||
// public static final String AD_BROADCAST = "on_success_action";
|
// public static final String AD_BROADCAST = "on_success_action";
|
||||||
// private static final String MAX_SDK = "27z51PI2aTeTbobe3ORmbnMCb97dZbW8zfHEBfRFzb2DlCRJaTQCNebHHVZ2aepZGpqkvO1J7noD4s8W2UwJew";
|
// private static final String MAX_SDK = "27z51PI2aTeTbobe3ORmbnMCb97dZbW8zfHEBfRFzb2DlCRJaTQCNebHHVZ2aepZGpqkvO1J7noD4s8W2UwJew";
|
||||||
// public static Boolean initSDK = false;
|
// public static Boolean initSDK = false;
|
||||||
|
|
||||||
public static Typeface defaultFont;
|
public static Typeface defaultFont;
|
||||||
|
|
||||||
|
private static final String AppKey = "ab3514befb0b4acafee6fc1d9bc5a9381";
|
||||||
|
private static final String APPId = "h674b1f3b3d3a2";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@ -36,9 +44,49 @@ public class ARApp extends Application {
|
|||||||
AssetManager assets = getAssets();
|
AssetManager assets = getAssets();
|
||||||
defaultFont = Typeface.createFromAsset(assets, "75_SemiBold.ttf");
|
defaultFont = Typeface.createFromAsset(assets, "75_SemiBold.ttf");
|
||||||
|
|
||||||
|
// 确保Firebase初始化
|
||||||
|
// FirebaseApp.initializeApp(this);
|
||||||
|
//
|
||||||
|
// // 输出日志以确认Firebase初始化
|
||||||
|
// if (!FirebaseApp.getApps(this).isEmpty()) {
|
||||||
|
// Log.d(TAG, "Firebase 初始化成功");
|
||||||
|
// } else {
|
||||||
|
// Log.e(TAG, "Firebase 初始化失败");
|
||||||
|
// }
|
||||||
|
|
||||||
|
initSdk();
|
||||||
|
|
||||||
ObjectBox.init(this);
|
ObjectBox.init(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initSdk() {
|
||||||
|
|
||||||
|
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResultCallback(boolean isEU) {
|
||||||
|
Log.e(TAG, "onResultCallback:" + isEU);
|
||||||
|
if (isEU && ATSDK.getGDPRDataLevel(ARApp.this) == ATSDK.UNKNOWN) {
|
||||||
|
ATSDK.showGdprAuth(ARApp.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorCallback(String errorMsg) {
|
||||||
|
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ATSDK.init( this, APPId, AppKey);
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
//测试工具
|
||||||
|
// ATDebuggerUITest.showDebuggerUI(this,debug_KEy);
|
||||||
|
//
|
||||||
|
// ATSDK.setNetworkLogDebug(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,8 @@ import com.trace.ar.drawing.R;
|
|||||||
import com.trace.ar.drawing.helper.ObjectBox;
|
import com.trace.ar.drawing.helper.ObjectBox;
|
||||||
import com.trace.ar.drawing.helper.Utils;
|
import com.trace.ar.drawing.helper.Utils;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
import com.trace.ar.drawing.topon.onActionListener;
|
||||||
|
|
||||||
public class DetailActivity extends AppCompatActivity implements View.OnTouchListener, View.OnClickListener {
|
public class DetailActivity extends AppCompatActivity implements View.OnTouchListener, View.OnClickListener {
|
||||||
private CameraSelector cameraSelector;
|
private CameraSelector cameraSelector;
|
||||||
@ -48,14 +50,12 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
private SeekBar seekBar;
|
private SeekBar seekBar;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int MODE;//当前状态
|
private int MODE;//当前状态
|
||||||
public static final int MODE_NONE = 0;//无操作
|
public static final int MODE_NONE = 0;//无操作
|
||||||
public static final int MODE_DRAG = 1;//单指操作
|
public static final int MODE_DRAG = 1;//单指操作
|
||||||
public static final int MODE_SCALE = 2;//双指操作
|
public static final int MODE_SCALE = 2;//双指操作
|
||||||
|
|
||||||
private Matrix startMatrix = new Matrix();
|
private Matrix startMatrix = new Matrix();
|
||||||
private Matrix endMatrix = new Matrix();//变化后的矩阵
|
private Matrix endMatrix = new Matrix();//变化后的矩阵
|
||||||
private PointF startPointF = new PointF();//初始坐标
|
private PointF startPointF = new PointF();//初始坐标
|
||||||
private float distance;//初始距离
|
private float distance;//初始距离
|
||||||
@ -77,6 +77,7 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
setContentView(R.layout.activity_detail);
|
setContentView(R.layout.activity_detail);
|
||||||
Utils.setStatusBarTextColor(this, true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
|
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
isMain = intent.getBooleanExtra(ARApp.Key_ISMAIN, false);
|
isMain = intent.getBooleanExtra(ARApp.Key_ISMAIN, false);
|
||||||
@ -96,27 +97,27 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
intentActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
|
||||||
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
if (result.getResultCode() == Activity.RESULT_OK && result.getData() != null) {
|
||||||
Uri imageUri = result.getData().getData();
|
Uri imageUri = result.getData().getData();
|
||||||
if(imageUri!= null){
|
if (imageUri != null) {
|
||||||
String lastPathSegment = imageUri.getLastPathSegment();
|
String lastPathSegment = imageUri.getLastPathSegment();
|
||||||
int index = lastPathSegment.lastIndexOf("/");
|
int index = lastPathSegment.lastIndexOf("/");
|
||||||
String name = lastPathSegment.substring(index+1);
|
String name = lastPathSegment.substring(index + 1);
|
||||||
double uriFileSize = Utils.getUriFileSize(DetailActivity.this, imageUri);
|
double uriFileSize = Utils.getUriFileSize(DetailActivity.this, imageUri);
|
||||||
Log.d(ARApp.TAG, "------uriFileSize-----" + uriFileSize+"--Mb");
|
Log.d(ARApp.TAG, "------uriFileSize-----" + uriFileSize + "--Mb");
|
||||||
if(uriFileSize>=5){
|
if (uriFileSize >= 5) {
|
||||||
Toast.makeText(DetailActivity.this, getString(R.string.import_im_too_big), Toast.LENGTH_SHORT).show();
|
Toast.makeText(DetailActivity.this, getString(R.string.import_im_too_big), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
imageView.setImageURI(imageUri);
|
imageView.setImageURI(imageUri);
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
boolean b = Utils.saveToInternalStorage(name, imageUri, DetailActivity.this);
|
boolean b = Utils.saveToInternalStorage(name, imageUri, DetailActivity.this);
|
||||||
if(b){
|
if (b) {
|
||||||
String importPath = Utils.getImportPath(name);
|
String importPath = Utils.getImportPath(name);
|
||||||
ObjectBox.insertImport(importPath);
|
ObjectBox.insertImport(importPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -130,7 +131,6 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void onInitIm(float imW, float imH) {
|
private void onInitIm(float imW, float imH) {
|
||||||
Point screen = Utils.getScreen(this);
|
Point screen = Utils.getScreen(this);
|
||||||
float newX = screen.x / 2f - imW / 2;
|
float newX = screen.x / 2f - imW / 2;
|
||||||
@ -150,8 +150,6 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
startPointF.set(event.getX(), event.getY());
|
startPointF.set(event.getX(), event.getY());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MODE = MODE_DRAG;
|
MODE = MODE_DRAG;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -196,11 +194,12 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v.equals(imBack)) {
|
if (v.equals(imBack)) {
|
||||||
|
|
||||||
if (isMain) {
|
AdManager.showTopOn(this, new onActionListener() {
|
||||||
finish();
|
@Override
|
||||||
} else {
|
public void onAction() {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
@ -212,8 +211,14 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
flashIm.setSelected(!selected);
|
flashIm.setSelected(!selected);
|
||||||
camera.getCameraControl().enableTorch(!selected);
|
camera.getCameraControl().enableTorch(!selected);
|
||||||
} else if (v.equals(imPhoto)) {
|
} else if (v.equals(imPhoto)) {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
AdManager.showTopOn(this, new onActionListener() {
|
||||||
intentActivityResultLauncher.launch(intent);
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
intentActivityResultLauncher.launch(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else if (v.equals(imZoom)) {
|
} else if (v.equals(imZoom)) {
|
||||||
if (seekBar.getVisibility() == View.VISIBLE) {
|
if (seekBar.getVisibility() == View.VISIBLE) {
|
||||||
seekBar.setVisibility(View.GONE);
|
seekBar.setVisibility(View.GONE);
|
||||||
@ -258,7 +263,7 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
} else {
|
} else {
|
||||||
permissions = new String[]{android.Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
permissions = new String[]{android.Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
||||||
}
|
}
|
||||||
if (!Utils.checkPermission(this,permissions)) {
|
if (!Utils.checkPermission(this, permissions)) {
|
||||||
hasPermission = false;
|
hasPermission = false;
|
||||||
imageView.setOnTouchListener(null);
|
imageView.setOnTouchListener(null);
|
||||||
ActivityCompat.requestPermissions(this, permissions, 0);
|
ActivityCompat.requestPermissions(this, permissions, 0);
|
||||||
@ -302,7 +307,7 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
if (requestCode == 0) {
|
if (requestCode == 0) {
|
||||||
if (Utils.checkPermission(DetailActivity.this,permissions)) {
|
if (Utils.checkPermission(DetailActivity.this, permissions)) {
|
||||||
hasPermission = true;
|
hasPermission = true;
|
||||||
imageView.setOnTouchListener(this);
|
imageView.setOnTouchListener(this);
|
||||||
startCamera();
|
startCamera();
|
||||||
@ -315,11 +320,18 @@ public class DetailActivity extends AppCompatActivity implements View.OnTouchLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void showNoPermission() {
|
private void showNoPermission() {
|
||||||
Toast.makeText(this, getString(R.string.permission_fail), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getString(R.string.permission_fail), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
AdManager.showTopOn(this, new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -19,6 +19,7 @@ import com.trace.ar.drawing.fragment.FavoriteFragment;
|
|||||||
import com.trace.ar.drawing.fragment.HomeFragment;
|
import com.trace.ar.drawing.fragment.HomeFragment;
|
||||||
import com.trace.ar.drawing.helper.Utils;
|
import com.trace.ar.drawing.helper.Utils;
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,13 +32,16 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private List<Fragment> listFragment = new ArrayList<>();
|
private List<Fragment> listFragment = new ArrayList<>();
|
||||||
|
|
||||||
private String[] permissions;
|
private String[] permissions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Utils.setStatusBarTextColor(this,true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
binding = ActivityHomeBinding.inflate(getLayoutInflater());
|
binding = ActivityHomeBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
|
||||||
listFragment.add(HomeFragment.newInstance());
|
listFragment.add(HomeFragment.newInstance());
|
||||||
listFragment.add(FavoriteFragment.newInstance());
|
listFragment.add(FavoriteFragment.newInstance());
|
||||||
onTabInit();
|
onTabInit();
|
||||||
@ -59,7 +63,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void bingTabVp() {
|
private void bingTabVp() {
|
||||||
binding.tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
binding.tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -112,5 +115,4 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,16 +3,18 @@ package com.trace.ar.drawing.activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.trace.ar.drawing.databinding.ActivityWelcomeBinding;
|
import com.trace.ar.drawing.databinding.ActivityWelcomeBinding;
|
||||||
import com.trace.ar.drawing.helper.Utils;
|
import com.trace.ar.drawing.helper.Utils;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
|
||||||
public class MySplashActivity extends AppCompatActivity {
|
public class MySplashActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private ActivityWelcomeBinding binding;
|
private ActivityWelcomeBinding binding;
|
||||||
private long time = 1000;
|
private long time = 11000;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
|
||||||
@ -24,22 +26,19 @@ public class MySplashActivity extends AppCompatActivity {
|
|||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
Utils.setStatusBarTextColor(this, true);
|
Utils.setStatusBarTextColor(this, true);
|
||||||
|
|
||||||
countDownTimer = new CountDownTimer(time, 200) {
|
AdManager.loadAllAd();
|
||||||
@Override
|
|
||||||
public void onTick(long millisUntilFinished) {
|
|
||||||
int progressPercentage = (int) ((100 * millisUntilFinished) / time);
|
|
||||||
|
|
||||||
// 或者从 100% 到 0% 的倒计时
|
ProgressBar progressBar = binding.loadingPb;
|
||||||
int Percentage = 100 - progressPercentage;
|
|
||||||
binding.loadingPb.setProgress(Percentage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
AdManager.setAlreadyShow();
|
||||||
public void onFinish() {
|
|
||||||
enterMain();
|
countDownTimer = AdManager.showWelcomeAd(this, time, millisUntilFinished -> {
|
||||||
|
int percentage = (int) (100 - (float) millisUntilFinished / time * 100);
|
||||||
|
progressBar.setProgress(percentage);
|
||||||
|
},
|
||||||
|
this::enterMain
|
||||||
|
);
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
countDownTimer.start();
|
countDownTimer.start();
|
||||||
}
|
}
|
||||||
private void enterMain() {
|
private void enterMain() {
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import com.trace.ar.drawing.ARApp;
|
|||||||
import com.trace.ar.drawing.adapter.ViewAllAdapter;
|
import com.trace.ar.drawing.adapter.ViewAllAdapter;
|
||||||
import com.trace.ar.drawing.databinding.ActivityViewAllBinding;
|
import com.trace.ar.drawing.databinding.ActivityViewAllBinding;
|
||||||
import com.trace.ar.drawing.helper.Utils;
|
import com.trace.ar.drawing.helper.Utils;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
import com.trace.ar.drawing.topon.onActionListener;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ public class ViewAllActivity extends AppCompatActivity {
|
|||||||
dirStr = getIntent().getStringExtra(ARApp.Key_ViewDir);
|
dirStr = getIntent().getStringExtra(ARApp.Key_ViewDir);
|
||||||
preViewBinding.categoryName.setText(dirStr.substring(dirStr.lastIndexOf("_") + 1));
|
preViewBinding.categoryName.setText(dirStr.substring(dirStr.lastIndexOf("_") + 1));
|
||||||
|
|
||||||
|
AdManager.loadAllAd();
|
||||||
|
|
||||||
|
|
||||||
onInitList();
|
onInitList();
|
||||||
@ -48,12 +51,24 @@ public class ViewAllActivity extends AppCompatActivity {
|
|||||||
preViewBinding.back.setOnClickListener(new View.OnClickListener() {
|
preViewBinding.back.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
finish();
|
AdManager.showTopOn(ViewAllActivity.this, new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
super.onBackPressed();
|
||||||
|
AdManager.showTopOn(this, new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -16,6 +16,8 @@ import com.trace.ar.drawing.activity.ViewAllActivity;
|
|||||||
import com.trace.ar.drawing.adapter.HomeFragmentAdapter;
|
import com.trace.ar.drawing.adapter.HomeFragmentAdapter;
|
||||||
import com.trace.ar.drawing.databinding.FragmentMainBinding;
|
import com.trace.ar.drawing.databinding.FragmentMainBinding;
|
||||||
import com.trace.ar.drawing.listener.onClickListener;
|
import com.trace.ar.drawing.listener.onClickListener;
|
||||||
|
import com.trace.ar.drawing.topon.AdManager;
|
||||||
|
import com.trace.ar.drawing.topon.onActionListener;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment implements onClickListener {
|
public class HomeFragment extends Fragment implements onClickListener {
|
||||||
private static final String ARG_PARAM1 = "param1";
|
private static final String ARG_PARAM1 = "param1";
|
||||||
@ -51,41 +53,57 @@ public class HomeFragment extends Fragment implements onClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initClick() {
|
||||||
private void initClick(){
|
|
||||||
binding.bannerGallery.setOnClickListener(new View.OnClickListener() {
|
binding.bannerGallery.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(requireContext(), GalleryActivity.class);
|
AdManager.showTopOn(requireActivity(), new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
Intent intent = new Intent(requireContext(), GalleryActivity.class);
|
||||||
// intent.putExtra(ARApp.Key_Camera, name);
|
// intent.putExtra(ARApp.Key_Camera, name);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.bannerCamera.setOnClickListener(new View.OnClickListener() {
|
binding.bannerCamera.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(requireContext(), DetailActivity.class);
|
|
||||||
|
AdManager.showTopOn(requireActivity(), new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
Intent intent = new Intent(requireContext(), DetailActivity.class);
|
||||||
// intent.putExtra(ARApp.Key_Camera, name);
|
// intent.putExtra(ARApp.Key_Camera, name);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClickItem(boolean viewAll,String dir) {
|
public void onClickItem(boolean viewAll, String dir) {
|
||||||
|
|
||||||
Intent intent;
|
|
||||||
if(viewAll){
|
|
||||||
intent = new Intent(requireContext(), ViewAllActivity.class);
|
|
||||||
intent.putExtra(ARApp.Key_ViewDir, dir);
|
|
||||||
}else {
|
|
||||||
intent = new Intent(requireContext(), DetailActivity.class);
|
|
||||||
intent.putExtra(ARApp.Key_Camera,dir);
|
|
||||||
intent.putExtra(ARApp.Key_ISMAIN,true);
|
|
||||||
}
|
|
||||||
startActivity(intent);
|
|
||||||
|
|
||||||
|
AdManager.showTopOn(getActivity(), new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
|
Intent intent;
|
||||||
|
if (viewAll) {
|
||||||
|
intent = new Intent(requireContext(), ViewAllActivity.class);
|
||||||
|
intent.putExtra(ARApp.Key_ViewDir, dir);
|
||||||
|
} else {
|
||||||
|
intent = new Intent(requireContext(), DetailActivity.class);
|
||||||
|
intent.putExtra(ARApp.Key_Camera, dir);
|
||||||
|
intent.putExtra(ARApp.Key_ISMAIN, true);
|
||||||
|
}
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// String place;
|
// String place;
|
||||||
|
|||||||
10
app/src/main/java/com/trace/ar/drawing/topon/AdListener.java
Normal file
10
app/src/main/java/com/trace/ar/drawing/topon/AdListener.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.trace.ar.drawing.topon;
|
||||||
|
|
||||||
|
public interface AdListener {
|
||||||
|
void loadFail(String placeId);
|
||||||
|
void showSuccess();
|
||||||
|
|
||||||
|
void showFail();
|
||||||
|
|
||||||
|
void showClose();
|
||||||
|
}
|
||||||
250
app/src/main/java/com/trace/ar/drawing/topon/AdManager.java
Normal file
250
app/src/main/java/com/trace/ar/drawing/topon/AdManager.java
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
package com.trace.ar.drawing.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.trace.ar.drawing.ARApp;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
ARDraw_Inter_3
|
||||||
|
n674b1f5b7e8cf
|
||||||
|
ARDraw_Inter_2
|
||||||
|
n674b1f5b12cd3
|
||||||
|
ARDraw_Inter_1
|
||||||
|
n674b1f5a9efd2
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static final String place1Id = "n674b1f5a9efd2";
|
||||||
|
private static final String place2Id = "n674b1f5b12cd3";
|
||||||
|
private static final String place3Id = "n674b1f5b7e8cf";
|
||||||
|
|
||||||
|
|
||||||
|
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.isEmpty()) {
|
||||||
|
ATInterstitial mInterstitialAd1 = new ATInterstitial(ARApp.context, place1Id);
|
||||||
|
ATInterstitial mInterstitialAd2 = new ATInterstitial(ARApp.context, place2Id);
|
||||||
|
ATInterstitial mInterstitialAd3 = new ATInterstitial(ARApp.context, 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(ARApp.TAG, "-has Cache------------");
|
||||||
|
return ad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.d(ARApp.TAG, "-No Cache------------");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setCallBack(ATInterstitial ad, AdListener listener) {
|
||||||
|
ad.setAdListener(new ATInterstitialListener() {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInterstitialAdLoaded() {
|
||||||
|
Log.d(ARApp.TAG, "LoadLoaded " + ad.mPlacementId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInterstitialAdLoadFail(AdError adError) {
|
||||||
|
listener.loadFail(ad.mPlacementId);
|
||||||
|
Log.d(ARApp.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||||
|
Log.d(ARApp.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 void setAlreadyShow() {
|
||||||
|
alreadyShow = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static CountDownTimer showWelcomeAd(
|
||||||
|
Activity activity,
|
||||||
|
Long totalTim,
|
||||||
|
CountAction countAction,
|
||||||
|
GoMainAction goMain
|
||||||
|
) {
|
||||||
|
|
||||||
|
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.trace.ar.drawing.topon;
|
||||||
|
|
||||||
|
public interface AdStatusAction {
|
||||||
|
void onStatus(int adType);
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.trace.ar.drawing.topon;
|
||||||
|
|
||||||
|
public interface CountAction {
|
||||||
|
void onCount(long millisUntilFinished);
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.trace.ar.drawing.topon;
|
||||||
|
|
||||||
|
public interface GoMainAction {
|
||||||
|
void onGo();
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.trace.ar.drawing.topon;
|
||||||
|
|
||||||
|
public interface onActionListener {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
@ -8,39 +8,39 @@
|
|||||||
tools:context=".activity.MySplashActivity">
|
tools:context=".activity.MySplashActivity">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
android:layout_width="126dp"
|
android:layout_width="126dp"
|
||||||
android:layout_height="126dp"
|
android:layout_height="126dp"
|
||||||
android:layout_marginTop="186dp"
|
android:layout_marginTop="186dp"
|
||||||
android:src="@mipmap/logo"
|
android:src="@mipmap/logo"
|
||||||
android:id="@+id/image"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<com.trace.ar.drawing.helper.MyTV
|
<com.trace.ar.drawing.helper.MyTV
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:textSize="24sp"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toBottomOf="@id/image"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
app:apply_font="true"
|
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:layout_height="wrap_content"/>
|
android:textSize="24sp"
|
||||||
|
app:apply_font="true"
|
||||||
<ProgressBar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_marginStart="25dp"
|
|
||||||
android:layout_marginEnd="25dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/image" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loading_pb"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="7dp"
|
||||||
|
android:layout_marginStart="25dp"
|
||||||
|
android:layout_marginEnd="25dp"
|
||||||
android:layout_marginBottom="60dp"
|
android:layout_marginBottom="60dp"
|
||||||
android:progress="100"
|
android:progress="100"
|
||||||
android:id="@+id/loading_pb"
|
|
||||||
android:progressDrawable="@drawable/welocm_pb"
|
android:progressDrawable="@drawable/welocm_pb"
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_height="7dp"/>
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx24096m -Dfile.encoding=UTF-8
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# 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
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
|||||||
@ -16,6 +16,28 @@ dependencyResolutionManagement {
|
|||||||
// maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
|
// maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
|
||||||
// maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
// maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
|
||||||
|
|
||||||
|
//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")
|
||||||
|
|
||||||
|
//TopOn集成测试工具
|
||||||
|
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user