增加功能

This commit is contained in:
litingting 2024-08-13 17:43:04 +08:00
parent a80c706a70
commit d17993f4ce
50 changed files with 1425 additions and 409 deletions

View File

@ -1,10 +1,12 @@
import java.util.Date
import java.text.SimpleDateFormat
plugins {
kotlin("kapt")
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
@ -63,4 +65,12 @@ dependencies {
val room_version = "2.6.1"
implementation ("androidx.room:room-runtime:$room_version")
kapt("androidx.room:room-compiler:$room_version")
implementation("com.squareup.okhttp3:okhttp:4.11.0")
}

View File

@ -34,3 +34,18 @@ java.lang.Object writeReplace();
java.lang.Object readResolve();
}
-keepclassmembers class com.pink.cute.wallpapers.PinkWallpapers {
public static final java.lang.String DB_NAME;
public static final int DB_VERSION;
}
-keepclassmembers class * {
@androidx.room.Query <methods>;
}
-keep class com.pink.cute.wallpapers.bean.Wallpaper { *; }
-keep class com.pink.cute.wallpapers.bean.Category { *; }
-keep class com.pink.cute.wallpapers.myroom.MyDatabase { *; }
-keep class com.pink.cute.wallpapers.myroom.CategoryDao { *; }
-keep class com.pink.cute.wallpapers.myroom.WallpaperDao { *; }

View File

@ -5,6 +5,9 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<application
android:name=".PinkWallpapers"
@ -18,14 +21,19 @@
android:theme="@style/Theme.PinkWallpapers"
tools:targetApi="31">
<activity
android:name=".SetWallpaperActivity"
android:name=".activity.SetWallpaperActivity"
android:exported="false" />
<activity
android:name=".WallpaperListActivity"
android:name=".activity.WallpaperListActivity"
android:exported="false" />
<activity
android:name=".LaunActivity"
android:name=".activity.AboutActivity"
android:exported="false" />
<activity
android:name=".activity.PrivacyActivity"
android:exported="false" />
<activity
android:name=".activity.LaunActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -34,7 +42,7 @@
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:name=".activity.MainActivity"
android:exported="false"
android:label="@string/app_name"/>

View File

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Privacy Policy</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 0px auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1, h2 {
color: #333;
}
h1 {
font-size: 24px;
margin-bottom: 20px;
}
h2 {
font-size: 20px;
margin-top: 20px;
margin-bottom: 10px;
}
p {
margin: 10px 0;
}
a {
color: #1a73e8;
}
</style>
</head>
<body>
<div class="container">
<h1>Privacy Policy</h1>
<p>This page is used to inform visitors regarding our policies with the collection, use, and
disclosure of Personal Information if anyone decided to use our Service.</p>
<p>If you choose to use our Service, then you agree to the collection and use of information in
relation to this policy. The Personal Information that We collect is used for providing and
improving the Service. We will not use or share your information with anyone except as
described in this Privacy Policy.</p>
<p>The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions,
which are accessible at [Terms and Conditions link] unless otherwise defined in this Privacy
Policy.</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.
Please refer to the privacy policy of the third-party service provider used by the
application.</p>
<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.</p>
<p>This Service does not use these “cookies” explicitly. However, the app may use third-party
code and libraries that use “cookies” to collect information and improve their services. You
have the option to either accept or refuse these cookies and know when a cookie is being
sent to your 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>
<ul>
<li>To facilitate our Service;</li>
<li>To provide the Service on our behalf;</li>
<li>To perform Service-related services; or</li>
<li>To assist us in analyzing how our Service is used.</li>
</ul>
<p>We want to inform users of this Service that these third parties have access to their
Personal Information. The reason is to perform the tasks assigned to them on our behalf.
However, they 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>
<p>This policy is effective as of 2024-01-09</p>
<h2>Contact Us</h2>
<p>If you have any questions or suggestions about our Privacy Policy, do not hesitate to contact
us at <a href="mailto:angiewiles2@gmail.com">angiewiles2@gmail.com</a>.</p>
</div>
</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",
@ -2197,6 +2237,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

