创建仓库

This commit is contained in:
lihongwei 2025-03-13 14:46:18 +08:00
commit 4ba4b8b0f2
76 changed files with 14797 additions and 0 deletions

15
.gitignore vendored Normal file
View 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
View File

@ -0,0 +1 @@
/build

75
app/build.gradle.kts Normal file
View File

@ -0,0 +1,75 @@
import java.text.SimpleDateFormat
import java.util.Date
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
id("com.google.devtools.ksp")
id("kotlin-parcelize")
}
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.wallpaper.wallpapermagic"
compileSdk = 35
defaultConfig {
applicationId = "com.wallpaper.wallpapermagic"
minSdk = 23
targetSdk = 35
versionCode = 1
versionName = "1.0.0"
setProperty(
"archivesBaseName",
"Wallpaper Magic_V" + versionName + "(${versionCode})_$timestamp"
)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
implementation("com.github.bumptech.glide:glide:4.16.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
implementation("androidx.room:room-runtime:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
implementation ("com.squareup.okhttp3:okhttp:4.12.0")
implementation ("androidx.activity:activity-ktx:1.10.1")
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,24 @@
package com.wallpaper.wallpapermagic
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 test, 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 test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.wallpaper.wallpapermagic", appContext.packageName)
}
}

View File

@ -0,0 +1,39 @@
<?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.SET_WALLPAPER" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WallpaperMagic"
tools:targetApi="31">
<activity
android:name=".activity.MagicActivity"
android:exported="false" />
<activity
android:name=".activity.SubListActivity"
android:exported="false" />
<activity
android:name=".activity.MainActivity"
android:exported="false" />
<activity
android:name=".activity.SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
package com.wallpaper.wallpapermagic
import android.app.Application
import android.content.Context
import android.content.SharedPreferences
import androidx.core.content.edit
import com.wallpaper.wallpapermagic.room.AppDatabase
import com.wallpaper.wallpapermagic.utils.JsonUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class App : Application() {
companion object {
@Volatile
private lateinit var instance: App
const val DB_VERSION = 1
const val DB_NAME = "magic_database"
private const val PREF_NAME = "magic_preferences"
private const val INIT_DATABASE = "InitDatabase"
@JvmStatic
fun getContext(): Context {
return instance.applicationContext
}
}
override fun onCreate() {
super.onCreate()
instance = this
val preferences: SharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE)
val init = preferences.getBoolean(INIT_DATABASE, false)
if (!init) {
initDatabase()
preferences.edit() { putBoolean(INIT_DATABASE, true) }
}
}
private fun initDatabase() {
val magicDao = AppDatabase.getDatabase(this).magicDao()
val magicEntities = JsonUtils.parseJson("wallpaper.json")
CoroutineScope(Dispatchers.IO).launch {
magicDao.insertAll(magicEntities)
}
}
}

View File

@ -0,0 +1,206 @@
package com.wallpaper.wallpapermagic.activity
import android.annotation.SuppressLint
import android.app.WallpaperManager
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.widget.Toast
import androidx.activity.enableEdgeToEdge
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.wallpaper.wallpapermagic.R
import com.wallpaper.wallpapermagic.databinding.ActivityMagicBinding
import com.wallpaper.wallpapermagic.room.MagicEntity
import com.wallpaper.wallpapermagic.utils.RoomViewModel
import com.wallpaper.wallpapermagic.utils.WallpaperImageHelper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class MagicActivity : AppCompatActivity() {
private lateinit var uiBinding: ActivityMagicBinding
private lateinit var wallpaperPath: String
private lateinit var wallpaperData: MagicEntity
private lateinit var wallpaperName: String
private lateinit var imageBitmap: Bitmap
private lateinit var imageHelper: WallpaperImageHelper
private lateinit var wallMgr: WallpaperManager
private lateinit var roomViewModel: RoomViewModel
@RequiresApi(Build.VERSION_CODES.N)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
uiBinding = ActivityMagicBinding.inflate(layoutInflater)
setContentView(uiBinding.root)
setupEdgeInsets()
initializeData()
setupListeners()
}
private fun setupEdgeInsets() {
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { view, insets ->
val navInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars())
view.setPadding(0, 0, 0, navInsets.bottom)
insets
}
}
private fun initializeData() {
val incomingWallpaper: MagicEntity? = intent.getParcelableExtra("magicEntity")
if (incomingWallpaper != null) {
wallpaperData = incomingWallpaper
} else {
finish()
return
}
wallpaperPath = wallpaperData.source
wallpaperName = wallpaperData.name
roomViewModel = ViewModelProvider(this)[RoomViewModel::class.java]
imageHelper = WallpaperImageHelper(uiBinding.progressBar, uiBinding.view)
wallMgr = WallpaperManager.getInstance(this)
}
@RequiresApi(Build.VERSION_CODES.N)
private fun setupListeners() {
displayLoading()
uiBinding.back.setOnClickListener { finish() }
uiBinding.like.setOnClickListener {
wallpaperData.isFavorite = !wallpaperData.isFavorite
roomViewModel.update(wallpaperData)
updateLikeIcon()
}
uiBinding.set.setOnClickListener { openWallpaperOptions() }
uiBinding.downPicture.setOnClickListener {
displayLoading()
imageHelper.downloadImage(this, wallpaperPath)
}
fetchAndDisplayImage()
observeFavoriteStatus()
}
override fun onRequestPermissionsResult(
requestCode: Int, permissions: Array<String>, grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == WallpaperImageHelper.PERMISSION_REQUEST_CODE && grantResults.isNotEmpty() &&
grantResults[0] == PackageManager.PERMISSION_GRANTED
) {
imageHelper.downloadImage(this, wallpaperPath)
} else {
Toast.makeText(this, "Storage permission denied", Toast.LENGTH_SHORT).show()
}
}
@SuppressLint("InflateParams")
@RequiresApi(Build.VERSION_CODES.N)
private fun openWallpaperOptions() {
val dialog = BottomSheetDialog(this)
val dialogLayout = LayoutInflater.from(this).inflate(R.layout.set_dialog, null)
dialogLayout.findViewById<View>(R.id.both).setOnClickListener {
setWallpaperWithFlags(imageBitmap, WallpaperManager.FLAG_SYSTEM or WallpaperManager.FLAG_LOCK)
dialog.dismiss()
}
dialogLayout.findViewById<View>(R.id.lock).setOnClickListener {
setWallpaperWithFlags(imageBitmap, WallpaperManager.FLAG_LOCK)
dialog.dismiss()
}
dialogLayout.findViewById<View>(R.id.desktop).setOnClickListener {
setWallpaperWithFlags(imageBitmap, WallpaperManager.FLAG_SYSTEM)
dialog.dismiss()
}
dialog.setContentView(dialogLayout)
dialog.show()
}
@RequiresApi(Build.VERSION_CODES.N)
private fun setWallpaperWithFlags(bitmap: Bitmap, flags: Int) {
displayLoading()
lifecycleScope.launch {
try {
applyWallpaper(bitmap, flags)
withContext(Dispatchers.Main) {
hideLoading()
Toast.makeText(this@MagicActivity, "Wallpaper set successfully", Toast.LENGTH_SHORT).show()
}
} catch (e: Exception) {
withContext(Dispatchers.Main) {
hideLoading()
Toast.makeText(this@MagicActivity, "Wallpaper setting failed", Toast.LENGTH_SHORT).show()
}
}
}
}
@RequiresApi(Build.VERSION_CODES.N)
private suspend fun applyWallpaper(bitmap: Bitmap, flags: Int) {
withContext(Dispatchers.IO) {
wallMgr.setBitmap(bitmap, null, true, flags)
}
}
private fun fetchAndDisplayImage() {
Glide.with(this)
.asBitmap()
.load(wallpaperPath)
.error(R.mipmap.placeholder)
.override(1080, 1920)
.centerInside()
.into(object : CustomTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
uiBinding.imageView.setImageBitmap(resource)
imageBitmap = resource
hideLoading()
}
override fun onLoadCleared(placeholder: Drawable?) {
uiBinding.imageView.setImageDrawable(placeholder)
}
override fun onLoadFailed(errorDrawable: Drawable?) {
uiBinding.imageView.setImageDrawable(errorDrawable)
hideLoading()
}
})
}
private fun observeFavoriteStatus() {
lifecycleScope.launch {
roomViewModel.getFavoriteStatus(wallpaperPath, wallpaperName).collect { updateLikeIcon() }
}
}
private fun updateLikeIcon() {
uiBinding.like.setImageResource(if (wallpaperData.isFavorite) R.drawable.like else R.drawable.un_like)
}
private fun displayLoading() {
uiBinding.progressBar.visibility = View.VISIBLE
uiBinding.view.visibility = View.VISIBLE
}
private fun hideLoading() {
uiBinding.progressBar.visibility = View.GONE
uiBinding.view.visibility = View.GONE
}
}

