V1.0.6(7) 广告场景:开屏、分类进入列表、保存按钮点击、设置壁纸弹窗上的三个按钮点击

This commit is contained in:
litingting 2024-08-27 11:49:07 +08:00
parent 0e2a01da5c
commit fb45e39473
6 changed files with 45 additions and 39 deletions

View File

@ -20,8 +20,8 @@ android {
applicationId = "com.wallart.art.wallpapers.hd" applicationId = "com.wallart.art.wallpapers.hd"
minSdk = 23 minSdk = 23
targetSdk = 34 targetSdk = 34
versionCode =6 versionCode =7
versionName = "1.0.5" versionName = "1.0.6"
setProperty("archivesBaseName", "Art Wallpaper_V" + versionName + "(${versionCode})_$timestamp") setProperty("archivesBaseName", "Art Wallpaper_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -14,6 +14,7 @@ import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryPreviewBean
import com.cute.girl.hd.pink.img.wallpaper.db.Data import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GCategoryDetail import com.cute.girl.hd.pink.img.wallpaper.entity.GCategoryDetail
import com.cute.girl.hd.pink.img.wallpaper.entity.IntentConstants import com.cute.girl.hd.pink.img.wallpaper.entity.IntentConstants
import com.cute.girl.hd.pink.img.wallpaper.topon.AdManager
//import com.cute.girl.hd.pink.img.wallpaper.net.base.BaseListener //import com.cute.girl.hd.pink.img.wallpaper.net.base.BaseListener
//import com.cute.girl.hd.pink.img.wallpaper.net.base.ServiceImage //import com.cute.girl.hd.pink.img.wallpaper.net.base.ServiceImage
//import com.cute.girl.hd.pink.img.wallpaper.net.response.ResponseCategoryDetail //import com.cute.girl.hd.pink.img.wallpaper.net.response.ResponseCategoryDetail
@ -45,6 +46,7 @@ class CategoryAbility : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
AdManager.loadAllAd()
binding = AbilityCategoryBinding.inflate(layoutInflater) binding = AbilityCategoryBinding.inflate(layoutInflater)
mViewModel = ViewModelProvider(this).get(CategoryListViewModel::class.java) mViewModel = ViewModelProvider(this).get(CategoryListViewModel::class.java)

View File

@ -86,10 +86,10 @@ class MainAbility : AppCompatActivity() {
return try { return try {
val pm: PackageManager = this.packageManager val pm: PackageManager = this.packageManager
val pi = pm.getPackageInfo(this.packageName, 0) val pi = pm.getPackageInfo(this.packageName, 0)
if (pi == null) "" else pi.versionName if (pi == null) "1.0.6" else pi.versionName
} catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace() e.printStackTrace()
"" "1.0.6"
} }
} }

View File