@ -1,13 +1,24 @@
package com.pink.cute.wallpapers
import android.app.Application
import android.util.Log
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.manager.Common
import com.pink.cute.wallpapers.myroom.MyDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class PinkWallpapers : Application() {
companion object {
const val DB_NAME = "Wall"
const val DB_VERSION = 1
const val TB_NAME_CATEGORY = "category"
const val TB_NAME_WALLPAPER = "wallpaper"
lateinit var pinkWallpapers: PinkWallpapers
lateinit var categoryList: List<Category>
@ -22,9 +33,17 @@ class PinkWallpapers : Application() {
}
private fun analyzeFiles() {
val fdInput = assets.open("wallres.json")
val jsonStr = Common.getJsonString(fdInput)
categoryList = Common.getListCategory(jsonStr)
CoroutineScope(Dispatchers.IO).launch {
val queryAllData = MyDatabase.myDatabase.CategoryDao().queryAllData()
Log.d("ting","---------queryAllData=${queryAllData.size}")
if (queryAllData.size <= 0) {
val fdInput = assets.open("wallres.json")
val jsonStr = Common.getJsonString(fdInput)
categoryList = Common.getListCategory(jsonStr)
}
}
}

View File

@ -1,232 +0,0 @@
package com.pink.cute.wallpapers
import android.app.WallpaperManager
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.target.Target
import com.bumptech.glide.request.transition.Transition
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.databinding.ActivitySetWallpaperBinding
import com.pink.cute.wallpapers.manager.Common
import com.pink.cute.wallpapers.manager.CropTransformation
import com.pink.cute.wallpapers.ui.DialogWallpaper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
class SetWallpaperActivity : AppCompatActivity() {
private lateinit var viewbing: ActivitySetWallpaperBinding
private lateinit var wallpaper: Wallpaper
private lateinit var wallpaperManager: WallpaperManager
private var mFile: File? = null
private var mBitmap: Bitmap? = null
private var selectDialog: DialogWallpaper? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewbing = ActivitySetWallpaperBinding.inflate(LayoutInflater.from(this), null, false)
setContentView(viewbing.root)
initBar()
wallpaper = intent.getSerializableExtra(Common.KEY_WALLPAPER) as Wallpaper
wallpaperManager = WallpaperManager.getInstance(this)
loadSource()
viewbing.btnBack.setOnClickListener {
finish()
}
viewbing.textSetBtn.setOnClickListener {
startShowAd{
startSet()
}
}
}
private fun startSet() {
if (selectDialog == null) {
selectDialog = DialogWallpaper.newInstance()
selectDialog?.onSetListener {
viewbing.loading.isVisible = true
mBitmap?.let { bitmap ->
when (it) {
Common.TYPE_BOTH -> {
lifecycleScope.launch {
withContext(Dispatchers.IO){
wallpaperManager.setBitmap(bitmap)//FLAG_SYSTEM | FLAG_LOCK)
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_HOME -> {
lifecycleScope.launch {
withContext(Dispatchers.IO){
Log.d("------","-------thread=${Thread.currentThread().name}")
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(bitmap)
} else {
wallpaperManager.setBitmap(
bitmap,
null,
true,
WallpaperManager.FLAG_SYSTEM
)
}
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_LOCK -> {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
Log.d("------","-------IO thread=${Thread.currentThread().name}")
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(bitmap)
} else {
wallpaperManager.setBitmap(
mBitmap,
null,
true,
WallpaperManager.FLAG_LOCK
)
}
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_DISSMISS -> {
viewbing.loading.isVisible = false
}
}
}
}
}
selectDialog?.show(supportFragmentManager, "")
}
private fun startShowAd(action:()->Unit) {
// TODO: showAd
action.invoke()
}
private fun initBar() {
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
}
private fun loadSource1() {
// viewbing.loading.isVisible = true
Glide.with(this)
.asFile()
.load(wallpaper.source)
.thumbnail(0.1f)
.transform(CropTransformation())
.into(object : CustomTarget<File>() {
override fun onResourceReady(resource: File, transition: Transition<in File>?) {
if (resource.exists()) {
mFile = resource
Log.d("--------", "--------resource=${resource.absolutePath}")
val decodeFile = BitmapFactory.decodeFile(resource.absolutePath)
viewbing.previewImg.setImageBitmap(decodeFile)
}
}
override fun onLoadCleared(placeholder: Drawable?) {
}
})
}
private fun loadSource() {
viewbing.loading.isVisible = true
Glide.with(this)
.asBitmap()
.load(wallpaper.source)
.thumbnail(0.1f)
.transform(CropTransformation())
.listener(object : RequestListener<Bitmap> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Bitmap>,
isFirstResource: Boolean
): Boolean {
viewbing.loading.isVisible = false
return false
}
override fun onResourceReady(
resource: Bitmap,
model: Any,
target: Target<Bitmap>?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
viewbing.loading.isVisible = false
mBitmap = resource
return false
}
}).into(viewbing.previewImg)
}
}

View File

@ -0,0 +1,77 @@
package com.pink.cute.wallpapers.activity
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.pink.cute.wallpapers.R
import com.pink.cute.wallpapers.databinding.ActivityAboutBinding
class AboutActivity : AppCompatActivity() {
private lateinit var vb: ActivityAboutBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
vb = ActivityAboutBinding.inflate(layoutInflater)
setContentView(vb.root)
// AdManager.loadAllAd()
val appVersionName = getAppVersionName()
appVersionName?.run {
vb.tvVersion.text = String.format(getString(R.string.app_version), this.versionName)
} ?: run {
vb.tvVersion.text = String.format(getString(R.string.app_version), "1.0.0")
}
vb.back.setOnClickListener {
// AdManager.showTopOn(this@AboutActivity) {
finish()
// }
}
vb.tvRate.setOnClickListener {
try {
val uri = String.format(getString(R.string.gp), packageName)
startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(uri)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
})
}catch (ex:Exception){
Log.d("ting","---------ex=${ex.message}")
}
}
vb.tvPrivacy.setOnClickListener {
startActivity(Intent(this@AboutActivity, PrivacyActivity::class.java))
}
vb.tvShare.setOnClickListener {
val uri = String.format(getString(R.string.gp), packageName)
val sendIntent = Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_TEXT, uri)
type = "text/plain"
}
startActivity(Intent.createChooser(sendIntent, resources.getString(R.string.share_title)))
}
}
override fun onBackPressed() {
super.onBackPressed()
// AdManager.showTopOn(this@AboutActivity) {
//
// }
}
private fun getAppVersionName(): PackageInfo? {
return try {
packageManager.getPackageInfo(packageName, 0)
} catch (e: PackageManager.NameNotFoundException) {
null
}
}
}

View File

@ -1,4 +1,4 @@
package com.pink.cute.wallpapers
package com.pink.cute.wallpapers.activity
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
@ -20,7 +20,6 @@ class LaunActivity : AppCompatActivity() {
startActivity(Intent(this@LaunActivity, MainActivity::class.java))
finish()
}
override fun onDestroy() {

View File

@ -1,12 +1,14 @@
package com.pink.cute.wallpapers
package com.pink.cute.wallpapers.activity
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.pink.cute.wallpapers.R
import com.pink.cute.wallpapers.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
@ -20,12 +22,8 @@ class MainActivity : AppCompatActivity() {
val navView: BottomNavigationView = binding.navView
val navController = findNavController(R.id.nav_host_fragment_activity_main)
// val appBarConfiguration = AppBarConfiguration(
// setOf(
// R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications
// )
// )
// setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
}
}

