更新ui与Top on广告 1.0.2(3)

This commit is contained in:
zhouzhijia 2024-08-13 14:32:17 +08:00
parent 8bfb74f7bc
commit d16b8c72b2
35 changed files with 1256 additions and 123 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ local.properties
app/release/coolkeyboard_v1.0.1(2)_07_26_15_20-release.apk
app/release/coolkeyboard_v1.0.1(2)_07_26_15_45-release.aab
app/release/coolkeyboard_v1.0.1(2)_07_26_16_14-release.aab
app/release/coolkeyboard_v1.0.2(3)_08_13_14_26-release.aab

View File

@ -1,9 +1,10 @@
import java.util.Date
import java.text.SimpleDateFormat
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id ("kotlin-kapt")
id("kotlin-kapt")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
}
@ -16,15 +17,18 @@ android {
applicationId = "com.key.coolkeyboard"
minSdk = 23
targetSdk = 34
versionCode = 2
versionName = "1.0.1"
setProperty("archivesBaseName", "coolkeyboard_v" + versionName + "(${versionCode})_$timestamp")
versionCode = 3
versionName = "1.0.2"
setProperty(
"archivesBaseName",
"coolkeyboard_v" + versionName + "(${versionCode})_$timestamp"
)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isShrinkResources =true
isShrinkResources = true
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
@ -36,7 +40,7 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures{
buildFeatures {
viewBinding = true
}
}
@ -62,14 +66,14 @@ dependencies {
implementation("androidx.room:room-guava:$room_version")
testImplementation("androidx.room:room-testing:$room_version")
implementation("androidx.room:room-paging:$room_version")
implementation ("io.github.youth5201314:banner:2.2.3")
implementation("io.github.youth5201314:banner:2.2.3")
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-config")
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
//Anythink (Necessary)
@ -107,8 +111,8 @@ dependencies {
//Pangle
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
implementation( "com.pangle.global:ads-sdk:6.0.0.3")
implementation( "com.google.android.gms:play-services-ads-identifier:18.0.1")
implementation("com.pangle.global:ads-sdk:6.0.0.3")
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//Mintegral
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")

View File

@ -814,7 +814,8 @@
}
]
},
{"className": "festival","list": [
{"className": "festival",
"list": [
{
"preview": "https://resource-sg-public.lux-ad.com/keyboard/d3ce935f39cfa4bf877370e7166523e0.webp",
"thumb": "https://resource-sg-public.lux-ad.com/keyboard/f9b79cbc3b678e9a7e63d334ea66fc7c.jpg",

View File

@ -26,11 +26,13 @@
padding-left: 20px;
}
</style>
</head>
<body>
<h1>Privacy Policy</h1>
<p><strong>Date:</strong> June 26, 2024</p>
<p><strong>Date:</strong> August 13, 2024</p>
<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
@ -116,6 +118,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:saleemjeeta2@gmail.com">saleemjeeta2@gmail.com</a>.</p>
us: <a href="mailto:arbabulfb@gmail.com">saleemjeeta2@gmail.com</a>.</p>
</body>
</html>

View File

@ -13,7 +13,10 @@ 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;
@ -35,6 +38,7 @@ public class CoolKeyboardSkin extends Application {
public static final String PRE_NAME = "Mypre";
public static final String PRE_KEY = "isinsert";
public static final String PRE_KEY_INIT = "isinit";
public static final String TAG = "zzj";
public static List<Otherdata> alllist = new ArrayList<>();
public static List<Otherdata> lovelist = new ArrayList<>();
public static List<Otherdata> coollist = new ArrayList<>();
@ -152,7 +156,6 @@ public class CoolKeyboardSkin extends Application {
}
private void initSdk() {
// ATSDK.integrationChecking(context);
ATSDK.init(context, TOP_ID, TOP_KEY);
@ -160,12 +163,14 @@ public class CoolKeyboardSkin extends Application {
ads = Mytool.getAllAd();
// ATSDK.setNetworkLogDebug(true);
// ATDebuggerUITest.showDebuggerUI(context,TOP_DEBUG);
RemoteConfigNew configNew = new RemoteConfigNew();
configNew.init(app);
AdManager.loadAllAd();
}
public static List<ATInterstitial> lodAd() {
return ads;
return null;
}

View File

@ -27,13 +27,16 @@ import com.key.coolkeyboard.databinding.ActivityAllBinding;
import com.key.coolkeyboard.fragment.AllFragment;
import com.key.coolkeyboard.tool.Adcallback;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
import com.vungle.ads.Ad;
import java.util.ArrayList;
import java.util.List;
public class AllActivity extends AppCompatActivity {
ActivityAllBinding binding;
private String[] listtext = {"ALL", "Love", "Cool", "Cute", "Neon", "Festival", "Gravity", "Aesthetic", "Super Theme"};
private String[] listtext = {"ALL", "Aesthetic", "Cool", "Cute", "Festival", "Love", "Neon", "Shining", "Super Theme"};
private PageAdapter adapter;
private List<Fragment> list = new ArrayList<>();
private TextView tabtext;
@ -54,7 +57,8 @@ public class AllActivity extends AppCompatActivity {
return insets;
});
ads = CoolKeyboardSkin.lodAd();
AdManager.loadAllAd();
// ads = CoolKeyboardSkin.lodAd();
initView();
initEvent();
@ -62,40 +66,52 @@ 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 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();
// showAd();
AdManager.showTopOn(AllActivity.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
}
});
binding.allSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(AllActivity.this, SerachActivity.class);
startActivity(intent);
AdManager.showTopOn(AllActivity.this, new onActionListener() {
@Override
public void onAction() {
Intent intent = new Intent(AllActivity.this, SerachActivity.class);
startActivity(intent);
}
});
}
});
}
@ -163,6 +179,12 @@ public class AllActivity extends AppCompatActivity {
@Override
public void onBackPressed() {
super.onBackPressed();
showAd();
// showAd();
AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
}
});
}
}