View File

@ -0,0 +1,112 @@
package com.wallpaper.wallpapermagic.activity
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayout.OnTabSelectedListener
import com.google.android.material.tabs.TabLayoutMediator
import com.wallpaper.wallpapermagic.R
import com.wallpaper.wallpapermagic.adapter.MainViewPager2Adapter
import com.wallpaper.wallpapermagic.databinding.ActivityMainBinding
import com.wallpaper.wallpapermagic.databinding.TabCustomBinding
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.enableEdgeToEdge()
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.getRoot())
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v: View, insets: WindowInsetsCompat ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
initData()
initEvent()
}
private fun initData() {
val adapter = MainViewPager2Adapter(this)
binding.mainViewpager2.setAdapter(adapter)
}
private fun initEvent() {
TabLayoutMediator(
binding.mainTabLayout,
binding.mainViewpager2
) { tab: TabLayout.Tab, position: Int ->
val tabCustomBinding: TabCustomBinding =
TabCustomBinding.inflate(LayoutInflater.from(this))
tab.setCustomView(tabCustomBinding.getRoot())
setTab(tabCustomBinding, position)
}.attach()
binding.mainTabLayout.addOnTabSelectedListener(object : OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab) {
updateTab(tab, true)
}
override fun onTabUnselected(tab: TabLayout.Tab) {
updateTab(tab, false)
}
override fun onTabReselected(tab: TabLayout.Tab) {
}
fun updateTab(tab: TabLayout.Tab, isSelected: Boolean) {
if (tab.customView != null) {
val tabCustomBinding: TabCustomBinding =
TabCustomBinding.bind(tab.customView!!)
val iconResId = getIconResource(tab.position, isSelected)
tabCustomBinding.image.setImageResource(iconResId)
val textColor = if (isSelected) R.color.white else R.color.black
tabCustomBinding.text.setTextColor(
ContextCompat.getColor(
this@MainActivity,
textColor
)
)
}
}
})
}
@SuppressLint("SetTextI18n")
private fun setTab(tabCustomBinding: TabCustomBinding, position: Int) {
var iconResId = getIconResource(position, false)
var textColorResId = R.color.black
when (position) {
0 -> {
tabCustomBinding.text.text = "Home"
iconResId = R.drawable.home
textColorResId = R.color.white
}
1 -> tabCustomBinding.text.text = "Collection"
}
tabCustomBinding.image.setImageResource(iconResId)
tabCustomBinding.text.setTextColor(ContextCompat.getColor(this, textColorResId))
}
private fun getIconResource(position: Int, isSelected: Boolean): Int {
if (position == 1) {
return if (isSelected) R.drawable.collection else R.drawable.un_collection
}
return if (isSelected) R.drawable.home else R.drawable.un_home
}
}

View File

