V1.0.5(6) 增加保存收藏功能

This commit is contained in:
litingting 2024-08-16 14:29:18 +08:00
parent fe19a59e5d
commit 668627adf3
53 changed files with 1027 additions and 810 deletions

View File

@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.jetbrainsKotlinAndroid)
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
kotlin("kapt")
}
@ -19,8 +20,8 @@ android {
applicationId = "com.wallart.art.wallpapers.hd"
minSdk = 23
targetSdk = 34
versionCode = 5
versionName = "1.0.4"
versionCode =6
versionName = "1.0.5"
setProperty("archivesBaseName", "Art Wallpaper_V" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@ -58,9 +59,7 @@ dependencies {
androidTestImplementation(libs.androidx.espresso.core)
//tabLayout
implementation("io.github.h07000223:flycoTabLayout:3.0.0")
//下拉刷新上拉加载
// implementation("io.github.scwang90:refresh-layout-kernel:2.0.5") //核心必须依赖
// implementation("io.github.scwang90:refresh-header-classics:2.0.5") //经典刷新头
//okhttp
implementation("com.squareup.okhttp3:okhttp:4.9.2")
implementation("commons-codec:commons-codec:1.11")
@ -68,8 +67,6 @@ dependencies {
implementation("com.github.bumptech.glide:glide:4.15.1")
annotationProcessor("com.github.bumptech.glide:compiler:4.11.0")
// implementation("com.squareup.retrofit2:retrofit:2.9.0")
// implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.7.2")
implementation("pub.devrel:easypermissions:3.0.0")
@ -77,6 +74,9 @@ dependencies {
implementation ("com.google.code.gson:gson:2.10.1")
val room_version = "2.6.1"
implementation ("androidx.room:room-runtime:$room_version")
kapt("androidx.room:room-compiler:$room_version")
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
implementation("com.google.firebase:firebase-analytics-ktx")
@ -122,8 +122,7 @@ dependencies {
implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
implementation("androidx.recyclerview:recyclerview:1.1.0")
//Tramini
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
//-----------------------------TopOn 聚合

View File

@ -19,19 +19,42 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#
# -keep class com.cute.girl.hd.pink.img.wallpaper.db.CategoryData { *; }
# -keep class com.cute.girl.hd.pink.img.wallpaper.db.Data { *; }
#
# -dontwarn org.bouncycastle.jsse.BCSSLParameters
# -dontwarn org.bouncycastle.jsse.BCSSLSocket
# -dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
# -dontwarn org.conscrypt.Conscrypt$Version
# -dontwarn org.conscrypt.Conscrypt
# -dontwarn org.conscrypt.ConscryptHostnameVerifier
# -dontwarn org.openjsse.javax.net.ssl.SSLParameters
# -dontwarn org.openjsse.javax.net.ssl.SSLSocket
# -dontwarn org.openjsse.net.ssl.OpenJSSE
# 保持 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 * { *; }
-keep class com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData { *; }
-keep class com.cute.girl.hd.pink.img.wallpaper.entity.Data { *; }
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
#---------------------------------TopOn 聚合
# Vungle

View File

@ -0,0 +1,68 @@
<!DOCTYPE html>
<!-- saved from url=(0046)https://artwallpaper.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><strong>May 23, 2024</strong></p>
<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://artwallpaper.bitbucket.io/RaymundoMeerdinkP9@gmail.com">RaymundoMeerdinkP9@gmail.com</a>.</p>
</body></html>

View File

@ -1,6 +1,7 @@
[
{
"name": "feature",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d799900c0ed4448a858fabe9a97adb74.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0778d29d9df3135981fa983db6447d4c.jpeg",
@ -102,6 +103,7 @@
},
{
"name": "recent",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/35b096446e9a5d5f48ceb0200a8f998a.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/e3e9cfd7ecb0f9291a40577ccd5a6041.jpeg",
@ -191,6 +193,7 @@
},
{
"name": "popular",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/450cfe73f9504835f27f7e86dff24d7f.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/cb1e57d9a8a8b74bd9da3a59d048b5f5.jpeg",
@ -280,6 +283,7 @@
},
{
"name": "anime",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/4dedaccf8e3cdec4bab521ba2714735d.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/78a53756b869919dea40478e803165fe.jpeg",
@ -333,6 +337,7 @@
},
{
"name": "unicorn",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/66e51fb0c777083a33c87169ff431c27.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/f394722f00db0df931ea62d8e0f1f273.jpeg",
@ -386,6 +391,7 @@
},
{
"name": "kitty",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/77b08753cd065bd8e60873b1c119538d.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0b52fe7cc5b2cf2d11cda94cf6dd77a9.jpeg",
@ -439,6 +445,7 @@
},
{
"name": "puppies",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/29c711336f36473a3cacd4d9661f953a.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d86f07746d129601913d2bf09599f6e8.jpeg",
@ -492,6 +499,7 @@
},
{
"name": "flowers",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/c7a1784fb016359f7a62a882333cc83b.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/2a05f339aa023822a6b07c843910241d.jpeg",
@ -545,6 +553,7 @@
},
{
"name": "eiffel tower",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/b6cde087dab857fdb24b0f0abd2385fa.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d7ea774c7936847034e7d47c6a4c3621.jpeg",
@ -598,6 +607,7 @@
},
{
"name": "dreamy",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/b66b86b24e7d5998b3ea5a6536929fa6.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/078a2934e9bd4e91691040427e42c1cf.jpeg",
@ -651,6 +661,7 @@
},
{
"name": "animals",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/ad04501013a619c9b579dc2d9e593bf2.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/10a20226dda3cf01850566e1cfe2e57b.jpeg",
@ -704,6 +715,7 @@
},
{
"name": "nature",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/aeaf0a95791d5064adf22a0dffc59692.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0a0068552c7716f4e62b52389be2e7aa.jpeg",
@ -757,6 +769,7 @@
},
{
"name": "cute",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/7a5e9212400d93fd5f5d6c1848b3d76e.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/6a53bf315f64477d85ceb46298475b8d.jpeg",
@ -810,6 +823,7 @@
},
{
"name": "cute",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/6af1ac41c0bda2023d5b8268b7e1295b.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/24281fc765fce9da4c3d9d86e1e9ccf3.jpeg",
@ -863,6 +877,7 @@
},
{
"name": "beautiful",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0045a8e120149c1088dcc90669b4e08c.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/a2e09a56793fbf9e8104833a199cf332.jpeg",
@ -916,6 +931,7 @@
},
{
"name": "love",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/7929459c12e04cfdc0613518a620b44b.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/93d96dd6956db5e77d25d83b9f46624c.jpeg",
@ -969,6 +985,7 @@
},
{
"name": "quotes",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/3deec3b8eaeff16459a684cef5224b9b.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/ffdee201ab115879fd038a7f529d7d2c.jpeg",
@ -1022,6 +1039,7 @@
},
{
"name": "kawaii",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/59eecae04d88aafdfc27dbdbed3f7206.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/de00f68d508f814beb905cd2fcb105b6.jpeg",
@ -1075,6 +1093,7 @@
},
{
"name": "butterflies",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/2be531772db23680710b0ae0f6bbd6b1.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/14bec2138e0dbbb8269fcd823373ec81.jpeg",
@ -1128,6 +1147,7 @@
},
{
"name": "ice-cream",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0bf796c657ed4d6f71a87506f78d5810.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/1bbcf0d4423449788cbc823441a3639a.jpeg",
@ -1181,6 +1201,7 @@
},
{
"name": "birds",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/eb8cff06bba7da5f3bdc7171815f30b0.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d027d5c75d46118a8ff86257f87a7818.jpeg",
@ -1234,6 +1255,7 @@
},
{
"name": "candy",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/e249865fcb0a40a9e64fbb125b467643.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d0522722bb51d48e79670f07e4ec94ed.jpeg",
@ -1287,6 +1309,7 @@
},
{
"name": "illustration",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0bd89baff334793eac9ea18c651d43b5.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/741a4f4e3c11a30f5f250eabb255f3d5.jpeg",
@ -1340,6 +1363,7 @@
},
{
"name": "colorful",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/2af2a4d4e9ab05a8ed888fb4a704ee07.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/668845fe70cd30c376a78f566e4b89c6.jpeg",
@ -1393,6 +1417,7 @@
},
{
"name": "pattern",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/9e75b52e8e3fee0ad35f4145935c2cb2.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/8b570d932db8d172bb9c1aca58972d4d.jpeg",
@ -1446,6 +1471,7 @@
},
{
"name": "floral",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/2831602ba02537da94d995723ccf7267.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/4ae5e4942ebe89d59e9cdc92b2805ccb.jpeg",
@ -1499,6 +1525,7 @@
},
{
"name": "cakes",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/b18657ce8505fca699060de13b37ce03.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/96e101029fa82cad3fba032e4d907874.jpeg",
@ -1540,6 +1567,7 @@
},
{
"name": "abstract",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/043429d95275d9ac3b571751507632d1.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/4bff588558b80ede14e99fdeeef127ad.jpeg",
@ -1593,6 +1621,7 @@
},
{
"name": "amoled",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/c7e353bebb4b98ecd4cd3d5311fcc84d.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/13362a433eeb77a8fddc8c5a75291d57.jpeg",
@ -1646,6 +1675,7 @@
},
{
"name": "vintage",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0d7fe05abaa5a041d26b3c0541533f88.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/a4e335102bf1bd6e2b9a305afff7c9b0.jpeg",
@ -1699,6 +1729,7 @@
},
{
"name": "cool",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0d183f9e2cc4ad2626d58bf60ef423e6.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/de36a2eae65bb24a433f22d2de2adf2f.jpeg",
@ -1752,6 +1783,7 @@
},
{
"name": "variety",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/fe57f912ce3eedf20716b20335b92a7a.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/3a5965c4291dba859c4b7f0b196f99c2.jpeg",
@ -1805,6 +1837,7 @@
},
{
"name": "funny",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/b2e70fdc63bcefd5846f136da3975f9c.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/1bd4c32c2eb2045a19c4cf7afb8201d4.jpeg",
@ -1858,6 +1891,7 @@
},
{
"name": "food",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d04ee07feb44c02fcf92a7c3094370fb.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/3a49c824f553e1b8f2ce743cb89e1b6c.jpeg",
@ -1911,6 +1945,7 @@
},
{
"name": "fashion",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d9fb7a20ef94b3c8379eeabd2f085211.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/f90e441b77b209c856bb2441ba11bac4.jpeg",
@ -1964,6 +1999,7 @@
},
{
"name": "sad",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/3670282caa3a1b93913827c103476de4.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/c59007c4e8b3befb96dbecb3ec326cc1.jpeg",
@ -2017,6 +2053,7 @@
},
{
"name": "music",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/ba895bdb432d5ae1315777e89f07b2de.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/d5f3a2230952dab694ff0a80825e0a9d.jpeg",
@ -2038,6 +2075,7 @@
},
{
"name": "fruit",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/25defad4df6676943fee66672cd9c469.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/e0f64bd789ef513368865c9f42adfaab.jpeg",
@ -2091,6 +2129,7 @@
},
{
"name": "doll",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/cf99a915f6e25f8a84edb0297ae5d5a7.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/8adbcdd5abe61cc2210d8d5bdc7343e8.jpeg",
@ -2144,6 +2183,7 @@
},
{
"name": "teddy",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/0cd0f61b1feaaca0be9d35baecfa9fb3.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/03b962f4e3ff5cc220544c6589a49482.jpeg",
@ -2169,10 +2209,6 @@
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/498b2956356743dd61bcf43c5e2bdfe5.jpeg",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/44f01787f33c354865ef2e0235a52bb7.jpeg"
},
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/8739a1033149540124a0c9bf2dca71b2.jpeg",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/dd3608457a2915a29de559f59927babc.jpeg"
},
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/30448f7b2fe2bcdf037fc3d1fc971751.jpeg",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/998df3180fbf701806e8fcdff50880fc.jpeg"
@ -2197,6 +2233,7 @@
},
{
"name": "winter",
"preUrl": "https://resource-sg-public.lux-ad.com/wallpaper/8497b431b92946723d7acbd1c9836bde.jpeg",
"list": [
{
"sourceUrl": "https://resource-sg-public.lux-ad.com/wallpaper/028622eed6c6083a721b5c6af19053d1.jpeg",

View File

@ -5,10 +5,14 @@ import android.util.Log
import com.anythink.core.api.ATSDK
import com.anythink.core.api.NetTrafficeCallback
//import com.anythink.debug.api.ATDebuggerUITest
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import com.cute.girl.hd.pink.img.wallpaper.topon.AdManager
import com.liulishuo.filedownloader.FileDownloader
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.json.JSONArray
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
@ -23,15 +27,19 @@ import java.nio.charset.StandardCharsets
class MyApp : Application() {
companion object {
lateinit var app: MyApp
lateinit var myData: List<CategoryData>
const val DB_Table_category = "Category"
const val DB_Table_wallpaper = "Wallpaper"
const val DB_NAME = "Art_Wallpaper"
const val DB_VERSION = 1
lateinit var myData: List<Category>
const val TAG = "=============="
const val AD_INIT_ACTION = "on_success_action"
var initSDK = false
}
private val APPId="h66978895679a9"
private val APPKey="00c254f2caba04948f14c41014ac5f33"
private val debug_key="fe06c76b794f95216f98e5982ae8f335fc558956"
private val APPId = "h66978895679a9"
private val APPKey = "00c254f2caba04948f14c41014ac5f33"
private val debug_key = "fe06c76b794f95216f98e5982ae8f335fc558956"
override fun onCreate() {
super.onCreate()
app = this
@ -41,65 +49,55 @@ class MyApp : Application() {
}
private fun readJson() {
val openFd = assets.open("test_new.json")
val pathDe = cacheDir.path + "/res.json"
if (File(pathDe).exists()) {
myData = fileToData(pathDe)
return
}
if (writeFile(openFd, pathDe)) {
myData = fileToData(pathDe)
CoroutineScope(Dispatchers.IO).launch {
val queryAll = MyDatabase.myDatabase.CategoryDao().queryAllData()
Log.d("-----------", "------queryAll=${queryAll.size}")
if (queryAll.isEmpty()) {
val openFd = assets.open("wallpaper.json")
fileToData(openFd)
}
}
}
private fun fileToData(path: String): List<CategoryData> {
val jsonStr = getJsonStr(path)
var data = mutableListOf<CategoryData>()
private fun fileToData(assetInput: InputStream) {
val jsonStr = getJsonStr(assetInput)
val array = JSONArray(jsonStr)
for (i in 0 until array.length()) {
val any = array.getJSONObject(i)
val title = any.getString("name")
val covert = any.getString("preUrl")
val categoryId = MyDatabase.myDatabase.CategoryDao()
.insertData(Category(title = title, covert = covert))
val jsonArray = any.getJSONArray("list")
var data1 = mutableListOf<Data>()
for (k in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(k)
val source = jsonObject.getString("sourceUrl")
val preview = jsonObject.getString("preUrl")
data1.add(Data(preview, source))
MyDatabase.myDatabase.WallpaperDao()
.insertWallpaper(
Data(
categoryId = categoryId,
sourceURl = source,
previewURl = preview
)
)
}
data.add(CategoryData(title, data1))
}
return data
}
fun writeFile(input: InputStream, filePath: String): Boolean {
val byte = ByteArray(4096)
val output = ByteArrayOutputStream()
var l: Int
while (input.read(byte).also { l = it } != -1) {
output.write(byte, 0, l)
}
val fileDe = File(filePath)
if (!fileDe.exists()) {
fileDe.createNewFile()
}
val fileOutputStream = FileOutputStream(filePath)
fileOutputStream.write(output.toByteArray())
output.close()
fileOutputStream.close()
return true
}
fun getJsonStr(resPath: String): String {
fun getJsonStr(input: InputStream): String {
val stringWriter = StringWriter()
val input = FileInputStream(resPath)
val charArray = CharArray(input.available())
var l = 0;
val bufReader = BufferedReader(InputStreamReader(input, StandardCharsets.UTF_8))
@ -129,7 +127,7 @@ class MyApp : Application() {
})
ATSDK.init( this, APPId, APPKey)
ATSDK.init(this, APPId, APPKey)
AdManager.loadAllAd()
//测试工具
// ATDebuggerUITest.showDebuggerUI(this,debug_key)

View File

@ -13,13 +13,13 @@ import com.bumptech.glide.request.target.Target
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestListener
import com.cute.girl.hd.pink.img.wallpaper.databinding.ItemCategoryBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData
import com.cute.girl.hd.pink.img.wallpaper.entity.GCategory
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
class CategoryAdapter(private val ctx: Context, private val list: List<CategoryData>) :
class CategoryAdapter(private val ctx: Context) :
RecyclerView.Adapter<CategoryAdapter.VH>() {
private var list: List<Category> = emptyList()
private var mListener: OnItemClickListener? = null
@ -27,6 +27,12 @@ class CategoryAdapter(private val ctx: Context, private val list: List<CategoryD
return VH(ItemCategoryBinding.inflate(LayoutInflater.from(ctx), parent, false))
}
fun update(data:List<Category>){
list = data
notifyDataSetChanged()
}
override fun onBindViewHolder(holder: VH, position: Int) {
if (list.isEmpty()) {
return
@ -43,7 +49,7 @@ class CategoryAdapter(private val ctx: Context, private val list: List<CategoryD
holder.mItemBinding?.ivPlaceholder?.show()
holder.mItemBinding?.ivWallpaper?.let {
Glide.with(ctx)
.load(bean.data[0].previewURl)
.load(bean.covert)
.transition(DrawableTransitionOptions.withCrossFade())
.listener(object : RequestListener<Drawable> {
override fun onLoadFailed(
@ -80,7 +86,7 @@ class CategoryAdapter(private val ctx: Context, private val list: List<CategoryD
}
interface OnItemClickListener {
fun onItemClick(categoryData: CategoryData)
fun onItemClick(category: Category)
}
class VH(itemView: View) : RecyclerView.ViewHolder(itemView) {

View File

@ -13,18 +13,23 @@ import com.bumptech.glide.request.target.Target
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestListener
import com.cute.girl.hd.pink.img.wallpaper.databinding.ItemImageBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GCategoryDetail
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.utils.DeviceUtil
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.dp2PxInt
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
class CategoryDetailAdapter(private val ctx: Context, private val list: List<Data>) :
class CategoryDetailAdapter(private val ctx: Context) :
RecyclerView.Adapter<CategoryDetailAdapter.VH>() {
private var list: List<Data> = emptyList()
private var mListener: OnItemClickListener? = null
fun updateData(mList:List<Data>){
list = mList
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
return VH(ItemImageBinding.inflate(LayoutInflater.from(ctx), parent, false))
}

View File

@ -1,107 +0,0 @@
package com.cute.girl.hd.pink.img.wallpaper.adapter
import android.content.Context
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target
import com.cute.girl.hd.pink.img.wallpaper.databinding.ItemPreviewBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GCategoryDetail
import com.cute.girl.hd.pink.img.wallpaper.utils.DownloadUtil
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
class CategoryPagerAdapter(private val ctx: Context, private val list: MutableList<Data>) :
RecyclerView.Adapter<CategoryPagerAdapter.VH>() {
private var mListener: OnItemClickListener? = null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
return VH(ItemPreviewBinding.inflate(LayoutInflater.from(ctx), parent, false))
}
override fun onBindViewHolder(holder: VH, position: Int) {
if (list.isEmpty()) {
return
}
if (position >= list.size) {
return
}
val bean = list[position]
holder.mItemBinding?.ivPlaceholder?.show()
val url = if (DownloadUtil.isExist(bean.sourceURl, bean.getTag())) {
DownloadUtil.getFilePath(bean.getTag())
} else {
bean.previewURl
}
// val url =bean.previewURl
holder.mItemBinding?.ivWallpaper?.let {
Glide.with(ctx)
.load(url)
.transition(DrawableTransitionOptions.withCrossFade())
.listener(object : RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
holder.mItemBinding?.ivPlaceholder?.show()
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
holder.mItemBinding?.ivPlaceholder?.hide()
return false
}
})
.into(it)
}
holder.getRoot()?.let {
it.setOnClickListener { mListener?.onItemClick(position) }
}
}
override fun getItemCount(): Int {
return list.size
}
fun setOnItemClickListener(listener: OnItemClickListener) {
mListener = listener
}
interface OnItemClickListener {
fun onItemClick(pos: Int)
}
class VH(itemView: View) : RecyclerView.ViewHolder(itemView) {
var mItemBinding: ItemPreviewBinding? = null
constructor(binding: ItemPreviewBinding) : this(binding.root) {
this.mItemBinding = binding
}
fun getRoot(): View? {
return mItemBinding?.root
}
}
}

View File

@ -13,19 +13,17 @@ import com.bumptech.glide.request.target.Target
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestListener
import com.cute.girl.hd.pink.img.wallpaper.databinding.ItemImageBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GImage
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.utils.DeviceUtil
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.dp2PxInt
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
class ImageGridAdapter(private val ctx: Context, private var list: List<Data>) :
class ImageGridAdapter(private val ctx: Context) :
RecyclerView.Adapter<ImageGridAdapter.VH>() {
private var mListener: OnItemClickListener? = null
private var list: List<Data> = emptyList()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
return VH(ItemImageBinding.inflate(LayoutInflater.from(ctx), parent, false))
}

View File

@ -13,8 +13,7 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target
import com.cute.girl.hd.pink.img.wallpaper.databinding.ItemPreviewBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GImage
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.utils.DownloadUtil
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show

View File

@ -0,0 +1,15 @@
package com.cute.girl.hd.pink.img.wallpaper.db
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import java.io.Serializable
@Entity(tableName = MyApp.DB_Table_category)
class Category(
@PrimaryKey(autoGenerate = true)
var id: Long = 0,
var title: String,
var covert:String
):Serializable{
}

View File

@ -0,0 +1,28 @@
package com.cute.girl.hd.pink.img.wallpaper.db;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import java.util.List;
@Dao
public interface CategoryDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
long insertData(Category data);
@Query("select * from category order by id desc")
LiveData<List<Category>> queryAll();
@Query("select * from category where title = :mtitle")
Category queryCateId(String mtitle);
@Query("select * from category order by id desc")
List<Category> queryAllData();
}

View File

@ -0,0 +1,61 @@
package com.cute.girl.hd.pink.img.wallpaper.db
import android.util.Log
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import java.io.Serializable
//class Data(var previewURl: String, var sourceURl: String) : Serializable {
//
// fun getTag(): String {
// val lastIndex1 = sourceURl.lastIndexOf("/")
//
// val lastIndex2 = sourceURl.lastIndexOf(".")
//
// val substring = sourceURl.substring(lastIndex1+1, lastIndex2)
// Log.d("-----------","------TAG----$substring")
//
// return substring
//
// }
//
//
//
//}
@Entity(
tableName = MyApp.DB_Table_wallpaper, foreignKeys = arrayOf(
ForeignKey(
entity = Category::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("categoryId"),
onDelete = ForeignKey.CASCADE
)
),
indices = [Index(value = ["id"], unique = true), Index(value = ["categoryId"])]
)
class Data(
@PrimaryKey(autoGenerate = true)
var id: Long = 0,
var categoryId: Long = 0,
var sourceURl: String,
var previewURl: String,
var sourceCache: String?= null,
var like: Boolean = false
) : Serializable {
fun getTag(): String {
val lastIndex1 = sourceURl.lastIndexOf("/")
val lastIndex2 = sourceURl.lastIndexOf(".")
val substring = sourceURl.substring(lastIndex1+1, lastIndex2)
Log.d("-----------","------TAG----$substring")
return substring
}
}

View File

@ -0,0 +1,29 @@
package com.cute.girl.hd.pink.img.wallpaper.db
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.cute.girl.hd.pink.img.wallpaper.MyApp
@Database(
entities = [Category::class, Data::class],
version = MyApp.DB_VERSION,
exportSchema = false
)
abstract class MyDatabase : RoomDatabase() {
abstract fun CategoryDao(): CategoryDao
abstract fun WallpaperDao(): WallpaperDao
companion object {
val myDatabase: MyDatabase by lazy {
Room.databaseBuilder(
MyApp.app, MyDatabase::class.java,
MyApp.DB_NAME
).build()
}
}
}

View File

@ -0,0 +1,32 @@
package com.cute.girl.hd.pink.img.wallpaper.db;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@Dao
public interface WallpaperDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
void insertWallpaper(Data prank);
@Query("select * from wallpaper where `like` ==:mlike")
LiveData<List<Data>> queryAllLike(boolean mlike );
@Query("select * from wallpaper where categoryId ==:mCategoryId")
LiveData<List<Data>> queryList(long mCategoryId);
@Query("select * from wallpaper where categoryId ==:mCategoryId")
List<Data> queryCategoryList(long mCategoryId);
@Query("select * from wallpaper where id ==:mId")
LiveData<Data> queryWallpaper(long mId);
@Update
void updateWallpaper(Data wallpaper);
}

View File

@ -1,5 +0,0 @@
package com.cute.girl.hd.pink.img.wallpaper.entity
import java.io.Serializable
class CategoryData(var title:String,var data:List<Data>):Serializable

View File

@ -1,22 +0,0 @@
package com.cute.girl.hd.pink.img.wallpaper.entity
import android.util.Log
import java.io.Serializable
class Data(var previewURl: String, var sourceURl: String) : Serializable {
fun getTag(): String {
val lastIndex1 = sourceURl.lastIndexOf("/")
val lastIndex2 = sourceURl.lastIndexOf(".")
val substring = sourceURl.substring(lastIndex1+1, lastIndex2)
Log.d("-----------","------TAG----$substring")
return substring
}
}

View File

@ -3,23 +3,25 @@ package com.cute.girl.hd.pink.img.wallpaper.page
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.cute.girl.hd.pink.img.wallpaper.adapter.CategoryDetailAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.AbilityCategoryBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryPreviewBean
import com.cute.girl.hd.pink.img.wallpaper.entity.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.IntentConstants
//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.response.ResponseCategoryDetail
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.onMain
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.view.CustomItemDecoration
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.CategoryListViewModel
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.CategoryViewModel
import java.util.concurrent.atomic.AtomicBoolean
class CategoryAbility : AppCompatActivity() {
@ -29,13 +31,13 @@ class CategoryAbility : AppCompatActivity() {
// private var mService: ServiceImage<ResponseCategoryDetail>? = null
private var isLoading = AtomicBoolean(false)
private var mPage = 1
private lateinit var mCid :CategoryData
private lateinit var mCid : Category
private var mCName = ""
private lateinit var mViewModel: CategoryListViewModel
companion object {
fun start(context: Context, categoryData: CategoryData) {
fun start(context: Context, category: Category) {
val intent = Intent(context, CategoryAbility::class.java)
intent.putExtra(IntentConstants.KEY_STRING, categoryData)
intent.putExtra(IntentConstants.KEY_STRING, category)
// intent.putExtra(IntentConstants.KEY_STRING2, cName)
context.startActivity(intent)
}
@ -44,6 +46,9 @@ class CategoryAbility : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = AbilityCategoryBinding.inflate(layoutInflater)
mViewModel = ViewModelProvider(this).get(CategoryListViewModel::class.java)
setContentView(binding.root)
setupViews()
binding.ivBack.setOnClickListener {
@ -54,21 +59,17 @@ class CategoryAbility : AppCompatActivity() {
private fun setupViews() {
if (intent.hasExtra(IntentConstants.KEY_STRING)) {
if (intent.getSerializableExtra(IntentConstants.KEY_STRING) != null) {
mCid = intent.getSerializableExtra(IntentConstants.KEY_STRING) as CategoryData
mCid = intent.getSerializableExtra(IntentConstants.KEY_STRING) as Category
mViewModel.queryData(mCid.id)
}
}
// if (intent.hasExtra(IntentConstants.KEY_STRING2)) {
// if (intent.getStringExtra(IntentConstants.KEY_STRING2) != null) {
// mCName = intent.getStringExtra(IntentConstants.KEY_STRING2)!!
// }
// }
// if (TextUtils.isEmpty(mCid)) {
// finish()
// return
// }
binding.tvTitle.text = mCid.title
mAdapter = CategoryDetailAdapter(this, mCid.data)
mAdapter = CategoryDetailAdapter(this)
mViewModel.listLiveData.observe(this){
mAdapter?.updateData(it)
}
mAdapter?.setOnItemClickListener(object :
CategoryDetailAdapter.OnItemClickListener {
override fun onItemClick(pos: Data) {

View File

@ -1,24 +1,27 @@
package com.cute.girl.hd.pink.img.wallpaper.page
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.adapter.CategoryAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.PageRecentBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.CategoryData
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.entity.GCategory
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.ServiceImage
//import com.cute.girl.hd.pink.img.wallpaper.net.response.ResponseCategory
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.onMain
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.view.CustomItemDecoration
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.CategoryViewModel
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.PopularViewModel
import java.util.concurrent.atomic.AtomicBoolean
class CategoryPage : Fragment() {
@ -28,13 +31,15 @@ class CategoryPage : Fragment() {
// private var mService: ServiceImage<ResponseCategory>? = null
private var isLoading = AtomicBoolean(false)
private lateinit var mViewModel: CategoryViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = PageRecentBinding.inflate(layoutInflater)
mViewModel = ViewModelProvider(this).get(CategoryViewModel::class.java)
return binding.root
}
@ -44,13 +49,14 @@ class CategoryPage : Fragment() {
}
private fun setupViews() {
val subList = MyApp.myData.subList(3, MyApp.myData.size)
mAdapter = CategoryAdapter(requireActivity(), subList)
mAdapter = CategoryAdapter(requireActivity())
mViewModel.listLiveData.observe(viewLifecycleOwner){
Log.d(MyApp.TAG,"-----Category--data--${it.size}")
mAdapter?.update(it)
}
mAdapter?.setOnItemClickListener(object :
CategoryAdapter.OnItemClickListener {
override fun onItemClick(pos: CategoryData) {
override fun onItemClick(pos: Category) {
toDetail(pos)
}
})
@ -60,87 +66,18 @@ class CategoryPage : Fragment() {
)
binding.rv.adapter = mAdapter!!
//下拉刷新
// binding.refreshLayout.setOnRefreshListener {
// if (isLoading.get()) {
// return@setOnRefreshListener
// }
// refresh()
// }
refresh()
}
private fun refresh() {
// if (mService == null) {
// mService = ServiceImage()
// }
// if (isLoading.get()) {
// return
// }
// isLoading.set(true)
// mService?.let { service ->
// val call = service.mApi.getCategory()
// service.callEnqueue(call, object : BaseListener<ResponseCategory> {
// override fun onResponse(t: ResponseCategory?) {
// if (t != null) {
// if (t.MaterialWallpaper != null && t.MaterialWallpaper.isNotEmpty()) {
// mList.clear()
// mList.addAll(t.MaterialWallpaper.toMutableList())
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// } else {
// onMain {
// updateView()
// }
// }
// } else {
// onMain {
// updateView()
// }
// }
// }
//
// override fun onFail(e: String?) {
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// }
// })
// }
}
fun updateView() {
// binding.refreshLayout.finishRefresh()
// binding.refreshLayout.finishLoadMore()
if (mList.isNotEmpty()) {
binding.tvEmpty.hide()
} else {
binding.tvEmpty.show()
}
}
fun toDetail(pos: CategoryData) {
fun toDetail(pos: Category) {
if (activity != null) {
showTopOn{
AdManager.showTopOn(requireActivity()){
CategoryAbility.start(requireActivity(), pos)
}
}
}
private fun showTopOn(action: () -> Unit) {
AdManager.showAD(requireActivity()) { integer: Int ->
if (integer == AdManager.type_show_close || integer == AdManager.type_no_cache || integer == AdManager.type_show_fail) {
action.invoke()
}
}
}
}

View File

@ -1,37 +1,43 @@
package com.cute.girl.hd.pink.img.wallpaper.page
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.R
import com.cute.girl.hd.pink.img.wallpaper.adapter.ImageGridAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.PageRecentBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.entity.GImage
import com.cute.girl.hd.pink.img.wallpaper.entity.PreviewBean
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.view.CustomItemDecoration
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.CategoryViewModel
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.FavoriteViewModel
import java.util.concurrent.atomic.AtomicBoolean
class FeaturePage : Fragment() {
class FavoritPage : Fragment() {
private lateinit var binding: PageRecentBinding
private var mList: MutableList<GImage> = mutableListOf()
private lateinit var mList: List<Data>
private var mAdapter: ImageGridAdapter? = null
// private var mService: ServiceImage<ResponseImage>? = null
private var isLoading = AtomicBoolean(false)
private var mPage = 1
private lateinit var mViewModel: FavoriteViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = PageRecentBinding.inflate(layoutInflater)
mViewModel = ViewModelProvider(this).get(FavoriteViewModel::class.java)
return binding.root
}
@ -41,61 +47,46 @@ class FeaturePage : Fragment() {
}
private fun setupViews() {
binding.tvEmpty.setText(getString(R.string.no_like))
binding.tvEmpty.isVisible = true
mAdapter = ImageGridAdapter(requireActivity())
mAdapter = ImageGridAdapter(requireActivity(), MyApp.myData[0].data)
MyDatabase.myDatabase.WallpaperDao().queryAllLike(true).observe(requireActivity()){
Log.d(MyApp.TAG,"----------like=${it.size}")
if(it.isNotEmpty()){
binding.tvEmpty.isVisible = false
}
mAdapter?.refresh(it)
}
mAdapter?.setOnItemClickListener(object :
ImageGridAdapter.OnItemClickListener {
override fun onItemClick(pos: Data) {
toPreview(pos)
}
})
binding.rv.layoutManager = GridLayoutManager(requireActivity(), 3)
binding.rv.addItemDecoration(
CustomItemDecoration(1, 2)
)
binding.rv.adapter = mAdapter!!
// //下拉刷新
// binding.refreshLayout.setOnRefreshListener {
// if (isLoading.get()) {
// return@setOnRefreshListener
// }
// refresh()
// }
//
// //上拉加载
// binding.refreshLayout.setOnLoadMoreListener {
// if (isLoading.get()) {
// return@setOnLoadMoreListener
// }
// loadMore()
// }
}
fun updateView() {
// binding.refreshLayout.finishRefresh()
// binding.refreshLayout.finishLoadMore()
if (mList.isNotEmpty()) {
binding.tvEmpty.hide()
} else {
binding.tvEmpty.show()
}
}
fun toPreview(pos: Data) {
// if (pos < 0 || pos >= mList.size) {
// return
// }
fun toPreview(data: Data) {
if (activity != null) {
val listBean = PreviewBean()
listBean.list = mList
PreviewAbility.start(requireActivity(), pos)
// val listBean = PreviewBean()
// listBean.list = mList
PreviewAbility.start(requireActivity(), data)
}
}

View File

@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.cute.girl.hd.pink.img.wallpaper.R
import com.cute.girl.hd.pink.img.wallpaper.databinding.AbilityMainBinding
import com.cute.girl.hd.pink.img.wallpaper.topon.AdManager
class MainAbility : AppCompatActivity() {
private lateinit var binding: AbilityMainBinding
@ -22,19 +23,18 @@ class MainAbility : AppCompatActivity() {
super.onCreate(savedInstanceState)
binding = AbilityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
AdManager.loadAllAd()
setupViews()
}
private fun setupViews() {
binding.tvVersion.text = "v${getAppVersionName()}"
mTitles.add("Recent")
mTitles.add("Popular")
mTitles.add("Feature")
mTitles.add("Category")
mFragments.add(RecentPage())
mTitles.add(getString(R.string.title_popular))
mTitles.add(getString(R.string.title_cate))
mTitles.add(getString(R.string.title_fav))
mFragments.add(PopularPage())
mFragments.add(FeaturePage())
mFragments.add(CategoryPage())
mFragments.add(FavoritPage())
mAdapter = MyPagerAdapter(supportFragmentManager)
binding.viewPager.adapter = mAdapter!!

View File

@ -1,50 +1,59 @@
package com.cute.girl.hd.pink.img.wallpaper.page
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.adapter.ImageGridAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.PageRecentBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.view.CustomItemDecoration
import com.cute.girl.hd.pink.img.wallpaper.viewmodel.PopularViewModel
import java.util.concurrent.atomic.AtomicBoolean
class PopularPage : Fragment() {
private lateinit var binding: PageRecentBinding
private lateinit var mList: List<Data>
private var mAdapter: ImageGridAdapter? = null
// private var mService: ServiceImage<ResponseImage>? = null
// private var mService: ServiceImage<ResponseImage>? = null
private var isLoading = AtomicBoolean(false)
private var mPage = 1
private lateinit var mViewModel: PopularViewModel
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = PageRecentBinding.inflate(layoutInflater)
Log.d(MyApp.TAG,"-------onCreateView--")
mViewModel = ViewModelProvider(this).get(PopularViewModel::class.java)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mList = MyApp.myData[2].data
setupViews()
}
private fun setupViews() {
mAdapter = ImageGridAdapter(requireActivity(), mList)
mAdapter = ImageGridAdapter(requireActivity())
mViewModel.listLiveData.observe(viewLifecycleOwner){
Log.d(MyApp.TAG,"-----Popular--data--${it.size}")
mAdapter?.refresh(it)
}
mAdapter?.setOnItemClickListener(object :
ImageGridAdapter.OnItemClickListener {
override fun onItemClick(pos: Data) {
toPreview(pos)
}
})
@ -54,124 +63,11 @@ class PopularPage : Fragment() {
)
binding.rv.adapter = mAdapter!!
// //下拉刷新
// binding.refreshLayout.setOnRefreshListener {
// if (isLoading.get()) {
// return@setOnRefreshListener
// }
// refresh()
// }
//
// //上拉加载
// binding.refreshLayout.setOnLoadMoreListener {
// if (isLoading.get()) {
// return@setOnLoadMoreListener
// }
// loadMore()
// }
refresh()
}
private fun refresh() {
// if (mService == null) {
// mService = ServiceImage()
// }
// if (isLoading.get()) {
// return
// }
// isLoading.set(true)
// mPage = 1
// mService?.let { service ->
// val call = service.mApi.getPopular(1)
// service.callEnqueue(call, object : BaseListener<ResponseImage> {
// override fun onResponse(t: ResponseImage?) {
// if (t != null) {
// if (t.MaterialWallpaper != null && t.MaterialWallpaper.isNotEmpty()) {
// mList.clear()
// mList.addAll(t.MaterialWallpaper.toMutableList())
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// } else {
// onMain {
// updateView()
// }
// }
// } else {
// onMain {
// updateView()
// }
// }
// }
//
// override fun onFail(e: String?) {
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// }
// })
// }
}
private fun loadMore() {
// if (mService == null) {
// mService = ServiceImage()
// }
// if (isLoading.get()) {
// return
// }
// isLoading.set(true)
// val newPage = mPage + 1
// mService?.let { service ->
// val call = service.mApi.getPopular(newPage)
// service.callEnqueue(call, object : BaseListener<ResponseImage> {
// override fun onResponse(t: ResponseImage?) {
// if (t != null) {
// if (t.MaterialWallpaper != null && t.MaterialWallpaper.isNotEmpty()) {
// mList.addAll(t.MaterialWallpaper.toMutableList())
// isLoading.set(false)
// mPage = newPage
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// } else {
// onMain {
// updateView()
// }
// }
// } else {
// onMain {
// updateView()
// }
// }
// }
//
// override fun onFail(e: String?) {
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// }
// })
// }
}
fun updateView() {
// binding.refreshLayout.finishRefresh()
// binding.refreshLayout.finishLoadMore()
if (mList.isNotEmpty()) {
binding.tvEmpty.hide()
} else {
binding.tvEmpty.show()
}
}
fun toPreview(pos: Data) {

View File

@ -16,7 +16,8 @@ import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.R
import com.cute.girl.hd.pink.img.wallpaper.adapter.ImagePagerAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.AbilityPreviewBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
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.utils.DownloadUtil
@ -27,6 +28,8 @@ import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.utils.MediaUtil
import com.cute.girl.hd.pink.img.wallpaper.utils.PermissionUtil
import com.cute.girl.hd.pink.img.wallpaper.view.SetAsDialog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import pub.devrel.easypermissions.EasyPermissions
import java.io.File
@ -39,6 +42,8 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
private var mSetAsDialog: SetAsDialog? = null
private var mAction = 0//0设置壁纸 1下载壁纸
var listBean: Data? = null
companion object {
fun start(context: Context, bean: Data) {
@ -52,16 +57,14 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = AbilityPreviewBinding.inflate(layoutInflater)
AdManager.loadAllAd()
setContentView(binding.root)
setupViews()
}
private fun showTopOn(action: () -> Unit) {
AdManager.showAD(this@PreviewAbility) { integer: Int ->
if (integer == AdManager.type_show_close || integer == AdManager.type_no_cache || integer == AdManager.type_show_fail) {
AdManager.showTopOn(this@PreviewAbility) {
action.invoke()
}
}
}
@ -74,10 +77,11 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
initData()
setUpView()
onClick()
}
private fun initData() {
var listBean: Data? = null
if (intent.hasExtra(IntentConstants.KEY_LIST)) {
listBean = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intent.getSerializableExtra(IntentConstants.KEY_LIST, Data::class.java)
@ -89,8 +93,12 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
finish()
return
}
MyDatabase.myDatabase.WallpaperDao().queryWallpaper(listBean!!.id).observe(this){
binding.imLike.isSelected = it.like
}
mList.clear()
mList.add(listBean)
mList.add(listBean!!)
if (mList.size == 0) {
finish()
@ -123,21 +131,51 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
})
}
private fun onClick(){
binding.ivBack.setOnClickListener {
finish()
}
binding.tvSet.setOnClickListener {
mAction = 0
if (isExist()) {
set4KWallpaper()
} else {
startDownload()
showTopOn {
mAction = 0
if (isExist()) {
set4KWallpaper()
} else {
startDownload()
}
}
}
binding.tvDownload.setOnClickListener {
showTopOn{
doSave()
}
}
binding.imLike.setOnClickListener {
showTopOn{
binding.imLike.isSelected = !binding.imLike.isSelected
if(binding.imLike.isSelected){
Toast.makeText(
this@PreviewAbility,
R.string.add_like.getString(),
Toast.LENGTH_SHORT
).show()
}else{
Toast.makeText(
this@PreviewAbility,
R.string.cancel_like.getString(),
Toast.LENGTH_SHORT
).show()
}
}
}
}
@ -163,6 +201,11 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
)
val file = File(path)
if (!file.exists()) {
Toast.makeText(
this@PreviewAbility,
R.string.re_download.getString(),
Toast.LENGTH_SHORT
).show()
return
}
val wallpaperManager = WallpaperManager.getInstance(this)
@ -170,7 +213,6 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
mSetAsDialog = SetAsDialog(this) {
onClickHomeScreen = {
showTopOn {
lifecycleScope.launch {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setStream(file.inputStream())
@ -190,13 +232,13 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
).show()
}
}
}
}
onClickLockScreen = {
showTopOn {
lifecycleScope.launch {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setStream(file.inputStream())
@ -216,12 +258,12 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
).show()
}
}
}
}
onClickBoth = {
showTopOn {
lifecycleScope.launch {
wallpaperManager.setStream(file.inputStream())//FLAG_SYSTEM | FLAG_LOCK)
onMain {
@ -232,8 +274,6 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
).show()
}
}
}
}
}
}
@ -301,9 +341,12 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
DownloadUtil.getFilePath(
image.getTag()
)
val saved = MediaUtil.saveImageToSystemAlbum(path, this@PreviewAbility)
val file = File(path)
val savedUri = MediaUtil.saveToGallery(this@PreviewAbility,file)
// val saved = MediaUtil.saveImageToSystemAlbum(path,this@PreviewAbility)
if (!isFinishing) {
if (saved) {
if (savedUri!= null) {
Toast.makeText(
this@PreviewAbility,
R.string.saved_to_album,
@ -321,6 +364,18 @@ class PreviewAbility : AppCompatActivity(), EasyPermissions.PermissionCallbacks
}
override fun onPause() {
super.onPause()
val selected = binding.imLike.isSelected
CoroutineScope(Dispatchers.IO).launch{
MyDatabase.myDatabase.WallpaperDao().updateWallpaper(listBean?.apply {
like = selected
})
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,

View File

@ -5,29 +5,35 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.view.View
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.R
import com.cute.girl.hd.pink.img.wallpaper.databinding.AbilityPrivacyBinding
import com.cute.girl.hd.pink.img.wallpaper.topon.AdManager
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.getString
class PrivacyAbility : AppCompatActivity() {
private lateinit var binding: AbilityPrivacyBinding
companion object {
const val URL_PRIVACY: String = "https://artwallpaper.bitbucket.io/privacy.html"
fun start(context: Context) {
context.startActivity(Intent(context, PrivacyAbility::class.java))
}
}
private val URL_PRIVACY: String = "file:///android_asset/ArtWallpaper_PrivacyPolicy.html"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = AbilityPrivacyBinding.inflate(layoutInflater)
AdManager.loadAllAd()
setContentView(binding.root)
setupViews()
}
@ -39,30 +45,10 @@ class PrivacyAbility : AppCompatActivity() {
val webSettings: WebSettings = binding.webView.settings
webSettings.javaScriptEnabled = true // enable javascript
webSettings.javaScriptCanOpenWindowsAutomatically = true
binding.webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
if (url.startsWith("http:") || url.startsWith("https:")) {
return false
}
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
return true
}
override fun onReceivedError(
view: WebView,
errorCode: Int,
description: String,
failingUrl: String
) {
}
}
binding.webView.loadUrl(URL_PRIVACY)
binding.ivBack.visibility = View.VISIBLE
binding.ivBack.setOnClickListener {
onBackPressed()
finish()
}
}
}

View File

@ -1,193 +0,0 @@
package com.cute.girl.hd.pink.img.wallpaper.page
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.adapter.ImageGridAdapter
import com.cute.girl.hd.pink.img.wallpaper.databinding.PageRecentBinding
import com.cute.girl.hd.pink.img.wallpaper.entity.Data
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.hide
import com.cute.girl.hd.pink.img.wallpaper.utils.GlobalExt.show
import com.cute.girl.hd.pink.img.wallpaper.view.CustomItemDecoration
import java.util.concurrent.atomic.AtomicBoolean
class RecentPage : Fragment() {
private lateinit var binding: PageRecentBinding
private lateinit var mList: List<Data>
private var mAdapter: ImageGridAdapter? = null
// private var mService: ServiceImage<ResponseImage>? = null
private var isLoading = AtomicBoolean(false)
private var mPage = 1
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = PageRecentBinding.inflate(layoutInflater)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mList = MyApp.myData[1].data
setupViews()
}
private fun setupViews() {
mAdapter = ImageGridAdapter(requireActivity(), mList)
mAdapter?.setOnItemClickListener(object :
ImageGridAdapter.OnItemClickListener {
override fun onItemClick(pos: Data) {
toPreview(pos)
}
})
binding.rv.layoutManager = GridLayoutManager(requireActivity(), 3)
binding.rv.addItemDecoration(
CustomItemDecoration(1, 2)
)
binding.rv.adapter = mAdapter!!
// //下拉刷新
// binding.refreshLayout.setOnRefreshListener {
// if (isLoading.get()) {
// return@setOnRefreshListener
// }
// refresh()
// }
//
// //上拉加载
// binding.refreshLayout.setOnLoadMoreListener {
// if (isLoading.get()) {
// return@setOnLoadMoreListener
// }
// loadMore()
// }
// refresh()
}
private fun refresh(){
val shuffled = mList.shuffled()
mAdapter?.refresh(shuffled)
}
// private fun refresh() {
// if (mService == null) {
// mService = ServiceImage()
// }
// if (isLoading.get()) {
// return
// }
// isLoading.set(true)
// mPage = 1
// mService?.let { service ->
// val call = service.mApi.getRecent(1)
// service.callEnqueue(call, object : BaseListener<ResponseImage> {
// override fun onResponse(t: ResponseImage?) {
// if (t != null) {
// if (t.MaterialWallpaper != null && t.MaterialWallpaper.isNotEmpty()) {
// mList.clear()
// mList.addAll(t.MaterialWallpaper.toMutableList())
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// } else {
// onMain {
// updateView()
// }
// }
// } else {
// onMain {
// updateView()
// }
// }
// }
//
// override fun onFail(e: String?) {
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// }
// })
// }
// }
private fun loadMore(){
}
// private fun loadMore() {
// if (mService == null) {
// mService = ServiceImage()
// }
// if (isLoading.get()) {
// return
// }
// isLoading.set(true)
// val newPage = mPage + 1
// mService?.let { service ->
// val call = service.mApi.getRecent(newPage)
// service.callEnqueue(call, object : BaseListener<ResponseImage> {
// override fun onResponse(t: ResponseImage?) {
// if (t != null) {
// if (t.MaterialWallpaper != null && t.MaterialWallpaper.isNotEmpty()) {
// mList.addAll(t.MaterialWallpaper.toMutableList())
// isLoading.set(false)
// mPage = newPage
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// } else {
// onMain {
// updateView()
// }
// }
// } else {
// onMain {
// updateView()
// }
// }
// }
//
// override fun onFail(e: String?) {
// isLoading.set(false)
// onMain {
// mAdapter?.notifyDataSetChanged()
// updateView()
// }
// }
// })
// }
// }
fun updateView() {
// binding.refreshLayout.finishRefresh()
// binding.refreshLayout.finishLoadMore()
if (mList.isNotEmpty()) {
binding.tvEmpty.hide()
} else {
binding.tvEmpty.show()
}
}
fun toPreview(data: Data) {
if (activity != null) {
// val listBean = PreviewBean()
// listBean.list = mList
PreviewAbility.start(requireActivity(), data)
}
}
}

View File

@ -6,24 +6,33 @@ import android.os.CountDownTimer
import androidx.appcompat.app.AppCompatActivity
import com.cute.girl.hd.pink.img.wallpaper.databinding.AbilityStartBinding
import com.cute.girl.hd.pink.img.wallpaper.topon.AdManager
import kotlin.math.roundToInt
class StartAbility : AppCompatActivity() {
private lateinit var binding: AbilityStartBinding
private var time = 11000L
private var countDownTimer: CountDownTimer? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = AbilityStartBinding.inflate(layoutInflater)
setContentView(binding.root)
countDownTimer = AdManager.showWelcomeAd(this@StartAbility, time) {
setupViews()
}
countDownTimer =
AdManager.showWelcomeAd(this@StartAbility, time, { millisUntilFinished ->
val percentage: Float = 100 - millisUntilFinished.toFloat() / time * 100
val round = percentage.roundToInt()
binding.progressbar.progress = round
if (AdManager.place1LoadFail && AdManager.place2LoadFail && AdManager.place3LoadFail) {
countDownTimer?.cancel()
setupViews()
}
}, {
setupViews()
})
countDownTimer?.start()
}

View File

@ -1,6 +1,8 @@
package com.cute.girl.hd.pink.img.wallpaper.topon
interface AdListener {
fun loadFail(placeId: String)
fun showSuccess()
fun showFail()

View File

@ -13,21 +13,28 @@ import com.cute.girl.hd.pink.img.wallpaper.MyApp
object AdManager {
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
/***
* n66978a7938950
* n66978a6a2a132
* n66978a40971a3
/**
n66978a7938950
n66978a6a2a132
n66978a40971a3
*/
const val place1Id = "n66978a7938950"
const val place2Id = "n66978a6a2a132"
const val place3Id = "n66978a40971a3"
var place1LoadFail = false
var place2LoadFail = false
var place3LoadFail = false
val list = mutableListOf<ATInterstitial>()
@ -43,7 +50,19 @@ object AdManager {
}
for (ad in list) {
if (!ad.isAdReady) {
setCallBack(ad,object : AdListener {
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() {
}
@ -63,23 +82,32 @@ object AdManager {
}
@JvmStatic
fun getReadyAd(): ATInterstitial? {
list.shuffle()
for (ad in list) {
if (ad.isAdReady) {
Log.d(MyApp.TAG, "-有广告------------")
return ad
}
}
Log.d(MyApp.TAG, "-没有广告------------")
return null
}
@JvmStatic
fun showWelcomeAd(activity: Activity,totalTim: Long, goMain: () -> Unit): CountDownTimer {
fun showWelcomeAd(
activity: Activity,
totalTim: Long,
countAction: (millisUntilFinished: 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) {
@ -129,7 +157,6 @@ object AdManager {
}
override fun onInterstitialAdClose(p0: ATAdInfo?) {
Log.d(MyApp.TAG, "AdClose ${p0?.showId} ")
listener.showClose()
}
@ -150,14 +177,19 @@ object AdManager {
@JvmStatic
fun showAD(activity: Activity, action: (type: Int) -> Unit) {
private fun showAD(activity: Activity, action: (type: Int) -> Unit) {
val readyAd = getReadyAd()
if (readyAd!= null) {
if (readyAd != null) {
Log.d(MyApp.TAG, "readyAd ${readyAd.mPlacementId} ")
action.invoke(type_has_cache)
setCallBack(readyAd,object : AdListener {
setCallBack(readyAd, object : AdListener {
override fun loadFail(placeId: String) {
}
override fun showSuccess() {
action.invoke(type_show_success)
}
override fun showFail() {
@ -171,11 +203,17 @@ object AdManager {
})
readyAd.show(activity)
} else {
Log.d(MyApp.TAG, "showAD type_no_cache ")
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.cute.girl.hd.pink.img.wallpaper.topon;
public interface onActionListener {
void onAction();
}

View File

@ -4,6 +4,8 @@ import android.net.Uri
import android.text.TextUtils
import android.util.Log
import androidx.annotation.MainThread
import com.cute.girl.hd.pink.img.wallpaper.MyApp
import com.cute.girl.hd.pink.img.wallpaper.R
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
@ -33,13 +35,11 @@ object DownloadUtil {
/**
* 获取文件下载路径
* path:/storage/emulated/0/Android/data/com.lux.sound.pranks.hilarious.effects/X4D/download/hairclipper_4.jpg
*
* /storage/emulated/0/Android/data/com.wallart.art.wallpapers.hd/files/PrankSound/download//c189c2a257a0591c3ff5060c235c7342
* /data/user/0/com.wallart.art.wallpapers.hd.test/cache/289e1219ab8467f96c5c347c30292256.jpeg
*/
fun getFilePath(tag: String?): String {
val s = FileUtil.getDownloadDirectory() + File.separator + tag
val s =
MyApp.app.cacheDir.absolutePath + File.separator + tag+".jpeg"
Log.d("-----------", "----getFilePath--$s")
return s
}

View File

@ -9,6 +9,7 @@ import android.os.Environment
import android.provider.MediaStore
import java.io.File
import java.io.FileInputStream
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
@ -202,4 +203,49 @@ object MediaUtil {
return false
}
fun saveToGallery(context: Context, photoFile: File): Uri? {
val displayName = "${System.currentTimeMillis()}.jpg"
val contentValues = ContentValues().apply {
put(MediaStore.Images.Media.DISPLAY_NAME, displayName)
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
put(MediaStore.Images.Media.IS_PENDING, 1)
}
}
val contentResolver = context.contentResolver
val collectionUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
} else {
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
}
val imageUri = contentResolver.insert(collectionUri, contentValues)
imageUri?.let { uri ->
try {
contentResolver.openOutputStream(uri)?.use { outputStream ->
val inputStream = FileInputStream(photoFile)
inputStream.copyTo(outputStream)
inputStream.close()
outputStream.close()
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
contentValues.clear()
contentValues.put(MediaStore.Images.Media.IS_PENDING, 0)
contentResolver.update(uri, contentValues, null, null)
} else {
}
return uri
} catch (e: IOException) {
return null
}
} ?: run {
return null
}
}
}

View File

@ -0,0 +1,31 @@
package com.cute.girl.hd.pink.img.wallpaper.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class CategoryListViewModel : ViewModel() {
private val _list = MutableLiveData<List<Data>>()
val listLiveData: LiveData<List<Data>> = _list
fun queryData(categorId:Long){
CoroutineScope(Dispatchers.IO).launch {
val queryCate = MyDatabase.myDatabase.WallpaperDao().queryCategoryList(categorId)
_list.postValue(queryCate)
}
}
}

View File

@ -0,0 +1,28 @@
package com.cute.girl.hd.pink.img.wallpaper.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class CategoryViewModel : ViewModel() {
private val _list = MutableLiveData<List<Category>>()
val listLiveData: LiveData<List<Category>> = _list
init {
CoroutineScope(Dispatchers.IO).launch {
val queryCate = MyDatabase.myDatabase.CategoryDao().queryAllData()
_list.postValue(queryCate)
}
}
}

View File

@ -0,0 +1,28 @@
package com.cute.girl.hd.pink.img.wallpaper.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class FavoriteViewModel : ViewModel() {
private val _list = MutableLiveData<List<Data>>()
val listLiveData: LiveData<List<Data>> = _list
// init {
// CoroutineScope(Dispatchers.IO).launch {
// val queryList = MyDatabase.myDatabase.WallpaperDao().queryAllLike(true)
// _list.postValue(queryList)
// }
//
// }
}

View File

@ -0,0 +1,24 @@
package com.cute.girl.hd.pink.img.wallpaper.viewmodel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.cute.girl.hd.pink.img.wallpaper.db.Category
import com.cute.girl.hd.pink.img.wallpaper.db.Data
import com.cute.girl.hd.pink.img.wallpaper.db.MyDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class PopularViewModel : ViewModel() {
private val _list = MutableLiveData<List<Data>>()
val listLiveData: LiveData<List<Data>> = _list
init {
CoroutineScope(Dispatchers.IO).launch {
val queryCateId = MyDatabase.myDatabase.CategoryDao().queryCateId("popular")
val queryList = MyDatabase.myDatabase.WallpaperDao().queryCategoryList(queryCateId.id)
_list.postValue(queryList)
}
}
}

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="16dp"
android:viewportWidth="20"
android:viewportHeight="16">
<path
android:pathData="M10.061,1.04C10.646,1.626 10.646,2.575 10.061,3.161L6.722,6.5L17,6.5C17.828,6.5 18.5,7.172 18.5,8C18.5,8.828 17.828,9.5 17,9.5L6.722,9.5L10.061,12.839C10.646,13.425 10.646,14.374 10.061,14.96C9.475,15.546 8.525,15.546 7.939,14.96L2.04,9.061C1.454,8.475 1.454,7.525 2.04,6.939L7.939,1.04C8.525,0.454 9.475,0.454 10.061,1.04Z"
android:strokeWidth="1"
android:fillColor="@color/black"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>

View File

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<group>
<clip-path
android:pathData="M0,0h44v44h-44z"/>
<path
android:pathData="M23.721,22.58L22.739,23.702V23.698L22.684,20.042C22.677,19.597 22.346,19.243 21.944,19.25C21.542,19.258 21.221,19.624 21.227,20.068L21.282,23.724C21.282,23.725 21.282,23.727 21.283,23.729L20.265,22.641C20.028,22.387 19.648,22.394 19.418,22.656C19.189,22.919 19.195,23.338 19.432,23.592L21.542,25.847C21.563,25.879 21.587,25.91 21.614,25.939C21.762,26.098 21.966,26.155 22.154,26.111C22.276,26.085 22.387,26.019 22.472,25.921C22.494,25.896 22.514,25.869 22.531,25.842L24.582,23.5C24.811,23.238 24.805,22.819 24.568,22.565C24.33,22.311 23.951,22.317 23.721,22.58Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M22,0C9.85,0 0,9.85 0,22C0,34.15 9.85,44 22,44C34.15,44 44,34.15 44,22C44,9.85 34.15,0 22,0ZM30.037,31.232C29.95,31.237 29.862,31.24 29.774,31.24H15.13C15.05,31.24 14.969,31.237 14.89,31.233C14.799,31.237 14.707,31.24 14.615,31.24C10.943,31.24 7.966,28.255 7.966,24.574C7.966,20.892 10.943,17.908 14.615,17.908C15.032,17.908 15.439,17.946 15.834,18.02C15.834,17.999 15.833,17.978 15.833,17.957C15.833,13.972 19.056,10.741 23.031,10.741C27.006,10.741 30.228,13.972 30.228,17.957C30.228,18.097 30.224,18.235 30.216,18.373C33.546,18.623 36.169,21.404 36.169,24.797C36.169,28.251 33.451,31.07 30.037,31.232Z"
android:fillColor="#ffffff"/>
</group>
</vector>

View File

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<group>
<clip-path
android:pathData="M0,0h44v44h-44z"/>
<path
android:pathData="M22,0C9.85,0 0,9.85 0,22C0,34.15 9.85,44 22,44C34.15,44 44,34.15 44,22C44,9.85 34.15,0 22,0Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M22,34L20.115,32.3C17.927,30.316 16.118,28.605 14.688,27.166C13.257,25.728 12.12,24.436 11.275,23.291C10.43,22.146 9.84,21.094 9.504,20.136C9.169,19.178 9.001,18.197 9,17.194C9,15.144 9.682,13.433 11.047,12.06C12.413,10.687 14.113,10 16.15,10C17.277,10 18.349,10.24 19.368,10.719C20.386,11.199 21.263,11.875 22,12.747C22.737,11.875 23.614,11.199 24.632,10.719C25.651,10.24 26.723,10 27.85,10C29.887,10 31.587,10.687 32.952,12.06C34.318,13.433 35,15.144 35,17.194C35,18.196 34.832,19.177 34.497,20.136C34.161,21.095 33.571,22.147 32.725,23.291C31.879,24.435 30.742,25.727 29.313,27.166C27.883,28.606 26.074,30.317 23.885,32.3L22,34Z"
android:fillColor="@color/theme_pink"/>
</group>
</vector>

View File

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<group>
<clip-path
android:pathData="M0,0h44v44h-44z"/>
<path
android:pathData="M22,0C9.85,0 0,9.85 0,22C0,34.15 9.85,44 22,44C34.15,44 44,34.15 44,22C44,9.85 34.15,0 22,0Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M22,34L20.115,32.3C17.927,30.316 16.118,28.605 14.688,27.166C13.257,25.728 12.12,24.436 11.275,23.291C10.43,22.146 9.84,21.094 9.504,20.136C9.169,19.178 9.001,18.197 9,17.194C9,15.144 9.682,13.433 11.047,12.06C12.413,10.687 14.113,10 16.15,10C17.277,10 18.349,10.24 19.368,10.719C20.386,11.199 21.263,11.875 22,12.747C22.737,11.875 23.614,11.199 24.632,10.719C25.651,10.24 26.723,10 27.85,10C29.887,10 31.587,10.687 32.952,12.06C34.318,13.433 35,15.144 35,17.194C35,18.196 34.832,19.177 34.497,20.136C34.161,21.095 33.571,22.147 32.725,23.291C31.879,24.435 30.742,25.727 29.313,27.166C27.883,28.606 26.074,30.317 23.885,32.3L22,34Z"
android:fillColor="#F5133B"/>
</group>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<path
android:pathData="M22,44C34.15,44 44,34.15 44,22C44,9.85 34.15,0 22,0C9.85,0 0,9.85 0,22C0,34.15 9.85,44 22,44ZM31.157,30.38L27.931,25.55V25.549L28.994,25.412C29.079,25.401 29.16,25.366 29.226,25.311C29.292,25.256 29.342,25.182 29.369,25.1C29.397,25.017 29.401,24.928 29.381,24.843C29.362,24.758 29.319,24.68 29.258,24.618L28.236,23.586C28.03,23.377 27.933,23.08 27.976,22.786L28.186,21.348C28.198,21.263 28.188,21.176 28.155,21.097C28.122,21.018 28.068,20.949 28,20.899C27.932,20.85 27.851,20.82 27.767,20.814C27.683,20.808 27.6,20.826 27.525,20.865L26.333,21.496C26.064,21.638 25.743,21.635 25.476,21.485L24.28,20.815C24.204,20.773 24.118,20.753 24.032,20.759C23.945,20.764 23.862,20.795 23.793,20.847C23.723,20.899 23.669,20.97 23.637,21.052C23.605,21.134 23.597,21.224 23.613,21.31L23.867,22.681C23.923,22.986 23.827,23.3 23.611,23.517L22.656,24.481C22.596,24.541 22.554,24.617 22.534,24.701C22.514,24.784 22.516,24.871 22.542,24.953C22.567,25.035 22.614,25.108 22.677,25.164C22.741,25.221 22.818,25.258 22.901,25.272L24.305,25.513C24.446,25.537 24.579,25.595 24.695,25.682C24.81,25.769 24.903,25.882 24.968,26.013L25.613,27.325C25.651,27.403 25.71,27.469 25.783,27.514C25.856,27.56 25.941,27.583 26.026,27.582C26.111,27.581 26.195,27.556 26.267,27.508C26.339,27.461 26.396,27.394 26.433,27.315L26.955,26.18L30.185,30.979C30.272,31.108 30.404,31.199 30.554,31.232C30.703,31.265 30.86,31.239 30.991,31.158C31.053,31.119 31.108,31.068 31.15,31.008C31.192,30.947 31.222,30.878 31.238,30.805C31.253,30.733 31.254,30.657 31.24,30.584C31.226,30.511 31.198,30.442 31.157,30.38ZM29.039,31.382C29.039,30.414 27.822,30.414 27.822,31.382V33.259C27.822,33.341 27.806,33.422 27.775,33.497C27.745,33.572 27.7,33.641 27.644,33.699C27.587,33.757 27.52,33.802 27.446,33.834C27.372,33.865 27.293,33.881 27.213,33.881H27.086L18.667,24.379C18.549,24.246 18.405,24.14 18.243,24.07C18.082,24 17.907,23.965 17.732,23.97C17.556,23.975 17.384,24.019 17.226,24.098C17.069,24.178 16.93,24.291 16.82,24.431L13.217,28.974V13.354C13.217,13.273 13.233,13.192 13.263,13.116C13.294,13.041 13.339,12.972 13.395,12.914C13.452,12.857 13.519,12.811 13.593,12.78C13.667,12.748 13.746,12.732 13.826,12.732H27.213C27.293,12.732 27.372,12.748 27.446,12.78C27.52,12.811 27.587,12.857 27.644,12.914C27.7,12.972 27.745,13.041 27.775,13.116C27.806,13.192 27.822,13.273 27.822,13.354V18.884C27.822,19.786 29.039,19.786 29.039,18.884V10.866C29.039,10.621 28.992,10.378 28.9,10.152C28.808,9.926 28.674,9.72 28.504,9.547C28.335,9.373 28.133,9.236 27.912,9.142C27.691,9.048 27.453,9 27.213,9H13.826C13.341,9 12.877,9.197 12.535,9.547C12.192,9.897 12,10.371 12,10.866V33.259C12,33.754 12.192,34.229 12.535,34.578C12.877,34.928 13.341,35.125 13.826,35.125H27.213C27.453,35.125 27.691,35.077 27.912,34.983C28.133,34.889 28.335,34.752 28.504,34.578C28.674,34.405 28.808,34.199 28.9,33.973C28.992,33.747 29.039,33.504 29.039,33.259V31.382ZM18.264,10.426C18.378,10.31 18.532,10.244 18.694,10.244H22.345C22.507,10.244 22.661,10.31 22.775,10.426C22.889,10.543 22.954,10.701 22.954,10.866C22.954,11.031 22.889,11.189 22.775,11.306C22.661,11.423 22.507,11.488 22.345,11.488H18.694C18.532,11.488 18.378,11.423 18.264,11.306C18.149,11.189 18.085,11.031 18.085,10.866C18.085,10.701 18.149,10.543 18.264,10.426ZM18.011,19.028C18.354,19.378 18.818,19.574 19.302,19.574C19.787,19.574 20.251,19.378 20.593,19.028C20.936,18.678 21.128,18.203 21.128,17.708C21.128,17.213 20.936,16.739 20.593,16.389C20.251,16.039 19.787,15.842 19.302,15.842C18.818,15.842 18.354,16.039 18.011,16.389C17.669,16.739 17.477,17.213 17.477,17.708C17.477,18.203 17.669,18.678 18.011,19.028Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</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/pb_bg" />
</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/pb_end_color"
android:startColor="@color/pb_start_color" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/im_like_true"/>
<item android:state_selected="false" android:drawable="@drawable/im_like_false"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/im_like_false" android:state_pressed="true" />
<item android:drawable="@drawable/im_set_wallpaper" />
</selector>

View File

@ -50,6 +50,7 @@
app:tl_indicator_height="3dp"
app:tl_indicator_width="20dp"
app:tl_textBold="BOTH"
app:tl_tab_space_equal="true"
app:tl_textSelectColor="@color/theme_white"
app:tl_textUnselectColor="@color/theme_gray"
app:tl_textsize="18sp" />

View File

@ -15,36 +15,70 @@
<LinearLayout
android:id="@+id/rlBottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="32dp"
android:background="@drawable/d_card_theme_pink_32dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingHorizontal="16dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:visibility="visible">
<ImageView
<FrameLayout
android:id="@+id/tvSet"
android:layout_width="48dp"
android:layout_height="48dp"
android:elevation="1dp"
android:gravity="center"
android:padding="8dp"
android:src="@drawable/ic_wallpaper"
android:visibility="visible" />
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
<ImageView
android:layout_width="64dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:elevation="1dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:src="@drawable/im_set_wallpaper" />
</FrameLayout>
<FrameLayout
android:id="@+id/tvDownload"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="40dp"
android:elevation="1dp"
android:gravity="center"
android:padding="8dp"
android:src="@drawable/ic_download"
android:visibility="visible" />
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="64dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:src="@drawable/im_download" />
</FrameLayout>
<FrameLayout
android:id="@+id/im_like"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="64dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:elevation="1dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:src="@drawable/selctor_like"
android:visibility="visible" />
</FrameLayout>
</LinearLayout>
@ -74,8 +108,8 @@
android:id="@+id/flDownload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:gravity="center">
android:gravity="center"
android:visibility="gone">
<View
android:layout_width="match_parent"

View File

@ -2,12 +2,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/theme_pink">
android:layout_height="56dp">
<ImageView
android:id="@+id/ivBack"
@ -17,7 +17,7 @@
android:layout_gravity="start"
android:layout_marginStart="21dp"
android:padding="3dp"
android:src="@drawable/ic_back"
android:src="@drawable/ic_back_black"
android:visibility="visible" />
<TextView
@ -27,8 +27,8 @@
android:layout_centerInParent="true"
android:fontFamily="@font/fredoka"
android:text="@string/privacy_policy"
android:textColor="@color/white"
android:textSize="24sp" />
android:textColor="@color/black"
android:textSize="21sp" />
</RelativeLayout>
<WebView

View File

@ -1,33 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<ImageView
android:id="@+id/imlogo"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="180dp"
android:src="@mipmap/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imlogo"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="@string/app_name"
android:textColor="@color/theme_pink"
android:textSize="19sp" />
<ProgressBar
android:id="@+id/progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="33dp"
android:layout_marginEnd="33dp"
android:layout_marginBottom="60dp"
android:progress="2"
android:progressDrawable="@drawable/progressbar" />
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@mipmap/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/app_name"
android:textColor="@color/theme_pink"
android:textSize="16sp" />
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:indeterminateTint="@color/theme_pink" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>

View File

@ -5,14 +5,7 @@
android:layout_height="match_parent"
android:background="@color/theme_white">
<!-- <com.scwang.smart.refresh.layout.SmartRefreshLayout-->
<!-- android:id="@+id/refreshLayout"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- <com.scwang.smart.refresh.header.ClassicsHeader-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -25,6 +18,7 @@
android:fontFamily="@font/fredoka"
android:layout_gravity="center"
android:gravity="center"
android:visibility="gone"
android:text="@string/empty_data_txt"
android:textColor="@color/theme_gray"
android:textSize="14sp" />
@ -36,11 +30,6 @@
</FrameLayout>
<!-- <com.scwang.smart.refresh.footer.ClassicsFooter-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />-->
<!-- </com.scwang.smart.refresh.layout.SmartRefreshLayout>-->
</FrameLayout>

View File

@ -6,4 +6,7 @@
<color name="theme_white">#EBF6F5</color>
<color name="theme_pink">#ED99B2</color>
<color name="theme_gray">#D8D8D8</color>
<color name="pb_bg">#B3B3B3</color>
<color name="pb_end_color">#ED99B2</color>
<color name="pb_start_color">#EFCED8</color>
</resources>

View File

@ -3,6 +3,7 @@
<string name="empty_data_txt">Image loading failed, please pull down to refresh and reload.</string>
<string name="downloading_image">Downloading HD Image...</string>
<string name="set_wallpaper">Set Wallpaper</string>
<string name="re_download">There is an exception in the wallpaper file, please try again</string>
<string name="set_success">Wallpaper set successfully</string>
<string name="home_screen">Home Screen</string>
<string name="lock_screen">Lock Screen</string>
@ -14,4 +15,11 @@
<string name="rate_us">Rate Us</string>
<string name="saved_to_album">Saved to album</string>
<string name="save_failed">Save failed</string>
<string name="title_fav">Favorite</string>
<string name="title_cate">Category</string>
<string name="title_popular">Popular</string>
<string name="no_like">You haven not added any favorite wallpapers yet</string>
<string name="add_like">Added to favorites successfully</string>
<string name="cancel_like">Successfully canceled the collection</string>
</resources>

View File

@ -2,6 +2,7 @@
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
kotlin("kapt") version "2.0.0"
id("com.google.gms.google-services") version "4.3.15" apply false
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
}

View File

@ -1,6 +1,6 @@
#Tue May 28 15:35:37 CST 2024
#Thu Aug 15 15:09:54 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

6
keystore.properties Normal file
View File

@ -0,0 +1,6 @@
app_name=Art Wallpaper
package_name=com.wallart.art.wallpapers.hd
keystoreFile=app/ArtWallpaper.jks
key_alias=ArtWallpaperkey0
key_store_password=ArtWallpaper
key_password=ArtWallpaper