接TopOn V1.0.1(2)
This commit is contained in:
parent
65a0d83ce2
commit
e4c1cfdf10
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,3 +16,5 @@ local.properties
|
||||
.idea/
|
||||
app/release/simplekeyboard_V1.0.0(1)_07_05_14_08-release.aab
|
||||
app/release/simplekeyboard_V1.0.0(1)_07_05_14_06-release.apk
|
||||
app/release/simplekeyboard_V1.0.0(1)_08_01_14_24-release.apk
|
||||
app/release/simplekeyboard_V1.0.1(2)_08_01_14_47-release.aab
|
||||
|
||||
@ -4,6 +4,8 @@ plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id ("kotlin-kapt")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -14,8 +16,8 @@ android {
|
||||
applicationId = "com.key.simplekeyboard"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "simplekeyboard_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -52,13 +54,68 @@ dependencies {
|
||||
implementation("androidx.room:room-runtime:$room_version")
|
||||
annotationProcessor("androidx.room:room-compiler:$room_version")
|
||||
kapt("androidx.room:room-compiler:$room_version")
|
||||
implementation("androidx.room:room-ktx:$room_version")
|
||||
implementation("androidx.room:room-rxjava2:$room_version")
|
||||
implementation("androidx.room:room-rxjava3:$room_version")
|
||||
implementation("androidx.room:room-guava:$room_version")
|
||||
testImplementation("androidx.room:room-testing:$room_version")
|
||||
implementation("androidx.room:room-paging:$room_version")
|
||||
|
||||
implementation ("io.github.youth5201314:banner:2.2.3")
|
||||
|
||||
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
|
||||
implementation("com.google.firebase:firebase-analytics-ktx")
|
||||
implementation("com.google.firebase:firebase-crashlytics-ktx")
|
||||
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
|
||||
//Anythink (Necessary)
|
||||
implementation("com.anythink.sdk:core-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:nativead-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:banner-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
|
||||
implementation("com.anythink.sdk:splash-tpn:6.3.68")
|
||||
|
||||
//Androidx (Necessary)
|
||||
implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
implementation("androidx.browser:browser:1.4.0")
|
||||
|
||||
//Vungle
|
||||
implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
|
||||
implementation("com.vungle:vungle-ads:7.3.2")
|
||||
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.3.68")
|
||||
implementation("com.unity3d.ads:unity-ads:4.9.3")
|
||||
|
||||
//Ironsource
|
||||
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68")
|
||||
implementation("com.ironsource.sdk:mediationsdk:8.1.0")
|
||||
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.3.68")
|
||||
implementation("com.bigossp:bigo-ads:4.7.4")
|
||||
|
||||
//Pangle
|
||||
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
|
||||
implementation("com.pangle.global:ads-sdk:6.0.0.3")
|
||||
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
|
||||
//Mintegral
|
||||
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")
|
||||
implementation("com.mbridge.msdk.oversea:reward:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnative:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
|
||||
implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
|
||||
implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
|
||||
//Tramini
|
||||
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
|
||||
|
||||
// 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": "75253434102",
|
||||
"project_id": "simple-keyboard-f5b7b",
|
||||
"storage_bucket": "simple-keyboard-f5b7b.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:75253434102:android:aca5f5e69614a703994ed7",
|
||||
"android_client_info": {
|
||||
"package_name": "com.key.simplekeyboard"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCVnAUNqGFDCEN2LUeeBCGLtoB_AgJJNig"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
92
app/proguard-rules.pro
vendored
92
app/proguard-rules.pro
vendored
@ -32,3 +32,95 @@
|
||||
-keep class com.key.simplekeyboard.data.Otherdata { *; }
|
||||
-keep class com.omicronapplications.** { *; }
|
||||
-keep class net.sf.sevenzipjbinding.** { *; }
|
||||
|
||||
#---------------------------------------------Topon
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers 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.** { *; }
|
||||
-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.*{ *; }
|
||||
#---------------------------------------------Topon
|
||||
@ -4,7 +4,7 @@
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.key.simplekeyboard.test",
|
||||
"applicationId": "com.key.simplekeyboard",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
@ -13,7 +13,7 @@
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "1.0.0",
|
||||
"outputFile": "simplekeyboard_V1.0.0(1)_07_05_14_06-release.apk"
|
||||
"outputFile": "simplekeyboard_V1.0.0(1)_08_01_14_24-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
package com.key.simplekeyboard;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.key.simplekeyboard.data.Mydata;
|
||||
import com.key.simplekeyboard.data.MydataBase;
|
||||
import com.key.simplekeyboard.data.Otherdata;
|
||||
@ -37,12 +42,38 @@ public class SimpleKeyboardSkins extends Application {
|
||||
private static boolean isinsert;
|
||||
private static final String PREFS_NAME = "MyPrefs";
|
||||
private static final String KEY_IS_INSERTED = "isinserted";
|
||||
private static final String TOP_ID = "h66ab2087ca5f6";
|
||||
private static final String TOP_KEY = "abd49d8b0a0203888f56dd3c9b35201d3";
|
||||
private static final String TOP_DEBUG = "04e8ce6db9751f67501af2bfed0cd0de0391453a";
|
||||
public static List<ATInterstitial> ads;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
context = getApplicationContext();
|
||||
|
||||
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onResultCallback(boolean isEU) {
|
||||
Log.e(TAG, "onResultCallback:" + isEU);
|
||||
if (isEU && ATSDK.getGDPRDataLevel(context) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorCallback(String errorMsg) {
|
||||
Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||
}
|
||||
});
|
||||
|
||||
initSdk();
|
||||
|
||||
|
||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
isinsert = prefs.getBoolean(KEY_IS_INSERTED, false);
|
||||
List<Mydata> myData = Mytools.parseJsonToList("keyboard.json");
|
||||
@ -63,6 +94,20 @@ public class SimpleKeyboardSkins extends Application {
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initSdk() {
|
||||
// ATSDK.integrationChecking(context);
|
||||
|
||||
ATSDK.init(context, TOP_ID, TOP_KEY);
|
||||
|
||||
ads = Mytools.getAllAd();
|
||||
// ATSDK.setNetworkLogDebug(true);
|
||||
// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG);
|
||||
}
|
||||
public static List<ATInterstitial> lodAd() {
|
||||
|
||||
return ads;
|
||||
}
|
||||
|
||||
|
||||
public static Context getContext() {
|
||||
return context;
|
||||
|
||||
@ -20,14 +20,19 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.key.simplekeyboard.R;
|
||||
|
||||
import com.key.simplekeyboard.SimpleKeyboardSkins;
|
||||
import com.key.simplekeyboard.adapter.PageAdapter;
|
||||
import com.key.simplekeyboard.data.MydataBase;
|
||||
import com.key.simplekeyboard.data.Otherdata;
|
||||
import com.key.simplekeyboard.fragment.AllFragment;
|
||||
import com.key.simplekeyboard.fragment.LikeFragment;
|
||||
import com.key.simplekeyboard.tools.AdActionListener;
|
||||
import com.key.simplekeyboard.tools.Adcallback;
|
||||
import com.key.simplekeyboard.tools.Mytools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -44,6 +49,7 @@ public class AllActivity extends AppCompatActivity {
|
||||
private List<Fragment> list = new ArrayList<>();
|
||||
private TypedArray imageArray;
|
||||
private PageAdapter adapter;
|
||||
private List<ATInterstitial> ads;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
@ -56,6 +62,10 @@ public class AllActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
ads = SimpleKeyboardSkins.lodAd();
|
||||
|
||||
|
||||
adapter = new PageAdapter(getSupportFragmentManager(), list);
|
||||
initView();
|
||||
|
||||
@ -102,6 +112,26 @@ public class AllActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
private void showAd(AdActionListener listener) {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
listener.onAction();
|
||||
} else {
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
listener.onAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
listener.onAction();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTabIcons(int position) {
|
||||
for (int i = 0; i < tabLayout.getTabCount(); i++) {
|
||||
TabLayout.Tab tab = tabLayout.getTabAt(i);
|
||||
@ -129,7 +159,12 @@ public class AllActivity extends AppCompatActivity {
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
showAd(new AdActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -147,6 +182,16 @@ public class AllActivity extends AppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
showAd(new AdActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
||||
@ -23,6 +23,8 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
@ -32,6 +34,8 @@ import com.key.simplekeyboard.adapter.ThumAdapter;
|
||||
import com.key.simplekeyboard.data.MydataBase;
|
||||
import com.key.simplekeyboard.data.Otherdata;
|
||||
import com.key.simplekeyboard.fragment.MainFragment;
|
||||
import com.key.simplekeyboard.tools.AdActionListener;
|
||||
import com.key.simplekeyboard.tools.Adcallback;
|
||||
import com.key.simplekeyboard.tools.Mytools;
|
||||
import com.key.simplekeyboard.tools.SpaceItem;
|
||||
import com.key.simplekeyboard.tools.StaticValue;
|
||||
@ -51,6 +55,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
private final Boolean[] islike = {false};
|
||||
private Otherdata otherdata;
|
||||
private List<Otherdata> prerandomlist = new ArrayList<>();
|
||||
private List<ATInterstitial> ads;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -63,6 +68,8 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
return insets;
|
||||
});
|
||||
|
||||
ads = SimpleKeyboardSkins.lodAd();
|
||||
|
||||
intView();
|
||||
|
||||
List<Otherdata> othList = MainFragment.generateRandomOtherdata(0, 10);
|
||||
@ -117,6 +124,26 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
intEvent();
|
||||
}
|
||||
|
||||
private void showAd(AdActionListener listener) {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
listener.onAction();
|
||||
} else {
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
listener.onAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
listener.onAction();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void intEvent() {
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -158,9 +185,15 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
Mytools.unZip(this, unzipPath, resource, (successful1, resDirPath) -> {
|
||||
if (successful1) {
|
||||
StaticValue.PATH = resDirPath;
|
||||
Toast.makeText(PreviewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show();
|
||||
downpg.setVisibility(View.GONE);
|
||||
finish();
|
||||
showAd(new AdActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
Toast.makeText(PreviewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show();
|
||||
downpg.setVisibility(View.GONE);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
Toast.makeText(PreviewActivity.this, getString(R.string.text_zip_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -214,9 +247,4 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
preimg.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
Log.e("zzj","1111111111111111");
|
||||
}
|
||||
}
|
||||
@ -10,10 +10,22 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
import com.anythink.interstitial.api.ATInterstitial;
|
||||
import com.key.simplekeyboard.R;
|
||||
import com.key.simplekeyboard.SimpleKeyboardSkins;
|
||||
import com.key.simplekeyboard.tools.Adcallback;
|
||||
import com.key.simplekeyboard.tools.CustomProgressBar;
|
||||
import com.key.simplekeyboard.tools.Mytools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private CountDownTimer countDownTimer;
|
||||
private List<ATInterstitial> ads;
|
||||
|
||||
private boolean isAlreadyShow = false;
|
||||
private float i = 0;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
@ -25,21 +37,62 @@ public class SplashActivity extends AppCompatActivity {
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
countDownTimer = new CountDownTimer(1000, 100) {
|
||||
ads = SimpleKeyboardSkins.lodAd();
|
||||
|
||||
CustomProgressBar customProgressBar = findViewById(R.id.splash_pg);
|
||||
|
||||
countDownTimer = new CountDownTimer(10100, 100) {
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
|
||||
i++;
|
||||
customProgressBar.setProgress(i);
|
||||
if (!isAlreadyShow) {
|
||||
showAd(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
starMainactivity();
|
||||
if (!isAlreadyShow) {
|
||||
showAd(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
|
||||
}
|
||||
|
||||
private void showAd(boolean go) {
|
||||
ATInterstitial mInterstitialAd = Mytools.onCache(ads);
|
||||
if (mInterstitialAd == null) {
|
||||
isAlreadyShow = false;
|
||||
if (go) {
|
||||
starMainactivity();
|
||||
}
|
||||
} else {
|
||||
isAlreadyShow = true;
|
||||
Mytools.setCallback(mInterstitialAd, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
starMainactivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
isAlreadyShow = true;
|
||||
starMainactivity();
|
||||
}
|
||||
});
|
||||
mInterstitialAd.show(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void starMainactivity() {
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
package com.key.simplekeyboard.tools;
|
||||
|
||||
public interface AdActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.key.simplekeyboard.tools;
|
||||
|
||||
|
||||
import com.anythink.core.api.AdError;
|
||||
|
||||
public interface Adcallback {
|
||||
void onShowFail(AdError ad);
|
||||
void onAdHidden( );
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.key.simplekeyboard.tools
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
|
||||
class CustomProgressBar(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||
private var progress = 0f // 当前进度
|
||||
private val maxProgress = 100f // 最大进度
|
||||
private val progressBarHeight = 20f // 进度条高度
|
||||
private val cornerRadius = 10f // 圆角半径
|
||||
private val backgroundColor = Color.parseColor("#26FFFFFF")
|
||||
private val startColor = Color.parseColor("#FF9ce8ff") // 起始颜色
|
||||
private val middleColor = Color.parseColor("#FFa4c4fb") // 中间颜色
|
||||
private val endColor = Color.parseColor("#FFbfa4ee") // 结束颜色
|
||||
private val paint = Paint()
|
||||
private val paintTow = Paint()
|
||||
|
||||
init {
|
||||
paint.style = Paint.Style.FILL
|
||||
paint.isAntiAlias = true
|
||||
paintTow.style = Paint.Style.FILL
|
||||
paintTow.isAntiAlias = true
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
// 绘制底色矩形
|
||||
paint.shader = null // 重置着色器
|
||||
paint.color = backgroundColor
|
||||
val backgroundRect = RectF(0f, (height / 2 - progressBarHeight / 2), width.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(backgroundRect, cornerRadius, cornerRadius, paint)
|
||||
|
||||
|
||||
// 计算进度条的宽度
|
||||
val progressBarWidth = (width * progress / maxProgress)
|
||||
|
||||
// 创建颜色渐变对象
|
||||
val gradient = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(startColor, middleColor, endColor), null, Shader.TileMode.CLAMP)
|
||||
paintTow.shader = gradient
|
||||
|
||||
// 绘制带圆角的进度条矩形
|
||||
val rect = RectF(0f, (height / 2 - progressBarHeight / 2), progressBarWidth.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paintTow)
|
||||
}
|
||||
|
||||
fun getProgress():Float{
|
||||
return progress
|
||||
}
|
||||
|
||||
// 设置进度
|
||||
fun setProgress(progress: Float) {
|
||||
this.progress = progress
|
||||
invalidate() // 请求重绘
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -14,6 +15,10 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
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.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
@ -49,6 +54,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -56,12 +62,101 @@ import java.util.concurrent.Executors;
|
||||
public class Mytools {
|
||||
|
||||
private static InputMethodManager methodManager = (InputMethodManager) SimpleKeyboardSkins.app.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
private static final String one_AD = "37dcb994d4988394";
|
||||
private static final String two_Ad = "a77c5657a94cbb64";
|
||||
private static final String three_ad = "b3a3acdefa7117ff";
|
||||
private static ExecutorService executorService;
|
||||
|
||||
private static final String one_AD = "n66ab20d96dc7a";
|
||||
private static final String two_Ad = "n66ab20d92323b";
|
||||
private static final String three_ad = "n66ab20d8c5d7e";
|
||||
private static ArrayList<ATInterstitial> adArrayList;
|
||||
|
||||
|
||||
public static void setCallback(ATInterstitial ad, Adcallback adcallback) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoaded--------" + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoadFail--------" + adError.getFullErrorInfo());
|
||||
adcallback.onShowFail(adError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
ad.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
|
||||
adcallback.onAdHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoError(AdError adError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ATInterstitial onCache(List<ATInterstitial> list) {
|
||||
Collections.shuffle(list);
|
||||
for (ATInterstitial ad : list) {
|
||||
if (ad.isAdReady()) {
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<ATInterstitial> getAllAd() {
|
||||
if (adArrayList == null) {
|
||||
adArrayList = new ArrayList<>();
|
||||
adArrayList.add(createAd(one_AD, SimpleKeyboardSkins.getContext()));
|
||||
adArrayList.add(createAd(two_Ad, SimpleKeyboardSkins.getContext()));
|
||||
adArrayList.add(createAd(three_ad, SimpleKeyboardSkins.getContext()));
|
||||
}
|
||||
for (ATInterstitial ad : adArrayList) {
|
||||
if (!ad.isAdReady()) {
|
||||
setCallback(ad, new Adcallback() {
|
||||
@Override
|
||||
public void onShowFail(AdError ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.load();
|
||||
}
|
||||
}
|
||||
return adArrayList;
|
||||
}
|
||||
|
||||
private static ATInterstitial createAd(String adUnitId, Context context) {
|
||||
ATInterstitial ad = new ATInterstitial(context, adUnitId);
|
||||
return ad;
|
||||
}
|
||||
|
||||
|
||||
public static void runIO(Runnable task) {
|
||||
getExecutorService().execute(task);
|
||||
}
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/splash_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/splash_activity"
|
||||
tools:context=".activity.SplashActivity">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="70dp"
|
||||
@ -35,11 +36,13 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/logo" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
<com.key.simplekeyboard.tools.CustomProgressBar
|
||||
android:id="@+id/splash_pg"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -2,4 +2,6 @@
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
id("com.google.gms.google-services") version "4.3.15" apply false
|
||||
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||
}
|
||||
@ -11,6 +11,18 @@ dependencyResolutionManagement {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven("https://jitpack.io")
|
||||
maven("https://jitpack.io")
|
||||
//Anythink(Core)
|
||||
maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
|
||||
//Ironsource
|
||||
maven("https://android-sdk.is.com/")
|
||||
//Mintegral
|
||||
maven("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||
//Pangle
|
||||
maven("https://artifact.bytedance.com/repository/pangle")
|
||||
|
||||
//TopOn集成测试工具
|
||||
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user