@ -0,0 +1,76 @@
package com.wallpaper.wallpapermagic.activity
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.os.CountDownTimer
import android.util.Log
import android.view.View
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.wallpaper.wallpapermagic.App
import com.wallpaper.wallpapermagic.R
import com.wallpaper.wallpapermagic.databinding.ActivitySplashBinding
@SuppressLint("CustomSplashScreen")
class SplashActivity : AppCompatActivity() {
private lateinit var binding: ActivitySplashBinding
private lateinit var countDownTimer: CountDownTimer
companion object {
private const val TOTAL_TIME: Long = 3000
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.enableEdgeToEdge()
binding = ActivitySplashBinding.inflate(layoutInflater)
setContentView(binding.getRoot())
ViewCompat.setOnApplyWindowInsetsListener(
findViewById(R.id.main)
) { v: View, insets: WindowInsetsCompat ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
Glide.with(this)
.load(R.mipmap.placeholder)
.transform(RoundedCorners(16))
.into(binding.image)
countDownTimer = object : CountDownTimer(TOTAL_TIME, 100) {
override fun onTick(millisUntilFinished: Long) {
val percentage = (100 - millisUntilFinished.toFloat() / TOTAL_TIME * 100).toInt()
binding.progressBar.progress = percentage
}
override fun onFinish() {
startMain()
}
}
countDownTimer.start()
}
private fun startMain() {
binding.progressBar.progress = 100
val intent = Intent(
this@SplashActivity,
MainActivity::class.java
)
startActivity(intent)
finish()
}
override fun onDestroy() {
super.onDestroy()
countDownTimer.cancel()
}
}

View File

@ -0,0 +1,73 @@
package com.wallpaper.wallpapermagic.activity
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.wallpaper.wallpapermagic.R
import com.wallpaper.wallpapermagic.adapter.MagicAdapter
import com.wallpaper.wallpapermagic.databinding.ActivitySubListBinding
import com.wallpaper.wallpapermagic.utils.ItemDecoration
import com.wallpaper.wallpapermagic.utils.RoomViewModel
import kotlinx.coroutines.launch
class SubListActivity : AppCompatActivity() {
private lateinit var binding: ActivitySubListBinding
private lateinit var adapter: MagicAdapter
private lateinit var roomViewModel: RoomViewModel
private lateinit var name: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySubListBinding.inflate(layoutInflater)
setContentView(binding.root)
enableEdgeToEdge()
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
initData()
initEvent()
}
private fun initData() {
name = intent.getStringExtra("name").toString()
roomViewModel = ViewModelProvider(this)[RoomViewModel::class.java]
binding.recyclerView.setLayoutManager(GridLayoutManager(this, 2))
adapter = MagicAdapter(
roomViewModel,
this,
ArrayList(),
this,
1
)
binding.recyclerView.setAdapter(adapter)
val itemDecoration = ItemDecoration(20, 15, 20)
binding.recyclerView.addItemDecoration(itemDecoration)
}
private fun initEvent() {
binding.back.setOnClickListener {
finish()
}
loadList()
}
private fun loadList() {
lifecycleScope.launch {
roomViewModel.getMagicEntitiesByName(name).collect { magicEntity ->
adapter.updateData(magicEntity)
}
}
}
}

View File

@ -0,0 +1,111 @@
package com.wallpaper.wallpapermagic.adapter
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.wallpaper.wallpapermagic.R
import com.wallpaper.wallpapermagic.activity.MagicActivity
import com.wallpaper.wallpapermagic.activity.SubListActivity
import com.wallpaper.wallpapermagic.room.MagicEntity
import com.wallpaper.wallpapermagic.utils.RoomViewModel
class MagicAdapter(
private val roomViewModel: RoomViewModel,
private val context: Context,
private var magicList: List<MagicEntity>,
private val activity: Activity,
private val type: Int
) :
RecyclerView.Adapter<MagicAdapter.ViewHolder>() {
@SuppressLint("NotifyDataSetChanged")
fun updateData(newWallpaperEntries: List<MagicEntity>) {
this.magicList = newWallpaperEntries
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view: View =
LayoutInflater.from(context).inflate(R.layout.item_magic, parent, false)
return ViewHolder(view)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val magicEntity: MagicEntity = magicList[position]
holder.bind(magicEntity)
}
override fun getItemCount(): Int {
return magicList.size
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
private val imageView: ImageView = itemView.findViewById(R.id.item_image_view)
private val favorite: ImageView = itemView.findViewById(R.id.item_favorite)
private val title: TextView = itemView.findViewById(R.id.item_title)
fun bind(magicEntity: MagicEntity) {
val imagePath: String = magicEntity.previewThumb
loadImage(imagePath)
if (type == 0) {
title.text = magicEntity.name
favorite.visibility = View.GONE
} else {
title.visibility = View.GONE
setFavoriteButton(magicEntity)
}
setClickListeners(magicEntity)
}
private fun loadImage(imagePath: String) {
Glide.with(context)
.load(imagePath)
.transform(RoundedCorners(32))
.error(R.mipmap.placeholder)
.placeholder(R.mipmap.placeholder)
.into(imageView)
}
private fun setFavoriteButton(magicEntity: MagicEntity) {
favorite.setImageResource(if (magicEntity.isFavorite) R.drawable.like else R.drawable.un_like)
}
private fun setClickListeners(magicEntity: MagicEntity) {
imageView.setOnClickListener {
val intent: Intent
if (type == 0) {
intent =
Intent(activity, SubListActivity::class.java)
intent.putExtra("name", magicEntity.name)
} else {
intent = Intent(activity, MagicActivity::class.java)
intent.putExtra("magicEntity", magicEntity)
}
activity.startActivity(intent)
}
favorite.setOnClickListener { toggleFavorite(magicEntity) }
}
private fun toggleFavorite(magicEntity: MagicEntity) {
val newStatus: Boolean = !magicEntity.isFavorite
magicEntity.isFavorite = newStatus
updateImageInDatabase(magicEntity)
notifyItemChanged(adapterPosition)
}
private fun updateImageInDatabase(magicEntity: MagicEntity) {
roomViewModel.update(magicEntity)
}
}
}

View File

@ -0,0 +1,24 @@
package com.wallpaper.wallpapermagic.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.wallpaper.wallpapermagic.fragment.CategoryFragment
import com.wallpaper.wallpapermagic.fragment.FavoriteFragment
class MainViewPager2Adapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
private val fragmentList: MutableList<Fragment> = ArrayList()
init {
fragmentList.add(CategoryFragment())
fragmentList.add(FavoriteFragment())
}
override fun createFragment(position: Int): Fragment {
return fragmentList[position]
}
override fun getItemCount(): Int {
return fragmentList.size
}
}