@ -93,7 +93,7 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
finish() finish()
return return
} }
MyDatabase.myDatabase.WallpaperDao().queryWallpaper(listBean!!.id).observe(this){ MyDatabase.myDatabase.WallpaperDao().queryWallpaper(listBean!!.id).observe(this) {
binding.imLike.isSelected = it.like binding.imLike.isSelected = it.like
} }
@ -134,47 +134,45 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
} }
private fun onClick(){ private fun onClick() {
binding.ivBack.setOnClickListener { binding.ivBack.setOnClickListener {
finish() finish()
} }
binding.tvSet.setOnClickListener { binding.tvSet.setOnClickListener {
showTopOn {
mAction = 0 mAction = 0
if (isExist()) { if (isExist()) {
set4KWallpaper() set4KWallpaper()
} else { } else {
startDownload() startDownload()
} }
}
} }
binding.tvDownload.setOnClickListener { binding.tvDownload.setOnClickListener {
showTopOn{ showTopOn {
doSave() doSave()
} }
} }
binding.imLike.setOnClickListener { binding.imLike.setOnClickListener {
showTopOn{
binding.imLike.isSelected = !binding.imLike.isSelected binding.imLike.isSelected = !binding.imLike.isSelected
if(binding.imLike.isSelected){ if (binding.imLike.isSelected) {
Toast.makeText( Toast.makeText(
this@PreviewAbility, this@PreviewAbility,
R.string.add_like.getString(), R.string.add_like.getString(),
Toast.LENGTH_SHORT Toast.LENGTH_SHORT
).show() ).show()
}else{ } else {
Toast.makeText( Toast.makeText(
this@PreviewAbility, this@PreviewAbility,
R.string.cancel_like.getString(), R.string.cancel_like.getString(),
Toast.LENGTH_SHORT Toast.LENGTH_SHORT
).show() ).show()
} }
}
} }
} }
@ -213,6 +211,7 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
mSetAsDialog = SetAsDialog(this) { mSetAsDialog = SetAsDialog(this) {
onClickHomeScreen = { onClickHomeScreen = {
showTopOn {
lifecycleScope.launch { lifecycleScope.launch {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setStream(file.inputStream()) wallpaperManager.setStream(file.inputStream())
@ -232,13 +231,14 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
).show() ).show()
} }
} }
}
} }
onClickLockScreen = { onClickLockScreen = {
showTopOn {
lifecycleScope.launch { lifecycleScope.launch {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setStream(file.inputStream()) wallpaperManager.setStream(file.inputStream())
@ -259,11 +259,14 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
} }
} }
}
} }
onClickBoth = { onClickBoth = {
showTopOn {
lifecycleScope.launch { lifecycleScope.launch {
wallpaperManager.setStream(file.inputStream())//FLAG_SYSTEM | FLAG_LOCK) wallpaperManager.setStream(file.inputStream())//FLAG_SYSTEM | FLAG_LOCK)
onMain { onMain {
@ -275,6 +278,9 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
} }
} }
} }
}
} }
} }
mSetAsDialog?.show() mSetAsDialog?.show()
@ -302,10 +308,7 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
return return
} }
val filePath = DownloadUtil.getFilePath(mList[mCurPos].getTag()) val filePath = DownloadUtil.getFilePath(mList[mCurPos].getTag())
Log.d(
"-----------",
"---------startDownload-${mList[mCurPos].sourceURl} filePath=${filePath}"
)
binding.flDownload.show() binding.flDownload.show()
DownloadUtil.downloadFile(mList[mCurPos].sourceURl, filePath) { DownloadUtil.downloadFile(mList[mCurPos].sourceURl, filePath) {
runOnUiThread { runOnUiThread {
@ -343,10 +346,10 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
) )
val file = File(path) val file = File(path)
val savedUri = MediaUtil.saveToGallery(this@PreviewAbility,file) val savedUri = MediaUtil.saveToGallery(this@PreviewAbility, file)
// val saved = MediaUtil.saveImageToSystemAlbum(path,this@PreviewAbility) // val saved = MediaUtil.saveImageToSystemAlbum(path,this@PreviewAbility)
if (!isFinishing) { if (!isFinishing) {
if (savedUri!= null) { if (savedUri != null) {
Toast.makeText( Toast.makeText(
this@PreviewAbility, this@PreviewAbility,
R.string.saved_to_album, R.string.saved_to_album,
@ -367,7 +370,7 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
val selected = binding.imLike.isSelected val selected = binding.imLike.isSelected
CoroutineScope(Dispatchers.IO).launch{ CoroutineScope(Dispatchers.IO).launch {
MyDatabase.myDatabase.WallpaperDao().updateWallpaper(listBean?.apply { MyDatabase.myDatabase.WallpaperDao().updateWallpaper(listBean?.apply {
like = selected like = selected
}) })

View File

@ -213,6 +213,7 @@ object AdManager {
showAD(activity) { type -> showAD(activity) { type ->
if (type == type_no_cache || type == type_show_close || type == type_show_fail) { if (type == type_no_cache || type == type_show_close || type == type_show_fail) {
listener.onAction() listener.onAction()
Log.d(MyApp.TAG,"-----------------AD SHOW")
} }
} }
} }

View File

@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/theme_gray</item> <item name="colorSecondaryVariant">@color/theme_gray</item>
<item name="colorOnSecondary">@color/black</item> <item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">@color/theme_pink</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
</style> </style>
</resources> </resources>