推荐弹窗点击进详情页面增加广告位置

This commit is contained in:
litingting 2024-08-23 13:45:53 +08:00
parent ffc9dbea88
commit d245b82100
30 changed files with 341 additions and 312 deletions

View File

@ -15,11 +15,11 @@ android {
defaultConfig { defaultConfig {
//com.sunny.tools.app.soft //com.sunny.tools.app.soft
applicationId = "com.sunny.tools.app.soft.test" applicationId = "com.sunny.tools.app.soft"
minSdk = 23 minSdk = 23
targetSdk = 34 targetSdk = 34
versionCode = 5 versionCode = 6
versionName = "1.0.4" versionName = "1.0.5"
setProperty("archivesBaseName", "Custom Keyboard_V" + versionName + "(${versionCode})_$timestamp") setProperty("archivesBaseName", "Custom Keyboard_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@ -58,7 +58,7 @@ dependencies {
implementation("com.geyifeng.immersionbar:immersionbar:3.2.2") implementation("com.geyifeng.immersionbar:immersionbar:3.2.2")
implementation("com.geyifeng.immersionbar:immersionbar-ktx:3.2.2") implementation("com.geyifeng.immersionbar:immersionbar-ktx:3.2.2")
implementation ("com.google.code.gson:gson:2.10.1")
implementation ("com.github.bumptech.glide:glide:4.16.0") implementation ("com.github.bumptech.glide:glide:4.16.0")
annotationProcessor ("com.github.bumptech.glide:compiler:4.16.0") annotationProcessor ("com.github.bumptech.glide:compiler:4.16.0")
@ -112,12 +112,12 @@ dependencies {
implementation("androidx.recyclerview:recyclerview:1.1.0") implementation("androidx.recyclerview:recyclerview:1.1.0")
//Tramini //Tramini
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68") // implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
//-----------------------------TopOn 聚合 //-----------------------------TopOn 聚合
// Debugger UI Tools // Debugger UI Tools
implementation ("com.anythink.sdk:debugger-ui:1.0.7") // implementation ("com.anythink.sdk:debugger-ui:1.0.7")

View File

@ -9,7 +9,7 @@
"client_info": { "client_info": {
"mobilesdk_app_id": "1:894189375933:android:0409bb4d16339f3a5082d4", "mobilesdk_app_id": "1:894189375933:android:0409bb4d16339f3a5082d4",
"android_client_info": { "android_client_info": {
"package_name": "com.sunny.tools.app.soft.test" "package_name": "com.sunny.tools.app.soft"
} }
}, },
"oauth_client": [], "oauth_client": [],

View File

@ -23,6 +23,24 @@
-keep class com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity { *; } -keep class com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity { *; }
# 保持 Room 的核心类不被混淆
-keep class androidx.room.** { *; }
-keep class androidx.sqlite.db.** { *; }
# 保持 Room 数据库类的基本结构
-keep class * extends androidx.room.RoomDatabase { *; }
# 保持 Room DAO 接口
-keep @androidx.room.Dao interface * { *; }
-keep @androidx.room.Dao class * { *; }
# 保持 Room 实体类
-keep @androidx.room.Entity class * { *; }
# 保持 Room 的注解类
-keep @androidx.room.Database class * { *; }
#---------------------------------TopOn 聚合 #---------------------------------TopOn 聚合
# Vungle # Vungle
-dontwarn com.vungle.ads.** -dontwarn com.vungle.ads.**

View File

@ -15,7 +15,9 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.TimberKeyboardNew" android:theme="@style/Theme.TimberKeyboardNew"
tools:targetApi="31"> tools:targetApi="31">
<activity
android:name=".ui.activity.PrivacyActivity"
android:exported="false" />
<activity <activity
android:name=".ui.activity.LoadingActivity" android:name=".ui.activity.LoadingActivity"
android:exported="true"> android:exported="true">
@ -25,14 +27,14 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".ui.activity.MainActivity" /> <activity android:name=".ui.activity.MainActivity" />
<activity android:name=".ui.activity.SetKeyboardActivity" />
<activity android:name=".ui.activity.ListActivity" /> <activity android:name=".ui.activity.ListActivity" />
<activity android:name=".ui.activity.DownloadActivity" /> <activity android:name=".ui.activity.DownloadActivity" />
<activity android:name=".ui.activity.DisplayActivity" <activity
android:name=".ui.activity.DisplayActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:windowSoftInputMode="stateVisible" /> android:windowSoftInputMode="stateVisible" />
<service <service
android:name=".service.KeyboardService" android:name=".service.KeyboardService"
android:exported="true" android:exported="true"
@ -40,11 +42,11 @@
<intent-filter> <intent-filter>
<action android:name="android.view.InputMethod" /> <action android:name="android.view.InputMethod" />
</intent-filter> </intent-filter>
<meta-data <meta-data
android:name="android.view.im" android:name="android.view.im"
android:resource="@xml/key_view" /> android:resource="@xml/key_view" />
</service> </service>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<!-- saved from url=(0047)https://hdwallpaperss.bitbucket.io/privacy.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Privacy Policy</title>
</head>
<body>
<h1>Privacy Policy</h1>
<p>We provides 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 add whatever else you collect here, e.g. users name, address, location, pictures. The information that We request will be retained on your device and is not collected by us in any way retained by us and used as described in this privacy policy.</p>
<p>The app does use third-party services that may collect information used to identify you.</p>
<h3>Please refer to the privacy policy of the third-party service provider used by the application:</h3>
<ul>
<li>Google Play Services</li>
<li>Google Analytics for Firebase</li>
<li>Firebase Crashlytics</li>
<li>Unity</li>
<li>AppLovin</li>
<li>Vungle</li>
</ul>
<h2>Log Data</h2>
<p>We want to inform you that whenever you use our Service, in a 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 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.
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 device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.</p>
<h2>Service Providers</h2>
<p>We may employ third-party companies and individuals due to the following reasons:</p>
<p>To facilitate our Service;
To provide the Service on our behalf;To perform Service-related services; orTo assist us in analyzing how our Service is used.
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 are obligated not to disclose or use the information for any other purpose.</p>
<h2>Security</h2>
<p>We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and We cannot guarantee its absolute security.</p>
<h2>Links to Other Sites</h2>
<p>This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by us. Therefore, We strongly advise you to review the Privacy Policy of these websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.</p>
<h2>Childrens 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 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 do the necessary actions.</p>
<h2>Changes to This Privacy Policy</h2>
<p>We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page.</p>
<h2>PRIVACY QUESTIONS</h2>
<p>We may update 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="https://hdwallpaperss.bitbucket.io/arbabulfb@gmail.com">arbabulfb@gmail.com
</a>.</p>
</body></html>

View File

@ -5,10 +5,8 @@ import android.content.Context
import android.util.Log import android.util.Log
import com.anythink.core.api.ATSDK import com.anythink.core.api.ATSDK
import com.anythink.core.api.NetTrafficeCallback import com.anythink.core.api.NetTrafficeCallback
import com.anythink.debug.api.ATDebuggerUITest
import com.sunny.app.soft.timberkeyboardnew.data.DataManager import com.sunny.app.soft.timberkeyboardnew.data.DataManager
import com.sunny.app.soft.timberkeyboardnew.room.MyDatabase import com.sunny.app.soft.timberkeyboardnew.room.MyDatabase
import com.sunny.app.soft.timberkeyboardnew.topon.AdManager import com.sunny.app.soft.timberkeyboardnew.topon.AdManager
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers

View File

@ -1,7 +1,7 @@
package com.sunny.app.soft.timberkeyboardnew.data package com.sunny.app.soft.timberkeyboardnew.data
import android.util.Log import android.util.Log
import com.google.gson.Gson
import com.sunny.app.soft.timberkeyboardnew.App import com.sunny.app.soft.timberkeyboardnew.App
import com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity import com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity
import com.sunny.app.soft.timberkeyboardnew.data.entity.CategoryEntity import com.sunny.app.soft.timberkeyboardnew.data.entity.CategoryEntity

View File

@ -1,14 +1,9 @@
package com.sunny.app.soft.timberkeyboardnew.tools package com.sunny.app.soft.timberkeyboardnew.tools
import android.app.Activity import android.app.Activity
import android.content.BroadcastReceiver
import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle import android.os.Bundle
import android.provider.Settings
import android.util.Log
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
@ -16,19 +11,15 @@ import android.view.ViewGroup
import android.view.Window import android.view.Window
import android.view.WindowManager import android.view.WindowManager
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.anythink.debug.util.a
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.sunny.app.soft.timberkeyboardnew.App import com.sunny.app.soft.timberkeyboardnew.App
import com.sunny.app.soft.timberkeyboardnew.R import com.sunny.app.soft.timberkeyboardnew.R
import com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity import com.sunny.app.soft.timberkeyboardnew.data.entity.BackgroundEntity
import com.sunny.app.soft.timberkeyboardnew.databinding.DialogRecommendBinding import com.sunny.app.soft.timberkeyboardnew.databinding.DialogRecommendBinding
import com.sunny.app.soft.timberkeyboardnew.databinding.DialogStepBinding
import com.sunny.app.soft.timberkeyboardnew.room.MyDatabase import com.sunny.app.soft.timberkeyboardnew.room.MyDatabase
import com.sunny.app.soft.timberkeyboardnew.topon.AdManager
import com.sunny.app.soft.timberkeyboardnew.ui.activity.DownloadActivity import com.sunny.app.soft.timberkeyboardnew.ui.activity.DownloadActivity
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@ -73,9 +64,7 @@ class DialogRecommend(var activity: Activity, var onClose: () -> Unit) : DialogF
dismiss() dismiss()
} }
dialogVb.imageview.setOnClickListener {
}
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
data = MyDatabase.myDatabase.BackgroundEntityDao().queryRandomItem() data = MyDatabase.myDatabase.BackgroundEntityDao().queryRandomItem()
@ -89,11 +78,14 @@ class DialogRecommend(var activity: Activity, var onClose: () -> Unit) : DialogF
.into(dialogVb.imageview) .into(dialogVb.imageview)
dialogVb.tvApply.setOnClickListener { dialogVb.tvApply.setOnClickListener {
AdManager.showTopOn(activity){
val intent = Intent(activity, DownloadActivity::class.java) val intent = Intent(activity, DownloadActivity::class.java)
intent.putExtra(AppConstant.KEY_EXTRA, backEntity) intent.putExtra(AppConstant.KEY_EXTRA, backEntity)
startActivity(intent) startActivity(intent)
dismiss() dismiss()
} }
}
} }
} }