View File

@ -0,0 +1,61 @@
package com.wallpaper.wallpapermagic.fragment
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.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.wallpaper.wallpapermagic.adapter.MagicAdapter
import com.wallpaper.wallpapermagic.databinding.FragmentCategoryBinding
import com.wallpaper.wallpapermagic.utils.ItemDecoration
import com.wallpaper.wallpapermagic.utils.RoomViewModel
import kotlinx.coroutines.launch
class CategoryFragment : Fragment() {
private lateinit var binding: FragmentCategoryBinding
private lateinit var adapter: MagicAdapter
private lateinit var roomViewModel: RoomViewModel
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = FragmentCategoryBinding.inflate(inflater, container, false)
initData()
initEvent()
return binding.getRoot()
}
private fun initData() {
roomViewModel = ViewModelProvider(this)[RoomViewModel::class.java]
binding.recyclerView.setLayoutManager(GridLayoutManager(context, 2))
adapter = MagicAdapter(
roomViewModel,
requireContext(),
ArrayList(),
requireActivity(),
0
)
binding.recyclerView.setAdapter(adapter)
val itemDecoration = ItemDecoration(20, 15, 20)
binding.recyclerView.addItemDecoration(itemDecoration)
}
private fun initEvent() {
loadCategory()
}
private fun loadCategory() {
lifecycleScope.launch {
roomViewModel.uniqueMagicEntities.collect { magicEntity ->
adapter.updateData(magicEntity)
}
}
}
}

View File

@ -0,0 +1,66 @@
package com.wallpaper.wallpapermagic.fragment
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.wallpaper.wallpapermagic.adapter.MagicAdapter
import com.wallpaper.wallpapermagic.databinding.FragmentFavoriteBinding
import com.wallpaper.wallpapermagic.utils.ItemDecoration
import com.wallpaper.wallpapermagic.utils.RoomViewModel
import kotlinx.coroutines.launch
class FavoriteFragment : Fragment() {
private lateinit var binding: FragmentFavoriteBinding
private lateinit var adapter: MagicAdapter
private lateinit var roomViewModel: RoomViewModel
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = FragmentFavoriteBinding.inflate(inflater, container, false)
initData()
initEvent()
return binding.getRoot()
}
private fun initData() {
roomViewModel = ViewModelProvider(this)[RoomViewModel::class.java]
binding.recyclerView.setLayoutManager(GridLayoutManager(context, 2))
adapter = MagicAdapter(
roomViewModel,
requireContext(),
ArrayList(),
requireActivity(),
1
)
binding.recyclerView.setAdapter(adapter)
val itemDecoration = ItemDecoration(20, 15, 20)
binding.recyclerView.addItemDecoration(itemDecoration)
}
private fun initEvent() {
loadFavorite()
}
private fun loadFavorite() {
lifecycleScope.launch {
roomViewModel.favoriteMagicEntities.collect { magicEntity ->
if (magicEntity.isEmpty()) {
binding.tip.visibility = View.VISIBLE
} else {
binding.tip.visibility = View.GONE
}
adapter.updateData(magicEntity)
}
}
}
}

View File

@ -0,0 +1,30 @@
package com.wallpaper.wallpapermagic.room
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.wallpaper.wallpapermagic.App
@Database(entities = [MagicEntity::class], version = App.DB_VERSION, exportSchema = false)
abstract class AppDatabase : RoomDatabase() {
abstract fun magicDao(): MagicDao
companion object {
@Volatile
private var INSTANCE: AppDatabase? = null
fun getDatabase(context: Context): AppDatabase {
return INSTANCE ?: synchronized(this) {
val instance = Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
App.DB_NAME
).build()
INSTANCE = instance
instance
}
}
}
}

View File

@ -0,0 +1,30 @@
package com.wallpaper.wallpapermagic.room
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import kotlinx.coroutines.flow.Flow
@Dao
interface MagicDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(magicEntities: List<MagicEntity>)
@Update
suspend fun update(magicEntity: MagicEntity)
@Query("SELECT * FROM MagicEntity WHERE isFavorite = 1")
fun getFavoriteMagicEntities(): Flow<List<MagicEntity>>
@Query("SELECT * FROM MagicEntity WHERE id IN (SELECT MAX(id) FROM MagicEntity GROUP BY name)")
fun getUniqueMagicEntities(): Flow<List<MagicEntity>>
@Query("SELECT * FROM MagicEntity WHERE name = :name ORDER BY id DESC")
fun getMagicEntitiesByName(name: String): Flow<List<MagicEntity>>
@Query("SELECT isFavorite FROM MagicEntity WHERE source = :imagePath AND name = :name ")
fun getFavoriteStatus(imagePath: String, name: String): Flow<Boolean>
}

View File

@ -0,0 +1,17 @@
package com.wallpaper.wallpapermagic.room
import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize
@Parcelize
@Entity
data class MagicEntity(
@PrimaryKey(autoGenerate = true) val id: Int = 0,
val name: String,
val original: String,
val previewThumb: String,
val source: String,
var isFavorite: Boolean
) : Parcelable

View File

@ -0,0 +1,6 @@
package com.wallpaper.wallpapermagic.utils
data class DownloadResult(
val isSuccessful: Boolean,
val message: String
)

View File

