init
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
BIN
app/PinkWallpapers.jks
Normal file
66
app/build.gradle.kts
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import java.util.Date
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
plugins {
|
||||||
|
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())
|
||||||
|
android {
|
||||||
|
namespace = "com.pink.cute.wallpapers"
|
||||||
|
compileSdk = 34
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
//com.pink.cute.wallpapers Pink Wallpapers
|
||||||
|
applicationId = "com.pink.cute.wallpapers.test"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 34
|
||||||
|
versionCode = 4
|
||||||
|
versionName = "1.0.3"
|
||||||
|
setProperty("archivesBaseName", "Pink Wallpapers_V" + versionName + "(${versionCode})_$timestamp")
|
||||||
|
testInstrumentationRunner = "androidx.wallpapers.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation("androidx.core:core-ktx:1.9.0")
|
||||||
|
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||||
|
implementation("com.google.android.material:material:1.12.0")
|
||||||
|
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||||
|
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.1")
|
||||||
|
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1")
|
||||||
|
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
||||||
|
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
||||||
|
testImplementation("junit:junit:4.13.2")
|
||||||
|
androidTestImplementation("androidx.wallpapers.ext:junit:1.1.5")
|
||||||
|
androidTestImplementation("androidx.wallpapers.espresso:espresso-core:3.5.1")
|
||||||
|
|
||||||
|
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||||
|
annotationProcessor("com.github.bumptech.glide:compiler:4.12.0")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "62351382065",
|
||||||
|
"project_id": "pink-wallpapers-hd-wallpapers",
|
||||||
|
"storage_bucket": "pink-wallpapers-hd-wallpapers.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:62351382065:android:8efff2c8a82f275be32710",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.pink.cute.wallpapers.test"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyBbsOEX368ZYhDKbJXbXsWclBSP-o4fEtA"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
36
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
-keepclassmembers class * implements java.io.Serializable {
|
||||||
|
|
||||||
|
static final long serialVersionUID;
|
||||||
|
|
||||||
|
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream);
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream);
|
||||||
|
|
||||||
|
java.lang.Object writeReplace();
|
||||||
|
|
||||||
|
java.lang.Object readResolve();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented wallpapers, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under wallpapers.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("com.pink.cute.wallpapers", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
43
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".PinkWallpapers"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/logo"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/logo"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.PinkWallpapers"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".SetWallpaperActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".WallpaperListActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".LaunActivity"
|
||||||
|
android:exported="true" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:label="@string/app_name"/>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
2251
app/src/main/assets/wallres.json
Normal file
32
app/src/main/java/com/pink/cute/wallpapers/LaunActivity.kt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import com.pink.cute.wallpapers.databinding.ActivityLaunBinding
|
||||||
|
|
||||||
|
|
||||||
|
class LaunActivity : AppCompatActivity() {
|
||||||
|
private lateinit var vb: ActivityLaunBinding
|
||||||
|
private var countDownTimer: CountDownTimer?= null
|
||||||
|
private var countDown = 10000L
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
vb = ActivityLaunBinding.inflate(LayoutInflater.from(this), null, false)
|
||||||
|
setContentView(vb.root)
|
||||||
|
|
||||||
|
startActivity(Intent(this@LaunActivity, MainActivity::class.java))
|
||||||
|
finish()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
countDownTimer?.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
31
app/src/main/java/com/pink/cute/wallpapers/MainActivity.kt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
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.pink.cute.wallpapers.databinding.ActivityMainBinding
|
||||||
|
|
||||||
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
private lateinit var binding: ActivityMainBinding
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/src/main/java/com/pink/cute/wallpapers/PinkWallpapers.kt
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import com.pink.cute.wallpapers.bean.Category
|
||||||
|
import com.pink.cute.wallpapers.manager.Common
|
||||||
|
|
||||||
|
class PinkWallpapers : Application() {
|
||||||
|
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
lateinit var pinkWallpapers: PinkWallpapers
|
||||||
|
|
||||||
|
lateinit var categoryList: List<Category>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
pinkWallpapers = this
|
||||||
|
initMAX()
|
||||||
|
analyzeFiles()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun analyzeFiles() {
|
||||||
|
val fdInput = assets.open("wallres.json")
|
||||||
|
val jsonStr = Common.getJsonString(fdInput)
|
||||||
|
categoryList = Common.getListCategory(jsonStr)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initMAX() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,232 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
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.viewadapter.AdapterRecommend
|
||||||
|
|
||||||
|
class WallpaperListActivity : AppCompatActivity() {
|
||||||
|
private lateinit var viewbing: ActivityWallpaperListBinding
|
||||||
|
private lateinit var mAdapter: AdapterRecommend
|
||||||
|
|
||||||
|
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)
|
||||||
|
mAdapter = AdapterRecommend(this)
|
||||||
|
|
||||||
|
PinkWallpapers.categoryList.filter {
|
||||||
|
it.category == categoryName
|
||||||
|
}.let {
|
||||||
|
mAdapter.updateList(it[0].list)
|
||||||
|
|
||||||
|
}
|
||||||
|
setList()
|
||||||
|
viewbing.textName.text = categoryName
|
||||||
|
viewbing.btnBack.setOnClickListener {
|
||||||
|
startShowAd {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
super.onBackPressed()
|
||||||
|
startShowAd {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setList() {
|
||||||
|
viewbing.listRecycler.run {
|
||||||
|
layoutManager = GridLayoutManager(this@WallpaperListActivity, 3)
|
||||||
|
adapter = mAdapter
|
||||||
|
addItemDecoration(ItemDecoration(8, 8, 2))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun startShowAd(action: () -> Unit) {
|
||||||
|
action.invoke()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
package com.pink.cute.wallpapers.bean
|
||||||
|
|
||||||
|
class Category(var category: String,var list:List<Wallpaper>) {
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.pink.cute.wallpapers.bean
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
class Wallpaper(var source: String,var preview:String) :Serializable{
|
||||||
|
}
|
||||||
87
app/src/main/java/com/pink/cute/wallpapers/manager/Common.kt
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package com.pink.cute.wallpapers.manager
|
||||||
|
|
||||||
|
import com.pink.cute.wallpapers.PinkWallpapers
|
||||||
|
import com.pink.cute.wallpapers.bean.Category
|
||||||
|
import com.pink.cute.wallpapers.bean.Wallpaper
|
||||||
|
import org.json.JSONArray
|
||||||
|
import java.io.BufferedReader
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.io.InputStreamReader
|
||||||
|
import java.io.StringWriter
|
||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
|
object Common {
|
||||||
|
|
||||||
|
const val KEY_CATEGORY_NAME = "select_name"
|
||||||
|
|
||||||
|
const val KEY_WALLPAPER = "wallpaper"
|
||||||
|
const val TYPE_BOTH = 0
|
||||||
|
const val TYPE_HOME = 1
|
||||||
|
const val TYPE_LOCK = 2
|
||||||
|
const val TYPE_DISSMISS = -1
|
||||||
|
|
||||||
|
fun getListCategory(jsonStr: String): List<Category> {
|
||||||
|
var data = mutableListOf<Category>()
|
||||||
|
val array = JSONArray(jsonStr)
|
||||||
|
for (i in 0 until array.length()) {
|
||||||
|
val any = array.getJSONObject(i)
|
||||||
|
val title = any.getString("name")
|
||||||
|
val jsonArray = any.getJSONArray("list")
|
||||||
|
var wallpaperMutableList = mutableListOf<Wallpaper>()
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
data.add(Category(title, wallpaperMutableList))
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun dp2Px(dp: Int): Int {
|
||||||
|
val scale: Float = PinkWallpapers.pinkWallpapers.resources.displayMetrics.density
|
||||||
|
return (dp * scale + 0.5f).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 getJsonString(input: InputStream): String {
|
||||||
|
val stringWriter = StringWriter()
|
||||||
|
val charArray = CharArray(input.available())
|
||||||
|
var l = 0;
|
||||||
|
val bufReader = BufferedReader(InputStreamReader(input, StandardCharsets.UTF_8))
|
||||||
|
while (bufReader.read(charArray).also {
|
||||||
|
l = it
|
||||||
|
} != -1) {
|
||||||
|
stringWriter.write(charArray, 0, l)
|
||||||
|
}
|
||||||
|
return stringWriter.toString()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.pink.cute.wallpapers.manager
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.util.Log
|
||||||
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
|
||||||
|
import java.security.MessageDigest
|
||||||
|
|
||||||
|
class CropTransformation() : BitmapTransformation() {
|
||||||
|
override fun transform(
|
||||||
|
pool: BitmapPool,
|
||||||
|
toTransform: Bitmap,
|
||||||
|
outWidth: Int,
|
||||||
|
outHeight: Int
|
||||||
|
): Bitmap {
|
||||||
|
val width = toTransform.width
|
||||||
|
val height = toTransform.height
|
||||||
|
|
||||||
|
Log.d("----------","---------width=${width} height=${height}")
|
||||||
|
|
||||||
|
// 裁剪的高度
|
||||||
|
val cropHeight = Common.dp2Px(19)
|
||||||
|
|
||||||
|
// 创建一个新的Bitmap,只包含下半部分
|
||||||
|
val cropBitmap = Bitmap.createBitmap(toTransform, 0, 0, width, height - cropHeight)
|
||||||
|
|
||||||
|
// 如果不再需要原始Bitmap,则回收
|
||||||
|
// toTransform.recycle()
|
||||||
|
return cropBitmap
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateDiskCacheKey(messageDigest: MessageDigest) {
|
||||||
|
// 更新缓存键以确保请求的是正确的变换
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
package com.pink.cute.wallpapers.manager
|
||||||
|
|
||||||
|
|
||||||
|
import android.graphics.Rect
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||||
|
|
||||||
|
class ItemDecoration : RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
|
// item的水平、垂直方向的间距
|
||||||
|
private var verticalSpacing = 0
|
||||||
|
private var horizontalSpacing = 0
|
||||||
|
|
||||||
|
// recyclerview 左右分别额外的边距,可正可负,效果如|◼ ◼ ◼ ◼|、| ◼ ◼ ◼ ◼ |
|
||||||
|
//首尾margin是 spacing + extraSpacing
|
||||||
|
private var extraSpacing = 0
|
||||||
|
|
||||||
|
// item占满一行时,该item是否需要左右间距
|
||||||
|
var needVerticalSpacingInSingleLine = true
|
||||||
|
var needHorizontalSpacingInSingleLine = true
|
||||||
|
|
||||||
|
constructor(spacing: Int) {
|
||||||
|
initSpacing(spacing, spacing, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(spacing: Int, extraSpacing: Int) {
|
||||||
|
initSpacing(spacing, spacing, extraSpacing)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(verticalSpacing: Int, horizontalSpacing: Int, extraSpacing: Int) {
|
||||||
|
initSpacing(verticalSpacing, horizontalSpacing, extraSpacing)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initSpacing(verticalSpacing: Int, horizontalSpacing: Int, extraSpacing: Int) {
|
||||||
|
this.horizontalSpacing = Common.dp2Px(horizontalSpacing)
|
||||||
|
this.verticalSpacing = Common.dp2Px(verticalSpacing)
|
||||||
|
this.extraSpacing = Common.dp2Px(extraSpacing)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemOffsets(
|
||||||
|
outRect: Rect,
|
||||||
|
view: View,
|
||||||
|
parent: RecyclerView,
|
||||||
|
state: RecyclerView.State
|
||||||
|
) {
|
||||||
|
val position = parent.getChildAdapterPosition(view)
|
||||||
|
var spanCount = 1
|
||||||
|
var spanSize = 1
|
||||||
|
var spanIndex = 0
|
||||||
|
|
||||||
|
parent.layoutManager?.run {
|
||||||
|
when (this) {
|
||||||
|
is StaggeredGridLayoutManager -> {
|
||||||
|
spanCount = this.spanCount
|
||||||
|
(view.layoutParams as StaggeredGridLayoutManager.LayoutParams)?.run {
|
||||||
|
if (isFullSpan) spanSize = spanCount
|
||||||
|
spanIndex = this.spanIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
is GridLayoutManager -> {
|
||||||
|
spanCount = this.spanCount
|
||||||
|
spanSize = this.spanSizeLookup.getSpanSize(position)
|
||||||
|
spanIndex = (view.layoutParams as GridLayoutManager.LayoutParams).spanIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
is LinearLayoutManager -> {
|
||||||
|
outRect.left = verticalSpacing
|
||||||
|
outRect.right = verticalSpacing
|
||||||
|
outRect.bottom = horizontalSpacing
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spanSize == spanCount) {
|
||||||
|
outRect.left =
|
||||||
|
if (needVerticalSpacingInSingleLine) verticalSpacing + extraSpacing else 0
|
||||||
|
outRect.right =
|
||||||
|
if (needVerticalSpacingInSingleLine) verticalSpacing + extraSpacing else 0
|
||||||
|
outRect.bottom = if (needHorizontalSpacingInSingleLine) horizontalSpacing else 0
|
||||||
|
} else {
|
||||||
|
val itemAllSpacing = (verticalSpacing * (spanCount + 1) + extraSpacing * 2) / spanCount
|
||||||
|
val left = verticalSpacing * (spanIndex + 1) - itemAllSpacing * spanIndex + extraSpacing
|
||||||
|
val right = itemAllSpacing - left
|
||||||
|
outRect.left = left
|
||||||
|
outRect.right = right
|
||||||
|
outRect.bottom = horizontalSpacing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
package com.pink.cute.wallpapers.ui
|
||||||
|
|
||||||
|
import android.content.DialogInterface
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.Window
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import com.pink.cute.wallpapers.R
|
||||||
|
import com.pink.cute.wallpapers.databinding.FragmentDialogWallpaperBinding
|
||||||
|
import com.pink.cute.wallpapers.manager.Common
|
||||||
|
|
||||||
|
|
||||||
|
class DialogWallpaper : DialogFragment() {
|
||||||
|
|
||||||
|
private var param1: String? = null
|
||||||
|
private var param2: String? = null
|
||||||
|
|
||||||
|
private lateinit var dialogVb: FragmentDialogWallpaperBinding
|
||||||
|
private lateinit var mylistener:(Int)->Unit
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
dialogVb = FragmentDialogWallpaperBinding.inflate(inflater, container, false)
|
||||||
|
init()
|
||||||
|
return dialogVb.root
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onSetListener(listener:(Int)->Unit){
|
||||||
|
mylistener = listener
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun init() {
|
||||||
|
isCancelable = true
|
||||||
|
val window = dialog!!.window
|
||||||
|
window!!.setBackgroundDrawableResource(R.color.nocolor)
|
||||||
|
window.decorView.setPadding(0, 0, 0, 0)
|
||||||
|
|
||||||
|
initBar(window)
|
||||||
|
|
||||||
|
|
||||||
|
val wlp = window.attributes
|
||||||
|
wlp.gravity = Gravity.CENTER
|
||||||
|
wlp.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
wlp.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
window.attributes = wlp
|
||||||
|
|
||||||
|
dialogVb.imclose.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
mylistener.invoke(Common.TYPE_DISSMISS)
|
||||||
|
|
||||||
|
}
|
||||||
|
dialogVb.tvBoth.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
mylistener.invoke(Common.TYPE_BOTH)
|
||||||
|
|
||||||
|
}
|
||||||
|
dialogVb.tvhome.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
mylistener.invoke(Common.TYPE_HOME)
|
||||||
|
|
||||||
|
}
|
||||||
|
dialogVb.tvlock.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
mylistener.invoke(Common.TYPE_LOCK)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDismiss(dialog: DialogInterface) {
|
||||||
|
super.onDismiss(dialog)
|
||||||
|
mylistener.invoke(Common.TYPE_DISSMISS)
|
||||||
|
}
|
||||||
|
private fun initBar(window:Window) {
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||||
|
window.decorView.systemUiVisibility =
|
||||||
|
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
}
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun newInstance() = DialogWallpaper()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.pink.cute.wallpapers.ui.dashboard
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
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.pink.cute.wallpapers.databinding.FragmentDashboardBinding
|
||||||
|
import com.pink.cute.wallpapers.manager.ItemDecoration
|
||||||
|
import com.pink.cute.wallpapers.viewadapter.AdapterRecommend
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
val dashboardViewModel =
|
||||||
|
ViewModelProvider(this).get(DashboardViewModel::class.java)
|
||||||
|
|
||||||
|
_binding = FragmentDashboardBinding.inflate(inflater, container, false)
|
||||||
|
val root: View = binding.root
|
||||||
|
dashboardViewModel.setListValue()
|
||||||
|
mAdapter = AdapterRecommend(requireContext())
|
||||||
|
setList()
|
||||||
|
dashboardViewModel.listLiveData.observe(viewLifecycleOwner) {
|
||||||
|
mAdapter.updateList(it)
|
||||||
|
}
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
private fun setList() {
|
||||||
|
binding.recomonedRecycler.run {
|
||||||
|
layoutManager = GridLayoutManager(requireContext(),3)
|
||||||
|
adapter = mAdapter
|
||||||
|
addItemDecoration(ItemDecoration(8,8,2))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
_binding = null
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.pink.cute.wallpapers.ui.dashboard
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import com.pink.cute.wallpapers.PinkWallpapers
|
||||||
|
import com.pink.cute.wallpapers.bean.Wallpaper
|
||||||
|
|
||||||
|
class DashboardViewModel : ViewModel() {
|
||||||
|
|
||||||
|
private val _list = MutableLiveData<List<Wallpaper>>()
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
data.forEach {
|
||||||
|
wallpaperList.addAll(it.list)
|
||||||
|
}
|
||||||
|
wallpaperList.shuffle()
|
||||||
|
_list.postValue(wallpaperList)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.pink.cute.wallpapers.ui.home
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
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.pink.cute.wallpapers.WallpaperListActivity
|
||||||
|
import com.pink.cute.wallpapers.databinding.FragmentHomeBinding
|
||||||
|
import com.pink.cute.wallpapers.manager.Common
|
||||||
|
import com.pink.cute.wallpapers.manager.ItemDecoration
|
||||||
|
import com.pink.cute.wallpapers.viewadapter.AdapterCategory
|
||||||
|
|
||||||
|
class HomeFragment : Fragment() {
|
||||||
|
|
||||||
|
private var _binding: FragmentHomeBinding? = null
|
||||||
|
|
||||||
|
|
||||||
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
|
private lateinit var adapterCategory: AdapterCategory
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
setList()
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setList() {
|
||||||
|
binding.categoryRecycler.run {
|
||||||
|
layoutManager = GridLayoutManager(requireContext(),2)
|
||||||
|
adapter = adapterCategory
|
||||||
|
addItemDecoration(ItemDecoration(12,12,2))
|
||||||
|
}
|
||||||
|
|
||||||
|
adapterCategory.setClickAction{
|
||||||
|
startActivity( Intent(requireContext(),WallpaperListActivity::class.java).apply {
|
||||||
|
putExtra(Common.KEY_CATEGORY_NAME,it)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
_binding = null
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.pink.cute.wallpapers.ui.home
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import com.pink.cute.wallpapers.PinkWallpapers
|
||||||
|
import com.pink.cute.wallpapers.bean.Category
|
||||||
|
|
||||||
|
class HomeViewModel : ViewModel() {
|
||||||
|
|
||||||
|
private val _list = MutableLiveData<List<Category>>()
|
||||||
|
val listLiveData: LiveData<List<Category>> = _list
|
||||||
|
|
||||||
|
|
||||||
|
fun setListValue() {
|
||||||
|
val data = PinkWallpapers.categoryList.filter {
|
||||||
|
it.category != "recent" && it.category != "feature" && it.category != "popular"
|
||||||
|
}
|
||||||
|
_list.postValue(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package com.pink.cute.wallpapers.viewadapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
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.bean.Category
|
||||||
|
import com.pink.cute.wallpapers.databinding.ItemCategoyBinding
|
||||||
|
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
|
||||||
|
var options = RequestOptions().transform(RoundedCorners(Common.dp2Px(26)))
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
|
||||||
|
val viewbing = ItemCategoyBinding.inflate(LayoutInflater.from(parent.context), null, false)
|
||||||
|
|
||||||
|
return VH(viewbing)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateList(list: List<Category>) {
|
||||||
|
mList = list
|
||||||
|
notifyDataSetChanged()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setClickAction(callback: (String) -> Unit) {
|
||||||
|
mCallback = callback
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun getItemCount(): Int = mList.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: VH, position: Int) {
|
||||||
|
|
||||||
|
holder.viewbing.run {
|
||||||
|
|
||||||
|
mList[position].let { data->
|
||||||
|
categoryName.text = data.category
|
||||||
|
Glide.with(context).load(data.list[2].preview)
|
||||||
|
.into(imageCovert)
|
||||||
|
root.setOnClickListener {
|
||||||
|
mCallback.invoke(data.category)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class VH(var viewbing: ItemCategoyBinding) : RecyclerView.ViewHolder(viewbing.root)
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.pink.cute.wallpapers.viewadapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
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.bean.Wallpaper
|
||||||
|
import com.pink.cute.wallpapers.databinding.ItemWallpaperBinding
|
||||||
|
import com.pink.cute.wallpapers.manager.Common
|
||||||
|
|
||||||
|
|
||||||
|
open class AdapterRecommend(var context: Context) : RecyclerView.Adapter<AdapterRecommend.VH>() {
|
||||||
|
|
||||||
|
var mList: List<Wallpaper> = emptyList()
|
||||||
|
var options = RequestOptions().transform(RoundedCorners(Common.dp2Px(26)))
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
|
|
||||||
|
val viewbing = ItemWallpaperBinding.inflate(LayoutInflater.from(parent.context), null, false)
|
||||||
|
|
||||||
|
return VH(viewbing)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateList(list: List<Wallpaper>){
|
||||||
|
mList = list
|
||||||
|
notifyDataSetChanged()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun getItemCount(): Int = mList.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: VH, position: Int) {
|
||||||
|
holder.viewbing.run {
|
||||||
|
mList[position].let { wallpaper->
|
||||||
|
Glide.with(context).load(wallpaper.preview)
|
||||||
|
.into(imageWallpaper)
|
||||||
|
|
||||||
|
root.setOnClickListener {
|
||||||
|
context.startActivity( Intent(context, SetWallpaperActivity::class.java).apply {
|
||||||
|
putExtra(Common.KEY_WALLPAPER,wallpaper)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class VH(var viewbing: ItemWallpaperBinding) : RecyclerView.ViewHolder(viewbing.root)
|
||||||
|
|
||||||
|
}
|
||||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/btnback.xml
Normal 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="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||||
|
android:fillColor="@color/black"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/category.xml
Normal 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="M360.8,62L180.2,62A118.3,118.3 0,0 0,62 180.2v180.6a118.3,118.3 0,0 0,118.2 118.2h298.7v-298.7A118.3,118.3 0,0 0,360.8 62zM424.4,424.4h-244.3a63.7,63.7 0,0 1,-63.6 -63.6L116.5,180.2a63.7,63.7 0,0 1,63.6 -63.6h180.6a63.7,63.7 0,0 1,63.6 63.6zM62,663.2v180.6a118.3,118.3 0,0 0,118.2 118.2h180.6a118.3,118.3 0,0 0,118.2 -118.2L478.9,545h-298.7A118.3,118.3 0,0 0,62 663.2zM424.4,843.8a63.7,63.7 0,0 1,-63.6 63.6L180.2,907.5a63.7,63.7 0,0 1,-63.6 -63.6L116.6,663.2a63.7,63.7 0,0 1,63.6 -63.6h244.3zM843.8,62L663.2,62a118.3,118.3 0,0 0,-118.2 118.2v298.7h298.8a118.3,118.3 0,0 0,118.2 -118.2L962,180.2A118.3,118.3 0,0 0,843.8 62zM907.5,360.8a63.7,63.7 0,0 1,-63.6 63.6h-244.3v-244.3a63.7,63.7 0,0 1,63.6 -63.6h180.6a63.7,63.7 0,0 1,63.6 63.6zM843.8,545L545,545v298.8A118.3,118.3 0,0 0,663.2 962h180.6a118.3,118.3 0,0 0,118.2 -118.2L962,663.2a118.3,118.3 0,0 0,-118.2 -118.2zM907.4,843.8a63.7,63.7 0,0 1,-63.6 63.6L663.2,907.4a63.7,63.7 0,0 1,-63.6 -63.6v-244.3h244.3a63.7,63.7 0,0 1,63.6 63.6z"
|
||||||
|
android:fillColor="#4D4D4D"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/cateogory_covert.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<solid android:color="@color/covert_color"/>
|
||||||
|
<corners android:radius="16dp"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/close.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="34dp"
|
||||||
|
android:height="34dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M512,160a352,352 0,1 1,0 704,352 352,0 0,1 0,-704zM512,224a288,288 0,1 0,0 576,288 288,0 0,0 0,-576zM466.8,421.5l45.2,45.3 45.3,-45.3a32,32 0,1 1,45.2 45.2L557.2,512l45.3,45.2a32,32 0,1 1,-45.2 45.2L512,557.3l-45.2,45.2a32,32 0,1 1,-45.2 -45.2l45.2,-45.2 -45.2,-45.3a32,32 0,1 1,45.2 -45.2z"
|
||||||
|
android:fillColor="@color/text_color_sub"/>
|
||||||
|
</vector>
|
||||||
7
app/src/main/res/drawable/dailog_background.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
<solid android:color="@color/text_color"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/ic_dashboard_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_home_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<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="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
|
||||||
|
</vector>
|
||||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<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>
|
||||||
12
app/src/main/res/drawable/recommend.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<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="M197.9,196.9v709h0.2L513,768.1l314.9,137.8h0.3v-709H197.9zM769,815.6L536.6,713.9c-7.5,-3.3 -15.6,-5 -23.7,-5s-16.2,1.7 -23.7,5L257,815.6V256h512v559.6z"
|
||||||
|
android:fillColor="#666666"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M418.7,539.4C398.8,613.1 403.8,650 433.8,650c18.1,0 45.1,-13.4 81.3,-40.1 36.1,25 63.2,37.5 81.2,37.5 31.1,0 35.5,-37 13.1,-111.1 92.6,-76.1 79.9,-114.7 -38.1,-116 -20.4,-57.2 -40.4,-85.8 -60,-85.8 -19.7,0 -39.1,29.2 -58,87.7 -117.8,5 -129.4,44.1 -34.6,117.2zM455.5,471.3c20.6,-0.8 38.4,-14.4 44.8,-34 4.4,-13.7 8.4,-24.2 11.9,-32.4 3.7,8 8.1,18.4 12.8,31.8 6.9,19.4 25.2,32.5 45.9,32.7 15.8,0.2 27.7,1 36.5,2.2 -6.5,6.8 -15.8,15.6 -29.2,26.5 -15.3,12.6 -21.6,33.3 -15.9,52.3 4.7,15.6 7.6,27.6 9.3,36.9 -7.5,-4.2 -16.9,-10 -28.5,-18.1 -8.4,-5.8 -18.2,-8.7 -28,-8.7 -10.3,0 -20.6,3.2 -29.3,9.6 -11.3,8.4 -20.5,14.5 -27.9,18.8 1.5,-9.3 4,-21.4 8.3,-37 5.1,-19.2 -1.7,-39.6 -17.5,-51.8 -13.7,-10.6 -23.3,-19.1 -29.9,-25.7 8.8,-1.1 20.8,-2.4 36.7,-3.1z"
|
||||||
|
android:fillColor="#666666"/>
|
||||||
|
</vector>
|
||||||
7
app/src/main/res/drawable/set_wallpaper_btn.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<solid android:color="@color/set_btn_color"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
41
app/src/main/res/layout/activity_laun.xml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".LaunActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/logo"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="200dp"
|
||||||
|
android:src="@mipmap/logo"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/purple_500"
|
||||||
|
android:textSize="19sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/logo" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="84dp"
|
||||||
|
android:indeterminateTint="@color/set_btn_color"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/logo" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
33
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?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"
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
|
android:id="@+id/nav_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:layout_marginEnd="0dp"
|
||||||
|
android:background="?android:attr/windowBackground"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/nav_host_fragment_activity_main"
|
||||||
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:defaultNavHost="true"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/nav_view"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:navGraph="@navigation/mobile_navigation" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
56
app/src/main/res/layout/activity_set_wallpaper.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".SetWallpaperActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/previewImg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_back"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/btnback"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_set_btn"
|
||||||
|
android:layout_width="146dp"
|
||||||
|
android:layout_height="54dp"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:background="@drawable/set_wallpaper_btn"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/set_wallpaper"
|
||||||
|
android:textColor="@color/text_color"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:indeterminateTint="@color/home_bg_color"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
37
app/src/main/res/layout/activity_wallpaper_list.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".WallpaperListActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_back"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/btnback"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:id="@+id/text_name"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/list_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_back" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
16
app/src/main/res/layout/fragment_dashboard.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.dashboard.DashboardFragment">
|
||||||
|
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
80
app/src/main/res/layout/fragment_dialog_wallpaper.xml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.DialogWallpaper">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="27dp"
|
||||||
|
android:layout_marginEnd="27dp"
|
||||||
|
android:background="@drawable/dailog_background"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="15dp"
|
||||||
|
android:paddingBottom="15dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="@string/set_wallpaper"
|
||||||
|
android:textColor="@color/text_color_sub"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imclose"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:padding="6dp"
|
||||||
|
android:src="@drawable/close" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:id="@+id/tvBoth"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:background="@drawable/set_wallpaper_btn"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_both_btn"
|
||||||
|
android:textColor="@color/text_color"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:id="@+id/tvhome"
|
||||||
|
android:background="@drawable/set_wallpaper_btn"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_home_btn"
|
||||||
|
android:textColor="@color/text_color"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="180dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:id="@+id/tvlock"
|
||||||
|
android:background="@drawable/set_wallpaper_btn"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/dialog_lock_btn"
|
||||||
|
android:textColor="@color/text_color"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
15
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.home.HomeFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
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" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
22
app/src/main/res/layout/fragment_notifications.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.notifications.NotificationsFragment">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_notifications"
|
||||||
|
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" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
34
app/src/main/res/layout/item_categoy.xml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
app:cardCornerRadius="15dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_covert"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="190dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/category_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignTop="@id/image_covert"
|
||||||
|
android:layout_alignBottom="@id/image_covert"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/covert_color"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="21sp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
15
app/src/main/res/layout/item_wallpaper.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:cardCornerRadius="8dp">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_wallpaper"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="190dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
19
app/src/main/res/menu/bottom_nav_menu.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<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" />-->
|
||||||
|
|
||||||
|
</menu>
|
||||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo.png
Normal file
|
After Width: | Height: | Size: 207 KiB |
25
app/src/main/res/navigation/mobile_navigation.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<navigation 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:id="@+id/mobile_navigation"
|
||||||
|
app:startDestination="@+id/navigation_home">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/navigation_home"
|
||||||
|
android:name="com.pink.cute.wallpapers.ui.home.HomeFragment"
|
||||||
|
android:label="@string/title_category"
|
||||||
|
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" />-->
|
||||||
|
</navigation>
|
||||||
16
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.PinkWallpapers" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
16
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FFF78FA7</color>
|
||||||
|
<color name="purple_700">#FFf8e7df</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="covert_color">#80000000</color>
|
||||||
|
<color name="home_bg_color">#f8e7df</color>
|
||||||
|
<color name="set_btn_color">#80F78FA7</color>
|
||||||
|
<color name="text_color">#FFFdfdfd</color>
|
||||||
|
<color name="nocolor">#00000000</color>
|
||||||
|
<color name="text_color_sub">#d39bdc</color>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<resources>
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
</resources>
|
||||||
14
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Pink Wallpapers</string>
|
||||||
|
<string name="title_category">Category</string>
|
||||||
|
<string name="title_recommend">Recommend</string>
|
||||||
|
<string name="title_favorite">Favorite</string>
|
||||||
|
<string name="set_wallpaper">Set Wallpaper</string>
|
||||||
|
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
<string name="dialog_home_btn">Home Screen</string>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</resources>
|
||||||
16
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.PinkWallpapers" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/white</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.pink.cute.wallpapers
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit wallpapers, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/testPinkWallpapers.jks
Normal file
8
build.gradle.kts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
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
|
||||||
|
id ("com.google.firebase.crashlytics") version "2.9.2" apply false
|
||||||
|
}
|
||||||
|
|
||||||
23
gradle.properties
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
|
kotlin.code.style=official
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Thu Jun 06 14:56:26 CST 2024
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
21
settings.gradle.kts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "PinkWallpapers"
|
||||||
|
include(":app")
|
||||||
|
|
||||||