View File

@ -74,7 +74,7 @@ object AdManager {
} }
}) })
// ad.load() ad.load()
} }
} }

View File

@ -11,19 +11,17 @@ abstract class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(setRootView()) setContentView(setRootView())
initView() initStatusBar()
if (loadAd()) { if (loadAd()) {
AdManager.loadAllAd() AdManager.loadAllAd()
} }
onUI()
} }
abstract fun onUI()
abstract fun loadAd(): Boolean abstract fun loadAd(): Boolean
abstract fun setRootView(): View abstract fun setRootView(): View
open fun initView() {
initStatusBar()
}
private fun initStatusBar() { private fun initStatusBar() {
ImmersionBar.with(this).statusBarDarkFont(true).init() ImmersionBar.with(this).statusBarDarkFont(true).init()
} }

View File

@ -7,6 +7,10 @@ import com.sunny.app.soft.timberkeyboardnew.databinding.ActivityDisplayBinding
class DisplayActivity : BaseActivity() { class DisplayActivity : BaseActivity() {
private lateinit var binding: ActivityDisplayBinding private lateinit var binding: ActivityDisplayBinding
override fun onUI() {
init()
}
override fun loadAd(): Boolean = true override fun loadAd(): Boolean = true
private var inputMethod: InputMethodManager? = null private var inputMethod: InputMethodManager? = null
@ -15,7 +19,7 @@ class DisplayActivity : BaseActivity() {
override fun setRootView(): View { override fun setRootView(): View {
binding = ActivityDisplayBinding.inflate(layoutInflater) binding = ActivityDisplayBinding.inflate(layoutInflater)
init()
return binding.root return binding.root
} }

View File

@ -56,14 +56,7 @@ class DownloadActivity :
private var appliedSkinStyle: Int = -1 private var appliedSkinStyle: Int = -1
private var defaultStyle = 0 private var defaultStyle = 0
override fun loadAd(): Boolean = true override fun onUI() {
override fun setRootView(): View {
binding = ActivityDownloadBinding.inflate(layoutInflater)
return binding.root
}
override fun initView() {
super.initView()
binding.downloadProgress.visibility = View.VISIBLE binding.downloadProgress.visibility = View.VISIBLE
backgroundEntity = intent.getSerializableExtra(AppConstant.KEY_EXTRA) as BackgroundEntity backgroundEntity = intent.getSerializableExtra(AppConstant.KEY_EXTRA) as BackgroundEntity
sp = getSharedPreferences(AppConstant.SHARE_NAME, Context.MODE_PRIVATE) sp = getSharedPreferences(AppConstant.SHARE_NAME, Context.MODE_PRIVATE)
@ -80,6 +73,14 @@ class DownloadActivity :
initTitle() initTitle()
} }
override fun loadAd(): Boolean = true
override fun setRootView(): View {
binding = ActivityDownloadBinding.inflate(layoutInflater)
return binding.root
}
private fun initTitle() { private fun initTitle() {
binding.bgName.text = "Keyboard background" binding.bgName.text = "Keyboard background"
} }
@ -124,14 +125,7 @@ class DownloadActivity :
} }
} }
private fun onShowAd() {
AdManager.showTopOn(this) {
startSetSkin()
}
}
private fun initButton() { private fun initButton() {
binding.downloadBack.setOnClickListener(this) binding.downloadBack.setOnClickListener(this)
@ -181,11 +175,22 @@ class DownloadActivity :
when (v) { when (v) {
binding.downloadBack -> finish() binding.downloadBack -> finish()
binding.btnDownload -> { binding.btnDownload -> {
AdManager.showTopOn(this) {
applySkin() applySkin()
} }
}
binding.imLike -> { binding.imLike -> {
AdManager.showTopOn(this@DownloadActivity){
binding.imLike.isSelected = !binding.imLike.isSelected binding.imLike.isSelected = !binding.imLike.isSelected
if(binding.imLike.isSelected){
Toast.makeText(this@DownloadActivity,getString(R.string.add_success),Toast.LENGTH_SHORT).show()
}else{
Toast.makeText(this@DownloadActivity,getString(R.string.cancel_success),Toast.LENGTH_SHORT).show()
}
}
} }
} }
} }
@ -205,14 +210,14 @@ class DownloadActivity :
if (stepDialog == null) { if (stepDialog == null) {
stepDialog = DialogStep.newInstance(this@DownloadActivity) { stepDialog = DialogStep.newInstance(this@DownloadActivity) {
if (KeyboardManager.isChoose() && KeyboardManager.isEnable()) { if (KeyboardManager.isChoose() && KeyboardManager.isEnable()) {
onShowAd() startSetSkin()
} }
} }
} }
stepDialog?.show(supportFragmentManager, "") stepDialog?.show(supportFragmentManager, "")
return return
} }
onShowAd() startSetSkin()
} }
private fun startSetSkin() { private fun startSetSkin() {

View File

@ -22,13 +22,7 @@ class ListActivity : BaseActivity(), View.OnClickListener {
return binding.root return binding.root
} }
override fun initView() {
super.initView()
categoryEntity = intent.getSerializableExtra(AppConstant.KEY_EXTRA) as CategoryEntity
initButton()
initTitle()
initRecyclerView()
}
private fun initRecyclerView() { private fun initRecyclerView() {
val selectAdapter = val selectAdapter =
@ -51,6 +45,14 @@ class ListActivity : BaseActivity(), View.OnClickListener {
adapter = selectAdapter adapter = selectAdapter
} }
} }
override fun onUI() {
categoryEntity = intent.getSerializableExtra(AppConstant.KEY_EXTRA) as CategoryEntity
initButton()
initTitle()
initRecyclerView()
}
override fun loadAd(): Boolean = true override fun loadAd(): Boolean = true
private fun initTitle() { private fun initTitle() {
binding.selectTitle.text = categoryEntity.name binding.selectTitle.text = categoryEntity.name

View File

@ -13,22 +13,8 @@ class LoadingActivity : BaseActivity() {
private var countDownTimer: CountDownTimer?= null private var countDownTimer: CountDownTimer?= null
private val time = 1000L private val time = 12000L
override fun onUI() {
override fun loadAd(): Boolean = false
override fun setRootView(): View {
binding = ActivityLoadingBinding.inflate(layoutInflater)
return binding.root
}
override fun onDestroy() {
super.onDestroy()
countDownTimer?.cancel()
}
override fun initView() {
super.initView()
countDownTimer = AdManager.showWelcomeAd(this@LoadingActivity, time, { millisUntilFinished -> countDownTimer = AdManager.showWelcomeAd(this@LoadingActivity, time, { millisUntilFinished ->
val percentage: Float = 100 - millisUntilFinished.toFloat() / time * 100 val percentage: Float = 100 - millisUntilFinished.toFloat() / time * 100
val round = percentage.roundToInt() val round = percentage.roundToInt()
@ -43,6 +29,19 @@ class LoadingActivity : BaseActivity() {
countDownTimer?.start() countDownTimer?.start()
} }
override fun loadAd(): Boolean = false
override fun setRootView(): View {
binding = ActivityLoadingBinding.inflate(layoutInflater)
return binding.root
}
override fun onDestroy() {
super.onDestroy()
countDownTimer?.cancel()
}
private fun intoMainActivity() { private fun intoMainActivity() {
val intent = Intent(this, MainActivity::class.java) val intent = Intent(this, MainActivity::class.java)

View File

@ -29,6 +29,12 @@ class MainActivity :
private var stepDialog: DialogStep? = null private var stepDialog: DialogStep? = null
private var recommendDialog: DialogRecommend? = null private var recommendDialog: DialogRecommend? = null
override fun onUI() {
initViewPager()
initTabButton()
checkStep()
}
override fun loadAd(): Boolean = true override fun loadAd(): Boolean = true
override fun setRootView(): View { override fun setRootView(): View {
@ -36,12 +42,7 @@ class MainActivity :
return binding.root return binding.root
} }
override fun initView() {
super.initView()
initViewPager()
initTabButton()
checkStep()
}
private fun initTabButton() { private fun initTabButton() {
binding.mainTabHome.setOnClickListener(this) binding.mainTabHome.setOnClickListener(this)

View File

@ -0,0 +1,22 @@
package com.sunny.app.soft.timberkeyboardnew.ui.activity
import android.view.View
import com.sunny.app.soft.timberkeyboardnew.databinding.ActivityPrivacyBinding
class PrivacyActivity : BaseActivity() {
override fun onUI() {
binding.webView.loadUrl("file:///android_asset/CustomKeyboard_PrivacyPolicy.html")
binding.back.setOnClickListener {
finish()
}
}
override fun loadAd(): Boolean = true
private lateinit var binding: ActivityPrivacyBinding
override fun setRootView(): View {
binding = ActivityPrivacyBinding.inflate(layoutInflater)
return binding.root
}
}

View File

@ -1,106 +0,0 @@
package com.sunny.app.soft.timberkeyboardnew.ui.activity
import android.app.AlertDialog
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.provider.Settings
import android.view.View
import android.view.inputmethod.InputMethodManager
import com.sunny.app.soft.timberkeyboardnew.R
import com.sunny.app.soft.timberkeyboardnew.databinding.ActivityEnableBinding
import com.sunny.app.soft.timberkeyboardnew.tools.KeyboardManager
class SetKeyboardActivity :
BaseActivity(),
View.OnClickListener {
private lateinit var binding: ActivityEnableBinding
private lateinit var inputManager: InputMethodManager
private lateinit var broadcastReceiver: BroadcastReceiver
override fun setRootView(): View {
binding = ActivityEnableBinding.inflate(layoutInflater)
return binding.root
}
override fun initView() {
super.initView()
inputManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
broadcastReceiver = StepperReceiver()
updateUi()
register()
initButton()
}
override fun loadAd(): Boolean = true
private fun initButton() {
binding.setKeyboardBack.setOnClickListener(this)
binding.setKeyboardSteps1.setOnClickListener(this)
binding.setKeyboardSteps2.setOnClickListener(this)
}
private fun register() {
registerReceiver(broadcastReceiver, IntentFilter(Intent.ACTION_INPUT_METHOD_CHANGED))
}
inner class StepperReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
updateUi()
}
}
private fun updateUi() {
// if (KeyboardManager.isEnable()) {
// binding.setKeyboardSteps1.setBackgroundResource(R.drawable.shape_r24_grey)
// } else {
// binding.setKeyboardSteps1.setBackgroundResource(R.drawable.shape_r24_orange)
// }
// if (KeyboardManager.isChoose()) {
// binding.setKeyboardSteps2.setBackgroundResource(R.drawable.shape_r24_grey)
// } else {
// binding.setKeyboardSteps2.setBackgroundResource(R.drawable.shape_r24_orange)
// }
// if (KeyboardManager.isChoose() && KeyboardManager.isEnable()) {
// showInfoDialog()
// }
}
private fun showInfoDialog() {
AlertDialog.Builder(this).apply {
title = "Settings"
setMessage("You have successfully activated the soft keyboard!")
setPositiveButton("OK") { _, _ -> finish() }
}.create().show()
}
override fun onResume() {
super.onResume()
updateUi()
}
override fun onDestroy() {
super.onDestroy()
unregisterReceiver(broadcastReceiver)
}
override fun onClick(v: View?) {
when (v) {
binding.setKeyboardBack -> finish()
binding.setKeyboardSteps1 -> chooseKeyboard()
binding.setKeyboardSteps2 -> settingKeyboard()
}
}
private fun settingKeyboard() {
inputManager.showInputMethodPicker()
}
private fun chooseKeyboard() {
val intent = Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)
startActivity(intent)
}
}

View File

@ -37,9 +37,13 @@ class CollectFragment :
private fun initViewPager() { private fun initViewPager() {
val homeViewAdapter = SelectAdapter(requireContext(), object : OnBgItemClickListener { val homeViewAdapter = SelectAdapter(requireContext(), object : OnBgItemClickListener {
override fun onItemClick(position: Int, backgroundEntity: BackgroundEntity) { override fun onItemClick(position: Int, backgroundEntity: BackgroundEntity) {
AdManager.showTopOn(requireActivity()) {
val intent = Intent(requireActivity(), DownloadActivity::class.java) val intent = Intent(requireActivity(), DownloadActivity::class.java)
intent.putExtra(AppConstant.KEY_EXTRA, backgroundEntity) intent.putExtra(AppConstant.KEY_EXTRA, backgroundEntity)
startActivity(intent) startActivity(intent)
}
} }
}) })
@ -71,14 +75,7 @@ class CollectFragment :
} }
fun onShowAd() {
AdManager.showTopOn(requireActivity()) {
enterList()
}
}
} }

View File

@ -37,7 +37,9 @@ class HomeFragment :
val homeViewAdapter = HomeViewAdapter(requireContext(), object : OnItemClickListener { val homeViewAdapter = HomeViewAdapter(requireContext(), object : OnItemClickListener {
override fun onItemClick(position: Int, categoryEntity: CategoryEntity) { override fun onItemClick(position: Int, categoryEntity: CategoryEntity) {
data = categoryEntity data = categoryEntity
onShowAd() AdManager.showTopOn(requireActivity()) {
enterList()
}
} }
@ -63,15 +65,7 @@ class HomeFragment :
} }
fun onShowAd() {
AdManager.showTopOn(requireActivity()) {
enterList()
}
}
private fun initTitle() { private fun initTitle() {
binding.homeTitle.text = App.appContext.getString(R.string.app_name) binding.homeTitle.text = App.appContext.getString(R.string.app_name)

View File

@ -1,12 +1,14 @@
package com.sunny.app.soft.timberkeyboardnew.ui.fragment package com.sunny.app.soft.timberkeyboardnew.ui.fragment
import android.content.Intent import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri import android.net.Uri
import android.view.View import android.view.View
import com.sunny.app.soft.timberkeyboardnew.App import com.sunny.app.soft.timberkeyboardnew.App
import com.sunny.app.soft.timberkeyboardnew.R import com.sunny.app.soft.timberkeyboardnew.R
import com.sunny.app.soft.timberkeyboardnew.databinding.FragmentSettingBinding import com.sunny.app.soft.timberkeyboardnew.databinding.FragmentSettingBinding
import com.sunny.app.soft.timberkeyboardnew.ui.activity.SetKeyboardActivity import com.sunny.app.soft.timberkeyboardnew.ui.activity.PrivacyActivity
class SettingFragment : BaseFragment(), View.OnClickListener { class SettingFragment : BaseFragment(), View.OnClickListener {
@ -20,7 +22,15 @@ class SettingFragment : BaseFragment(), View.OnClickListener {
super.initView() super.initView()
binding.settingLayoutRating.setOnClickListener(this) binding.settingLayoutRating.setOnClickListener(this)
binding.settingLayoutShare.setOnClickListener(this) binding.settingLayoutShare.setOnClickListener(this)
binding.settingLayoutSetKeyboard.setOnClickListener(this) binding.layoutPrivacy.setOnClickListener(this)
val appVersionName = getAppVersionName()
appVersionName?.let {
binding.tvVersion.text = String.format(getString(R.string.version), it.versionName)
}.run {
binding.tvVersion.text = String.format(getString(R.string.version), "1.0.5")
}
} }
override fun onClick(v: View?) { override fun onClick(v: View?) {
@ -40,9 +50,19 @@ class SettingFragment : BaseFragment(), View.OnClickListener {
startActivity(intent) startActivity(intent)
} }
binding.settingLayoutSetKeyboard -> { binding.layoutPrivacy -> {
startActivity(Intent(requireActivity(), PrivacyActivity::class.java))
}
} }
} }
private fun getAppVersionName(): PackageInfo? {
return try {
requireActivity().packageManager.getPackageInfo(requireActivity().packageName, 0)
} catch (exception: PackageManager.NameNotFoundException) {
null
}
} }
} }

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M844.8,200.5L554.7,55.5c-25.6,-12.8 -57.6,-12.8 -83.2,0L181.3,200.5c-34.1,14.9 -53.3,46.9 -53.3,83.2v264.5c0,121.6 59.7,236.8 162.1,315.7 74.7,57.6 200.5,110.9 204.8,113.1 4.3,2.1 10.7,4.3 17.1,4.3s10.7,-2.1 17.1,-4.3c4.3,-2.1 132.3,-55.5 204.8,-113.1 102.4,-78.9 162.1,-194.1 162.1,-315.7V283.7c0,-36.3 -19.2,-68.3 -51.2,-83.2zM554.7,522.7v136.5c0,23.5 -19.2,42.7 -42.7,42.7s-42.7,-19.2 -42.7,-42.7v-136.5c-38.4,-17.1 -64,-53.3 -64,-98.1 0,-59.7 46.9,-106.7 106.7,-106.7s106.7,46.9 106.7,106.7c0,44.8 -25.6,81.1 -64,98.1z"
android:fillColor="@color/set_ic_color"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M510.9,63.9c-246.9,0 -447.1,200.7 -447.1,448.4 0,247.6 200.2,448.4 447.1,448.4 246.9,0 447.1,-200.7 447.1,-448.4C957.9,264.6 757.8,63.9 510.9,63.9zM510.9,260c30.9,0 55.9,25.1 55.9,56 0,31 -25,56 -55.9,56s-55.9,-25.1 -55.9,-56C455,285.1 480,260 510.9,260zM566.7,764.4l-55.7,0c-0.1,0 -0.1,0 -0.2,0 -0.1,0 -0.1,-0 -0.2,-0l-55.7,0c-15.4,0 -27.9,-12.5 -27.9,-28 0,-15.5 12.5,-28 27.9,-28l27.9,0L482.9,484.2l-27.9,0c-15.4,0 -27.9,-12.5 -27.9,-28 0,-15.5 12.5,-28 27.9,-28l55.9,0c15.4,0 27.9,12.5 27.9,28 0,0.3 -0,0.6 -0,0.9 0,0.3 0,0.6 0,0.9l0,250.4 27.9,0c15.4,0 27.9,12.5 27.9,28C594.7,751.9 582.2,764.4 566.7,764.4z"
android:fillColor="@color/set_ic_color"/>
</vector>

View File

@ -5,5 +5,5 @@
android:viewportHeight="1024"> android:viewportHeight="1024">
<path <path
android:pathData="M465.6,81.9a51.8,51.8 0,0 1,92.8 0l120.3,243.8 268.8,39a51.8,51.8 0,0 1,28.8 88.3l-194.6,189.8 46.1,267.8a51.8,51.8 0,0 1,-75.2 54.7l-240.6,-128 -240.6,128a51.8,51.8 0,0 1,-75.2 -54.7l46.1,-267.8 -194.6,-189.8a51.8,51.8 0,0 1,28.8 -88.3l268.8,-39z" android:pathData="M465.6,81.9a51.8,51.8 0,0 1,92.8 0l120.3,243.8 268.8,39a51.8,51.8 0,0 1,28.8 88.3l-194.6,189.8 46.1,267.8a51.8,51.8 0,0 1,-75.2 54.7l-240.6,-128 -240.6,128a51.8,51.8 0,0 1,-75.2 -54.7l46.1,-267.8 -194.6,-189.8a51.8,51.8 0,0 1,28.8 -88.3l268.8,-39z"
android:fillColor="#2c2c2c"/> android:fillColor="@color/set_ic_color"/>
</vector> </vector>

View File

@ -5,5 +5,5 @@
android:viewportHeight="1024"> android:viewportHeight="1024">
<path <path
android:pathData="M778.6,653.7c-43.7,0 -82.5,20.9 -107.1,53.2l-283,-168.5c3.2,-12.4 5.1,-25.3 5.1,-38.7 0,-3.9 -0.3,-7.7 -0.6,-11.5l283.2,-170.6c24.7,28.9 61.4,47.3 102.5,47.3 74.4,0 134.8,-60.3 134.8,-134.8 0,-74.4 -60.3,-134.8 -134.8,-134.8 -74.4,0 -134.8,60.3 -134.8,134.8 0,14.8 2.4,28.9 6.8,42.2L369.9,418c-27.3,-43.4 -75.4,-72.3 -130.4,-72.3 -85.1,0 -154,69 -154,154s69,154 154,154c45.6,0 86.4,-19.9 114.6,-51.4L648.3,754.5c-2.8,10.9 -4.5,22.2 -4.5,34 0,74.4 60.3,134.8 134.8,134.8 74.4,0 134.8,-60.3 134.8,-134.8C913.4,714.1 853,653.7 778.6,653.7L778.6,653.7 778.6,653.7zM778.6,653.7" android:pathData="M778.6,653.7c-43.7,0 -82.5,20.9 -107.1,53.2l-283,-168.5c3.2,-12.4 5.1,-25.3 5.1,-38.7 0,-3.9 -0.3,-7.7 -0.6,-11.5l283.2,-170.6c24.7,28.9 61.4,47.3 102.5,47.3 74.4,0 134.8,-60.3 134.8,-134.8 0,-74.4 -60.3,-134.8 -134.8,-134.8 -74.4,0 -134.8,60.3 -134.8,134.8 0,14.8 2.4,28.9 6.8,42.2L369.9,418c-27.3,-43.4 -75.4,-72.3 -130.4,-72.3 -85.1,0 -154,69 -154,154s69,154 154,154c45.6,0 86.4,-19.9 114.6,-51.4L648.3,754.5c-2.8,10.9 -4.5,22.2 -4.5,34 0,74.4 60.3,134.8 134.8,134.8 74.4,0 134.8,-60.3 134.8,-134.8C913.4,714.1 853,653.7 778.6,653.7L778.6,653.7 778.6,653.7zM778.6,653.7"
android:fillColor="#2c2c2c"/> android:fillColor="@color/set_ic_color"/>
</vector> </vector>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
tools:context=".ui.activity.SetKeyboardActivity">
<View
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/white"
android:orientation="horizontal">
<ImageView
android:id="@+id/setKeyboard_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="8dp"
android:background="@color/white"
android:padding="8dp"
android:src="@mipmap/icon_back" />
<TextView
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@color/white"
android:gravity="center"
android:text="@string/enable"
android:textColor="@color/black"
android:textSize="18sp" />
<View
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:background="@color/white" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="26dp"
android:layout_marginEnd="26dp"
android:gravity="center"
android:layout_marginTop="60dp"
android:lineSpacingExtra="8dp"
android:text="@string/setKeyboard_text"
android:textColor="@color/orange"
android:textSize="15sp" />
<TextView
android:id="@+id/setKeyboard_steps1"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_marginStart="70dp"
android:layout_marginTop="70dp"
android:layout_marginEnd="70dp"
android:background="@drawable/selector_step"
android:gravity="center"
android:text="@string/setKeyboard_steps1"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
android:id="@+id/setKeyboard_steps2"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_marginStart="70dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="70dp"
android:background="@drawable/selector_step"
android:gravity="center"
android:text="@string/setKeyboard_steps2"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>

View File

@ -0,0 +1,47 @@
<?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:paddingTop="50dp"
tools:context=".ui.activity.PrivacyActivity">
<ImageView
android:id="@+id/back"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginStart="12dp"
android:padding="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:src="@mipmap/icon_back"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:padding="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text="@string/app_privacy"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/back"
android:text="@string/app_privacy"
android:textColor="@color/black"
android:textSize="15sp"
app:layout_constraintTop_toBottomOf="@id/back"
tools:ignore="WebViewLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -81,6 +81,37 @@
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="@color/white33" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/layout_privacy"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="25dp"
android:src="@drawable/ic_privacy" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:gravity="center"
android:text="@string/app_privacy"
android:textColor="@color/black"
android:textSize="14sp" />
</LinearLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0.5dp" android:layout_height="0.5dp"
@ -89,7 +120,6 @@
android:background="@color/white33" /> android:background="@color/white33" />
<LinearLayout <LinearLayout
android:id="@+id/setting_layout_setKeyboard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:gravity="center_vertical" android:gravity="center_vertical"
@ -100,14 +130,15 @@
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginStart="25dp" android:layout_marginStart="25dp"
android:src="@drawable/im_set_false" /> android:src="@drawable/ic_version" />
<TextView <TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:gravity="center" android:gravity="center"
android:text="@string/setting_setKeyboard" android:text="@string/version"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>

View File

@ -17,4 +17,5 @@
<color name="step_ok">#F7F9FC</color> <color name="step_ok">#F7F9FC</color>
<color name="et_color">#FFF3E3</color> <color name="et_color">#FFF3E3</color>
<color name="hint_text_color">#F7931A</color> <color name="hint_text_color">#F7931A</color>
<color name="set_ic_color">#2c2c2c</color>
</resources> </resources>

View File

@ -23,6 +23,10 @@
<string name="slect_key">Please select the following button background</string> <string name="slect_key">Please select the following button background</string>
<string name="display">Display</string> <string name="display">Display</string>
<string name="display_et">Enter text to see the effect</string> <string name="display_et">Enter text to see the effect</string>
<string name="version">V %s</string>
<string name="app_privacy">Privacy Policy</string>
<string name="add_success">Added to favorites successfully</string>
<string name="cancel_success">Successfully canceled the collection</string>
<string name="delete_res">skin_%s_delete_emoji.png</string> <string name="delete_res">skin_%s_delete_emoji.png</string>
<string name="caps_res">skin_%s_caps_enabled.png</string> <string name="caps_res">skin_%s_caps_enabled.png</string>

View File

@ -23,7 +23,7 @@ dependencyResolutionManagement {
maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") maven ("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
//TopOn集成测试工具 //TopOn集成测试工具
maven ( "https://jfrog.anythinktech.com/artifactory/debugger") // maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
} }
} }