@ -0,0 +1,76 @@
package com.wallpaper.wallpapermagic.utils;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.wallpaper.wallpapermagic.App;
public class ItemDecoration extends RecyclerView.ItemDecoration {
private final int verticalSpacing;
private final int horizontalSpacing;
private final int extraSpacing;
public ItemDecoration(int verticalSpacingDp, int horizontalSpacingDp, int extraSpacingDp) {
this.verticalSpacing = Math.round(dpToPx(verticalSpacingDp));
this.horizontalSpacing = Math.round(dpToPx(horizontalSpacingDp));
this.extraSpacing = Math.round(dpToPx(extraSpacingDp));
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
int spanCount = 1;
int spanSize = 1;
int spanIndex = 0;
int position = parent.getChildAdapterPosition(view);
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
if (layoutManager instanceof StaggeredGridLayoutManager) {
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
spanCount = staggeredGridLayoutManager.getSpanCount();
spanSize = layoutParams.isFullSpan() ? spanCount : 1;
spanIndex = layoutParams.getSpanIndex();
} else if (layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
spanCount = gridLayoutManager.getSpanCount();
spanSize = gridLayoutManager.getSpanSizeLookup().getSpanSize(position);
spanIndex = layoutParams.getSpanIndex();
} else if (layoutManager instanceof LinearLayoutManager) {
outRect.left = horizontalSpacing;
outRect.right = horizontalSpacing;
outRect.bottom = verticalSpacing;
return;
}
if (spanSize == spanCount) {
outRect.left = horizontalSpacing + extraSpacing;
outRect.right = horizontalSpacing + extraSpacing;
} else {
int totalSpacing = (horizontalSpacing * (spanCount + 1) + extraSpacing * 2) / spanCount;
int leftSpacing = horizontalSpacing * (spanIndex + 1) - totalSpacing * spanIndex + extraSpacing;
int rightSpacing = totalSpacing - leftSpacing;
outRect.left = leftSpacing;
outRect.right = rightSpacing;
}
outRect.bottom = verticalSpacing;
if (position < spanCount) {
outRect.top = verticalSpacing;
}
}
public static float dpToPx(float dpValue) {
float density = App.getContext().getResources().getDisplayMetrics().density;
return dpValue * density + 0.5f;
}
}

View File

@ -0,0 +1,71 @@
package com.wallpaper.wallpapermagic.utils
import com.wallpaper.wallpapermagic.App
import com.wallpaper.wallpapermagic.room.MagicEntity
import org.json.JSONArray
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
object JsonUtils {
private fun loadJSONFromAsset(fileName: String): String {
val jsonString = StringBuilder()
try {
App.getContext().assets.open(fileName).use { inputStream ->
BufferedReader(InputStreamReader(inputStream)).use { reader ->
reader.forEachLine { line ->
jsonString.append(line)
}
}
}
} catch (e: IOException) {
e.printStackTrace()
}
return jsonString.toString()
}
fun parseJson(fileName: String): List<MagicEntity> {
val audioDataList = mutableListOf<MagicEntity>()
try {
val jsonString = loadJSONFromAsset(fileName)
if (jsonString.isEmpty()) {
throw IllegalArgumentException("JSON file is empty or invalid.")
}
val jsonArray = JSONArray(jsonString)
for (i in 0 until jsonArray.length()) {
val categoryObject = jsonArray.getJSONObject(i)
val name = categoryObject.getString("name")
val listArray = categoryObject.getJSONArray("data")
for (j in 0 until listArray.length()) {
val itemObject = listArray.getJSONObject(j)
val original = itemObject.getString("original")
val previewThumb = itemObject.getString("previewThumb")
val source = itemObject.getString("source")
audioDataList.add(
MagicEntity(
name = name,
original = original,
previewThumb = previewThumb,
source = source,
isFavorite = false
)
)
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return audioDataList
}
}

View File

@ -0,0 +1,34 @@
package com.wallpaper.wallpapermagic.utils
import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.viewModelScope
import com.wallpaper.wallpapermagic.room.AppDatabase
import com.wallpaper.wallpapermagic.room.MagicDao
import com.wallpaper.wallpapermagic.room.MagicEntity
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
class RoomViewModel(application: Application) : AndroidViewModel(application) {
private val magicDao: MagicDao = AppDatabase.getDatabase(application).magicDao()
val favoriteMagicEntities: Flow<List<MagicEntity>> = magicDao.getFavoriteMagicEntities()
val uniqueMagicEntities: Flow<List<MagicEntity>> = magicDao.getUniqueMagicEntities()
fun getMagicEntitiesByName(name: String): Flow<List<MagicEntity>> {
return magicDao.getMagicEntitiesByName(name)
}
fun getFavoriteStatus(imagePath: String, name: String): Flow<Boolean> {
return magicDao.getFavoriteStatus(imagePath, name)
}
fun update(magicEntity: MagicEntity) {
viewModelScope.launch {
magicDao.update(magicEntity)
}
}
}

View File

@ -0,0 +1,114 @@
package com.wallpaper.wallpapermagic.utils
import android.Manifest
import android.app.Activity
import android.content.ContentValues
import android.content.pm.PackageManager
import android.os.Build
import android.provider.MediaStore
import android.view.View
import android.widget.ProgressBar
import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.IOException
class WallpaperImageHelper(
private val loadingBar: ProgressBar,
private val overlayView: View
) {
companion object {
const val PERMISSION_REQUEST_CODE = 456
}
fun downloadImage(context: Activity, imageUrl: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
startImageDownload(context, imageUrl)
} else {
if (ContextCompat.checkSelfPermission(
context,
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
context,
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
PERMISSION_REQUEST_CODE
)
} else {
startImageDownload(context, imageUrl)
}
}
}
private fun startImageDownload(context: Activity, url: String) {
CoroutineScope(Dispatchers.Main).launch {
showLoading()
val result = withContext(Dispatchers.IO) { downloadImageToGallery(context, url) }
hideLoading()
Toast.makeText(context, result.message, Toast.LENGTH_SHORT).show()
}
}
private fun downloadImageToGallery(context: Activity, url: String): DownloadResult {
val fileName = "wallpaper_${System.currentTimeMillis()}.jpg"
val contentValues = ContentValues().apply {
put(MediaStore.Images.Media.DISPLAY_NAME, fileName)
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
put(MediaStore.Images.Media.IS_PENDING, 1)
}
}
val collectionUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
} else {
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
}
val imageUri = context.contentResolver.insert(collectionUri, contentValues)
?: return DownloadResult(false, "Failed to initialize storage")
return try {
val client = OkHttpClient()
val request = Request.Builder().url(url).build()
val response = client.newCall(request).execute()
if (!response.isSuccessful) throw IOException("Unexpected code ${response.code}")
response.body?.byteStream()?.use { inputStream ->
context.contentResolver.openOutputStream(imageUri)?.use { outputStream ->
inputStream.copyTo(outputStream)
} ?: throw IOException("Failed to open output stream")
} ?: throw IOException("Empty response body")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
contentValues.clear()
contentValues.put(MediaStore.Images.Media.IS_PENDING, 0)
context.contentResolver.update(imageUri, contentValues, null, null)
}
DownloadResult(true, "Image saved to gallery")
} catch (e: Exception) {
context.contentResolver.delete(imageUri, null, null)
DownloadResult(false, "Failed to save image: ${e.localizedMessage}")
} finally {
// response.body?.close()
}
}
private fun showLoading() {
loadingBar.visibility = View.VISIBLE
overlayView.visibility = View.VISIBLE
}
private fun hideLoading() {
loadingBar.visibility = View.GONE
overlayView.visibility = View.GONE
}
}