View File

@ -46,10 +46,13 @@ import com.key.coolkeyboard.adapter.PageAdapter;
import com.key.coolkeyboard.data.MydataBase;
import com.key.coolkeyboard.data.Otherdata;
import com.key.coolkeyboard.databinding.ActivityMainBinding;
import com.key.coolkeyboard.fragment.DownloadFragment;
import com.key.coolkeyboard.fragment.LikeFragment;
import com.key.coolkeyboard.fragment.MainFragment;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.tool.StaticValue;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
import java.io.File;
import java.util.ArrayList;
@ -80,9 +83,15 @@ public class MainActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
AdManager.loadAllAd();
initData();
showDg();
if (Mytool.isStep1() && Mytool.isStep2()) {
dialog.dismiss();
// Log.e("zzj", "---step1---" + Mytool.isStep1() + "---step2---" + Mytool.isStep2());
}
}
private void showDg() {
@ -111,6 +120,12 @@ public class MainActivity extends AppCompatActivity {
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) {
@ -178,8 +193,15 @@ public class MainActivity extends AppCompatActivity {
});
toastDialog.setCanceledOnTouchOutside(false);
toastDialog.findViewById(R.id.toast_dialog_apply).setOnClickListener(v -> {
downLoad();
AdManager.showTopOn(MainActivity.this, new onActionListener() {
@Override
public void onAction() {
downLoad();
}
});
});
toastDialog.findViewById(R.id.toast_dialog_cancel).setOnClickListener(new View.OnClickListener() {
@ -193,7 +215,10 @@ public class MainActivity extends AppCompatActivity {
File cacheDir = this.getCacheDir();
unzipPath = cacheDir + "/" + otherdata.getTitle();
toastDialog.show();
if (toastDialog != null) {
toastDialog.show();
}
toastDialog.getWindow().setAttributes(lp);
}
@ -258,6 +283,7 @@ public class MainActivity extends AppCompatActivity {
list.add(new MainFragment());
list.add(new LikeFragment());
list.add(new DownloadFragment());
PageAdapter adapter = new PageAdapter(getSupportFragmentManager(), list);
binding.mainViewpager.setAdapter(adapter);
binding.mainTabLayout.setupWithViewPager(binding.mainViewpager);
@ -289,6 +315,9 @@ public class MainActivity extends AppCompatActivity {
case 1:
tab.setIcon(position == 1 ? R.drawable.like_check : R.drawable.like_uncheck);
break;
case 2:
tab.setIcon(position == 2 ? R.drawable.down_check : R.drawable.down_uncheck);
break;
default:
break;
}
@ -307,6 +336,9 @@ public class MainActivity extends AppCompatActivity {
case 1:
tab.setIcon(R.drawable.like_uncheck);
break;
case 2:
tab.setIcon(R.drawable.down_uncheck);
break;
default:
break;
}
@ -318,6 +350,12 @@ public class MainActivity extends AppCompatActivity {
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

View File

@ -32,6 +32,8 @@ import com.key.coolkeyboard.databinding.ActivityPreviewBinding;
import com.key.coolkeyboard.tool.Adcallback;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.tool.StaticValue;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
import java.io.File;
import java.util.List;
@ -56,8 +58,8 @@ public class PreviewActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
ads = CoolKeyboardSkin.lodAd();
AdManager.loadAllAd();
// ads = CoolKeyboardSkin.lodAd();
Intent intent = getIntent();
preview = intent.getStringExtra(StaticValue.KEY_PRE);
@ -68,27 +70,27 @@ 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 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();
@ -102,7 +104,13 @@ public class PreviewActivity extends AppCompatActivity {
binding.previewBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
}
});
@ -116,7 +124,12 @@ public class PreviewActivity extends AppCompatActivity {
binding.previewIslike.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
checkLike();
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
checkLike();
}
});
}
});
@ -152,6 +165,10 @@ public class PreviewActivity extends AppCompatActivity {
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);
binding.downloadText.setVisibility(View.GONE);
@ -160,6 +177,7 @@ public class PreviewActivity extends AppCompatActivity {
Mytool.unZip(this, unzipPath, resource, (successful1, resDirPath) -> {
if (successful1) {
StaticValue.PATH = resDirPath;
otherdata.setPath(resDirPath);
otherdata.setDownloaded(true);
Mytool.runIO(new Runnable() {
@Override
@ -167,7 +185,13 @@ public class PreviewActivity extends AppCompatActivity {
MydataBase.getInstance().myDAO().update(otherdata);
}
});
showAd();
AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
showKey();
}
});
// showAd();
} else {
Toast.makeText(PreviewActivity.this, getString(R.string.text_zip_failed), Toast.LENGTH_SHORT).show();
}
@ -183,6 +207,7 @@ public class PreviewActivity extends AppCompatActivity {
}
private void initData() {
binding.download.setSelected(false);
binding.previewTitle.setTypeface(Typeface.createFromAsset(getAssets(), "Baumans-Regular.ttf"));
binding.previewTitle.setText(name);
binding.imageProgress.setVisibility(View.VISIBLE);
@ -205,6 +230,12 @@ public class PreviewActivity extends AppCompatActivity {
binding.downloadText.setText(R.string.download_apply);
binding.downloadImage.setVisibility(View.GONE);
}
String path = StaticValue.PATH;
if (path.equals(otherdata.getPath())) {
binding.download.setSelected(true);
binding.downloadText.setText(R.string.download_text_using);
binding.download.setEnabled(false);
}
}
}
});
@ -230,4 +261,14 @@ public class PreviewActivity extends AppCompatActivity {
}
@Override
public void onBackPressed() {
super.onBackPressed();
AdManager.showTopOn(PreviewActivity.this, new onActionListener() {
@Override
public void onAction() {
}
});
}
}

