diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5d73466..f8896cc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,11 +14,11 @@ android { compileSdk = 34 defaultConfig { - applicationId = "com.key.coolkeyboard" + applicationId = "com.key.coolkeyboard.test" minSdk = 23 targetSdk = 34 - versionCode = 3 - versionName = "1.0.2" + versionCode = 4 + versionName = "1.0.3" setProperty( "archivesBaseName", "coolkeyboard_v" + versionName + "(${versionCode})_$timestamp" @@ -126,7 +126,7 @@ dependencies { implementation("androidx.recyclerview:recyclerview:1.1.0") //Tramini - implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68") +// implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68") // Debugger UI Tools // implementation ("com.anythink.sdk:debugger-ui:1.0.7") diff --git a/app/google-services.json b/app/google-services.json index 98a960c..b423aa4 100644 --- a/app/google-services.json +++ b/app/google-services.json @@ -9,7 +9,7 @@ "client_info": { "mobilesdk_app_id": "1:121856077377:android:4af5d308b9b1e5cb40a0c0", "android_client_info": { - "package_name": "com.key.coolkeyboard" + "package_name": "com.key.coolkeyboard.test" } }, "oauth_client": [], diff --git a/app/src/main/assets/privacy.html b/app/src/main/assets/Cool_Keyboard_Privacy.html similarity index 74% rename from app/src/main/assets/privacy.html rename to app/src/main/assets/Cool_Keyboard_Privacy.html index 8f6a74c..ea502d0 100644 --- a/app/src/main/assets/privacy.html +++ b/app/src/main/assets/Cool_Keyboard_Privacy.html @@ -8,43 +8,44 @@ body { font-family: Arial, sans-serif; line-height: 1.6; - margin: 0; - padding: 0; - padding: 20px; - } - h1, h2 { + margin: 20px; color: #333; } + h1, h2 { + color: #0056b3; + } + h1 { + font-size: 24px; + } h2 { - margin-top: 20px; + font-size: 20px; } p { - margin: 10px 0; + margin-bottom: 10px; } ul { - margin: 10px 0; + margin-bottom: 10px; padding-left: 20px; } - - + li { + margin-bottom: 5px; + } -

Privacy Policy

-

Date: August 13, 2024

- +

Privacy Policy July 25, 2024

We provide this Privacy Policy to help you understand how we collect, use, and disclose information, including what you may provide to us or that we obtain from our products and services. We treat your privacy very seriously. Your privacy is important to us.

Information Collection and Use

For a better experience, while using our Service, we may require you to provide us with certain - personally identifiable information, such as users' name, address, location, pictures, etc. The - information that we request will be retained on your device and is not collected or retained by - us in any way and used as described in this privacy policy.

+ personally identifiable information. This may include users' names, addresses, locations, and + pictures. The information that we request will be retained on your device and is not collected + or retained by us in any way beyond what is described in this privacy policy.

The app does use third-party services that may collect information used to identify you.

-

Please refer to the privacy policy of the third-party service provider used by the +

Please refer to the privacy policies of the third-party service providers used by the application:

Log Data

-

We want to inform you that whenever you use our Service, in case of an error in the app, we +

We want to inform you that whenever you use our Service, in the case of an error in the app, we collect data and information (through third-party products) on your phone called Log Data. This - Log Data may include information such as your device Internet Protocol (“IP”) address, device + Log Data may include information such as your device’s Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our Service, the time and date of your use of the Service, and other statistics.

Cookies

Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on - your device's internal memory.

+ your device’s internal memory.

This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your @@ -79,10 +76,10 @@

Service Providers

We may employ third-party companies and individuals due to the following reasons:

We want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they @@ -104,9 +101,9 @@

Children’s Privacy

These Services do not address anyone under the age of 13. We do not knowingly collect personally identifiable information from children under 13 years of age. In the case we discover that a - child under 13 has provided us with personal information, we will immediately delete this from - our servers. If you are a parent or guardian and you are aware that your child has provided us - with personal information, please contact us so that we will be able to take the necessary + child under 13 has provided us with personal information, we immediately delete this from our + servers. If you are a parent or guardian and you are aware that your child has provided us with + personal information, please contact us so that we will be able to take the necessary actions.

Changes to This Privacy Policy

@@ -118,6 +115,6 @@

We may update the Privacy Policy from time to time. When we change the policy in a material way, a notice will be posted on our website along with the updated Privacy Policy.

If you have any questions or concerns about our Privacy Policy or data processing, please contact - us: saleemjeeta2@gmail.com.

+ us: arbabulfb@gmail.com.

diff --git a/app/src/main/java/com/key/coolkeyboard/CoolKeyboardSkin.java b/app/src/main/java/com/key/coolkeyboard/CoolKeyboardSkin.java index 4eb9463..f34e713 100644 --- a/app/src/main/java/com/key/coolkeyboard/CoolKeyboardSkin.java +++ b/app/src/main/java/com/key/coolkeyboard/CoolKeyboardSkin.java @@ -1,7 +1,5 @@ package com.key.coolkeyboard; -import static android.content.ContentValues.TAG; - import android.app.Application; import android.content.Context; import android.content.SharedPreferences; @@ -13,10 +11,8 @@ import com.anythink.interstitial.api.ATInterstitial; import com.key.coolkeyboard.data.Mydata; import com.key.coolkeyboard.data.MydataBase; import com.key.coolkeyboard.data.Otherdata; -import com.key.coolkeyboard.firebase.RemoteConfigNew; import com.key.coolkeyboard.tool.Mytool; import com.key.coolkeyboard.topon.AdManager; -import com.pgl.ssdk.S; import java.util.ArrayList; import java.util.HashSet; @@ -159,13 +155,12 @@ public class CoolKeyboardSkin extends Application { // ATSDK.integrationChecking(context); ATSDK.init(context, TOP_ID, TOP_KEY); - - ads = Mytool.getAllAd(); -// ATSDK.setNetworkLogDebug(true); -// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG); - RemoteConfigNew configNew = new RemoteConfigNew(); - configNew.init(app); AdManager.loadAllAd(); + +// ATSDK.setNetworkLogDebug(true); + + +// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG); } public static List lodAd() { diff --git a/app/src/main/java/com/key/coolkeyboard/activity/AllActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/AllActivity.java index bb30f9a..410a2a0 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/AllActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/AllActivity.java @@ -58,7 +58,7 @@ public class AllActivity extends AppCompatActivity { }); AdManager.loadAllAd(); -// ads = CoolKeyboardSkin.lodAd(); + initView(); initEvent(); @@ -66,51 +66,21 @@ public class AllActivity extends AppCompatActivity { } -// private void showAd() { -// ATInterstitial mInterstitialAd = Mytool.onCache(ads); -// if (mInterstitialAd == null) { -// finish(); -// } else { -// Mytool.setCallback(mInterstitialAd, new Adcallback() { -// @Override -// public void onShowFail(AdError ad) { -// finish(); -// } -// -// @Override -// public void onAdHidden() { -// finish(); -// } -// }); -// mInterstitialAd.show(this); -// } -// -// } + private void initEvent() { binding.allBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { -// showAd(); - AdManager.showTopOn(AllActivity.this, new onActionListener() { - @Override - public void onAction() { - finish(); - } - }); + finish(); } }); binding.allSearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - AdManager.showTopOn(AllActivity.this, new onActionListener() { - @Override - public void onAction() { - Intent intent = new Intent(AllActivity.this, SerachActivity.class); - startActivity(intent); - } - }); + Intent intent = new Intent(AllActivity.this, SerachActivity.class); + startActivity(intent); } }); @@ -176,15 +146,5 @@ public class AllActivity extends AppCompatActivity { } - @Override - public void onBackPressed() { - super.onBackPressed(); -// showAd(); - AdManager.showTopOn(this, new onActionListener() { - @Override - public void onAction() { - } - }); - } } \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/activity/MainActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/MainActivity.java index cf7908c..e161f1f 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/MainActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/MainActivity.java @@ -11,41 +11,32 @@ import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; import android.annotation.SuppressLint; -import android.app.Dialog; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; -import android.content.IntentFilter; -import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.provider.Settings; import android.util.Log; -import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; -import android.view.inputmethod.InputMethodManager; import android.widget.ImageView; import android.widget.Toast; import com.bumptech.glide.Glide; -import com.bumptech.glide.load.DataSource; -import com.bumptech.glide.load.engine.GlideException; -import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.target.CustomTarget; -import com.bumptech.glide.request.target.Target; import com.bumptech.glide.request.transition.Transition; import com.google.android.material.tabs.TabLayout; import com.key.coolkeyboard.CoolKeyboardSkin; import com.key.coolkeyboard.R; import com.key.coolkeyboard.adapter.PageAdapter; +import com.key.coolkeyboard.callback.RecommendDialogCallback; +import com.key.coolkeyboard.callback.StepDialogCallback; import com.key.coolkeyboard.data.MydataBase; import com.key.coolkeyboard.data.Otherdata; import com.key.coolkeyboard.databinding.ActivityMainBinding; +import com.key.coolkeyboard.dialog.RecommendDialogFragment; +import com.key.coolkeyboard.dialog.StepDialogFragment; import com.key.coolkeyboard.fragment.DownloadFragment; import com.key.coolkeyboard.fragment.LikeFragment; import com.key.coolkeyboard.fragment.MainFragment; @@ -56,17 +47,14 @@ import com.key.coolkeyboard.topon.onActionListener; import java.io.File; import java.util.ArrayList; -import java.util.Collections; import java.util.List; public class MainActivity extends AppCompatActivity { ActivityMainBinding binding; private List list = new ArrayList<>(); - private Dialog dialog; - private Dialog toastDialog; - private BroadcastReceiver broadcastReceiver; - private static final InputMethodManager methodManager = (InputMethodManager) CoolKeyboardSkin.app.getSystemService(Context.INPUT_METHOD_SERVICE); + private StepDialogFragment stepDialogFragment; + private RecommendDialogFragment recommendDialogFragment; private Otherdata otherdata; private String unzipPath; @@ -84,200 +72,101 @@ public class MainActivity extends AppCompatActivity { return insets; }); AdManager.loadAllAd(); + Mytool.runIO(new Runnable() { + @Override + public void run() { + otherdata = MydataBase.getInstance().myDAO().queryRandomItem(); + Log.d(CoolKeyboardSkin.TAG, "------000--otherdata="+otherdata); + } + }); initData(); - showDg(); if (Mytool.isStep1() && Mytool.isStep2()) { - dialog.dismiss(); -// Log.e("zzj", "---step1---" + Mytool.isStep1() + "---step2---" + Mytool.isStep2()); + showToastDg(); + } else { + showDg(); } } private void showDg() { - dialog = new Dialog(this); - dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); - dialog.setContentView(R.layout.dialog); - dialog.setCancelable(true); - dialog.getWindow().setGravity(Gravity.BOTTOM); - dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); + if (stepDialogFragment == null) { + stepDialogFragment = StepDialogFragment.newInstance(MainActivity.this, new StepDialogCallback() { + @Override + public void onDisMiss() { + showToastDg(); + } + }); - WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); - lp.copyFrom(dialog.getWindow().getAttributes()); - lp.width = WindowManager.LayoutParams.MATCH_PARENT; - lp.height = WindowManager.LayoutParams.WRAP_CONTENT; -// dialog.setCanceledOnTouchOutside(false); - broadcastReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - updateDialogContent(); - } - }; - registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_INPUT_METHOD_CHANGED)); - - dialog.findViewById(R.id.step1).setOnClickListener(v -> { - Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS); - startActivity(intent); - }); - dialog.findViewById(R.id.step2).setOnClickListener(v -> methodManager.showInputMethodPicker()); - dialog.findViewById(R.id.setting_cancel).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - hideDg(); - } - }); - dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - Mytool.runIO(new Runnable() { - @Override - public void run() { - List list1 = MydataBase.getInstance().myDAO().getAll(); - otherdata = list1.get(137); - if (toastDialog == null) { - runOnUiThread(new Runnable() { - @Override - public void run() { - showToastDg(); - } - }); - - } - } - }); - } - }); - dialog.show(); - dialog.getWindow().setAttributes(lp); - - updateDialogContent(); + } + stepDialogFragment.show(getSupportFragmentManager(), ""); } - private void updateDialogContent() { - boolean step1 = Mytool.isStep1(); - boolean step2 = Mytool.isStep2(); - dialog.findViewById(R.id.step1).setSelected(step1); - dialog.findViewById(R.id.step2).setSelected(step2); - updateDialogImages(); - - } private void showToastDg() { - toastDialog = new Dialog(this); - toastDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); - toastDialog.setContentView(R.layout.toast_dialog); - toastDialog.setCancelable(true); -// toastDialog.getWindow().setGravity(Gravity.BOTTOM); - toastDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); - - WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); - lp.copyFrom(toastDialog.getWindow().getAttributes()); - lp.width = WindowManager.LayoutParams.WRAP_CONTENT; - lp.height = WindowManager.LayoutParams.WRAP_CONTENT; - - ImageView toastImageView = toastDialog.findViewById(R.id.toast_dialog_image); - Glide.with(MainActivity.this) - .asBitmap() - .load(otherdata.getPreview()) - .placeholder(R.mipmap.logo) - .into(new CustomTarget() { - @Override - public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { - toastImageView.setImageBitmap(resource); - } - - @Override - public void onLoadCleared(@Nullable Drawable placeholder) { - - } - }); - - toastDialog.setCanceledOnTouchOutside(false); - - toastDialog.findViewById(R.id.toast_dialog_apply).setOnClickListener(v -> { - AdManager.showTopOn(MainActivity.this, new onActionListener() { + if (recommendDialogFragment == null) { + recommendDialogFragment = RecommendDialogFragment.newInstance(MainActivity.this, new RecommendDialogCallback() { @Override - public void onAction() { + public void onTryNow() { + binding.pbLoading.setVisibility(View.VISIBLE); downLoad(); } }); - - }); - toastDialog.findViewById(R.id.toast_dialog_cancel).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { -// if (toastDialog != null && toastDialog.isShowing()) { - toastDialog.dismiss(); -// } + if (otherdata != null) { + recommendDialogFragment.setIm(otherdata.getPreview()); } - }); + } + File cacheDir = this.getCacheDir(); unzipPath = cacheDir + "/" + otherdata.getTitle(); - if (toastDialog != null) { - toastDialog.show(); + if (otherdata != null) { + recommendDialogFragment.setIm(otherdata.getPreview()); } + recommendDialogFragment.show(getSupportFragmentManager(), ""); + - toastDialog.getWindow().setAttributes(lp); } private void downLoad() { - if (!Mytool.isStep1() || !Mytool.isStep2()) { -// Toast.makeText(this, getString(R.string.text_hint), Toast.LENGTH_SHORT).show(); - Intent intent = new Intent(this, SettingActivity.class); - startActivity(intent); - } else { - Mytool.donwnZip(this, otherdata.getZipUrl(), (successful, resource) -> { - if (successful) { - Mytool.unZip(this, unzipPath, resource, (successful1, resDirPath) -> { - if (successful1) { - StaticValue.PATH = resDirPath; - otherdata.setDownloaded(true); - Mytool.runIO(new Runnable() { - @Override - public void run() { - MydataBase.getInstance().myDAO().update(otherdata); - } - }); - showKey(); - } else { - Toast.makeText(MainActivity.this, getString(R.string.text_zip_failed), Toast.LENGTH_SHORT).show(); - } - }); - } else { - Toast.makeText(MainActivity.this, getString(R.string.text_download_failed), Toast.LENGTH_SHORT).show(); + Mytool.donwnZip(this, otherdata.getZipUrl(), (successful, resource) -> { + if (successful) { + Mytool.unZip(this, unzipPath, resource, (successful1, resDirPath) -> { + if (successful1) { + StaticValue.PATH = resDirPath; + otherdata.setDownloaded(true); + Mytool.runIO(new Runnable() { + @Override + public void run() { + MydataBase.getInstance().myDAO().update(otherdata); + } + }); + showKey(); + } else { + binding.pbLoading.setVisibility(View.GONE); + Toast.makeText(MainActivity.this, getString(R.string.text_zip_failed), Toast.LENGTH_SHORT).show(); + } + }); + } else { + binding.pbLoading.setVisibility(View.GONE); + Toast.makeText(MainActivity.this, getString(R.string.text_download_failed), Toast.LENGTH_SHORT).show(); - } - }); - } + } + }); } private void showKey() { + if(recommendDialogFragment!= null){ + recommendDialogFragment.closeDialog(); + } + binding.pbLoading.setVisibility(View.GONE); Toast.makeText(MainActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, ShowKeyboardActivity.class); startActivity(intent); } - private void hideDg() { - if (dialog != null && dialog.isShowing()) { - dialog.dismiss(); - } - } - - private void updateDialogImages() { - if (Mytool.isStep2()) { - dialog.findViewById(R.id.step2_image).setVisibility(View.VISIBLE); - } else { - dialog.findViewById(R.id.step2_image).setVisibility(View.GONE); - } - if (Mytool.isStep1()) { - dialog.findViewById(R.id.step1_image).setVisibility(View.VISIBLE); - } else { - dialog.findViewById(R.id.step1_image).setVisibility(View.GONE); - } - } private void initData() { @@ -346,23 +235,10 @@ public class MainActivity extends AppCompatActivity { } } - @Override - protected void onResume() { - super.onResume(); - updateDialogContent(); - Intent intent = getIntent(); - int a = intent.getIntExtra(StaticValue.KEY_ISshow, 0); -// Log.e("zzj", "a is------" + a); - if (a == 1) { - dialog.dismiss(); - } - } @Override protected void onDestroy() { super.onDestroy(); - if (broadcastReceiver != null) { - unregisterReceiver(broadcastReceiver); - } + } } diff --git a/app/src/main/java/com/key/coolkeyboard/activity/PreviewActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/PreviewActivity.java index 4885ee1..1a9d198 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/PreviewActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/PreviewActivity.java @@ -59,8 +59,6 @@ public class PreviewActivity extends AppCompatActivity { return insets; }); AdManager.loadAllAd(); -// ads = CoolKeyboardSkin.lodAd(); - Intent intent = getIntent(); preview = intent.getStringExtra(StaticValue.KEY_PRE); name = intent.getStringExtra(StaticValue.KEY_NAME); @@ -70,27 +68,7 @@ public class PreviewActivity extends AppCompatActivity { initEvent(); } -// private void showAd() { -// ATInterstitial mInterstitialAd = Mytool.onCache(ads); -// if (mInterstitialAd == null) { -// showKey(); -// -// } else { -// Mytool.setCallback(mInterstitialAd, new Adcallback() { -// @Override -// public void onShowFail(AdError ad) { -// showKey(); -// } -// -// @Override -// public void onAdHidden() { -// showKey(); -// } -// }); -// mInterstitialAd.show(this); -// } -// -// } + private void showKey() { Toast.makeText(PreviewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show(); @@ -104,20 +82,19 @@ public class PreviewActivity extends AppCompatActivity { binding.previewBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - AdManager.showTopOn(PreviewActivity.this, new onActionListener() { - @Override - public void onAction() { - finish(); - } - }); - + finish(); } }); binding.download.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - downLoad(); + AdManager.showTopOn(PreviewActivity.this, new onActionListener() { + @Override + public void onAction() { + downLoad(); + } + }); } }); @@ -161,13 +138,11 @@ public class PreviewActivity extends AppCompatActivity { private void downLoad() { if (!Mytool.isStep1() || !Mytool.isStep2()) { -// Toast.makeText(this, getString(R.string.text_hint), Toast.LENGTH_SHORT).show(); + Intent intent = new Intent(this, SettingActivity.class); startActivity(intent); } else { -// Intent intent = new Intent(); -// intent.putExtra(StaticValue.KEY_ISshow, 1); -// startActivity(intent); + binding.downloadProgress.setVisibility(View.VISIBLE); binding.downloadImage.setVisibility(View.GONE); @@ -185,13 +160,7 @@ public class PreviewActivity extends AppCompatActivity { MydataBase.getInstance().myDAO().update(otherdata); } }); - AdManager.showTopOn(this, new onActionListener() { - @Override - public void onAction() { - showKey(); - } - }); -// showAd(); + showKey(); } else { Toast.makeText(PreviewActivity.this, getString(R.string.text_zip_failed), Toast.LENGTH_SHORT).show(); } @@ -261,14 +230,10 @@ public class PreviewActivity extends AppCompatActivity { } + @Override public void onBackPressed() { super.onBackPressed(); - AdManager.showTopOn(PreviewActivity.this, new onActionListener() { - @Override - public void onAction() { - } - }); } } \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/activity/SerachActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/SerachActivity.java index e4c997f..2f8a4ab 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/SerachActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/SerachActivity.java @@ -65,13 +65,7 @@ public class SerachActivity extends AppCompatActivity { binding.searchBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - AdManager.showTopOn(SerachActivity.this, new onActionListener() { - @Override - public void onAction() { - finish(); - } - }); -// finish(); + finish(); } }); binding.searchSearch.setOnClickListener(new View.OnClickListener() { @@ -143,14 +137,5 @@ public class SerachActivity extends AppCompatActivity { hideKeyView(); } - @Override - public void onBackPressed() { - super.onBackPressed(); - AdManager.showTopOn(this, new onActionListener() { - @Override - public void onAction() { - } - }); - } } \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/activity/ShowKeyboardActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/ShowKeyboardActivity.java index 90ad582..edc0d4e 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/ShowKeyboardActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/ShowKeyboardActivity.java @@ -69,14 +69,5 @@ public class ShowKeyboardActivity extends AppCompatActivity { binding.showkeyEdit.clearFocus(); } - @Override - public void onBackPressed() { - super.onBackPressed(); - AdManager.showTopOn(ShowKeyboardActivity.this, new onActionListener() { - @Override - public void onAction() { - } - }); - } } \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/activity/SplashActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/SplashActivity.java index 845b40c..b4d63c7 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/SplashActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/SplashActivity.java @@ -1,27 +1,22 @@ package com.key.coolkeyboard.activity; +import android.annotation.SuppressLint; +import android.content.Intent; +import android.graphics.Typeface; +import android.os.Bundle; +import android.os.CountDownTimer; + 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 android.annotation.SuppressLint; -import android.content.Intent; -import android.graphics.Typeface; -import android.os.Bundle; -import android.os.CountDownTimer; -import android.util.AttributeSet; - import com.anythink.core.api.AdError; import com.anythink.interstitial.api.ATInterstitial; -import com.key.coolkeyboard.CoolKeyboardSkin; import com.key.coolkeyboard.R; -import com.key.coolkeyboard.databinding.ActivityPreviewBinding; import com.key.coolkeyboard.databinding.ActivitySplashBinding; -import com.key.coolkeyboard.firebase.RemoteConfigNew; import com.key.coolkeyboard.tool.Adcallback; -import com.key.coolkeyboard.tool.CustomProgressBar; import com.key.coolkeyboard.tool.Mytool; import com.key.coolkeyboard.topon.AdManager; @@ -37,7 +32,7 @@ public class SplashActivity extends AppCompatActivity { private List ads; private boolean isAlreadyShow = false; - private float i = 0; + private long totaltime = 1000L; @SuppressLint("MissingInflatedId") @Override @@ -52,19 +47,13 @@ public class SplashActivity extends AppCompatActivity { v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; }); - AdManager.loadAllAd(); -// ads = CoolKeyboardSkin.lodAd(); - binding.splashTitle.setTypeface(Typeface.createFromAsset(getAssets(), "Baumans-Regular.ttf")); - countDownTimer = AdManager.showWelcomeAd(this, 10100, new Function1() { + countDownTimer = AdManager.showWelcomeAd(this, totaltime, new Function1() { @Override public Unit invoke(Long aLong) { - Float percentage = 100 - (float) aLong / 10100 * 100; -// round = Integer.parseInt(String.valueOf(percentage)); + Float percentage = 100 - (float) aLong / totaltime * 100; binding.splashPg.setProgress(percentage); -// i++; -// binding.splashPg.setProgress(i); return null; } }, new Function0() { @@ -76,58 +65,6 @@ public class SplashActivity extends AppCompatActivity { }); countDownTimer.start(); -// countDownTimer = new CountDownTimer(10100, 100) { -// @Override -// public void onTick(long l) { -// i++; -// binding.splashPg.setProgress(i); -// if (!isAlreadyShow) { -// showAd(false); -// } -// } -// -// @Override -// public void onFinish() { -// if (!isAlreadyShow) { -// showAd(true); -// } -// } -// }; -// -// countDownTimer.start(); - - - } - - private void showAd(boolean go) { - ATInterstitial mInterstitialAd = Mytool.onCache(ads); - if (mInterstitialAd == null) { - isAlreadyShow = false; - if (go) { - starMainactivity(); - } - } else { - isAlreadyShow = true; - Mytool.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() { diff --git a/app/src/main/java/com/key/coolkeyboard/activity/WebActivity.java b/app/src/main/java/com/key/coolkeyboard/activity/WebActivity.java index 7eaf92e..b966aab 100644 --- a/app/src/main/java/com/key/coolkeyboard/activity/WebActivity.java +++ b/app/src/main/java/com/key/coolkeyboard/activity/WebActivity.java @@ -8,8 +8,10 @@ import androidx.core.view.WindowInsetsCompat; import android.annotation.SuppressLint; import android.os.Bundle; +import android.view.View; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.FrameLayout; import com.key.coolkeyboard.R; @@ -29,6 +31,13 @@ public class WebActivity extends AppCompatActivity { WebView webView = findViewById(R.id.web); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient()); - webView.loadUrl("file:///android_asset/privacy.html"); + webView.loadUrl("file:///android_asset/Cool_Keyboard_Privacy.html"); + FrameLayout back = findViewById(R.id.back); + back.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/callback/RecommendDialogCallback.java b/app/src/main/java/com/key/coolkeyboard/callback/RecommendDialogCallback.java new file mode 100644 index 0000000..1db21f1 --- /dev/null +++ b/app/src/main/java/com/key/coolkeyboard/callback/RecommendDialogCallback.java @@ -0,0 +1,6 @@ +package com.key.coolkeyboard.callback; + +public interface RecommendDialogCallback { + + void onTryNow(); +} diff --git a/app/src/main/java/com/key/coolkeyboard/callback/StepDialogCallback.java b/app/src/main/java/com/key/coolkeyboard/callback/StepDialogCallback.java new file mode 100644 index 0000000..0dfb94b --- /dev/null +++ b/app/src/main/java/com/key/coolkeyboard/callback/StepDialogCallback.java @@ -0,0 +1,6 @@ +package com.key.coolkeyboard.callback; + +public interface StepDialogCallback { + + void onDisMiss(); +} diff --git a/app/src/main/java/com/key/coolkeyboard/data/MyDAO.java b/app/src/main/java/com/key/coolkeyboard/data/MyDAO.java index 902910a..debb076 100644 --- a/app/src/main/java/com/key/coolkeyboard/data/MyDAO.java +++ b/app/src/main/java/com/key/coolkeyboard/data/MyDAO.java @@ -12,6 +12,9 @@ public interface MyDAO { @Query("SELECT * FROM keyboard_table") List getAll(); + @Query("select * from keyboard_table order by RANDOM() LIMIT 1") + Otherdata queryRandomItem(); + @Query("select * from keyboard_table where title =:title ") List getsearchlist(String title); diff --git a/app/src/main/java/com/key/coolkeyboard/dialog/RecommendDialogFragment.java b/app/src/main/java/com/key/coolkeyboard/dialog/RecommendDialogFragment.java new file mode 100644 index 0000000..958a8d2 --- /dev/null +++ b/app/src/main/java/com/key/coolkeyboard/dialog/RecommendDialogFragment.java @@ -0,0 +1,132 @@ +package com.key.coolkeyboard.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.provider.Settings; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.DataSource; +import com.bumptech.glide.load.engine.GlideException; +import com.bumptech.glide.request.RequestListener; +import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.target.Target; +import com.bumptech.glide.request.transition.Transition; +import com.key.coolkeyboard.CoolKeyboardSkin; +import com.key.coolkeyboard.R; +import com.key.coolkeyboard.activity.MainActivity; +import com.key.coolkeyboard.callback.RecommendDialogCallback; +import com.key.coolkeyboard.callback.StepDialogCallback; +import com.key.coolkeyboard.databinding.DialogBinding; +import com.key.coolkeyboard.databinding.ToastDialogBinding; +import com.key.coolkeyboard.tool.Mytool; +import com.key.coolkeyboard.topon.AdManager; +import com.key.coolkeyboard.topon.onActionListener; + +public class RecommendDialogFragment extends DialogFragment { + + private Activity mActivity; + private ToastDialogBinding vb; + + + private RecommendDialogCallback callback; + + private String im; + + public void setIm(String im) { + this.im = im; + } + + public RecommendDialogFragment(Activity activity, RecommendDialogCallback stepDialogCallback) { + mActivity = activity; + callback = stepDialogCallback; + + } + + @Override + public void onDestroy() { + super.onDestroy(); + + } + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + vb = ToastDialogBinding.inflate(inflater, container, false); + init(); + return vb.getRoot(); + } + + private void init() { + + Dialog dialog = getDialog(); + setCancelable(false); + if (dialog != null) { + Window window = dialog.getWindow(); + if (window != null) { + window.setBackgroundDrawableResource(R.color.transparent); + window.getDecorView().setPadding(0, 0, 0, 0); + + WindowManager.LayoutParams attributes = window.getAttributes(); + attributes.gravity = Gravity.CENTER; + attributes.width = WindowManager.LayoutParams.WRAP_CONTENT; + attributes.height = WindowManager.LayoutParams.WRAP_CONTENT; + window.setAttributes(attributes); + } + } + + + Glide.with(CoolKeyboardSkin.app) + .asDrawable() + .load(im) + .placeholder(R.mipmap.logo) + .into(vb.toastDialogImage); + + + vb.toastDialogApply.setOnClickListener(v -> { + if (callback != null) { + callback.onTryNow(); + } + + }); + vb.toastDialogCancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + } + + public void closeDialog(){ + dismiss(); + } + + + public static RecommendDialogFragment newInstance(Activity activity, RecommendDialogCallback stepDialogCallback) { + + RecommendDialogFragment recommendDialogFragment = new RecommendDialogFragment(activity, stepDialogCallback); + return recommendDialogFragment; + } +} diff --git a/app/src/main/java/com/key/coolkeyboard/dialog/StepDialogFragment.java b/app/src/main/java/com/key/coolkeyboard/dialog/StepDialogFragment.java new file mode 100644 index 0000000..4a17481 --- /dev/null +++ b/app/src/main/java/com/key/coolkeyboard/dialog/StepDialogFragment.java @@ -0,0 +1,145 @@ +package com.key.coolkeyboard.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.IntentFilter; +import android.os.Bundle; +import android.provider.Settings; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; + +import com.key.coolkeyboard.CoolKeyboardSkin; +import com.key.coolkeyboard.R; +import com.key.coolkeyboard.callback.StepDialogCallback; +import com.key.coolkeyboard.databinding.DialogBinding; +import com.key.coolkeyboard.tool.Mytool; + +public class StepDialogFragment extends DialogFragment { + + private Activity mActivity; + private DialogBinding vb; + private BroadcastReceiver broadcastReceiver; + private InputMethodManager methodManager; + private StepDialogCallback callback; + + + public StepDialogFragment(Activity activity, StepDialogCallback stepDialogCallback) { + mActivity = activity; + callback = stepDialogCallback; + + } + + @Override + public void onDestroy() { + super.onDestroy(); + if (broadcastReceiver != null && mActivity != null && !mActivity.isFinishing()) { + mActivity.unregisterReceiver(broadcastReceiver); + } + } + + @Override + public void onDismiss(@NonNull DialogInterface dialog) { + super.onDismiss(dialog); + + if (callback != null) { + callback.onDisMiss(); + } + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + vb = DialogBinding.inflate(inflater, container, false); + init(); + return vb.getRoot(); + } + + private void init() { + methodManager = (InputMethodManager) CoolKeyboardSkin.app.getSystemService(Context.INPUT_METHOD_SERVICE); + Dialog dialog = getDialog(); + setCancelable(false); + if (dialog != null) { + Window window = dialog.getWindow(); + if (window != null) { + window.setBackgroundDrawableResource(R.color.transparent); + window.getDecorView().setPadding(0, 0, 0, 0); + + WindowManager.LayoutParams attributes = window.getAttributes(); + attributes.gravity = Gravity.BOTTOM; + attributes.width = WindowManager.LayoutParams.MATCH_PARENT; + attributes.height = WindowManager.LayoutParams.WRAP_CONTENT; + window.setAttributes(attributes); + } + } + + broadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + updateDialogContent(); + } + }; + mActivity.registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_INPUT_METHOD_CHANGED)); + + + vb.step1.setOnClickListener(v -> { + Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS); + startActivity(intent); + }); + vb.step2.setOnClickListener(v -> methodManager.showInputMethodPicker()); + vb.settingCancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + } + + @Override + public void onResume() { + super.onResume(); + updateDialogContent(); + } + + private void updateDialogContent() { + boolean step1 = Mytool.isStep1(); + boolean step2 = Mytool.isStep2(); + vb.step1.setSelected(step1); + vb.step2.setSelected(step2); + if (step1) { + vb.step1Image.setVisibility(View.VISIBLE); + } else { + vb.step1Image.setVisibility(View.GONE); + } + + if (step2) { + vb.step2Image.setVisibility(View.VISIBLE); + } else { + vb.step2Image.setVisibility(View.GONE); + } + if (step1 && step2) { + dismiss(); + } + } + + + public static StepDialogFragment newInstance(Activity activity,StepDialogCallback stepDialogCallback) { + + StepDialogFragment stepDialogFragment = new StepDialogFragment(activity,stepDialogCallback); + return stepDialogFragment; + } +} diff --git a/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigKey.kt b/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigKey.kt deleted file mode 100644 index c9e8059..0000000 --- a/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigKey.kt +++ /dev/null @@ -1,245 +0,0 @@ -package com.key.coolkeyboard.firebase - -object RemoteConfigKey { - - //配置在firebase中的key,通过它取出自己配置的json - const val KEY_AD_SHOW_INTERVAL = "key_ad_show_interval" - - - const val DEFAULT_AD_JSON = """ -{ - "AD_SHOW_LIMIT": { - "admob_inst": 100, - "admob_native": 100, - "max_banner": 100, - "max_inst": 100, - "max_native": 100 - }, - "sounds_inst_show_interval": 25000, - "LOLAds_EXPIRE_HOURS_NEW_USER": 20, - "sounds_inst_splash": { - "data": [{ - "after_click": { - "admob_inst": "keep", - "max_inst": "keep" - }, - "block": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "close": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "config": [ - [ - "admob_inst", - { - "ca-app-pub-2419639357236809/7376891200": 100 - } - ] - ], - "limit": { - "admob_inst": 100, - "max_inst": 100 - }, - "cycle": 0, - "timeout": 15000, - "showIntervalEnable": false - }] - }, - "sounds_inst_into_play": { - "data": [{ - "after_click": { - "admob_inst": "keep", - "max_inst": "keep" - }, - "block": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "close": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "config": [ - [ - "admob_inst", - { - "ca-app-pub-2419639357236809/9750976941": 100 - } - ] - ], - "limit": { - "admob_inst": 100, - "max_inst": 100 - }, - "cycle": 0, - "timeout": 15000, - "showIntervalEnable": false - }] - }, - "sounds_inst_exit_sounds_list": { - "data": [{ - "after_click": { - "admob_inst": "keep", - "max_inst": "keep" - }, - "block": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "close": { - "admob_inst": { - "delay": 0, - "rate": 0 - }, - "max_inst": { - "delay": 0, - "rate": 0 - } - }, - "config": [ - [ - "admob_inst", - { - "ca-app-pub-2419639357236809/9844693327": 100 - } - ] - ], - "limit": { - "admob_inst": 100, - "max_inst": 100 - }, - "cycle": 0, - "timeout": 15000, - "showIntervalEnable": false - }] - }, - "sounds_android_native_musicList": { - "data": [{ - "config": [ - [ - "admob_native", - { - "ca-app-pub-2419639357236809/9811482858": 100 - } - ] - ], - "block": { - "admob_native": { - "delay": 0, - "rate": 0 - }, - "max_native": { - "delay": 0, - "rate": 0 - } - }, - "click": { - "admob_native": [ - 100, - 100, - 100, - 100, - 100 - ], - "max_native": [ - 100, - 100, - 100, - 100, - 100 - ] - }, - "after_click": { - "admob_native": "next", - "max_native": "next" - }, - "limit": { - "admob_native": 100, - "max_native": 100 - } - }] - }, - "sounds_android_native_play": { - "data": [{ - "config": [ - [ - "admob_native", - { - "ca-app-pub-2419639357236809/8134642941": 100 - } - ] - ], - "block": { - "admob_native": { - "delay": 0, - "rate": 0 - }, - "max_native": { - "delay": 0, - "rate": 0 - } - }, - "click": { - "admob_native": [ - 100, - 100, - 100, - 100, - 100 - ], - "max_native": [ - 100, - 100, - 100, - 100, - 100 - ] - }, - "after_click": { - "admob_native": "next", - "max_native": "next" - }, - "limit": { - "admob_native": 100, - "max_native": 100 - } - }] - } -} - """ -//"{\"AD_SHOW_LIMIT\":{\"max_banner\":100,\"max_inst\":100,\"max_native\":100},\"sounds_inst_show_interval\":25000,\"LOLAds_EXPIRE_HOURS_NEW_USER\":20,\"sounds_inst_splash\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"f685a8fc471fd92b\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_into_sounds_list\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"2a1e13e10c0358c9\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_into_play\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"2a1e13e10c0358c9\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_into_play2\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"2a1e13e10c0358c9\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_exit_sounds_list\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"b0c27a89f370cbed\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_exit_play\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"b0c27a89f370cbed\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_exit_play2\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"b0c27a89f370cbed\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_exit_edit\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"b0c27a89f370cbed\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_inst_create_next\":{\"data\":[{\"after_click\":{\"max_inst\":\"keep\"},\"block\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"close\":{\"max_inst\":{\"delay\":0,\"rate\":0}},\"config\":[[\"max_inst\",{\"66d99619cea2243d\":100}]],\"limit\":{\"max_inst\":100},\"cycle\":0,\"timeout\":15000,\"showIntervalEnable\":false}]},\"sounds_android_native_musicList\":{\"data\":[{\"config\":[[\"max_native\",{\"2aa4162b650aa26d\":100}]],\"block\":{\"max_native\":{\"delay\":0,\"rate\":0}},\"click\":{\"max_native\":[100,100,100,100,100]},\"after_click\":{\"max_native\":\"next\"},\"limit\":{\"max_native\":100}}]},\"sounds_android_native_play\":{\"data\":[{\"config\":[[\"max_native\",{\"35f6847f26ddcd76\":100}]],\"block\":{\"max_native\":{\"delay\":0,\"rate\":0}},\"click\":{\"max_native\":[100,100,100,100,100]},\"after_click\":{\"max_native\":\"next\"},\"limit\":{\"max_native\":100}}]}}" -} - diff --git a/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigNew.kt b/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigNew.kt deleted file mode 100644 index 59c47e7..0000000 --- a/app/src/main/java/com/key/coolkeyboard/firebase/RemoteConfigNew.kt +++ /dev/null @@ -1,141 +0,0 @@ -package com.key.coolkeyboard.firebase - -import android.app.Application -import android.content.Context -import android.os.Handler -import android.os.Looper -import android.os.Message -import android.text.TextUtils -import android.util.Log -import com.google.firebase.remoteconfig.BuildConfig -import com.google.firebase.remoteconfig.ConfigUpdate -import com.google.firebase.remoteconfig.ConfigUpdateListener -import com.google.firebase.remoteconfig.FirebaseRemoteConfig -import com.google.firebase.remoteconfig.FirebaseRemoteConfigException -import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings -import com.google.firebase.remoteconfig.FirebaseRemoteConfigValue -import com.key.coolkeyboard.CoolKeyboardSkin - -import java.lang.ref.WeakReference - - -class RemoteConfigNew { - - - private var ctx: Context? = null - private var mFirebaseRemoteConfig: FirebaseRemoteConfig? = null - - //配置是否初始化成功 - private var isInit = false - - //上次获取数据的时间 - private var lastFetchTime: Long = 0 - private val handler = MHandler(this) - - - companion object { - const val MSG_REFRESH_CONFIG = 1 - val instance: RemoteConfigNew by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { - RemoteConfigNew() - } - } - - fun init(ctx: Application) { - this.ctx = ctx - initConfig() - fetchConfig() - onConfigUpdate() - } - - private fun initConfig() { - var intervalTime = (60 * 10).toLong() - //如果是开发状态,则将提取时间缩短 - if (BuildConfig.DEBUG) { - intervalTime = (60 * 5).toLong() - } - mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance() - val configSettings = - FirebaseRemoteConfigSettings.Builder() //默认值12小时的最短提取间隔,如果在间隔内取值,则优先取上次的结果 - .setMinimumFetchIntervalInSeconds(intervalTime).build() - mFirebaseRemoteConfig!!.setConfigSettingsAsync(configSettings) - } - - private fun onConfigUpdate() { - mFirebaseRemoteConfig!!.addOnConfigUpdateListener(object : ConfigUpdateListener { - override fun onUpdate(configUpdate: ConfigUpdate) { - Log.d(CoolKeyboardSkin.TAG, "Updated keys: " + configUpdate.updatedKeys) - try { - mFirebaseRemoteConfig!!.activate().addOnCompleteListener { task -> - if (task.isSuccessful) { - updateData("onConfigUpdate", mFirebaseRemoteConfig!!.all) - } - } - } catch (ignore: Exception) { - } - } - - override fun onError(error: FirebaseRemoteConfigException) { - Log.d(CoolKeyboardSkin.TAG, "Config update error with code: " + error.code) - } - }) - } - - private fun fetchConfig() { - //这里可能会抛出异常 FirebaseRemoteConfigFetchThrottledException - try { - mFirebaseRemoteConfig!!.fetchAndActivate().addOnCompleteListener { task -> - if (task.isSuccessful) { - isInit = true - lastFetchTime = System.currentTimeMillis() - updateData("fetchAndActivate", mFirebaseRemoteConfig!!.all) - //24小时后,重新再去获取 - handler.removeMessages(MSG_REFRESH_CONFIG) - handler.sendEmptyMessageDelayed( - MSG_REFRESH_CONFIG, (1000 * 60 * 60 * 24).toLong() - ) - } else { - //15分钟后重新再去获取 - handler.removeMessages(MSG_REFRESH_CONFIG) - handler.sendEmptyMessageDelayed(MSG_REFRESH_CONFIG, (1000 * 60 * 15).toLong()) - } - } - } catch (ignore: Exception) { - } - } - - private fun updateData(from: String, all: Map) { - for ((key, value) in all) { - try { - Log.d( - CoolKeyboardSkin.TAG, "from = " + from + "Key = " + key + " Value = " + value.asString() - ) - if (TextUtils.equals(RemoteConfigKey.KEY_AD_SHOW_INTERVAL, key)) { - Sp.getInstance(CoolKeyboardSkin.app) - .putLong(RemoteConfigKey.KEY_AD_SHOW_INTERVAL, value.asLong()).commit() - } - - } catch (ignore: Exception) { - - } - } - } - - private class MHandler(remoteConfig: RemoteConfigNew) : Handler(Looper.getMainLooper()) { - private val weakReference: WeakReference - - init { - weakReference = WeakReference(remoteConfig) - } - - override fun handleMessage(msg: Message) { - super.handleMessage(msg) - val remoteConfig = weakReference.get() - if (remoteConfig?.ctx != null) { - if (msg.what == MSG_REFRESH_CONFIG) { - remoteConfig.fetchConfig() - } - } - } - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/key/coolkeyboard/firebase/Sp.java b/app/src/main/java/com/key/coolkeyboard/firebase/Sp.java deleted file mode 100644 index e888bfd..0000000 --- a/app/src/main/java/com/key/coolkeyboard/firebase/Sp.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.key.coolkeyboard.firebase; - -import android.app.Application; -import android.content.Context; -import android.content.SharedPreferences; - -import com.key.coolkeyboard.topon.AdManager; - - -public class Sp { - private static String spName = "AD_SHOW"; - private static Sp instance; - private SharedPreferences.Editor editor; - - private SharedPreferences preferences; - - private Sp(Application context) { - preferences = context.getSharedPreferences(spName, Context.MODE_PRIVATE); - editor = preferences.edit(); - } - - - public static Sp getInstance(Application context) { - if (instance == null) { - instance = new Sp(context); - } - return instance; - } - - - public Sp putLong(String key, long value) { - editor.putLong(key, value); - return this; - } - - public boolean commit() { - return editor.commit(); - } - - public long getLongValue(String key) { - return preferences.getLong(key, AdManager.VALUE_SHOW_INTERVAL); - } -} diff --git a/app/src/main/java/com/key/coolkeyboard/fragment/MainFragment.java b/app/src/main/java/com/key/coolkeyboard/fragment/MainFragment.java index 9676015..499cfc1 100644 --- a/app/src/main/java/com/key/coolkeyboard/fragment/MainFragment.java +++ b/app/src/main/java/com/key/coolkeyboard/fragment/MainFragment.java @@ -116,21 +116,16 @@ public class MainFragment extends Fragment { binding.minSearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - AdManager.showTopOn(requireActivity(), new onActionListener() { - @Override - public void onAction() { - String text = binding.mainEdit.getText().toString(); - hideKeyboard(); - if (!TextUtils.isEmpty(text)) { - Intent intent = new Intent(requireContext(), SerachActivity.class); - intent.putExtra(StaticValue.KEY_TEXT, text); - intent.putExtra(StaticValue.KEY_ISMAINSH, text); - startActivity(intent); - } else { - Toast.makeText(requireContext(), getString(R.string.text_tips), Toast.LENGTH_SHORT).show(); - } - } - }); + String text = binding.mainEdit.getText().toString(); + hideKeyboard(); + if (!TextUtils.isEmpty(text)) { + Intent intent = new Intent(requireContext(), SerachActivity.class); + intent.putExtra(StaticValue.KEY_TEXT, text); + intent.putExtra(StaticValue.KEY_ISMAINSH, text); + startActivity(intent); + } else { + Toast.makeText(requireContext(), getString(R.string.text_tips), Toast.LENGTH_SHORT).show(); + } } }); @@ -151,7 +146,6 @@ public class MainFragment extends Fragment { } private void initData() { - binding.mainTitle.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "Baumans-Regular.ttf")); binding.settingTitle.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "Baumans-Regular.ttf")); diff --git a/app/src/main/java/com/key/coolkeyboard/tool/Mytool.java b/app/src/main/java/com/key/coolkeyboard/tool/Mytool.java index 6890d02..e4eb73d 100644 --- a/app/src/main/java/com/key/coolkeyboard/tool/Mytool.java +++ b/app/src/main/java/com/key/coolkeyboard/tool/Mytool.java @@ -62,97 +62,11 @@ public class Mytool { private static InputMethodManager methodManager = (InputMethodManager) CoolKeyboardSkin.app.getSystemService(Context.INPUT_METHOD_SERVICE); private static ExecutorService executorService; - public static final String one_AD = "n66a23b25d78ba"; - public static final String two_Ad = "n66a23b25ada67"; - public static final String three_ad = "n66a23b257ca0e"; - private static ArrayList 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 list) { - Collections.shuffle(list); - for (ATInterstitial ad : list) { - if (ad.isAdReady()) { - return ad; - } - } - return null; - } - - public static List getAllAd() { - if (adArrayList == null) { - adArrayList = new ArrayList<>(); - adArrayList.add(createAd(one_AD, CoolKeyboardSkin.app)); - adArrayList.add(createAd(two_Ad, CoolKeyboardSkin.app)); - adArrayList.add(createAd(three_ad, CoolKeyboardSkin.app)); - } - 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) { diff --git a/app/src/main/java/com/key/coolkeyboard/topon/AdManager.kt b/app/src/main/java/com/key/coolkeyboard/topon/AdManager.kt index 3c80305..b90417f 100644 --- a/app/src/main/java/com/key/coolkeyboard/topon/AdManager.kt +++ b/app/src/main/java/com/key/coolkeyboard/topon/AdManager.kt @@ -8,17 +8,10 @@ import com.anythink.core.api.AdError import com.anythink.interstitial.api.ATInterstitial import com.anythink.interstitial.api.ATInterstitialListener import com.key.coolkeyboard.CoolKeyboardSkin -import com.key.coolkeyboard.firebase.RemoteConfigKey -import com.key.coolkeyboard.firebase.Sp object AdManager { - //默认的广告展示间隔时间20s - const val VALUE_SHOW_INTERVAL = 1000 * 30L - - //上次广告展示时刻 - var LAST_AD_SHOW = 0L const val type_no_cache = 0 const val type_has_cache = 1 @@ -68,7 +61,6 @@ object AdManager { place3LoadFail = true } } - override fun showSuccess() { } @@ -82,7 +74,7 @@ object AdManager { } }) - ad.load() +// ad.load() } } @@ -91,33 +83,14 @@ object AdManager { @JvmStatic fun getReadyAd(): ATInterstitial? { - - if (LAST_AD_SHOW > 0L) { - val adInterval = - Sp.getInstance(CoolKeyboardSkin.app) - .getLongValue(RemoteConfigKey.KEY_AD_SHOW_INTERVAL) - val curInterval = System.currentTimeMillis() - LAST_AD_SHOW - - Log.d( - CoolKeyboardSkin.TAG, - "-广告判断------------LAST_AD_SHOW=$LAST_AD_SHOW curInterval=${curInterval} adInterval=${adInterval}" - ) - if (curInterval < adInterval) { - Log.d( - CoolKeyboardSkin.TAG, - "-没有广告--------" - ) - return null - } - } list.shuffle() for (ad in list) { if (ad.isAdReady) { - Log.d(CoolKeyboardSkin.TAG, "-有广告------------") + Log.d(CoolKeyboardSkin.TAG, "-has AD------------") return ad } } - Log.d(CoolKeyboardSkin.TAG, "-没有广告------------") + Log.d(CoolKeyboardSkin.TAG, "-no Ad------------") return null } @@ -178,7 +151,7 @@ object AdManager { override fun onInterstitialAdShow(p0: ATAdInfo?) { Log.d(CoolKeyboardSkin.TAG, "AdShow ${p0?.showId} ") listener.showSuccess() - ad.load() +// ad.load() } override fun onInterstitialAdClose(p0: ATAdInfo?) { @@ -214,7 +187,7 @@ object AdManager { override fun showSuccess() { action.invoke(type_show_success) - LAST_AD_SHOW = System.currentTimeMillis() + } override fun showFail() { @@ -237,6 +210,7 @@ object AdManager { fun showTopOn(activity: Activity, listener: onActionListener) { showAD(activity) { type -> if (type == type_no_cache || type == type_show_close || type == type_show_fail) { + Log.d(CoolKeyboardSkin.TAG, "-showTopOn-----") listener.onAction() } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 22501a0..657c1fd 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -2,22 +2,24 @@ + + android:layout_height="match_parent" + android:background="@mipmap/bg_main"> + + app:layout_constraintTop_toTopOf="parent" /> + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_web.xml b/app/src/main/res/layout/activity_web.xml index 3e34128..c4b76de 100644 --- a/app/src/main/res/layout/activity_web.xml +++ b/app/src/main/res/layout/activity_web.xml @@ -1,14 +1,29 @@ - + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog.xml b/app/src/main/res/layout/dialog.xml index 73df51c..3fdadbb 100644 --- a/app/src/main/res/layout/dialog.xml +++ b/app/src/main/res/layout/dialog.xml @@ -1,119 +1,125 @@ - - - - - - - - - + android:layout_height="wrap_content"> + - - - - - + android:layout_marginTop="20dp" + android:layout_marginEnd="24dp" + android:src="@drawable/icon_cancel" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + app:layout_constraintTop_toBottomOf="@+id/setting_image" /> - \ No newline at end of file + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 97873d2..c33409a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -10,4 +10,5 @@ #9D9D9D #F7F4FF #F4B1C9 + #00000000 \ No newline at end of file diff --git a/keystore.properties b/keystore.properties new file mode 100644 index 0000000..dcf5e7c --- /dev/null +++ b/keystore.properties @@ -0,0 +1,6 @@ +app_name=Cool Keyboard +package_name=com.key.coolkeyboard +keystoreFile=app/coolkeyboard.jks +key_alias=coolkeyboardkey0 +key_store_password=coolkeyboard +key_password=coolkeyboard \ No newline at end of file