View 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>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/white"
android:pathData="M224,480h640a32,32 0,1 1,0 64H224a32,32 0,0 1,0 -64"/>
<path
android:fillColor="@color/white"
android:pathData="M237.2,512l265.4,265.3a32,32 0,0 1,-45.3 45.3l-288,-288a32,32 0,0 1,0 -45.3l288,-288a32,32 0,1 1,45.3 45.3z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M472.1,341.5l7.9,-0.2h320a138.7,138.7 0,0 1,138.5 130.8l0.2,7.9v320a138.7,138.7 0,0 1,-130.8 138.5l-7.9,0.2h-320a138.7,138.7 0,0 1,-138.5 -130.8L341.3,800v-320a138.7,138.7 0,0 1,130.8 -138.5zM800,405.3h-320a74.7,74.7 0,0 0,-74.4 68.5l-0.3,6.1v320a74.7,74.7 0,0 0,68.6 74.4l6.1,0.3h320a74.7,74.7 0,0 0,74.4 -68.6l0.3,-6.1v-320a74.7,74.7 0,0 0,-74.7 -74.7zM640,469.3a32,32 0,0 1,32 32v106.6h106.7a32,32 0,0 1,0 64h-106.7v106.8a32,32 0,0 1,-64 0v-106.8h-106.7a32,32 0,1 1,0 -64h106.7L608,501.3A32,32 0,0 1,640 469.3zM664.8,180.6l2.2,7.6 29.6,110.4h-66.3l-25.1,-93.9a74.7,74.7 0,0 0,-91.5 -52.8L204.7,234.8a74.7,74.7 0,0 0,-54.2 85.1l1.4,6.3 82.9,309.1A74.7,74.7 0,0 0,298.7 690.2v64.3a138.8,138.8 0,0 1,-123.5 -95.1l-2.2,-7.5 -82.8,-309.1a138.7,138.7 0,0 1,90.5 -167.6l7.6,-2.2 309.1,-82.8a138.7,138.7 0,0 1,167.6 90.5z"
android:fillColor="@color/white"/>
</vector>

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/gray"
android:pathData="M1023,522.6c0,100.2 -81.5,181.7 -181.7,181.7l-185.6,0c-11.3,0 -20.5,-9.2 -20.5,-20.5 0,-11.3 9.2,-20.5 20.5,-20.5l185.6,0c77.6,0 140.8,-63.1 140.8,-140.8 0,-77.4 -62.8,-140.4 -140.2,-140.8 -0.4,0 -0.8,0.1 -1.2,0.1 -5.9,0.1 -11.7,-2.3 -15.7,-6.7 -4,-4.4 -5.9,-10.3 -5.2,-16.3 1.3,-10.8 1.9,-19.8 1.9,-28.2 0,-60.8 -23.7,-117.9 -66.6,-160.8 -43,-43 -100.1,-66.6 -160.8,-66.6 -47.4,0 -92.7,14.4 -131.2,41.8 -37.6,26.7 -66,63.7 -81.9,106.9 -2.4,6.5 -8,11.4 -14.8,12.9 -6.8,1.5 -13.9,-0.6 -18.9,-5.5 -19.3,-19.3 -44.9,-30 -72.2,-30 -56.3,0 -102.1,45.8 -102.1,102.1 0,0.3 0,1 0.1,1.6 0.1,0.9 0.1,1.8 0.2,2.8 0.3,9.5 -5.9,17.9 -15,20.5 -32.4,8.9 -61.5,28.6 -82.2,55.2 -21.3,27.5 -32.6,60.5 -32.6,95.4 0,86.2 70.2,156.4 156.4,156.4l170,0c11.3,0 20.5,9.2 20.5,20.5 0,11.3 -9.2,20.5 -20.5,20.5l-170,0c-108.8,0 -197.4,-88.5 -197.4,-197.4 0,-44.1 14.2,-85.7 41.1,-120.5 22.8,-29.5 53.9,-52.1 88.7,-64.8 5.1,-74.3 67.1,-133.2 142.8,-133.2 28.4,0 55.5,8.2 78.7,23.5 19.7,-39.9 48.8,-74.2 85.5,-100.2 45.4,-32.3 99,-49.4 154.9,-49.4 71.7,0 139.1,27.9 189.8,78.6 50.7,50.7 78.6,118.1 78.6,189.8 0,3.7 -0.1,7.5 -0.3,11.4C952.6,352.6 1023,429.5 1023,522.6z"/>
<path
android:fillColor="@color/gray"
android:pathData="M629.3,820.7l-102,102c-4,4 -9.2,6 -14.5,6s-10.5,-2 -14.5,-6l-102,-102c-8,-8 -8,-20.9 0,-28.9s20.9,-8 28.9,0l67.1,67.1 0,-358.7c0,-11.3 9.2,-20.5 20.5,-20.5 11.3,0 20.5,9.2 20.5,20.5l0,358.7 67.1,-67.1c8,-8 20.9,-8 28.9,0S637.3,812.7 629.3,820.7z"/>
</vector>

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40.2dp"
android:height="32dp"
android:viewportWidth="1286"
android:viewportHeight="1024">
<path
android:fillColor="@color/white"
android:pathData="M1097.6,603.4l-9.9,-8.5c-1.4,-2.8 -4.2,-4.2 -7.1,-5.7L645.8,222.4 211,589.2c-2.8,1.4 -5.7,2.8 -7.1,5.7l-9.9,8.5h5.7c0,2.8 -1.4,4.2 -1.4,7.1v388.1c0,14.2 11.3,24.1 24.1,24.1H538.2V716.7h215.3v307.3h315.8c14.2,0 24.1,-11.3 24.1,-24.1V610.4c0,-2.8 0,-4.2 -1.4,-7.1h5.7z"/>
<path
android:fillColor="@color/white"
android:pathData="M1284.6,535.4L645.8,0 0,541l80.7,80.7 565.1,-473.1 558,467.4z"/>
<path
android:fillColor="@color/white"
android:pathData="M1097.6,412.1l-195.5,-59.5V9.9h195.5z"/>
</vector>

