广告场景(开屏、view All按钮点击、详情页下载点击、收藏按钮点击、应用成功页面的返回点击)
This commit is contained in:
parent
d16b8c72b2
commit
c1abe2137f
@ -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")
|
||||
|
||||
@ -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": [],
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Privacy Policy</h1>
|
||||
<p><strong>Date:</strong> August 13, 2024</p>
|
||||
|
||||
<h1>Privacy Policy July 25, 2024</h1>
|
||||
<p>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.</p>
|
||||
|
||||
<h2>Information Collection and Use</h2>
|
||||
<p>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.</p>
|
||||
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.</p>
|
||||
<p>The app does use third-party services that may collect information used to identify you.</p>
|
||||
<p>Please refer to the privacy policy of the third-party service provider used by the
|
||||
<p>Please refer to the privacy policies of the third-party service providers used by the
|
||||
application:</p>
|
||||
<ul>
|
||||
<li>Google Play Services</li>
|
||||
@ -52,24 +53,20 @@
|
||||
<li>Firebase Crashlytics</li>
|
||||
<li>Unity</li>
|
||||
<li>AppLovin</li>
|
||||
<li>Pangle</li>
|
||||
<li>Mintegral</li>
|
||||
<li>Bigo</li>
|
||||
<li>Ironsource</li>
|
||||
<li>Vungle</li>
|
||||
</ul>
|
||||
|
||||
<h2>Log Data</h2>
|
||||
<p>We want to inform you that whenever you use our Service, in case of an error in the app, we
|
||||
<p>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.</p>
|
||||
|
||||
<h2>Cookies</h2>
|
||||
<p>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.</p>
|
||||
your device’s internal memory.</p>
|
||||
<p>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 @@
|
||||
<h2>Service Providers</h2>
|
||||
<p>We may employ third-party companies and individuals due to the following reasons:</p>
|
||||
<ul>
|
||||
<li>To facilitate our Service</li>
|
||||
<li>To provide the Service on our behalf</li>
|
||||
<li>To perform Service-related services</li>
|
||||
<li>To assist us in analyzing how our Service is used</li>
|
||||
<li>To facilitate our Service;</li>
|
||||
<li>To provide the Service on our behalf;</li>
|
||||
<li>To perform Service-related services; or</li>
|
||||
<li>To assist us in analyzing how our Service is used.</li>
|
||||
</ul>
|
||||
<p>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 @@
|
||||
<h2>Children’s Privacy</h2>
|
||||
<p>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.</p>
|
||||
|
||||
<h2>Changes to This Privacy Policy</h2>
|
||||
@ -118,6 +115,6 @@
|
||||
<p>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.</p>
|
||||
<p>If you have any questions or concerns about our Privacy Policy or data processing, please contact
|
||||
us: <a href="mailto:arbabulfb@gmail.com">saleemjeeta2@gmail.com</a>.</p>
|
||||
us: <a href="mailto:arbabulfb@gmail.com">arbabulfb@gmail.com</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -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<ATInterstitial> lodAd() {
|
||||
|
||||
@ -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() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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<Fragment> 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<Otherdata> 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<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -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<ATInterstitial> 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<Long, Unit>() {
|
||||
countDownTimer = AdManager.showWelcomeAd(this, totaltime, new Function1<Long, Unit>() {
|
||||
@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<Unit>() {
|
||||
@ -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() {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.key.coolkeyboard.callback;
|
||||
|
||||
public interface RecommendDialogCallback {
|
||||
|
||||
void onTryNow();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.key.coolkeyboard.callback;
|
||||
|
||||
public interface StepDialogCallback {
|
||||
|
||||
void onDisMiss();
|
||||
}
|
||||
@ -12,6 +12,9 @@ public interface MyDAO {
|
||||
@Query("SELECT * FROM keyboard_table")
|
||||
List<Otherdata> getAll();
|
||||
|
||||
@Query("select * from keyboard_table order by RANDOM() LIMIT 1")
|
||||
Otherdata queryRandomItem();
|
||||
|
||||
@Query("select * from keyboard_table where title =:title ")
|
||||
List<Otherdata> getsearchlist(String title);
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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}}]}}"
|
||||
}
|
||||
|
||||
@ -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<String, FirebaseRemoteConfigValue>) {
|
||||
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<RemoteConfigNew>
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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"));
|
||||
|
||||
|
||||
@ -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<ATInterstitial> adArrayList;
|
||||
|
||||
|
||||
public static void setCallback(ATInterstitial ad, Adcallback adcallback) {
|
||||
ad.setAdListener(new ATInterstitialListener() {
|
||||
@Override
|
||||
public void onInterstitialAdLoaded() {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoaded--------" + ad.mPlacementId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdLoadFail(AdError adError) {
|
||||
// Log.e("zzj", "---------onInterstitialAdLoadFail--------" + adError.getFullErrorInfo());
|
||||
adcallback.onShowFail(adError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClicked(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdShow(ATAdInfo atAdInfo) {
|
||||
ad.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdClose(ATAdInfo atAdInfo) {
|
||||
adcallback.onAdHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoStart(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoEnd(ATAdInfo atAdInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterstitialAdVideoError(AdError adError) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static ATInterstitial onCache(List<ATInterstitial> list) {
|
||||
Collections.shuffle(list);
|
||||
for (ATInterstitial ad : list) {
|
||||
if (ad.isAdReady()) {
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<ATInterstitial> getAllAd() {
|
||||
if (adArrayList == null) {
|
||||
adArrayList = new ArrayList<>();
|
||||
adArrayList.add(createAd(one_AD, 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) {
|
||||
|
||||
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,22 +2,24 @@
|
||||
<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/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/activity_main"
|
||||
android:background="@color/black"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:background="@mipmap/bg_main"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_main">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/main_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginBottom="6dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/main_tabLayout"
|
||||
android:layout_marginBottom="6dp" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/main_tabLayout"
|
||||
@ -28,5 +30,17 @@
|
||||
app:tabIndicatorHeight="0dp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminateTint="@color/pre_load_color"
|
||||
android:src="@color/pre_load_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -1,14 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout 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/activity_web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".activity.WebActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/bg_main_setting"
|
||||
android:padding="8dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:src="@drawable/icon_back" />
|
||||
</FrameLayout>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/web"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
@ -1,119 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dialog_bg">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/setting_image"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@mipmap/setting_hint_image"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/setting_cancel"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:src="@drawable/icon_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setting_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/setting_hint"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="29sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/setting_image" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/step1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:background="@drawable/step_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/setting_hint">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/step1_image"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/icon_check"
|
||||
app:layout_constraintBottom_toBottomOf="@id/step1_text"
|
||||
app:layout_constraintStart_toEndOf="@id/step1_text"
|
||||
app:layout_constraintTop_toTopOf="@id/step1_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/step1_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/step1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:id="@+id/setting_image"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@mipmap/setting_hint_image"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/step2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:background="@drawable/step_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/step1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/step2_image"
|
||||
android:id="@+id/setting_cancel"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/icon_check"
|
||||
app:layout_constraintBottom_toBottomOf="@id/step2_text"
|
||||
app:layout_constraintStart_toEndOf="@id/step2_text"
|
||||
app:layout_constraintTop_toTopOf="@id/step2_text" />
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:src="@drawable/icon_cancel"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/step2_text"
|
||||
android:id="@+id/setting_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/step2"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/setting_hint"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textSize="29sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
app:layout_constraintTop_toBottomOf="@+id/setting_image" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/step1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:background="@drawable/step_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/setting_hint">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/step1_image"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/icon_check"
|
||||
app:layout_constraintBottom_toBottomOf="@id/step1_text"
|
||||
app:layout_constraintStart_toEndOf="@id/step1_text"
|
||||
app:layout_constraintTop_toTopOf="@id/step1_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/step1_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/step1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/step2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:background="@drawable/step_selector"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/step1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/step2_image"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:background="@drawable/icon_check"
|
||||
app:layout_constraintBottom_toBottomOf="@id/step2_text"
|
||||
app:layout_constraintStart_toEndOf="@id/step2_text"
|
||||
app:layout_constraintTop_toTopOf="@id/step2_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/step2_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/step2"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</FrameLayout>
|
||||
@ -10,4 +10,5 @@
|
||||
<color name="version">#9D9D9D</color>
|
||||
<color name="showkey_edit_hint_color">#F7F4FF</color>
|
||||
<color name="showkey_edit_text_color">#F4B1C9</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
</resources>
|
||||
6
keystore.properties
Normal file
6
keystore.properties
Normal file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user