View File

@ -25,6 +25,8 @@ import com.key.coolkeyboard.databinding.ActivitySerachBinding;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.tool.SpaceItem;
import com.key.coolkeyboard.tool.StaticValue;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
import java.util.ArrayList;
import java.util.List;
@ -47,7 +49,7 @@ public class SerachActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
AdManager.loadAllAd();
Intent intent = getIntent();
text = intent.getStringExtra(StaticValue.KEY_TEXT);
@ -63,7 +65,13 @@ public class SerachActivity extends AppCompatActivity {
binding.searchBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
AdManager.showTopOn(SerachActivity.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
// finish();
}
});
binding.searchSearch.setOnClickListener(new View.OnClickListener() {
@ -134,4 +142,15 @@ public class SerachActivity extends AppCompatActivity {
super.onPause();
hideKeyView();
}
@Override
public void onBackPressed() {
super.onBackPressed();
AdManager.showTopOn(this, new onActionListener() {
@Override
public void onAction() {
}
});
}
}

View File

@ -20,6 +20,7 @@ import com.key.coolkeyboard.CoolKeyboardSkin;
import com.key.coolkeyboard.R;
import com.key.coolkeyboard.databinding.ActivitySettingBinding;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.topon.AdManager;
public class SettingActivity extends AppCompatActivity {
ActivitySettingBinding binding;
@ -38,7 +39,7 @@ public class SettingActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
AdManager.loadAllAd();
binding.settingTitle.setTypeface(Typeface.createFromAsset(getAssets(), "Baumans-Regular.ttf"));
@ -50,12 +51,6 @@ public class SettingActivity extends AppCompatActivity {
binding.step1.setSelected(step1);
binding.step2.setSelected(step2);
intImage();
if (step1 && step2) {
Intent settingIntent = new Intent(context, SettingActivity.class);
settingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(settingIntent);
finish();
}
}
};
registerReceiver(broadcastReceiver, new IntentFilter(Intent.ACTION_INPUT_METHOD_CHANGED));

View File

@ -10,10 +10,13 @@ import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.key.coolkeyboard.R;
import com.key.coolkeyboard.databinding.ActivityShowKeyboardBinding;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
public class ShowKeyboardActivity extends AppCompatActivity {
ActivityShowKeyboardBinding binding;
@ -30,8 +33,18 @@ public class ShowKeyboardActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
binding.showkeyBack.setOnClickListener(v -> finish());
AdManager.loadAllAd();
binding.showkeyBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AdManager.showTopOn(ShowKeyboardActivity.this, new onActionListener() {
@Override
public void onAction() {
finish();
}
});
}
});
binding.showkeyTitle.setTypeface(Typeface.createFromAsset(getAssets(), "Baumans-Regular.ttf"));
}
@ -55,4 +68,15 @@ public class ShowKeyboardActivity extends AppCompatActivity {
imm.hideSoftInputFromWindow(binding.showkeyEdit.getWindowToken(), 0);
binding.showkeyEdit.clearFocus();
}
@Override
public void onBackPressed() {
super.onBackPressed();
AdManager.showTopOn(ShowKeyboardActivity.this, new onActionListener() {
@Override
public void onAction() {
}
});
}
}

View File