View 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>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M512,926h-6c-6,0 -12,-3 -15,-9L143,569C92,518 62,449 62,374s30,-144 81,-195c51,-51 120,-81 195,-81 63,0 126,21 174,63 108,-90 270,-81 369,18 108,108 108,282 0,390L533,917c-6,6 -12,9 -21,9z"
android:fillColor="#ff0000"/>
</vector>

View File

@ -0,0 +1,30 @@
<!-- res/drawable/seekbar_progress_drawable.xml -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dp" />
<solid android:color="#D3D3D3" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dp" />
<solid android:color="#FFD700" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dp" />
<gradient
android:startColor="#4891FF"
android:endColor="#6CE89E"
android:angle="0" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#A3BFFA"
android:startColor="#E8ECEF"
android:type="linear"
android:useLevel="false" />
<corners android:radius="16sp" />
</shape>

View File

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="12dp" />
<solid android:color="#80FF9999" />
</shape>

View File

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/gray"
android:pathData="M729.3,93.4L234.3,585.1 432.9,783.8l488.4,-488.3z"/>
<path
android:fillColor="@color/gray"
android:pathData="M195.5,617.5l-29.1,32.2v197.8h195.8l27.6,-26.1z"/>
<path
android:fillColor="@color/gray"
android:pathData="M757.7,62a89.2,89.2 0,0 1,126 2.1l72,74.4a89.2,89.2 0,0 1,-2.1 126L757.7,62z"/>
<path
android:fillColor="@color/gray"
android:pathData="M936.3,1024H80.2A73.9,73.9 0,0 1,6.3 950.2V94A73.9,73.9 0,0 1,80.2 20.2h565.3l-61.3,73.8H80.2v856.2h856.2V444.9l73.8,-79.3v584.5a73.9,73.9 0,0 1,-73.8 73.9z"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="@color/gray" />
<corners android:radius="6dp" />
</shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M472.1,341.5l7.9,-0.2h320a138.7,138.7 0,0 1,138.5 130.8l0.2,7.9v320a138.7,138.7 0,0 1,-130.8 138.5l-7.9,0.2h-320a138.7,138.7 0,0 1,-138.5 -130.8L341.3,800v-320a138.7,138.7 0,0 1,130.8 -138.5zM800,405.3h-320a74.7,74.7 0,0 0,-74.4 68.5l-0.3,6.1v320a74.7,74.7 0,0 0,68.6 74.4l6.1,0.3h320a74.7,74.7 0,0 0,74.4 -68.6l0.3,-6.1v-320a74.7,74.7 0,0 0,-74.7 -74.7zM640,469.3a32,32 0,0 1,32 32v106.6h106.7a32,32 0,0 1,0 64h-106.7v106.8a32,32 0,0 1,-64 0v-106.8h-106.7a32,32 0,1 1,0 -64h106.7L608,501.3A32,32 0,0 1,640 469.3zM664.8,180.6l2.2,7.6 29.6,110.4h-66.3l-25.1,-93.9a74.7,74.7 0,0 0,-91.5 -52.8L204.7,234.8a74.7,74.7 0,0 0,-54.2 85.1l1.4,6.3 82.9,309.1A74.7,74.7 0,0 0,298.7 690.2v64.3a138.8,138.8 0,0 1,-123.5 -95.1l-2.2,-7.5 -82.8,-309.1a138.7,138.7 0,0 1,90.5 -167.6l7.6,-2.2 309.1,-82.8a138.7,138.7 0,0 1,167.6 90.5z"
android:fillColor="@color/black"/>
</vector>