View File

@ -0,0 +1,29 @@
package com.pink.cute.wallpapers.activity
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.pink.cute.wallpapers.databinding.ActivityPrivacyBinding
class PrivacyActivity : AppCompatActivity() {
private lateinit var vb: ActivityPrivacyBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
vb = ActivityPrivacyBinding.inflate(layoutInflater)
setContentView(vb.root)
vb.webView.loadUrl("file:///android_asset/Pink_Wallpapers_privacy.html")
vb.back.setOnClickListener {
finish()
}
}
override fun onBackPressed() {
super.onBackPressed()
}
}

View File

@ -0,0 +1,393 @@
package com.pink.cute.wallpapers.activity
import android.Manifest
import android.app.Activity
import android.app.WallpaperManager
import android.content.ContentValues
import android.content.Context
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.graphics.drawable.toBitmap
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.R
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.databinding.ActivitySetWallpaperBinding
import com.pink.cute.wallpapers.manager.Common
import com.pink.cute.wallpapers.manager.CropTransformation
import com.pink.cute.wallpapers.myroom.MyDatabase
import com.pink.cute.wallpapers.ui.DialogWallpaper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
import java.io.FileInputStream
import java.io.IOException
class SetWallpaperActivity : AppCompatActivity() {
private lateinit var viewbing: ActivitySetWallpaperBinding
private lateinit var wallpaper: Wallpaper
private lateinit var wallpaperManager: WallpaperManager
private var mBitmap: Bitmap? = null
private var selectDialog: DialogWallpaper? = null
private val code = -23
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewbing = ActivitySetWallpaperBinding.inflate(LayoutInflater.from(this), null, false)
setContentView(viewbing.root)
initBar()
wallpaper = intent.getSerializableExtra(Common.KEY_WALLPAPER) as Wallpaper
refrshLike()
wallpaperManager = WallpaperManager.getInstance(this)
loadSource()
viewbing.btnBack.setOnClickListener {
finish()
}
viewbing.textSetBtn.setOnClickListener {
startShowAd {
startSet()
}
}
viewbing.btnSave.setOnClickListener {
if (requestPermission(this@SetWallpaperActivity, code)) {
startSave()
}
}
viewbing.btnLike.setOnClickListener {
viewbing.imLike.isSelected = !viewbing.imLike.isSelected
if(viewbing.imLike.isSelected){
Toast.makeText(this, getString(R.string.add_like), Toast.LENGTH_SHORT)
.show()
}else{
Toast.makeText(this, getString(R.string.cancel_like), Toast.LENGTH_SHORT)
.show()
}
}
}
private fun refrshLike(){
CoroutineScope(Dispatchers.IO).launch {
wallpaper = MyDatabase.myDatabase.WallpaperDao().queryWallpaper(wallpaper.id)
withContext(Dispatchers.Main){
viewbing.imLike.isSelected = wallpaper.like
}
}
}
override fun onPause() {
super.onPause()
CoroutineScope(Dispatchers.IO).launch {
MyDatabase.myDatabase.WallpaperDao().updateWallpaper(wallpaper.apply {
like = viewbing.imLike.isSelected
})
}
}
private fun startSave() {
viewbing.loading.isVisible = true
wallpaper.sourceCache?.let {
val file = File(it)
if (file.exists()) {
val saveToGallery = saveToGallery(PinkWallpapers.pinkWallpapers, file)
if (saveToGallery != null) {
Toast.makeText(this, getString(R.string.save_success), Toast.LENGTH_SHORT)
.show()
} else {
Toast.makeText(this, getString(R.string.save_fail), Toast.LENGTH_SHORT)
.show()
}
viewbing.loading.isVisible = false
}
} ?: run {
Toast.makeText(this, getString(R.string.save_fail), Toast.LENGTH_SHORT)
.show()
viewbing.loading.isVisible = false
}
}
private fun startSet() {
mBitmap = viewbing.previewImg.drawable.toBitmap()
if (selectDialog == null) {
selectDialog = DialogWallpaper.newInstance()
selectDialog?.onSetListener {
viewbing.loading.isVisible = true
mBitmap?.let { bitmap ->
when (it) {
Common.TYPE_BOTH -> {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
wallpaperManager.setBitmap(bitmap)//FLAG_SYSTEM | FLAG_LOCK)
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_HOME -> {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
Log.d("------", "-------thread=${Thread.currentThread().name}")
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(bitmap)
} else {
wallpaperManager.setBitmap(
bitmap,
null,
true,
WallpaperManager.FLAG_SYSTEM
)
}
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_LOCK -> {
lifecycleScope.launch {
withContext(Dispatchers.IO) {
Log.d(
"------",
"-------IO thread=${Thread.currentThread().name}"
)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(bitmap)
} else {
wallpaperManager.setBitmap(
mBitmap,
null,
true,
WallpaperManager.FLAG_LOCK
)
}
}
runOnUiThread {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.set_ok),
Toast.LENGTH_SHORT
).show()
}
}
}
Common.TYPE_DISSMISS -> {
viewbing.loading.isVisible = false
}
}
}
}
}
selectDialog?.show(supportFragmentManager, "")
}
private fun startShowAd(action: () -> Unit) {
action.invoke()
}
private fun initBar() {
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
}
private fun loadSource() {
viewbing.loading.isVisible = true
Glide.with(this)
.asFile()
.load(wallpaper.source)
.thumbnail(0.1f)
.transform(CropTransformation())
.listener(object : RequestListener<File> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<File>,
isFirstResource: Boolean
): Boolean {
viewbing.loading.isVisible = false
Toast.makeText(
this@SetWallpaperActivity,
getString(R.string.load_file),
Toast.LENGTH_SHORT
)
.show()
return false
}
override fun onResourceReady(
resource: File,
model: Any,
target: Target<File>?,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
wallpaper.sourceCache = resource.absolutePath
val bitmap = BitmapFactory.decodeFile(resource.absolutePath)
viewbing.previewImg.setImageBitmap(bitmap)
viewbing.loading.isVisible = false
return false
}
}).preload()
}
/**
* .listener(object : RequestListener<Bitmap> {
* override fun onLoadFailed(
* e: GlideException?,
* model: Any?,
* target: Target<Bitmap>,
* isFirstResource: Boolean
* ): Boolean {
*
* viewbing.loading.isVisible = false
* return false
* }
*
* override fun onResourceReady(
* resource: Bitmap,
* model: Any,
* target: Target<Bitmap>?,
* dataSource: DataSource,
* isFirstResource: Boolean
* ): Boolean {
* viewbing.loading.isVisible = false
* mBitmap = resource
*
* return false
* }
* })
*/
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == code) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startSave()
} else {
Toast.makeText(this, getString(R.string.grant_permission), Toast.LENGTH_SHORT)
.show()
}
}
}
private fun requestPermission(context: Activity, requestCode: Int): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
return true
}
return if (context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
context,
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
requestCode
)
false
} else {
true
}
}
private 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