@ -19,12 +19,18 @@ 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;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
public class SplashActivity extends AppCompatActivity {
ActivitySplashBinding binding;
private CountDownTimer countDownTimer;
@ -46,31 +52,50 @@ public class SplashActivity extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
ads = CoolKeyboardSkin.lodAd();
AdManager.loadAllAd();
// ads = CoolKeyboardSkin.lodAd();
binding.splashTitle.setTypeface(Typeface.createFromAsset(getAssets(), "Baumans-Regular.ttf"));
countDownTimer = new CountDownTimer(10100, 100) {
countDownTimer = AdManager.showWelcomeAd(this, 10100, new Function1<Long, Unit>() {
@Override
public void onTick(long l) {
i++;
binding.splashPg.setProgress(i);
if (!isAlreadyShow) {
showAd(false);
}
public Unit invoke(Long aLong) {
Float percentage = 100 - (float) aLong / 10100 * 100;
// round = Integer.parseInt(String.valueOf(percentage));
binding.splashPg.setProgress(percentage);
// i++;
// binding.splashPg.setProgress(i);
return null;
}
}, new Function0<Unit>() {
@Override
public void onFinish() {
if (!isAlreadyShow) {
showAd(true);
}
public Unit invoke() {
starMainactivity();
return null;
}
};
});
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();
}

View File

@ -24,6 +24,9 @@ public interface MyDAO {
@Query("SELECT * FROM keyboard_table WHERE islike = :islike")
List<Otherdata> getlikelist(boolean islike);
@Query("SELECT * FROM keyboard_table WHERE isDownloaded = :isdownload")
List<Otherdata> getdownloadlist(boolean isdownload);
@Query("SELECT * FROM keyboard_table WHERE title LIKE '%' || :title || '%'")
List<Otherdata> getSearchData(String title);

View File

@ -4,6 +4,7 @@ import androidx.room.Entity;
import androidx.room.PrimaryKey;
import com.key.coolkeyboard.CoolKeyboardSkin;
import com.pgl.ssdk.S;
import java.util.ArrayList;
import java.util.List;
@ -20,6 +21,15 @@ public class Otherdata {
public String zipUrl;
public Boolean islike;
public Boolean isDownloaded;
public String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Boolean getDownloaded() {
return isDownloaded;

View File

@ -0,0 +1,245 @@
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}}]}}"
}

View File

@ -0,0 +1,141 @@
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()
}
}
}
}
}

View File

@ -0,0 +1,43 @@
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);
}
}

View File

@ -49,7 +49,7 @@ public class AllFragment extends Fragment {
thumAdapter = new ThumAdapter(requireContext(), CoolKeyboardSkin.getNeonlist());
} else if (tabargs.equals("Festival")) {
thumAdapter = new ThumAdapter(requireContext(), CoolKeyboardSkin.getFestivallist());
} else if (tabargs.equals("Gravity")) {
} else if (tabargs.equals("Shining")) {
thumAdapter = new ThumAdapter(requireContext(), CoolKeyboardSkin.getGravitylist());
} else if (tabargs.equals("Aesthetic")) {
thumAdapter = new ThumAdapter(requireContext(), CoolKeyboardSkin.getAestheticlist());

View File

@ -0,0 +1,75 @@
package com.key.coolkeyboard.fragment;
import android.graphics.Typeface;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.key.coolkeyboard.R;
import com.key.coolkeyboard.adapter.ThumAdapter;
import com.key.coolkeyboard.data.MydataBase;
import com.key.coolkeyboard.data.Otherdata;
import com.key.coolkeyboard.databinding.FragmentDownloadBinding;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.tool.SpaceItem;
import java.util.ArrayList;
import java.util.List;
public class DownloadFragment extends Fragment {
FragmentDownloadBinding binding;
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
private List<Otherdata> likelist = new ArrayList<>();
private ThumAdapter thumAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
binding = FragmentDownloadBinding.inflate(getLayoutInflater());
binding.downTitle.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "Baumans-Regular.ttf"));
binding.downText.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "Baumans-Regular.ttf"));
initData();
binding.downRv.addItemDecoration(spaceItem);
return binding.getRoot();
}
private void initData() {
Mytool.runIO(new Runnable() {
@Override
public void run() {
likelist = MydataBase.getInstance().myDAO().getdownloadlist(true);
requireActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (likelist.isEmpty()) {
binding.downHintImage.setVisibility(View.VISIBLE);
binding.downText.setVisibility(View.VISIBLE);
} else {
binding.downHintImage.setVisibility(View.GONE);
binding.downText.setVisibility(View.GONE);
}
thumAdapter = new ThumAdapter(requireContext(), likelist);
binding.downRv.setLayoutManager(new GridLayoutManager(requireContext(), 2));
binding.downRv.setAdapter(thumAdapter);
}
});
}
});
}
@Override
public void onResume() {
super.onResume();
initData();
}
}

View File

@ -34,6 +34,8 @@ import com.key.coolkeyboard.databinding.FragmentMainBinding;
import com.key.coolkeyboard.tool.Mytool;
import com.key.coolkeyboard.tool.SpaceItem;
import com.key.coolkeyboard.tool.StaticValue;
import com.key.coolkeyboard.topon.AdManager;
import com.key.coolkeyboard.topon.onActionListener;
import com.youth.banner.adapter.BannerImageAdapter;
import com.youth.banner.holder.BannerImageHolder;
import com.youth.banner.indicator.CircleIndicator;
@ -78,10 +80,15 @@ public class MainFragment extends Fragment {
binding.rateCons.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = "https://play.google.com/store/apps/details?id=com.key.coolkeyboard";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
try {
String url = "https://play.google.com/store/apps/details?id=com.key.coolkeyboard";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
} catch (Exception e) {
}
}
});
@ -109,24 +116,35 @@ public class MainFragment extends Fragment {
binding.minSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
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();
}
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();
}
}
});
}
});
binding.mainViewAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(requireContext(), AllActivity.class);
startActivity(intent);
AdManager.showTopOn(requireActivity(), new onActionListener() {
@Override
public void onAction() {
Intent intent = new Intent(requireContext(), AllActivity.class);
startActivity(intent);
}
});
}
});

