V1.0.2(3)接入topon和firebase
This commit is contained in:
parent
bf9cebc7fb
commit
1dc5e0ec00
@ -4,6 +4,8 @@ import java.util.Date
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
@ -14,8 +16,8 @@ android {
|
||||
applicationId = "com.finger.keyboard.selection"
|
||||
minSdk =23
|
||||
targetSdk = 34
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
versionCode = 3
|
||||
versionName = "1.0.2"
|
||||
setProperty("archivesBaseName", "Finger Keyboard_" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -59,4 +61,104 @@ dependencies {
|
||||
|
||||
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
||||
implementation ("com.google.code.gson:gson:2.10.1")
|
||||
|
||||
// Import the BoM for the Firebase platform
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.7.0"))
|
||||
|
||||
// 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": "412615406459",
|
||||
"project_id": "finger-keyboard",
|
||||
"storage_bucket": "finger-keyboard.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:412615406459:android:fe4eb46165e3388c21c3de",
|
||||
"android_client_info": {
|
||||
"package_name": "com.finger.keyboard.selection"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDIulCOsT-SCSt-jYvdvit1amr-QT8rE88"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
131
app/proguard-rules.pro
vendored
131
app/proguard-rules.pro
vendored
@ -25,4 +25,133 @@
|
||||
-keep class * extends com.google.gson.reflect.TypeToken
|
||||
|
||||
-keep class com.example.fingerkeyboard.data.MyData { *; }
|
||||
-keep class com.example.fingerkeyboard.data.ListName { *; }
|
||||
-keep class com.example.fingerkeyboard.data.ListName { *; }
|
||||
|
||||
#---------------------------------------------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
|
||||
@ -5,7 +5,7 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:name=".KeyBoard"
|
||||
android:name=".KeyBoardApplication"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
||||
@ -3,42 +3,49 @@ package com.example.fingerkeyboard;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.example.fingerkeyboard.R;
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.example.fingerkeyboard.topon.AdManager;
|
||||
|
||||
public class HomeActivity extends AppCompatActivity {
|
||||
private CountDownTimer countDownTimer;
|
||||
private static final long TOTAL_TIME = 11000;
|
||||
private ProgressBar progress;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home);
|
||||
countDownTimer = new CountDownTimer(1000,500) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
}
|
||||
progress = findViewById(R.id.progress);
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
Intent intent = new Intent(HomeActivity.this,MainActivity.class);
|
||||
startActivity(intent);
|
||||
finishAffinity();
|
||||
}
|
||||
};
|
||||
goCount();
|
||||
AdManager.loadAllAd();
|
||||
AdManager.setAlreadyShow();
|
||||
|
||||
countDownTimer = AdManager.showWelcomeAd(this, TOTAL_TIME, millisUntilFinished -> {
|
||||
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
||||
progress.setProgress(percentage);
|
||||
},
|
||||
this::goCount
|
||||
);
|
||||
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
public void goCount(){countDownTimer.start();}
|
||||
public void goCount() {
|
||||
progress.setProgress(100);
|
||||
Intent intent = new Intent(HomeActivity.this,MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
package com.example.fingerkeyboard;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.example.fingerkeyboard.data.ListName;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class KeyBoard extends Application {
|
||||
public static KeyBoard app;
|
||||
public static List<ListName> listNames;
|
||||
private boolean isinit = false;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
try {
|
||||
InputStream open = getAssets().open("keyboard.json");
|
||||
String covertStr = Readfile.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
Gson gson = new Gson();
|
||||
listNames = gson.fromJson(covertStr, new TypeToken<List<ListName>>() {
|
||||
}.getType());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public static List<ListName> getuserList() {
|
||||
|
||||
if(listNames != null){
|
||||
return listNames;
|
||||
}
|
||||
return listNames;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.example.fingerkeyboard;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.anythink.core.api.ATSDK;
|
||||
import com.anythink.core.api.NetTrafficeCallback;
|
||||
import com.example.fingerkeyboard.data.ListName;
|
||||
import com.example.fingerkeyboard.topon.AdManager;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class KeyBoardApplication extends Application {
|
||||
public static KeyBoardApplication app;
|
||||
public static List<ListName> listNames;
|
||||
private boolean isinit = false;
|
||||
|
||||
public static final String TAG = "--------------";
|
||||
|
||||
private static final String AppKey = "ae0b6031e079e9d7ff568ff43efa8cdc0";
|
||||
private static final String APPId = "h6791d71a1a203";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
app = this;
|
||||
|
||||
// //确保Firebase初始化
|
||||
// FirebaseApp.initializeApp(this);
|
||||
//
|
||||
// // 输出日志以确认Firebase初始化
|
||||
// if (!FirebaseApp.getApps(this).isEmpty()) {
|
||||
// Log.d(TAG, "Firebase 初始化成功1");
|
||||
// } else {
|
||||
// Log.e(TAG, "Firebase 初始化失败0");
|
||||
// }
|
||||
|
||||
initSdk();
|
||||
|
||||
try {
|
||||
InputStream open = getAssets().open("keyboard.json");
|
||||
String covertStr = Readfile.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
Gson gson = new Gson();
|
||||
listNames = gson.fromJson(covertStr, new TypeToken<List<ListName>>() {
|
||||
}.getType());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public static List<ListName> getuserList() {
|
||||
|
||||
if(listNames != null){
|
||||
return listNames;
|
||||
}
|
||||
return listNames;
|
||||
}
|
||||
private void initSdk() {
|
||||
|
||||
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
|
||||
@Override
|
||||
public void onResultCallback(boolean isEU) {
|
||||
Log.e(TAG, "onResultCallback:" + isEU);
|
||||
if (isEU && ATSDK.getGDPRDataLevel(KeyBoardApplication.this) == ATSDK.UNKNOWN) {
|
||||
ATSDK.showGdprAuth(KeyBoardApplication.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);
|
||||
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return app.getApplicationContext();
|
||||
}
|
||||
}
|
||||
@ -25,6 +25,7 @@ import com.example.fingerkeyboard.fragment.GravityFragment;
|
||||
import com.example.fingerkeyboard.fragment.LoveFragment;
|
||||
import com.example.fingerkeyboard.fragment.NeonFragment;
|
||||
import com.example.fingerkeyboard.fragment.SuperFragment;
|
||||
import com.example.fingerkeyboard.topon.AdManager;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
|
||||
@ -42,8 +43,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
|
||||
private AestheticFragment aestheticfragment;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -54,6 +53,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||
}
|
||||
|
||||
private void initfindview(){
|
||||
AdManager.loadAllAd();
|
||||
|
||||
btn_love = (Button) findViewById(R.id.btn_love);
|
||||
btn_love.setSelected(true);
|
||||
btn_festival = (Button) findViewById(R.id.btn_festival);
|
||||
|
||||
@ -27,7 +27,10 @@ import com.bumptech.glide.request.target.Target;
|
||||
import com.example.fingerkeyboard.tool.MyTools;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.topon.AdManager;
|
||||
import com.example.fingerkeyboard.topon.onActionListener;
|
||||
|
||||
public class PreviewActivity extends AppCompatActivity {
|
||||
private ImageView imageViewBack;
|
||||
@ -54,7 +57,16 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
onGetData(); //获取数据
|
||||
|
||||
}
|
||||
public void initView(){
|
||||
|
||||
public void initView() {
|
||||
AdManager.loadAllAd();
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
imageViewBack = findViewById(R.id.image_view_back_id);
|
||||
imageViewPreview = findViewById(R.id.image_view_preview_id);
|
||||
textViewName = findViewById(R.id.text_view_name_id);
|
||||
@ -64,7 +76,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
//获取数据
|
||||
public void onGetData(){
|
||||
public void onGetData() {
|
||||
Intent intent = getIntent();
|
||||
name = intent.getStringExtra(KEY_NAME);
|
||||
url = intent.getStringExtra(KEY_URL);
|
||||
@ -87,23 +99,33 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
File cacheDir = this.getCacheDir();
|
||||
unzipPath = cacheDir + "/" + name;
|
||||
|
||||
Log.d("--------------------","----------name+"+name);
|
||||
Log.d("--------------------", "----------name+" + name);
|
||||
setListener();
|
||||
}
|
||||
|
||||
//点击事件
|
||||
private void setListener(){
|
||||
private void setListener() {
|
||||
linearLayoutDown.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setAction();
|
||||
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
setAction();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
imageViewBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d("--------------------","----------finish");
|
||||
finish();
|
||||
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
Log.d("--------------------", "----------finish");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -112,7 +134,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
public void onBackPressed() {
|
||||
//按下返回键,实现日志打印
|
||||
super.onBackPressed();
|
||||
Log.d("-------","--------onBackPressed ");
|
||||
Log.d("-------", "--------onBackPressed ");
|
||||
}
|
||||
|
||||
private void setAction() {
|
||||
@ -124,7 +146,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
.setPositiveButton("yes", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Intent intent = new Intent(PreviewActivity.this,SettingActivity.class);
|
||||
Intent intent = new Intent(PreviewActivity.this, SettingActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
})
|
||||
@ -145,7 +167,7 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
private void goApply() {
|
||||
progressBarDownload.setVisibility(View.VISIBLE);
|
||||
String skinPathByName = MyTools.getSkinPathByName(name);
|
||||
Log.d("----skinPathByName","------skinPathByName+"+skinPathByName);
|
||||
Log.d("----skinPathByName", "------skinPathByName+" + skinPathByName);
|
||||
if (!skinPathByName.isEmpty()) {
|
||||
setCurrentKeyboardSkin(skinPathByName);
|
||||
progressBarDownload.setVisibility(View.GONE);
|
||||
@ -179,8 +201,8 @@ public class PreviewActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void setCurrentKeyboardSkin(String resDirPath) {
|
||||
Log.d("---","----path"+resDirPath);
|
||||
private void setCurrentKeyboardSkin(String resDirPath) {
|
||||
Log.d("---", "----path" + resDirPath);
|
||||
MyTools.saveSkin(resDirPath);
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@ import com.example.fingerkeyboard.R;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.fingerkeyboard.tool.MyTools;
|
||||
import com.example.fingerkeyboard.topon.AdManager;
|
||||
import com.example.fingerkeyboard.topon.onActionListener;
|
||||
|
||||
|
||||
public class SettingActivity extends AppCompatActivity {
|
||||
@ -41,6 +43,14 @@ public class SettingActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void initView(){
|
||||
AdManager.loadAllAd();
|
||||
AdManager.showTopOn(this, new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
imageViewBack = findViewById(R.id.image_view_back_id);
|
||||
textViewStep1 = findViewById(R.id.textview_step1);
|
||||
textViewStep2 = findViewById(R.id.textview_step2);
|
||||
|
||||
@ -10,7 +10,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -27,7 +27,7 @@ public class AestheticFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_festival, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(6).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(6).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -10,7 +10,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -27,7 +27,7 @@ public class CoolFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_gravity, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(5).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(5).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -11,7 +11,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -31,7 +31,7 @@ public class CuteFragment extends Fragment {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_cute, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(2).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(2).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -11,7 +11,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -30,7 +30,7 @@ public class FestivalFragment extends Fragment {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_festival, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(1).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(1).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -11,7 +11,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -31,7 +31,7 @@ public class GravityFragment extends Fragment {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_gravity, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(3).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(3).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -10,7 +10,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -27,7 +27,7 @@ public class LoveFragment extends Fragment {
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.fragment_love, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(0).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(0).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -10,7 +10,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -27,7 +27,7 @@ public class NeonFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_festival, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(4).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(4).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -10,7 +10,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
import com.example.fingerkeyboard.adapter.ThumbAdapter;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
@ -27,7 +27,7 @@ public class SuperFragment extends Fragment {
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_festival, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_id);
|
||||
List<MyData> list = KeyBoard.getuserList().get(7).getList();
|
||||
List<MyData> list = KeyBoardApplication.getuserList().get(7).getList();
|
||||
recyclerView.setAdapter(new ThumbAdapter(getActivity(), list));
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
|
||||
recyclerView.addItemDecoration(new SpaceItem(MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity()),MyTools.dpToPx(10,getActivity())));
|
||||
|
||||
@ -11,7 +11,7 @@ import android.util.Xml;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
@ -23,38 +23,18 @@ import java.io.StringReader;
|
||||
import java.util.Objects;
|
||||
|
||||
public class CustomViewConfig {
|
||||
private String Bg_action_normal = "btn_keyboard_key_functional_normal.9.png";
|
||||
private String jpg_BG = "keyboard_background.jpg";
|
||||
|
||||
private String jpg_BG_new = "keyboard_background.png";
|
||||
private String color_normal_key = "key_text_color_normal";
|
||||
private String color_action_key = "key_text_color_functional";
|
||||
private String Bg_pressed = "btn_keyboard_key_normal_pressed.9.png";
|
||||
private String Bg_normal = "btn_keyboard_key_normal_normal.9.png";
|
||||
private String path_drawxh = "/drawable-xhdpi-v4/";
|
||||
private String path_drawxxh = "/drawable-xxhdpi-v4/";
|
||||
private String path_color = "/colors.xml";
|
||||
private String icon_del = "sym_keyboard_delete_normal.png";
|
||||
private String icon_shift = "sym_keyboard_shift.png";
|
||||
private String Bg_action_pressed = "btn_keyboard_key_functional_pressed.9.png";
|
||||
private String icon_shift_lock = "sym_keyboard_shift_locked.png";
|
||||
|
||||
private String Bg_space_normal = "btn_keyboard_spacekey_normal_normal.9.png";
|
||||
private String Bg_space_pressed = "btn_keyboard_spacekey_normal_pressed.9.png";
|
||||
|
||||
|
||||
private Drawable BgActionDraw;
|
||||
private Drawable BgSpaceDraw;
|
||||
private Drawable BgNormalDraw;
|
||||
private Drawable iconShift = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.ico_shift_lit);
|
||||
private Drawable iconDel = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.del_icon);
|
||||
private Drawable BG = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.de_keyboard_bg);
|
||||
private Drawable iconShift = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.ico_shift_lit);
|
||||
private Drawable iconDel = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.del_icon);
|
||||
private Drawable BG = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.de_keyboard_bg);
|
||||
|
||||
private int keyNoramlcolor = com.example.fingerkeyboard.KeyBoard.app.getResources().getColor(R.color.white, null);
|
||||
private int keyNoramlcolor = KeyBoardApplication.getContext().getResources().getColor(R.color.white, null);
|
||||
|
||||
private int keyActioncolor = com.example.fingerkeyboard.KeyBoard.app.getResources().getColor(R.color.white, null);
|
||||
private int keyActioncolor = KeyBoardApplication.getContext().getResources().getColor(R.color.white, null);
|
||||
|
||||
private Drawable iconShiftLock = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.ico_shift_lit);
|
||||
private Drawable iconShiftLock = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.ico_shift_lit);
|
||||
|
||||
public Drawable getBG() {return BG;}
|
||||
|
||||
@ -62,10 +42,6 @@ public class CustomViewConfig {
|
||||
return BgActionDraw;
|
||||
}
|
||||
|
||||
public Drawable getBgSpaceDraw() {
|
||||
return BgSpaceDraw;
|
||||
}
|
||||
|
||||
public Drawable getBgNormalDraw() {
|
||||
return BgNormalDraw;
|
||||
}
|
||||
@ -92,49 +68,50 @@ public class CustomViewConfig {
|
||||
|
||||
public void init(){
|
||||
|
||||
iconShift = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.ico_shift_lit);
|
||||
iconDel = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.del_icon);
|
||||
BG = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.de_keyboard_bg);
|
||||
iconShiftLock = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app, R.drawable.ico_shift_lit);
|
||||
iconShift = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.ico_shift_lit);
|
||||
iconDel = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.del_icon);
|
||||
BG = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.de_keyboard_bg);
|
||||
iconShiftLock = ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.ico_shift_lit);
|
||||
|
||||
keyNoramlcolor = com.example.fingerkeyboard.KeyBoard.app.getResources().getColor(R.color.white, null);
|
||||
|
||||
Drawable drawable1 = ContextCompat.getDrawable(com.example.fingerkeyboard.KeyBoard.app,R.mipmap.logo);
|
||||
Drawable drawable2 = ContextCompat.getDrawable(KeyBoard.app,R.mipmap.logo);
|
||||
keyNoramlcolor = KeyBoardApplication.getContext().getResources().getColor(R.color.white, null);
|
||||
|
||||
Drawable drawable1 = ContextCompat.getDrawable(KeyBoardApplication.getContext(),R.mipmap.logo);
|
||||
Drawable drawable2 = ContextCompat.getDrawable(KeyBoardApplication.app,R.mipmap.logo);
|
||||
|
||||
StateListDrawable state = MyTools.getStatus(drawable2,drawable1);//首先创建了一个StateListDrawable对象status。
|
||||
BgActionDraw = state;
|
||||
BgNormalDraw = state;
|
||||
BgSpaceDraw = state;
|
||||
}
|
||||
|
||||
//获取键盘未按下时背景
|
||||
private Drawable getKeyBackGround(Context context, String resDirPath, String drawName)
|
||||
{
|
||||
String filePath = resDirPath+path_drawxh+drawName; //文件路径
|
||||
String path_drawxh = "/drawable-xhdpi-v4/";
|
||||
String filePath = resDirPath+ path_drawxh +drawName; //文件路径
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
return bitmapDrawable;
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
}
|
||||
private Drawable getBackGround(Context context,String resDirPath)
|
||||
{
|
||||
String filePath = resDirPath+path_drawxxh+jpg_BG;
|
||||
String jpg_BG = "keyboard_background.jpg";
|
||||
String path_drawxxh = "/drawable-xxhdpi-v4/";
|
||||
String filePath = resDirPath+ path_drawxxh + jpg_BG;
|
||||
if (!new File(filePath).exists()) {
|
||||
filePath = resDirPath+path_drawxxh+jpg_BG_new;
|
||||
String jpg_BG_new = "keyboard_background.png";
|
||||
filePath = resDirPath+ path_drawxxh + jpg_BG_new;
|
||||
}
|
||||
|
||||
//BitmapDrawable 是对位图(Bitmap)的一种包装。它允许将一个 Bitmap 对象包装成一个可绘制的资源,以便在 Android 应用中使用
|
||||
BitmapDrawable bitmapDrawable = new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
return bitmapDrawable;
|
||||
return new BitmapDrawable(context.getResources(), BitmapFactory.decodeFile(filePath));
|
||||
}
|
||||
|
||||
private void updateKeyColor(String resDirPath) {
|
||||
|
||||
String colorXmlPath = resDirPath+path_color;
|
||||
String path_color = "/colors.xml";
|
||||
String colorXmlPath = resDirPath+ path_color;
|
||||
File file = new File(colorXmlPath);
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
@ -149,10 +126,12 @@ public class CustomViewConfig {
|
||||
while (eventT != XmlPullParser.END_DOCUMENT) {
|
||||
if (eventT == XmlPullParser.START_TAG && (Objects.equals(xmlPullParser.getName(), "color") || Objects.equals(xmlPullParser.getName(), "item"))) {
|
||||
String value = xmlPullParser.getAttributeValue(null, "name");
|
||||
String color_normal_key = "key_text_color_normal";
|
||||
if (value != null && value.equals(color_normal_key)) {
|
||||
keyNoramlcolor = Color.parseColor(xmlPullParser.nextText());
|
||||
|
||||
}
|
||||
String color_action_key = "key_text_color_functional";
|
||||
if (value != null && value.equals(color_action_key)) {
|
||||
keyActioncolor = Color.parseColor(xmlPullParser.nextText());
|
||||
|
||||
@ -160,7 +139,7 @@ public class CustomViewConfig {
|
||||
}
|
||||
eventT = xmlPullParser.next();
|
||||
}
|
||||
}catch (XmlPullParserException exception){
|
||||
}catch (XmlPullParserException ignored){
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -175,20 +154,23 @@ public class CustomViewConfig {
|
||||
updateKeyColor(resDirPath);
|
||||
BG = getBackGround(con, resDirPath);
|
||||
|
||||
Drawable keyBackGround = getKeyBackGround(con, resDirPath, Bg_normal);
|
||||
Drawable keyBackGround1 = getKeyBackGround(con, resDirPath, Bg_pressed);
|
||||
String bg_normal = "btn_keyboard_key_normal_normal.9.png";
|
||||
Drawable keyBackGround = getKeyBackGround(con, resDirPath, bg_normal);
|
||||
String bg_pressed = "btn_keyboard_key_normal_pressed.9.png";
|
||||
Drawable keyBackGround1 = getKeyBackGround(con, resDirPath, bg_pressed);
|
||||
BgNormalDraw = MyTools.getStatus(keyBackGround, keyBackGround1);
|
||||
|
||||
Drawable keyBackGround2 = getKeyBackGround(con, resDirPath, Bg_action_normal);
|
||||
Drawable keyBackGround3 = getKeyBackGround(con, resDirPath, Bg_action_pressed);
|
||||
String bg_action_normal = "btn_keyboard_key_functional_normal.9.png";
|
||||
Drawable keyBackGround2 = getKeyBackGround(con, resDirPath, bg_action_normal);
|
||||
String bg_action_pressed = "btn_keyboard_key_functional_pressed.9.png";
|
||||
Drawable keyBackGround3 = getKeyBackGround(con, resDirPath, bg_action_pressed);
|
||||
BgActionDraw = MyTools.getStatus(keyBackGround2, keyBackGround3);
|
||||
|
||||
Drawable keyBackGround4 = getKeyBackGround(con, resDirPath, Bg_space_normal);
|
||||
Drawable keyBackGround5 = getKeyBackGround(con, resDirPath, Bg_space_pressed);
|
||||
BgSpaceDraw = MyTools.getStatus(keyBackGround4, keyBackGround5);
|
||||
|
||||
String icon_del = "sym_keyboard_delete_normal.png";
|
||||
iconDel = getKeyBackGround(con, resDirPath, icon_del);
|
||||
String icon_shift = "sym_keyboard_shift.png";
|
||||
iconShift = getKeyBackGround(con, resDirPath, icon_shift);
|
||||
String icon_shift_lock = "sym_keyboard_shift_locked.png";
|
||||
iconShiftLock = getKeyBackGround(con, resDirPath, icon_shift_lock);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
package com.example.fingerkeyboard.tool;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.TypedValue;
|
||||
|
||||
public class DrawableUtils {
|
||||
|
||||
public static void drawKeyIcon(KeyBoard.Key currentKey,
|
||||
Drawable drawKeyIcon,
|
||||
Canvas myCanvas,
|
||||
MyKeyBoardView myKeyBoardView) {
|
||||
currentKey.icon = drawKeyIcon;
|
||||
currentKey.icon.setBounds(getIconBounds(currentKey, drawKeyIcon, myKeyBoardView));
|
||||
currentKey.icon.draw(myCanvas);
|
||||
}
|
||||
|
||||
private static Rect getIconBounds(KeyBoard.Key currentKey,
|
||||
Drawable drawKeyIcon,
|
||||
MyKeyBoardView customKeyboardView) {
|
||||
float icon_w = drawKeyIcon.getIntrinsicWidth();
|
||||
float icon_h = drawKeyIcon.getIntrinsicHeight();
|
||||
float icon_wr = icon_w / currentKey.width;
|
||||
float icon_hr = icon_h / currentKey.height;
|
||||
|
||||
float tep1, tep2;
|
||||
if (icon_wr > icon_hr) {
|
||||
tep2 = icon_wr;
|
||||
tep1 = Math.max(icon_wr, 0.5f);
|
||||
} else {
|
||||
tep2 = icon_hr;
|
||||
tep1 = Math.max(icon_hr, 0.5f);
|
||||
}
|
||||
|
||||
icon_h = (icon_h / tep2) * tep1;
|
||||
icon_w = (icon_w / tep2) * tep1;
|
||||
|
||||
int top = (int) (currentKey.y + customKeyboardView.getPaddingTop() + (currentKey.height - icon_h) / 2);
|
||||
int left = (int) (currentKey.x + customKeyboardView.getPaddingLeft() + (currentKey.width - icon_w) / 2);
|
||||
int bottom = top + (int) icon_h;
|
||||
int right = left + (int) icon_w;
|
||||
|
||||
return new Rect(left, top, right, bottom);
|
||||
}
|
||||
|
||||
public static float spToPx(Float values, Context context) {
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, values, context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,19 +3,22 @@ package com.example.fingerkeyboard.tool;
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyKeyBoardView extends KeyBoardView{
|
||||
private CustomViewConfig config = new CustomViewConfig();
|
||||
public class MyKeyBoardView extends KeyBoardView {
|
||||
private final CustomViewConfig config = new CustomViewConfig();
|
||||
private int shift_status = 0;
|
||||
private int viewType = 0;
|
||||
|
||||
private Context context;
|
||||
private Paint mPaint;
|
||||
|
||||
public void setShift_status(int shift_status) {
|
||||
this.shift_status = shift_status;
|
||||
@ -44,26 +47,11 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
initView();
|
||||
}
|
||||
|
||||
public MyKeyBoardView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
initView();
|
||||
}
|
||||
|
||||
|
||||
private Paint mPaint;
|
||||
private int leftPressedColor = 0xFFFF0000;
|
||||
private int rightPressedColor = 0xFFAA0000;
|
||||
private int action = -10;
|
||||
private Paint paint = new Paint();
|
||||
private Path pathLeft = new Path();
|
||||
|
||||
|
||||
private void initView() {
|
||||
config.init();
|
||||
context = getContext();
|
||||
mPaint = new Paint();
|
||||
mPaint.setTextAlign(Paint.Align.CENTER);
|
||||
float textSize = MyTools.spToPpx(16f, context);
|
||||
float textSize = MyTools.spToPpx(16f, KeyBoardApplication.getContext());
|
||||
mPaint.setTextSize(textSize);
|
||||
mPaint.setColor(config.getKeyNoramlcolor());
|
||||
}
|
||||
@ -107,7 +95,7 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
onDrawLabel(key, canvas);
|
||||
} else if (code == KeyBoard.KEYCODE_DELETE) {
|
||||
onDrawKeyBackground(key, config.getBgActionDraw(), canvas);
|
||||
DrawIcon.INSTANCE.onDrawKeyIcon(key, config.getIconDel(), canvas, this);
|
||||
DrawIcon.INSTANCE.onDrawKeyIcon(key, getDeleteDraw(), canvas, this);
|
||||
onDrawLabel(key, canvas);
|
||||
} else {
|
||||
mPaint.setColor(config.getKeyNoramlcolor());
|
||||
@ -117,12 +105,8 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void updateConfigView(Context con) {
|
||||
config.updateConfig(con);
|
||||
setBackground(config.getBG());
|
||||
@ -130,7 +114,17 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
|
||||
}
|
||||
|
||||
private Drawable getDeleteDraw() {
|
||||
if (config.getIconDel() == null) {
|
||||
return ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.del_icon);
|
||||
}
|
||||
return config.getIconDel();
|
||||
}
|
||||
|
||||
private Drawable getShiftDraw() {
|
||||
if (config.getIconShift() == null || config.getIconShiftLock() == null) {
|
||||
return ContextCompat.getDrawable(KeyBoardApplication.getContext(), R.drawable.ico_shift_lit);
|
||||
}
|
||||
if (shift_status == 0) {
|
||||
return config.getIconShift();
|
||||
} else if (shift_status == 1) {
|
||||
@ -140,7 +134,6 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onDrawKeyBackground(KeyBoard.Key myKey,
|
||||
Drawable keyBG,
|
||||
Canvas canvas) {
|
||||
@ -157,7 +150,7 @@ public class MyKeyBoardView extends KeyBoardView{
|
||||
Canvas canvas) {
|
||||
boolean b = myKey.label == null || myKey.label == "";
|
||||
if (!b) {
|
||||
float y1 = myKey.y + getPaddingRight() + (myKey.height/ 2f) + ((mPaint.getTextSize() - mPaint.descent()) / 2f);
|
||||
float y1 = myKey.y + getPaddingRight() + (myKey.height / 2f) + ((mPaint.getTextSize() - mPaint.descent()) / 2f);
|
||||
float x1 = myKey.x + getPaddingLeft() + ((myKey.width / 2f));
|
||||
canvas.drawText(myKey.label.toString(), x1, y1, mPaint);
|
||||
|
||||
|
||||
@ -37,11 +37,10 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import com.example.fingerkeyboard.KeyBoard;
|
||||
import com.example.fingerkeyboard.KeyBoardApplication;
|
||||
import com.example.fingerkeyboard.data.MyData;
|
||||
import com.example.fingerkeyboard.listener.DownloadCallback;
|
||||
import com.example.fingerkeyboard.listener.UnzipCallback;
|
||||
@ -54,7 +53,7 @@ public class MyTools {
|
||||
private static String sharedpreferenceKey_skin = "key_skin";
|
||||
|
||||
|
||||
private static final SharedPreferences share = KeyBoard.app.getSharedPreferences(
|
||||
private static final SharedPreferences share = KeyBoardApplication.app.getSharedPreferences(
|
||||
sharedpreferenceName, Context.MODE_PRIVATE);
|
||||
|
||||
|
||||
@ -76,7 +75,7 @@ public class MyTools {
|
||||
private static final SharedPreferences.Editor editorShare = share.edit();
|
||||
|
||||
|
||||
private static InputMethodManager methodManager = (InputMethodManager) KeyBoard.app.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
private static InputMethodManager methodManager = (InputMethodManager) KeyBoardApplication.app.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
|
||||
|
||||
@ -155,8 +154,8 @@ public class MyTools {
|
||||
methodManager.showInputMethodPicker();
|
||||
}
|
||||
public static boolean isStep2() {
|
||||
String string = Settings.Secure.getString(KeyBoard.app.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
if (string.startsWith(KeyBoard.app.getPackageName())) {
|
||||
String string = Settings.Secure.getString(KeyBoardApplication.app.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||
if (string.startsWith(KeyBoardApplication.app.getPackageName())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -170,7 +169,7 @@ public class MyTools {
|
||||
|
||||
public static boolean isStep1() {
|
||||
for (InputMethodInfo inputMethodInfo : methodManager.getEnabledInputMethodList()) {
|
||||
if (inputMethodInfo.getId().startsWith(KeyBoard.app.getPackageName())) {
|
||||
if (inputMethodInfo.getId().startsWith(KeyBoardApplication.app.getPackageName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.example.fingerkeyboard.topon;
|
||||
|
||||
public interface AdListener {
|
||||
void loadFail(String placeId);
|
||||
void showSuccess();
|
||||
|
||||
void showFail();
|
||||
|
||||
void showClose();
|
||||
}
|
||||
@ -0,0 +1,250 @@
|
||||
package com.example.fingerkeyboard.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.example.fingerkeyboard.KeyBoardApplication;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
Finger_Inter_Seting
|
||||
n6791d73f85c5d
|
||||
Finger_Inter_Preview
|
||||
n6791d73f5919b
|
||||
Finger_Inter_Open
|
||||
n6791d73f25a7e
|
||||
*/
|
||||
|
||||
private static final String place1Id = "n6791d73f25a7e";
|
||||
private static final String place2Id = "n6791d73f5919b";
|
||||
private static final String place3Id = "n6791d73f85c5d";
|
||||
|
||||
|
||||
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(KeyBoardApplication.getContext(), place1Id);
|
||||
ATInterstitial mInterstitialAd2 = new ATInterstitial(KeyBoardApplication.getContext(), place2Id);
|
||||
ATInterstitial mInterstitialAd3 = new ATInterstitial(KeyBoardApplication.getContext(), 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(KeyBoardApplication.TAG, "-has Cache------------");
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
Log.d(KeyBoardApplication.TAG, "-No Cache------------");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void setCallBack(ATInterstitial ad, AdListener listener) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
Log.d(KeyBoardApplication.TAG, "LoadLoaded " + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
listener.loadFail(ad.mPlacementId);
|
||||
Log.d(KeyBoardApplication.TAG, "LoadFail:--" + ad.mPlacementId + "--" + adError.getCode() + "---" + adError.getDesc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
Log.d(KeyBoardApplication.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.example.fingerkeyboard.topon;
|
||||
|
||||
public interface AdStatusAction {
|
||||
void onStatus(int adType);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.example.fingerkeyboard.topon;
|
||||
|
||||
public interface CountAction {
|
||||
void onCount(long millisUntilFinished);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.example.fingerkeyboard.topon;
|
||||
|
||||
public interface GoMainAction {
|
||||
void onGo();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.example.fingerkeyboard.topon;
|
||||
|
||||
public interface onActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
20
app/src/main/res/drawable/progress_gradient.xml
Normal file
20
app/src/main/res/drawable/progress_gradient.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#D3D3D3" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<gradient
|
||||
android:startColor="#4891FF"
|
||||
android:endColor="#6CE89E"
|
||||
android:angle="0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
@ -1,40 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<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/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".HomeActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:src="@mipmap/logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="260dp"
|
||||
/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Finger Keyboard"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/logo"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="Finger Keyboard"
|
||||
android:textColor="@color/keyboard_main"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="italic"
|
||||
android:textColor="@color/keyboard_main"
|
||||
/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/logo" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:indeterminateTint="#C3AFE6" />
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="5dp"
|
||||
android:layout_marginStart="53dp"
|
||||
android:layout_marginEnd="53dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_gradient"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -3,4 +3,6 @@ plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.jetbrains.kotlin.android) 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
|
||||
}
|
||||
@ -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. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
|
||||
@ -14,6 +14,29 @@ dependencyResolutionManagement {
|
||||
mavenCentral()
|
||||
maven("https://jitpack.io")
|
||||
maven ("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