@ -1,35 +1,41 @@
package com.pink.cute.wallpapers
package com.pink.cute.wallpapers.activity
import android.os.Bundle
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.databinding.ActivityWallpaperListBinding
import com.pink.cute.wallpapers.manager.Common
import com.pink.cute.wallpapers.manager.ItemDecoration
import com.pink.cute.wallpapers.myroom.MyDatabase
import com.pink.cute.wallpapers.viewadapter.AdapterRecommend
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class WallpaperListActivity : AppCompatActivity() {
private lateinit var viewbing: ActivityWallpaperListBinding
private lateinit var mAdapter: AdapterRecommend
private lateinit var mCategory: Category
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewbing = ActivityWallpaperListBinding.inflate(LayoutInflater.from(this), null, false)
setContentView(viewbing.root)
val categoryName = intent.getStringExtra(Common.KEY_CATEGORY_NAME)
mCategory = intent.getSerializableExtra(Common.KEY_CATEGORY_NAME) as Category
mAdapter = AdapterRecommend(this)
PinkWallpapers.categoryList.filter {
it.category == categoryName
}.let {
mAdapter.updateList(it[0].list)
CoroutineScope(Dispatchers.IO).launch{
val queryList = MyDatabase.myDatabase.WallpaperDao().queryList(mCategory.id)
mAdapter.updateList(queryList)
}
setList()
viewbing.textName.text = categoryName
viewbing.textName.text = mCategory.category
viewbing.btnBack.setOnClickListener {
startShowAd {
finish()

View File

@ -1,4 +1,16 @@
package com.pink.cute.wallpapers.bean
class Category(var category: String,var list:List<Wallpaper>) {
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.pink.cute.wallpapers.PinkWallpapers
import java.io.Serializable
@Entity(tableName = PinkWallpapers.TB_NAME_CATEGORY)
class Category(
@PrimaryKey(autoGenerate = true)
var id: Long = 0,
var category: String,
var covert:String
):Serializable{
}

View File

@ -1,6 +1,29 @@
package com.pink.cute.wallpapers.bean
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index
import androidx.room.PrimaryKey
import com.pink.cute.wallpapers.PinkWallpapers
import java.io.Serializable
class Wallpaper(var source: String,var preview:String) :Serializable{
@Entity(
tableName = PinkWallpapers.TB_NAME_WALLPAPER, foreignKeys = arrayOf(
ForeignKey(
entity = Category::class,
parentColumns = arrayOf("id"),
childColumns = arrayOf("categoryId"),
onDelete = ForeignKey.CASCADE
)
),
indices = [Index(value = ["id"], unique = true)]
)
class Wallpaper(
@PrimaryKey(autoGenerate = true)
var id: Long = 0,
var categoryId: Long = 0,
var source: String, var preview: String,
var sourceCache: String?= null,
var like: Boolean = false
) : Serializable {
}

View File

@ -1,8 +1,10 @@
package com.pink.cute.wallpapers.manager
import android.util.Log
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.myroom.MyDatabase
import org.json.JSONArray
import java.io.BufferedReader
import java.io.ByteArrayOutputStream
@ -29,15 +31,28 @@ object Common {
for (i in 0 until array.length()) {
val any = array.getJSONObject(i)
val title = any.getString("name")
val mCovert = any.getString("preUrl")
val category = Category(category = title, covert = mCovert)
data.add(category)
val insertCateId = MyDatabase.myDatabase.CategoryDao().insertData(category)
val jsonArray = any.getJSONArray("list")
var wallpaperMutableList = mutableListOf<Wallpaper>()
Log.d("ting","-----------category=${category.category} $insertCateId")
for (k in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(k)
val source = jsonObject.getString("sourceUrl")
val preview = jsonObject.getString("preUrl")
wallpaperMutableList.add(Wallpaper(preview = preview, source = source))
val wallpaper = Wallpaper(preview = preview, source = source, categoryId = insertCateId)
MyDatabase.myDatabase.WallpaperDao().insertWallpaper(wallpaper)
wallpaperMutableList.add(wallpaper)
}
data.add(Category(title, wallpaperMutableList))
}
return data

View File

@ -0,0 +1,31 @@
package com.pink.cute.wallpapers.myroom;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import com.pink.cute.wallpapers.bean.Category;
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 category = :title")
Category queryCateId(String title);
@Query("select * from category order by id desc")
List<Category> queryAllData();
}

View File

@ -0,0 +1,31 @@
package com.pink.cute.wallpapers.myroom
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.bean.Wallpaper
@Database(
entities = [Category::class, Wallpaper::class],
version = PinkWallpapers.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(
PinkWallpapers.pinkWallpapers, MyDatabase::class.java,
PinkWallpapers.DB_NAME
).build()
}
}
}

View File

@ -0,0 +1,30 @@
package com.pink.cute.wallpapers.myroom;
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 com.pink.cute.wallpapers.bean.Wallpaper;
import java.util.List;
@Dao
public interface WallpaperDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
void insertWallpaper(Wallpaper prank);
@Query("select * from wallpaper where `like` ==:mlike")
LiveData<List<Wallpaper>> queryAllLike(boolean mlike );
@Query("select * from wallpaper where categoryId ==:mId")
List<Wallpaper> queryList(long mId);
@Query("select * from wallpaper where id ==:mId")
Wallpaper queryWallpaper(long mId);
@Update
void updateWallpaper(Wallpaper wallpaper);
}

View File

@ -1,5 +1,6 @@
package com.pink.cute.wallpapers.ui.dashboard
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -7,6 +8,7 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.pink.cute.wallpapers.activity.AboutActivity
import com.pink.cute.wallpapers.databinding.FragmentDashboardBinding
import com.pink.cute.wallpapers.manager.ItemDecoration
import com.pink.cute.wallpapers.viewadapter.AdapterRecommend
@ -15,8 +17,7 @@ class DashboardFragment : Fragment() {
private var _binding: FragmentDashboardBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
private lateinit var mAdapter: AdapterRecommend
@ -30,21 +31,30 @@ class DashboardFragment : Fragment() {
_binding = FragmentDashboardBinding.inflate(inflater, container, false)
val root: View = binding.root
dashboardViewModel.setListValue()
mAdapter = AdapterRecommend(requireContext())
setList()
dashboardViewModel.listLiveData.observe(viewLifecycleOwner) {
mAdapter.updateList(it)
}
onClick()
return root
}
private fun setList() {
binding.recomonedRecycler.run {
layoutManager = GridLayoutManager(requireContext(),3)
adapter = mAdapter
addItemDecoration(ItemDecoration(8,8,2))
private fun onClick() {
binding.set.setOnClickListener {
startActivity(Intent(requireContext(), AboutActivity::class.java))
}
}
private fun setList() {
binding.recomonedRecycler.run {
layoutManager = GridLayoutManager(requireContext(), 3)
adapter = mAdapter
addItemDecoration(ItemDecoration(8, 8, 2))
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null

View File

@ -5,6 +5,12 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.myroom.CategoryDao
import com.pink.cute.wallpapers.myroom.MyDatabase
import com.pink.cute.wallpapers.myroom.WallpaperDao
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class DashboardViewModel : ViewModel() {
@ -12,15 +18,32 @@ class DashboardViewModel : ViewModel() {
val listLiveData: LiveData<List<Wallpaper>> = _list
fun setListValue() {
val wallpaperList = mutableListOf<Wallpaper>()
val data = PinkWallpapers.categoryList.filter {
it.category == "recent" || it.category == "feature" || it.category == "popular"
init {
CoroutineScope(Dispatchers.IO).launch {
val queryCateId1 = MyDatabase.myDatabase.CategoryDao().queryCateId("recent")
val queryCateId2 = MyDatabase.myDatabase.CategoryDao().queryCateId("feature")
val queryCateId3 = MyDatabase.myDatabase.CategoryDao().queryCateId("popular")
var list = mutableListOf<Wallpaper>()
queryCateId1?.let {
val queryList = MyDatabase.myDatabase.WallpaperDao().queryList(queryCateId1.id)
list.addAll(queryList)
}
queryCateId2?.let {
val queryList2 = MyDatabase.myDatabase.WallpaperDao().queryList(queryCateId2.id)
list.addAll(queryList2)
}
queryCateId3?.let {
val queryList3 = MyDatabase.myDatabase.WallpaperDao().queryList(queryCateId3.id)
list.addAll(queryList3)
}
list.shuffle()
_list.postValue(list)
}
data.forEach {
wallpaperList.addAll(it.list)
}
wallpaperList.shuffle()
_list.postValue(wallpaperList)
}
}

View File

@ -8,7 +8,9 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.pink.cute.wallpapers.WallpaperListActivity
import com.pink.cute.wallpapers.activity.AboutActivity
import com.pink.cute.wallpapers.activity.SetWallpaperActivity
import com.pink.cute.wallpapers.activity.WallpaperListActivity
import com.pink.cute.wallpapers.databinding.FragmentHomeBinding
import com.pink.cute.wallpapers.manager.Common
import com.pink.cute.wallpapers.manager.ItemDecoration
@ -29,12 +31,15 @@ class HomeFragment : Fragment() {
savedInstanceState: Bundle?
): View {
val homeViewModel = ViewModelProvider(this)[HomeViewModel::class.java]
homeViewModel.setListValue()
_binding = FragmentHomeBinding.inflate(inflater, container, false)
val root: View = binding.root
adapterCategory = AdapterCategory(requireContext())
homeViewModel.listLiveData.observe(viewLifecycleOwner) {
adapterCategory.updateList(it)
homeViewModel.listLiveData.observe(viewLifecycleOwner) { list->
val data = list.filter {
it.category != "recent" && it.category != "feature" && it.category != "popular"
}
adapterCategory.updateList(data)
}
setList()
return root
@ -42,18 +47,20 @@ class HomeFragment : Fragment() {
private fun setList() {
binding.categoryRecycler.run {
layoutManager = GridLayoutManager(requireContext(),2)
layoutManager = GridLayoutManager(requireContext(), 2)
adapter = adapterCategory
addItemDecoration(ItemDecoration(12,12,2))
addItemDecoration(ItemDecoration(12, 12, 2))
}
adapterCategory.setClickAction{
startActivity( Intent(requireContext(),WallpaperListActivity::class.java).apply {
putExtra(Common.KEY_CATEGORY_NAME,it)
adapterCategory.setClickAction {
startActivity(Intent(requireContext(), WallpaperListActivity::class.java).apply {
putExtra(Common.KEY_CATEGORY_NAME, it)
})
}
}
override fun onDestroyView() {

View File

@ -5,17 +5,22 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.pink.cute.wallpapers.PinkWallpapers
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.myroom.CategoryDao
import com.pink.cute.wallpapers.myroom.MyDatabase
class HomeViewModel : ViewModel() {
private val _list = MutableLiveData<List<Category>>()
val listLiveData: LiveData<List<Category>> = _list
class HomeViewModel(var cateDao: CategoryDao? = null) : ViewModel() {
fun setListValue() {
val data = PinkWallpapers.categoryList.filter {
it.category != "recent" && it.category != "feature" && it.category != "popular"
}
_list.postValue(data)
var listLiveData: LiveData<List<Category>>
init {
cateDao = MyDatabase.myDatabase.CategoryDao()
val queryAll = cateDao?.queryAll()
// val data = PinkWallpapers.categoryList.filter {
// it.category != "recent" && it.category != "feature" && it.category != "popular"
// }
listLiveData = queryAll!!
}
}

View File

@ -0,0 +1,57 @@
package com.pink.cute.wallpapers.ui.notifications
import android.os.Bundle
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.pink.cute.wallpapers.databinding.FragmentFavoriteBinding
import com.pink.cute.wallpapers.manager.ItemDecoration
import com.pink.cute.wallpapers.viewadapter.AdapterRecommend
class FavoriteFragment : Fragment() {
private var _binding: FragmentFavoriteBinding? = null
private val binding get() = _binding!!
private lateinit var mAdapter: AdapterRecommend
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val favoriteViewModel =
ViewModelProvider(this).get(FavoriteViewModel::class.java)
_binding = FragmentFavoriteBinding.inflate(inflater, container, false)
val root: View = binding.root
mAdapter = AdapterRecommend(requireContext())
setList()
favoriteViewModel.listLiveData.observe(viewLifecycleOwner) {
updateView(it.isNotEmpty())
mAdapter.updateList(it)
}
return root
}
private fun updateView(hasData: Boolean){
binding.tvNoData.isVisible = !hasData
binding.likeRecycler.isVisible = hasData
}
private fun setList() {
binding.likeRecycler.run {
layoutManager = GridLayoutManager(requireContext(),3)
adapter = mAdapter
addItemDecoration(ItemDecoration(8,8,2))
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -0,0 +1,21 @@
package com.pink.cute.wallpapers.ui.notifications
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.pink.cute.wallpapers.bean.Category
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.myroom.MyDatabase
class FavoriteViewModel : ViewModel() {
var listLiveData: LiveData<List<Wallpaper>>
init {
var wallDao = MyDatabase.myDatabase.WallpaperDao()
listLiveData = wallDao.queryAllLike(true)
}
}

View File

@ -1,42 +0,0 @@
package com.pink.cute.wallpapers.ui.notifications
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.pink.cute.wallpapers.databinding.FragmentNotificationsBinding
class NotificationsFragment : Fragment() {
private var _binding: FragmentNotificationsBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val notificationsViewModel =
ViewModelProvider(this).get(NotificationsViewModel::class.java)
_binding = FragmentNotificationsBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textNotifications
notificationsViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
return root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -1,13 +0,0 @@
package com.pink.cute.wallpapers.ui.notifications
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
class NotificationsViewModel : ViewModel() {
private val _text = MutableLiveData<String>().apply {
value = "This is notifications Fragment"
}
val text: LiveData<String> = _text
}

View File

@ -15,7 +15,7 @@ import com.pink.cute.wallpapers.manager.Common
open class AdapterCategory(var context: Context) : RecyclerView.Adapter<AdapterCategory.VH>() {
var mList: List<Category> = emptyList()
private lateinit var mCallback: (String) -> Unit
private lateinit var mCallback: (Category) -> Unit
var options = RequestOptions().transform(RoundedCorners(Common.dp2Px(26)))
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
@ -32,7 +32,7 @@ open class AdapterCategory(var context: Context) : RecyclerView.Adapter<AdapterC
}
fun setClickAction(callback: (String) -> Unit) {
fun setClickAction(callback: (Category) -> Unit) {
mCallback = callback
}
@ -45,10 +45,10 @@ open class AdapterCategory(var context: Context) : RecyclerView.Adapter<AdapterC
mList[position].let { data->
categoryName.text = data.category
Glide.with(context).load(data.list[2].preview)
Glide.with(context).load(data.covert)
.into(imageCovert)
root.setOnClickListener {
mCallback.invoke(data.category)
mCallback.invoke(data)
}
}

View File

@ -8,7 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
import com.pink.cute.wallpapers.SetWallpaperActivity
import com.pink.cute.wallpapers.activity.SetWallpaperActivity
import com.pink.cute.wallpapers.bean.Wallpaper
import com.pink.cute.wallpapers.databinding.ItemWallpaperBinding
import com.pink.cute.wallpapers.manager.Common

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FFffffff"
android:pathData="M188.3,729.4h644.8c18.4,0 33.3,14.9 33.3,33.3S851.5,796 833.1,796L188.3,796c-18.4,0 -33.3,-14.9 -33.3,-33.3s14.9,-33.3 33.3,-33.3zM577.4,429.1h124.2c5.9,0 11.6,2.3 15.7,6.5 8.7,8.7 8.7,22.8 0,31.4L526.4,657.9c-8.7,8.7 -22.8,8.7 -31.4,0L304.1,467c-4.2,-4.2 -6.5,-9.8 -6.5,-15.7 0,-12.3 10,-22.2 22.2,-22.2L444,429.1L444,151.3c0,-36.8 29.9,-66.7 66.7,-66.7s66.7,29.9 66.7,66.7v277.8z"/>
</vector>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/set_btn_color"/>
</shape>

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M944.5,552.5l-182.4,330.7a73.8,73.8 0,0 1,-64.6 38.3h-362.1a73.8,73.8 0,0 1,-64.6 -38.3l-182.4,-330.7a75.3,75.3 0,0 1,0 -72.7l182.4,-330.7a73.8,73.8 0,0 1,64.6 -38.3h362.1a73.8,73.8 0,0 1,64.6 38.3l182.4,330.7a75.3,75.3 0,0 1,0 72.7zM888.5,521.3a10.8,10.8 0,0 0,0 -10.4l-182,-330.7a10.5,10.5 0,0 0,-9.2 -5.5L335.7,174.8a10.5,10.5 0,0 0,-9.2 5.5l-182,330.7a10.8,10.8 0,0 0,0 10.4l182,330.7a10.5,10.5 0,0 0,9.2 5.5h361.5a10.5,10.5 0,0 0,9.2 -5.5l182,-330.7zM513.7,682.7c-94.3,0 -170.7,-76.4 -170.7,-170.7s76.4,-170.7 170.7,-170.7c94.3,0 170.7,76.4 170.7,170.7s-76.4,170.7 -170.7,170.7zM513.7,618.7c58.9,0 106.7,-47.8 106.7,-106.7s-47.8,-106.7 -106.7,-106.7 -106.7,47.8 -106.7,106.7 47.8,106.7 106.7,106.7z"
android:fillColor="@color/purple_500"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/like_gray"
android:pathData="M533.5,268.3q33.8,-42 71.7,-75.8 32.8,-27.6 74.2,-50.2t86.5,-19.5q63.5,5.1 106,30.2t67.6,63.5 34.3,87 6.1,99.8 -17.9,97.8 -36.9,87 -48.6,74.8 -53.2,62q-41,42 -85.5,78.3t-85,62.5 -73.7,41.5 -51.7,15.4q-20.5,1 -52.2,-14.3t-69.6,-41.5 -79.9,-62 -82.9,-75.8q-26.6,-25.6 -57.3,-59.4t-57.9,-74.2 -46.6,-87.6 -21.5,-100.4 11.3,-99.8 39.9,-83.5 65.5,-62 88.1,-35.3q24.6,-5.1 49.2,-1.5t48.1,12.3 45.1,22 41,27.6q45.1,33.8 86,80.9z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/like_red"
android:pathData="M533.5,268.3q33.8,-42 71.7,-75.8 32.8,-27.6 74.2,-50.2t86.5,-19.5q63.5,5.1 106,30.2t67.6,63.5 34.3,87 6.1,99.8 -17.9,97.8 -36.9,87 -48.6,74.8 -53.2,62q-41,42 -85.5,78.3t-85,62.5 -73.7,41.5 -51.7,15.4q-20.5,1 -52.2,-14.3t-69.6,-41.5 -79.9,-62 -82.9,-75.8q-26.6,-25.6 -57.3,-59.4t-57.9,-74.2 -46.6,-87.6 -21.5,-100.4 11.3,-99.8 39.9,-83.5 65.5,-62 88.1,-35.3q24.6,-5.1 49.2,-1.5t48.1,12.3 45.1,22 41,27.6q45.1,33.8 86,80.9z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#666666"
android:pathData="M533.5,268.3q33.8,-42 71.7,-75.8 32.8,-27.6 74.2,-50.2t86.5,-19.5q63.5,5.1 106,30.2t67.6,63.5 34.3,87 6.1,99.8 -17.9,97.8 -36.9,87 -48.6,74.8 -53.2,62q-41,42 -85.5,78.3t-85,62.5 -73.7,41.5 -51.7,15.4q-20.5,1 -52.2,-14.3t-69.6,-41.5 -79.9,-62 -82.9,-75.8q-26.6,-25.6 -57.3,-59.4t-57.9,-74.2 -46.6,-87.6 -21.5,-100.4 11.3,-99.8 39.9,-83.5 65.5,-62 88.1,-35.3q24.6,-5.1 49.2,-1.5t48.1,12.3 45.1,22 41,27.6q45.1,33.8 86,80.9z"/>
</vector>

View File

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

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/back"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginStart="12dp"
android:layout_marginTop="8dp"
android:padding="10dp"
android:src="@drawable/btnback"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="@+id/card_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="63dp"
app:cardCornerRadius="6dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/back">
<ImageView
android:layout_width="86dp"
android:layout_height="86dp"
android:src="@mipmap/logo" />
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/app_version"
android:textColor="@color/black"
android:textSize="15sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/card_logo" />
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:text="@string/app_rate"
android:layout_marginStart="25dp"
android:id="@+id/tv_rate"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/tv_version" />
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="25dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="25dp"
android:background="@color/line_color"
app:layout_constraintTop_toBottomOf="@id/tv_rate" />
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:text="@string/app_share"
android:layout_marginStart="25dp"
android:id="@+id/tv_share"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/view1" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="25dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="25dp"
android:background="@color/line_color"
app:layout_constraintTop_toBottomOf="@id/tv_share" />
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:text="@string/app_privacy"
android:layout_marginStart="25dp"
android:id="@+id/tv_privacy"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintTop_toBottomOf="@id/view2" />
<View
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="25dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="25dp"
android:background="@color/line_color"
app:layout_constraintTop_toBottomOf="@id/tv_privacy" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,18 +4,25 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LaunActivity">
tools:context=".activity.LaunActivity">
<ImageView
<androidx.cardview.widget.CardView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="200dp"
android:src="@mipmap/logo"
app:cardCornerRadius="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/logo" />
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/back"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginStart="12dp"
android:padding="10dp"
android:src="@drawable/btnback" />
<TextView
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:text="@string/app_privacy"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold" />
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/back"
android:text="@string/app_privacy"
android:textColor="@color/black"
android:textSize="15sp"
tools:ignore="WebViewLayout" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SetWallpaperActivity">
tools:context=".activity.SetWallpaperActivity">
<ImageView
android:id="@+id/previewImg"
@ -26,7 +26,25 @@
android:src="@drawable/btnback"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/btn_like"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:padding="5dp"
app:layout_constraintBottom_toBottomOf="@id/text_set_btn"
app:layout_constraintEnd_toStartOf="@id/text_set_btn"
app:layout_constraintTop_toTopOf="@id/text_set_btn">
<ImageView
android:layout_width="34dp"
android:id="@+id/imLike"
android:layout_height="34dp"
android:background="@drawable/download_bg"
android:gravity="center"
android:padding="6dp"
android:src="@drawable/selector_like" />
</FrameLayout>
<TextView
android:id="@+id/text_set_btn"
@ -42,6 +60,26 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<FrameLayout
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:padding="5dp"
app:layout_constraintBottom_toBottomOf="@id/text_set_btn"
app:layout_constraintStart_toEndOf="@id/text_set_btn"
app:layout_constraintTop_toTopOf="@id/text_set_btn">
<ImageView
android:layout_width="34dp"
android:layout_height="34dp"
android:background="@drawable/download_bg"
android:gravity="center"
android:padding="6dp"
android:src="@drawable/download" />
</FrameLayout>
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".WallpaperListActivity">
tools:context=".activity.WallpaperListActivity">
<ImageView
@ -21,7 +21,7 @@
android:layout_height="44dp"
android:gravity="center"
android:textColor="@color/black"
android:textSize="16sp"
android:textSize="21sp"
android:id="@+id/text_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View File

@ -6,11 +6,32 @@
android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment">
<ImageView
android:id="@+id/set"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="12dp"
android:padding="12dp"
android:src="@drawable/icon_set"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="@color/purple_500"
android:textSize="21sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/set"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/set" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recomoned_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="@id/set" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,19 +4,26 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">
tools:context=".ui.notifications.FavoriteFragment">
<TextView
android:id="@+id/text_notifications"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/like_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="22dp"
android:layout_marginEnd="22dp"
android:gravity="center"
android:id="@+id/tv_no_data"
android:text="@string/no_like"
android:textColor="@color/purple_500"
android:textSize="19sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,6 +10,6 @@
android:id="@+id/category_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,19 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/recommend"
android:title="@string/title_recommend" />
<item
android:id="@+id/navigation_home"
android:icon="@drawable/category"
android:title="@string/title_category" />
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/recommend"
android:title="@string/title_recommend" />
<!-- <item-->
<!-- android:id="@+id/navigation_notifications"-->
<!-- android:icon="@drawable/ic_notifications_black_24dp"-->
<!-- android:title="@string/title_favorite" />-->
android:id="@+id/navigation_favorite"
android:icon="@drawable/like_gray"
android:title="@string/title_favorite" />
</menu>

View File

@ -3,8 +3,12 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_home">
app:startDestination="@+id/navigation_dashboard">
<fragment
android:id="@+id/navigation_dashboard"
android:name="com.pink.cute.wallpapers.ui.dashboard.DashboardFragment"
android:label="@string/title_recommend"
tools:layout="@layout/fragment_dashboard" />
<fragment
android:id="@+id/navigation_home"
android:name="com.pink.cute.wallpapers.ui.home.HomeFragment"
@ -12,14 +16,8 @@
tools:layout="@layout/fragment_home" />
<fragment
android:id="@+id/navigation_dashboard"
android:name="com.pink.cute.wallpapers.ui.dashboard.DashboardFragment"
android:label="@string/title_recommend"
tools:layout="@layout/fragment_dashboard" />
<!-- <fragment-->
<!-- android:id="@+id/navigation_notifications"-->
<!-- android:name="wallpaperspapers.ui.notifications.NotificationsFragment"-->
<!-- android:label="@string/title_favorite"-->
<!-- tools:layout="@layout/fragment_notifications" />-->
android:id="@+id/navigation_favorite"
android:name="com.pink.cute.wallpapers.ui.notifications.FavoriteFragment"
android:label="@string/title_favorite"
tools:layout="@layout/fragment_favorite" />
</navigation>

View File

@ -13,4 +13,8 @@
<color name="text_color">#FFFdfdfd</color>
<color name="nocolor">#00000000</color>
<color name="text_color_sub">#d39bdc</color>
<color name="line_color">#737373</color>
<color name="like_gray">#737373</color>
<color name="like_red">#D13434</color>
<color name="ss">#1a73e8</color>
</resources>

View File

@ -10,5 +10,18 @@
<string name="dialog_lock_btn">Lock Screen</string>
<string name="dialog_both_btn">Both</string>
<string name="set_ok">Congratulations, the wallpaper is set successfully</string>
<string name="app_version">V%s</string>
<string name="app_rate">Rate Us</string>
<string name="app_privacy">Privacy Policy</string>
<string name="app_share">Share</string>
<string name="gp">https://play.google.com/store/apps/details?id=%s</string>
<string name="grant_permission">Please grant permission to use related functions</string>
<string name="save">Save Album</string>
<string name="save_fail">Sorry, failed to save the image, please exit the current page and try again</string>
<string name="load_file">Loading failed, please check the network and re-enter the page</string>
<string name="save_success">Congratulations, the image was saved successfully</string>
<string name="add_like">Added to favorites successfully</string>
<string name="cancel_like">Successfully canceled the collection</string>
<string name="no_like">You haven not added any favorite wallpapers yet</string>
<string name="share_title">There are many wallpapers for you to choose from</string>
</resources>

View File

@ -1,5 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
kotlin("kapt") version "2.0.0"
id("com.android.application") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
id("com.google.gms.google-services") version "4.3.15" apply false