View File

@ -105,6 +105,7 @@ public class MyKeyboard extends KeyboardView {
config.init();
float texsize = Mytool.spToPpx(20f, this.getContext());
mPaint.setTextSize(texsize);
setPreviewEnabled(false);
}
public void updateConfigView(Context con) {

View File

@ -62,9 +62,9 @@ public class Mytool {
private static InputMethodManager methodManager = (InputMethodManager) CoolKeyboardSkin.app.getSystemService(Context.INPUT_METHOD_SERVICE);
private static ExecutorService executorService;
private static final String one_AD = "n66a23b25d78ba";
private static final String two_Ad = "n66a23b25ada67";
private static final String three_ad = "n66a23b257ca0e";
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;

View File

@ -7,4 +7,5 @@ public class StaticValue {
public static String PATH = "";
public static String KEY_TEXT = "";
public static String KEY_ISMAINSH = "";
public static String KEY_ISshow = "";
}

View File

@ -0,0 +1,11 @@
package com.key.coolkeyboard.topon
interface AdListener {
fun loadFail(placeId: String)
fun showSuccess()
fun showFail()
fun showClose()
}

View File

@ -0,0 +1,244 @@
package com.key.coolkeyboard.topon
import android.app.Activity
import android.os.CountDownTimer
import android.util.Log
import com.anythink.core.api.ATAdInfo
import com.anythink.core.api.AdError
import com.anythink.interstitial.api.ATInterstitial
import com.anythink.interstitial.api.ATInterstitialListener
import com.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
const val type_show_success = 2
const val type_show_close = 3
const val type_show_fail = 4
/**
n66b1d3d019590
n66b1d3cfebd3c
n66b1d3cfc4f3b
*/
const val place1Id = "n66a23b25d78ba"
const val place2Id = "n66a23b25ada67"
const val place3Id = "n66a23b257ca0e"
var place1LoadFail = false
var place2LoadFail = false
var place3LoadFail = false
val list = mutableListOf<ATInterstitial>()
@JvmStatic
fun loadAllAd() {
if (list.size <= 0) {
val mInterstitialAd1 = ATInterstitial(CoolKeyboardSkin.app, place1Id)
val mInterstitialAd2 = ATInterstitial(CoolKeyboardSkin.app, place2Id)
val mInterstitialAd3 = ATInterstitial(CoolKeyboardSkin.app, place3Id)
list.add(mInterstitialAd1)
list.add(mInterstitialAd2)
list.add(mInterstitialAd3)
}
for (ad in list) {
if (!ad.isAdReady) {
setCallBack(ad, object : AdListener {
override fun loadFail(placeId: String) {
if (placeId == place1Id) {
place1LoadFail = true
}
if (placeId == place2Id) {
place2LoadFail = true
}
if (placeId == place3Id) {
place3LoadFail = true
}
}
override fun showSuccess() {
}
override fun showFail() {
}
override fun showClose() {
}
})
ad.load()
}
}
}
@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, "-有广告------------")
return ad
}
}
Log.d(CoolKeyboardSkin.TAG, "-没有广告------------")
return null
}
@JvmStatic
fun showWelcomeAd(
activity: Activity,
totalTim: Long,
countAction: (Long) -> Unit,
goMain:()->Unit
): CountDownTimer {
var alreadyShow = false
var timer = object : CountDownTimer(totalTim, 100) {
override fun onTick(millisUntilFinished: Long) {
countAction.invoke(millisUntilFinished)
if (!alreadyShow) {
showAD(activity) {
if (it == type_has_cache) {
alreadyShow = true
}
if (it == type_show_close || it == type_show_fail) {
goMain.invoke()
}
}
}
}
override fun onFinish() {
if (!alreadyShow) {
showAD(activity) {
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
goMain.invoke()
}
}
}
}
}
return timer
}
private fun setCallBack(ad: ATInterstitial, listener: AdListener) {
ad.setAdListener(object : ATInterstitialListener {
override fun onInterstitialAdLoaded() {
Log.d(CoolKeyboardSkin.TAG, "LoadLoaded ${ad.mPlacementId}")
}
override fun onInterstitialAdLoadFail(p0: AdError?) {
Log.d(CoolKeyboardSkin.TAG, "LoadFail:${p0?.code} ${p0?.desc}")
}
override fun onInterstitialAdClicked(p0: ATAdInfo?) {
}
override fun onInterstitialAdShow(p0: ATAdInfo?) {
Log.d(CoolKeyboardSkin.TAG, "AdShow ${p0?.showId} ")
listener.showSuccess()
ad.load()
}
override fun onInterstitialAdClose(p0: ATAdInfo?) {
listener.showClose()
}
override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
}
override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
}
override fun onInterstitialAdVideoError(p0: AdError?) {
listener.showFail()
}
})
}
@JvmStatic
private fun showAD(activity: Activity, action: (type: Int) -> Unit) {
val readyAd = getReadyAd()
if (readyAd != null) {
Log.d(CoolKeyboardSkin.TAG, "readyAd ${readyAd.mPlacementId} ")
action.invoke(type_has_cache)
setCallBack(readyAd, object : AdListener {
override fun loadFail(placeId: String) {
}
override fun showSuccess() {
action.invoke(type_show_success)
LAST_AD_SHOW = System.currentTimeMillis()
}
override fun showFail() {
action.invoke(type_show_fail)
}
override fun showClose() {
action.invoke(type_show_close)
}
})
readyAd.show(activity)
} else {
action.invoke(type_no_cache)
}
}
@JvmStatic
fun showTopOn(activity: Activity, listener: onActionListener) {
showAD(activity) { type ->
if (type == type_no_cache || type == type_show_close || type == type_show_fail) {
listener.onAction()
}
}
}
}