View File

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40.2dp"
android:height="32dp"
android:viewportWidth="1286"
android:viewportHeight="1024">
<path
android:fillColor="@color/black"
android:pathData="M1097.6,603.4l-9.9,-8.5c-1.4,-2.8 -4.2,-4.2 -7.1,-5.7L645.8,222.4 211,589.2c-2.8,1.4 -5.7,2.8 -7.1,5.7l-9.9,8.5h5.7c0,2.8 -1.4,4.2 -1.4,7.1v388.1c0,14.2 11.3,24.1 24.1,24.1H538.2V716.7h215.3v307.3h315.8c14.2,0 24.1,-11.3 24.1,-24.1V610.4c0,-2.8 0,-4.2 -1.4,-7.1h5.7z"/>
<path
android:fillColor="@color/black"
android:pathData="M1284.6,535.4L645.8,0 0,541l80.7,80.7 565.1,-473.1 558,467.4z"/>
<path
android:fillColor="@color/black"
android:pathData="M1097.6,412.1l-195.5,-59.5V9.9h195.5z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="@color/gray"
android:pathData="M526.5,159.6C572.6,113.5 631.9,85.3 704,85.3c155.2,0 277.3,126.9 277.3,305.4 0,107.1 -52.7,196.1 -150,292.2 -20.9,20.7 -85,79.3 -87.9,82.1 -9.1,8.6 -18.8,17.6 -29.3,26.8a1554.3,1554.3 0,0 1,-41.3 35.1c-29.9,24.5 -61.8,49.2 -93.6,72.9a2607.7,2607.7 0,0 1,-42.7 31.1,42.7 42.7,0 0,1 -49.1,0 2607.7,2607.7 0,0 1,-42.7 -31,2444 2444,0 0,1 -93.6,-72.9 1554.3,1554.3 0,0 1,-41.3 -35.1c-10.5,-9.2 -20.2,-18.2 -29.3,-26.8 -2.9,-2.8 -66.9,-61.4 -87.9,-82.1C95.4,586.9 42.7,497.9 42.7,390.7 42.7,212.2 164.8,85.3 320,85.3c72.1,0 131.4,28.1 177.5,74.2 5.2,5.2 10,10.4 14.5,15.5 4.5,-5.1 9.3,-10.3 14.5,-15.5zM528.4,831.4A2360.7,2360.7 0,0 0,618.7 761a1469.8,1469.8 0,0 0,39 -33.2c9.7,-8.5 18.6,-16.7 26.9,-24.6 4,-3.8 67.2,-61.7 86.8,-81C854,540.7 896,469.7 896,390.7 896,258.6 811.3,170.7 704,170.7c-47.8,0 -86.1,18.2 -117.2,49.3a202.3,202.3 0,0 0,-27.9 35,129.7 129.7,0 0,0 -7.9,13.9c-15,33.7 -62.9,33.7 -78,0a129.7,129.7 0,0 0,-7.9 -13.9,202.3 202.3,0 0,0 -28,-35C406.1,188.9 367.8,170.7 320,170.7c-107.3,0 -192,88 -192,220.1 0,78.9 42,149.9 124.6,231.5 19.6,19.3 82.8,77.2 86.8,81 8.2,7.8 17.2,16 26.9,24.6 12.1,10.7 25.1,21.8 39,33.2a2360.7,2360.7 0,0 0,106.7 82.4c5.2,-3.8 10.7,-7.8 16.4,-12.1z"/>
</vector>

View File

@ -0,0 +1,108 @@
<?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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/soft_black"
tools:context=".activity.MagicActivity">
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:src="@drawable/back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/background_container"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="32dp"
android:background="@drawable/rounded_rectangle_white_transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView
android:id="@+id/like"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="16dp"
android:src="@drawable/un_like"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/down_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/like">
<ProgressBar
android:id="@+id/down_progress"
android:layout_width="24dp"
android:layout_height="24dp"
android:indeterminateTint="@color/black"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:src="@drawable/download"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/set"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="16dp"
android:src="@drawable/set_as"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/down_picture" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray"
android:focusable="true"
android:visibility="gone" />
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,42 @@
<?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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/soft_black"
tools:context=".activity.MainActivity">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24sp"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/main_viewpager2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="@+id/main_tab_layout"
app:layout_constraintTop_toBottomOf="@+id/title" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tab_layout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="25dp"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:tabIndicatorHeight="0dp"
app:tabRippleColor="@android:color/transparent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,49 @@
<?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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/soft_black"
tools:context=".activity.SplashActivity">
<ImageView
android:id="@+id/image"
android:layout_width="150dp"
android:layout_height="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.388" />
<TextView
android:id="@+id/splash_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:gravity="center"
android:text="@string/app_name"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/image" />
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="5dp"
android:layout_marginStart="53dp"
android:layout_marginEnd="53dp"
android:layout_marginBottom="80dp"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/progress_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/soft_black"
tools:context=".activity.SubListActivity">
<ImageView
android:id="@+id/back"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="25dp"
android:src="@drawable/back"
app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/title" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:gravity="center"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="25dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,17 @@
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.CategoryFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
</FrameLayout>

View File

@ -0,0 +1,28 @@
<?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=".fragment.FavoriteFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp" />
<TextView
android:id="@+id/tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Aww, you havent liked any wallpapers yet! Cmon, cutie, spread some love! 🥰💖"
android:textColor="@color/white"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,32 @@
<androidx.constraintlayout.widget.ConstraintLayout 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="256dp">
<ImageView
android:id="@+id/item_image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/item_favorite"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:src="@drawable/un_like"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textColor="@color/white"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,96 @@
<?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:layout_width="250dp"
android:layout_height="wrap_content"
android:background="@drawable/rounded_rectangle_white_transparent">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text=""
android:textColor="@color/black"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/both"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:background="@drawable/set_background"
android:padding="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Both"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/lock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginBottom="20dp"
android:background="@drawable/set_background"
android:padding="12dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/both">
<TextView
android:id="@+id/lock_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lock"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/desktop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginBottom="20dp"
android:background="@drawable/set_background"
android:padding="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/lock">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Desktop"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,32 @@
<?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/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:background="@drawable/rounded_rectangle_gradient">
<ImageView
android:id="@+id/image"
android:layout_width="16dp"
android:layout_height="16dp"
app:layout_constraintBottom_toTopOf="@+id/text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:gravity="center"
android:layout_marginTop="5dp"
android:text="@string/app_name"
android:textSize="14sp"
app:layout_constraintTop_toBottomOf="@+id/image" />
</androidx.constraintlayout.widget.ConstraintLayout>

View 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>

View 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

View File

@ -0,0 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.WallpaperMagic" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="soft_black">#0D1B2A</color>
<color name="gray">#9C979D</color>
</resources>

View File

@ -0,0 +1,5 @@
<resources>
<string name="app_name">Wallpaper Magic</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

View File

@ -0,0 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.WallpaperMagic" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.WallpaperMagic" parent="Base.Theme.WallpaperMagic" />
</resources>

View 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 than 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>

View 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>

View File

@ -0,0 +1,17 @@
package com.wallpaper.wallpapermagic
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, 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)
}
}

7
build.gradle.kts Normal file
View File

@ -0,0 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
id("com.google.devtools.ksp") version "2.0.21-1.0.27" apply false
}

23
gradle.properties Normal file
View 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. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-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

26
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,26 @@
[versions]
agp = "8.9.0"
kotlin = "2.0.21"
coreKtx = "1.15.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.10.1"
constraintlayout = "2.2.1"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Tue Mar 11 16:23:37 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View 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
View 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

24
settings.gradle.kts Normal file
View File

@ -0,0 +1,24 @@
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Wallpaper Magic"
include(":app")