View File

@ -0,0 +1,6 @@
package com.key.coolkeyboard.topon;
public interface onActionListener {
void onAction();
}

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.056,5.333C15.136,5.333 17.691,7.563 18.166,10.482C20.309,10.635 22,12.406 22,14.569C22,16.729 20.314,18.498 18.175,18.655C18.155,18.663 18.133,18.666 18.112,18.666H6.804C6.782,18.666 6.76,18.662 6.739,18.654C4.091,18.473 2,16.287 2,13.616C2,10.997 4.012,8.844 6.587,8.591C7.627,6.653 9.686,5.333 12.056,5.333ZM12.743,10.051H11.312C11.265,10.051 11.219,10.069 11.186,10.102C11.153,10.136 11.134,10.181 11.134,10.228V13.395H9.441C9.318,13.395 9.218,13.494 9.218,13.616C9.218,13.673 9.24,13.728 9.279,13.769L11.854,16.459C11.939,16.548 12.081,16.552 12.17,16.468C12.173,16.465 12.176,16.462 12.178,16.459L14.753,13.769C14.838,13.68 14.835,13.54 14.745,13.456C14.704,13.417 14.649,13.395 14.591,13.395H12.921V10.228C12.921,10.181 12.903,10.136 12.869,10.102C12.835,10.069 12.79,10.051 12.743,10.051Z"
android:fillColor="#1B1B1B"/>
<group>
<clip-path
android:pathData="M0,3.333h24v17h-24zM12.056,5.333C15.136,5.333 17.691,7.563 18.166,10.482C20.309,10.635 22,12.406 22,14.569C22,16.729 20.314,18.498 18.175,18.655C18.155,18.663 18.133,18.666 18.112,18.666H6.804C6.782,18.666 6.76,18.662 6.739,18.654C4.091,18.473 2,16.287 2,13.616C2,10.997 4.012,8.844 6.587,8.591C7.627,6.653 9.686,5.333 12.056,5.333ZM12.743,10.051H11.312C11.265,10.051 11.219,10.069 11.186,10.102C11.153,10.136 11.134,10.181 11.134,10.228V13.395H9.441C9.318,13.395 9.218,13.494 9.218,13.616C9.218,13.673 9.24,13.728 9.279,13.769L11.854,16.459C11.939,16.548 12.081,16.552 12.17,16.468C12.173,16.465 12.176,16.462 12.178,16.459L14.753,13.769C14.838,13.68 14.835,13.54 14.745,13.456C14.704,13.417 14.649,13.395 14.591,13.395H12.921V10.228C12.921,10.181 12.903,10.136 12.869,10.102C12.835,10.069 12.79,10.051 12.743,10.051Z"/>
<path
android:pathData="M18.166,10.482L16.686,10.724L16.877,11.894L18.06,11.978L18.166,10.482ZM18.175,18.655L18.066,17.159L17.855,17.174L17.657,17.247L18.175,18.655ZM18.112,18.666L18.112,20.166L18.112,20.166L18.112,18.666ZM6.804,18.666L6.804,17.166L6.803,17.166L6.804,18.666ZM6.739,18.654L7.283,17.256L7.07,17.173L6.841,17.158L6.739,18.654ZM6.587,8.591L6.734,10.084L7.531,10.006L7.909,9.301L6.587,8.591ZM11.134,13.395V14.895H12.634V13.395H11.134ZM9.218,13.616L7.718,13.616L7.718,13.616L9.218,13.616ZM9.279,13.769L8.196,14.806L8.196,14.806L9.279,13.769ZM11.854,16.459L12.938,15.422L12.938,15.422L11.854,16.459ZM12.17,16.468L11.143,15.375L11.143,15.375L12.17,16.468ZM12.178,16.459L11.095,15.422L11.095,15.422L12.178,16.459ZM14.753,13.769L15.837,14.806L15.837,14.806L14.753,13.769ZM14.745,13.456L13.718,14.549L13.718,14.549L14.745,13.456ZM14.591,13.395L14.591,11.895H14.591V13.395ZM12.921,13.395H11.421V14.895H12.921V13.395ZM12.056,6.833C14.399,6.833 16.328,8.528 16.686,10.724L19.647,10.241C19.053,6.598 15.873,3.833 12.056,3.833V6.833ZM18.06,11.978C19.435,12.076 20.5,13.21 20.5,14.569H23.5C23.5,11.602 21.184,9.193 18.273,8.986L18.06,11.978ZM20.5,14.569C20.5,15.926 19.438,17.059 18.066,17.159L18.285,20.151C21.19,19.938 23.5,17.532 23.5,14.569H20.5ZM17.657,17.247C17.802,17.194 17.956,17.166 18.111,17.166L18.112,20.166C18.31,20.166 18.507,20.131 18.694,20.063L17.657,17.247ZM18.112,17.166H6.804V20.166H18.112V17.166ZM6.803,17.166C6.967,17.166 7.13,17.197 7.283,17.256L6.195,20.052C6.39,20.128 6.597,20.167 6.806,20.166L6.803,17.166ZM6.841,17.158C4.964,17.029 3.5,15.481 3.5,13.616H0.5C0.5,17.092 3.219,19.917 6.637,20.151L6.841,17.158ZM3.5,13.616C3.5,11.788 4.908,10.263 6.734,10.084L6.441,7.099C3.116,7.425 0.5,10.207 0.5,13.616H3.5ZM7.909,9.301C8.696,7.834 10.256,6.833 12.056,6.833V3.833C9.117,3.833 6.559,5.472 5.266,7.882L7.909,9.301ZM12.743,8.551H11.312V11.551H12.743V8.551ZM11.312,8.551C10.872,8.551 10.446,8.724 10.13,9.037L12.242,11.168C11.993,11.415 11.658,11.551 11.312,11.551V8.551ZM10.13,9.037C9.814,9.351 9.634,9.779 9.634,10.228H12.634C12.634,10.583 12.491,10.921 12.242,11.168L10.13,9.037ZM9.634,10.228V13.395H12.634V10.228H9.634ZM11.134,11.895H9.441V14.895H11.134V11.895ZM9.441,11.895C8.502,11.895 7.718,12.653 7.718,13.616H10.718C10.718,14.335 10.134,14.895 9.441,14.895V11.895ZM7.718,13.616C7.718,14.061 7.89,14.487 8.196,14.806L10.363,12.732C10.589,12.969 10.718,13.285 10.718,13.616L7.718,13.616ZM8.196,14.806L10.771,17.497L12.938,15.422L10.363,12.732L8.196,14.806ZM10.771,17.496C11.425,18.18 12.509,18.208 13.198,17.56L11.143,15.375C11.652,14.896 12.453,14.916 12.938,15.422L10.771,17.496ZM13.198,17.56C13.219,17.54 13.241,17.518 13.262,17.496L11.095,15.422C11.111,15.406 11.127,15.39 11.143,15.375L13.198,17.56ZM13.262,17.497L15.837,14.806L13.67,12.732L11.095,15.422L13.262,17.497ZM15.837,14.806C16.499,14.115 16.469,13.018 15.773,12.363L13.718,14.549C13.2,14.062 13.178,13.246 13.67,12.732L15.837,14.806ZM15.773,12.363C15.452,12.061 15.029,11.895 14.591,11.895L14.591,14.895C14.268,14.895 13.955,14.772 13.718,14.549L15.773,12.363ZM14.591,11.895H12.921V14.895H14.591V11.895ZM14.421,13.395V10.228H11.421V13.395H14.421ZM14.421,10.228C14.421,9.779 14.241,9.351 13.925,9.037L11.813,11.168C11.564,10.921 11.421,10.583 11.421,10.228H14.421ZM13.925,9.037C13.609,8.724 13.184,8.551 12.743,8.551V11.551C12.396,11.551 12.062,11.415 11.813,11.168L13.925,9.037Z"
android:fillColor="#1B1B1B"/>
</group>
<path
android:pathData="M12.726,10.067H11.296C11.248,10.067 11.203,10.086 11.169,10.119C11.136,10.153 11.117,10.198 11.117,10.245V13.412H9.425C9.301,13.412 9.201,13.511 9.201,13.633C9.201,13.69 9.223,13.745 9.263,13.786L11.837,16.476C11.922,16.565 12.064,16.569 12.153,16.484C12.156,16.482 12.159,16.479 12.162,16.476L14.737,13.786C14.822,13.697 14.818,13.557 14.728,13.473C14.687,13.434 14.632,13.412 14.575,13.412H12.905V10.245C12.905,10.198 12.886,10.153 12.852,10.119C12.819,10.086 12.773,10.067 12.726,10.067Z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M18.112,20.167L6.806,20.167L6.805,20.167C6.707,20.167 6.61,20.159 6.514,20.142C3.154,19.85 0.5,17.052 0.5,13.618C0.5,10.479 2.718,7.871 5.664,7.222C7.045,5.178 9.394,3.834 12.056,3.834C15.493,3.834 18.413,6.075 19.394,9.181C21.757,9.842 23.5,11.996 23.5,14.57C23.5,17.493 21.251,19.875 18.401,20.142C18.306,20.159 18.209,20.167 18.112,20.167ZM18.175,18.656C20.314,18.499 22,16.73 22,14.57C22,12.407 20.309,10.636 18.166,10.483C17.691,7.564 15.136,5.334 12.056,5.334C9.686,5.334 7.627,6.654 6.587,8.592C4.012,8.845 2,10.998 2,13.618C2,16.288 4.091,18.474 6.739,18.655C6.76,18.663 6.782,18.667 6.804,18.667H18.112C18.133,18.667 18.155,18.663 18.175,18.656Z"
android:fillColor="#B1B1B3"
android:fillType="evenOdd"/>
<path
android:pathData="M12.726,8.761H11.296C11.248,8.761 11.203,8.779 11.169,8.813C11.136,8.846 11.117,8.891 11.117,8.938V12.105H9.425C9.301,12.105 9.201,12.204 9.201,12.327C9.201,12.383 9.223,12.438 9.263,12.479L11.837,15.169C11.922,15.258 12.064,15.262 12.153,15.178C12.156,15.175 12.159,15.172 12.162,15.169L14.737,12.479C14.822,12.39 14.818,12.25 14.728,12.166C14.687,12.127 14.632,12.105 14.575,12.105H12.905V8.938C12.905,8.891 12.886,8.846 12.852,8.813C12.819,8.779 12.773,8.761 12.726,8.761Z"
android:fillColor="#B1B1B3"/>
</vector>

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:strokeWidth="1"
android:pathData="M12,0.5L12,0.5A11.5,11.5 0,0 1,23.5 12L23.5,12A11.5,11.5 0,0 1,12 23.5L12,23.5A11.5,11.5 0,0 1,0.5 12L0.5,12A11.5,11.5 0,0 1,12 0.5z"
android:fillColor="#00000000"
android:strokeColor="#ffffff"/>
<path
android:pathData="M16.496,8.511C16.774,8.233 16.774,7.782 16.496,7.504C16.218,7.225 15.767,7.225 15.489,7.504L12,10.993L8.511,7.504C8.233,7.225 7.782,7.225 7.504,7.504C7.225,7.782 7.225,8.233 7.504,8.511L10.993,12L7.504,15.489C7.225,15.767 7.225,16.218 7.504,16.496C7.782,16.774 8.233,16.774 8.511,16.496L12,13.007L15.489,16.496C15.767,16.774 16.218,16.774 16.496,16.496C16.774,16.218 16.774,15.767 16.496,15.489L13.007,12L16.496,8.511Z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="10dp" />
<solid android:color="@color/color_main_setting" />
</shape>
</item>
<!-- <item android:id="@android:id/secondaryProgress">-->
<!-- <clip>-->
<!-- <shape>-->
<!-- <corners android:radius="10dp" />-->
<!-- <gradient-->
<!-- android:angle="0"-->
<!-- android:centerColor="#606360"-->
<!-- android:centerY="0.75"-->
<!-- android:endColor="#606360"-->
<!-- android:startColor="#606360" />-->
<!-- </shape>-->
<!-- </clip>-->
<!-- </item>-->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="10dp" />
<gradient
android:angle="0"
android:endColor="@color/showkey_edit_hint_color"
android:startColor="@color/showkey_edit_text_color" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -22,10 +22,10 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_marginStart="16dp"
android:id="@+id/preview_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:background="@drawable/bg_main_setting"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="@id/preview_title"
@ -43,10 +43,10 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:layout_marginEnd="16dp"
android:id="@+id/preview_islike"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:background="@drawable/icon_prelike_uncheck"
app:layout_constraintBottom_toBottomOf="@id/preview_title"
app:layout_constraintEnd_toEndOf="parent"
@ -57,8 +57,8 @@
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="27dp"
android:layout_marginEnd="16dp"
app:layout_constraintTop_toBottomOf="@id/preview_title">
<ProgressBar
@ -81,10 +81,10 @@
android:id="@+id/download"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:background="@drawable/preview_download_bg"
android:background="@drawable/step_selector"
android:paddingStart="16dp"
android:paddingTop="10dp"
android:paddingEnd="16dp"

View File

@ -16,6 +16,15 @@
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"

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".fragment.DownloadFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_main">
<TextView
android:id="@+id/down_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/download_title"
android:textColor="@color/white"
android:textSize="28sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/down_hint_image"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="70dp"
android:src="@mipmap/down_hint_image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/down_title" />
<TextView
android:id="@+id/down_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/nodown_tips"
android:textColor="@color/search_hint_text_color"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/down_hint_image" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/down_rv"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="17dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/down_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -3,6 +3,7 @@
<string name="cool_key">Cool Key</string>
<string name="view_all">All</string>
<string name="favorite_title">My Favorite</string>
<string name="download_title">My Download</string>
<string name="setting_title">Settings</string>
<string name="setting_text">System authorization</string>
<string name="rate_text">Rate</string>
@ -25,12 +26,13 @@
<string name="text_zip_failed">Zip failed</string>
<string name="share_title">Here is a Cool Keyboard</string>
<string name="nolike_tips">No favorites added yet</string>
<string name="nodown_tips">No keyboards downloaded yet</string>
<string name="setting_hint">Keyboard \n requires permission to use</string>
<string name="step1">Step 1:Select</string>
<string name="step2">Step 2:Enabled</string>
<string name="text_hint">For normal use, please enter the setting to complete the setting steps.</string>
<string name="main_banner_title">Start using Wallpaper Keyboard !</string>
<string name="versionnumver_text">Version 1.0.1</string>
<string name="versionnumver_text">Version 1.0.2</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="privacy_url">https://sites.google.com/view/cool-keyboard---theme-skin</string>
@ -38,4 +40,5 @@
<string name="showkey_title">Applied results</string>
<string name="download_apply">Apply</string>
<string name="toast_apply_text">Apply Now</string>
<string name="download_text_using">In Use</string>
</resources>