创建仓库
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
|
||||||
69
app/build.gradle.kts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
}
|
||||||
|
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
|
android {
|
||||||
|
namespace = "com.live.dynamicwallpaper"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.live.dynamicwallpaper"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 34
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0.0"
|
||||||
|
setProperty(
|
||||||
|
"archivesBaseName",
|
||||||
|
"Dynamic Wallpaper_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.appcompat)
|
||||||
|
implementation(libs.material)
|
||||||
|
implementation(libs.activity)
|
||||||
|
implementation(libs.constraintlayout)
|
||||||
|
implementation(libs.core.ktx)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.ext.junit)
|
||||||
|
androidTestImplementation(libs.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")
|
||||||
|
annotationProcessor("androidx.room:room-compiler:2.6.1")
|
||||||
|
|
||||||
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||||
|
|
||||||
|
implementation("com.google.android.exoplayer:exoplayer:2.19.1")
|
||||||
|
|
||||||
|
}
|
||||||
21
app/proguard-rules.pro
vendored
Normal 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
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.live.dynamicwallpaper;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
public void useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||||
|
assertEquals("com.live.dynamicwallpaper", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
54
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?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" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.BIND_WALLPAPER"
|
||||||
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".MyApplication"
|
||||||
|
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.DynamicWallpaper"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.MainActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.DynamicActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.SplashActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".service.LiveWallpaperService"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="My Live Wallpaper"
|
||||||
|
android:permission="android.permission.BIND_WALLPAPER">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.wallpaper.WallpaperService" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.service.wallpaper"
|
||||||
|
android:resource="@xml/live_wallpaper" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
4866
app/src/main/assets/Explore.json
Normal file
1047
app/src/main/assets/Shift.json
Normal file
4832
app/src/main/assets/trending.json
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
package com.live.dynamicwallpaper;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.util.InitDatabase;
|
||||||
|
|
||||||
|
public class MyApplication extends Application {
|
||||||
|
public static MyApplication application;
|
||||||
|
public static final int DB_VERSION = 1;
|
||||||
|
public static final String DB_NAME = "dynamic_database";
|
||||||
|
private static final String PREF_NAME = "app_preferences";
|
||||||
|
private static final String KEY_INIT = "is_init";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
|
||||||
|
application = this;
|
||||||
|
|
||||||
|
lockScreenOrientation();
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||||
|
boolean isInit = sharedPreferences.getBoolean(KEY_INIT, false);
|
||||||
|
|
||||||
|
if (!isInit) {
|
||||||
|
initDatabase();
|
||||||
|
sharedPreferences.edit().putBoolean(KEY_INIT, true).apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lockScreenOrientation() {
|
||||||
|
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||||
|
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStarted(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResumed(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityPaused(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStopped(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Context getContext() {
|
||||||
|
return application.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initDatabase() {
|
||||||
|
InitDatabase.initDB();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.live.dynamicwallpaper.callback;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public interface OnDownloadCallback {
|
||||||
|
void onSuccess(File file);
|
||||||
|
|
||||||
|
void onFailure(Exception e);
|
||||||
|
|
||||||
|
void onProgress(int progress);
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.live.dynamicwallpaper.data.dao;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
import androidx.room.Update;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface DynamicDataDao {
|
||||||
|
@Insert
|
||||||
|
void insertAll(List<DynamicData> coolEntity);
|
||||||
|
|
||||||
|
@Update
|
||||||
|
void update(DynamicData coolEntity);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM DynamicData WHERE wallpaperType = 0 ORDER BY id DESC")
|
||||||
|
LiveData<List<DynamicData>> getTrendingList();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM DynamicData WHERE wallpaperType = 3 ORDER BY id DESC")
|
||||||
|
LiveData<List<DynamicData>> getExploreList();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM DynamicData WHERE wallpaperType = 2 ORDER BY id DESC")
|
||||||
|
LiveData<List<DynamicData>> getShiftList();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM DynamicData WHERE isFavorite = 1")
|
||||||
|
LiveData<List<DynamicData>> getFavoriteList();
|
||||||
|
|
||||||
|
@Query("SELECT * FROM DynamicData WHERE wallpaperType = :type AND flowId = :flowId")
|
||||||
|
LiveData<DynamicData> getFavoriteStatus(int type, int flowId);
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.live.dynamicwallpaper.data.database;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.room.Database;
|
||||||
|
import androidx.room.Room;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.MyApplication;
|
||||||
|
import com.live.dynamicwallpaper.data.dao.DynamicDataDao;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
|
||||||
|
@Database(entities = {DynamicData.class}, version = MyApplication.DB_VERSION, exportSchema = false)
|
||||||
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
|
|
||||||
|
public abstract DynamicDataDao dynamicDataDao();
|
||||||
|
|
||||||
|
private static volatile AppDatabase INSTANCE;
|
||||||
|
|
||||||
|
public static AppDatabase getInstance(Context context) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
synchronized (AppDatabase.class) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||||
|
AppDatabase.class, MyApplication.DB_NAME)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
package com.live.dynamicwallpaper.data.entity;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class DynamicData implements Serializable {
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
private int id;
|
||||||
|
private String category;
|
||||||
|
private String description;
|
||||||
|
private int downloads;
|
||||||
|
private int flowId;
|
||||||
|
private String image;
|
||||||
|
private int pro;
|
||||||
|
private String resolution;
|
||||||
|
private String thumbnail;
|
||||||
|
private int wallpaperType;
|
||||||
|
private String wallpaperPath;
|
||||||
|
private boolean isFavorite;
|
||||||
|
|
||||||
|
public DynamicData(String category, String description, int downloads, int flowId, String image, int pro, String resolution, String thumbnail, int wallpaperType, String wallpaperPath, boolean isFavorite) {
|
||||||
|
this.category = category;
|
||||||
|
this.description = description;
|
||||||
|
this.downloads = downloads;
|
||||||
|
this.flowId = flowId;
|
||||||
|
this.image = image;
|
||||||
|
this.pro = pro;
|
||||||
|
this.resolution = resolution;
|
||||||
|
this.thumbnail = thumbnail;
|
||||||
|
this.wallpaperType = wallpaperType;
|
||||||
|
this.wallpaperPath = wallpaperPath;
|
||||||
|
this.isFavorite = isFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategory(String category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDownloads() {
|
||||||
|
return downloads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDownloads(int downloads) {
|
||||||
|
this.downloads = downloads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFlowId() {
|
||||||
|
return flowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlowId(int flowId) {
|
||||||
|
this.flowId = flowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPro() {
|
||||||
|
return pro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPro(int pro) {
|
||||||
|
this.pro = pro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResolution() {
|
||||||
|
return resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResolution(String resolution) {
|
||||||
|
this.resolution = resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getThumbnail() {
|
||||||
|
return thumbnail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThumbnail(String thumbnail) {
|
||||||
|
this.thumbnail = thumbnail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWallpaperType() {
|
||||||
|
return wallpaperType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWallpaperType(int wallpaperType) {
|
||||||
|
this.wallpaperType = wallpaperType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWallpaperPath() {
|
||||||
|
return wallpaperPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWallpaperPath(String wallpaperPath) {
|
||||||
|
this.wallpaperPath = wallpaperPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFavorite() {
|
||||||
|
return isFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFavorite(boolean favorite) {
|
||||||
|
isFavorite = favorite;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
package com.live.dynamicwallpaper.data.repository;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.data.dao.DynamicDataDao;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class DynamicRepository {
|
||||||
|
private final DynamicDataDao dynamicDataDao;
|
||||||
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
|
public DynamicRepository(DynamicDataDao dynamicDataDao) {
|
||||||
|
this.dynamicDataDao = dynamicDataDao;
|
||||||
|
this.executorService = Executors.newSingleThreadExecutor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertAll(List<DynamicData> flowEntities) {
|
||||||
|
executorService.execute(() -> dynamicDataDao.insertAll(flowEntities));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(DynamicData dynamicData) {
|
||||||
|
executorService.execute(() -> dynamicDataDao.update(dynamicData));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getTrendingList() {
|
||||||
|
return dynamicDataDao.getTrendingList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getExploreList() {
|
||||||
|
return dynamicDataDao.getExploreList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getShiftList() {
|
||||||
|
return dynamicDataDao.getShiftList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getFavoriteList() {
|
||||||
|
return dynamicDataDao.getFavoriteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<DynamicData> getFavoriteStatus(int type, int id) {
|
||||||
|
return dynamicDataDao.getFavoriteStatus(type,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.live.dynamicwallpaper.service;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.service.wallpaper.WallpaperService;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.C;
|
||||||
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
|
import com.google.android.exoplayer2.MediaItem;
|
||||||
|
import com.google.android.exoplayer2.Player;
|
||||||
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
|
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
|
||||||
|
import com.google.android.exoplayer2.upstream.DefaultDataSource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class LiveWallpaperService extends WallpaperService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Engine onCreateEngine() {
|
||||||
|
return new LoopingVideoEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class LoopingVideoEngine extends Engine {
|
||||||
|
private ExoPlayer playerInstance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(SurfaceHolder holder) {
|
||||||
|
super.onCreate(holder);
|
||||||
|
setupPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupPlayer() {
|
||||||
|
playerInstance = new ExoPlayer.Builder(LiveWallpaperService.this).build();
|
||||||
|
playerInstance.setRepeatMode(Player.REPEAT_MODE_ONE);
|
||||||
|
configureSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSurfaceCreated(SurfaceHolder holder) {
|
||||||
|
super.onSurfaceCreated(holder);
|
||||||
|
if (playerInstance != null && holder != null) {
|
||||||
|
playerInstance.setVideoSurface(holder.getSurface());
|
||||||
|
playerInstance.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVisibilityChanged(boolean isVisible) {
|
||||||
|
super.onVisibilityChanged(isVisible);
|
||||||
|
if (playerInstance == null) return;
|
||||||
|
|
||||||
|
if (isVisible) {
|
||||||
|
configureSource();
|
||||||
|
playerInstance.play();
|
||||||
|
} else {
|
||||||
|
playerInstance.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSurfaceDestroyed(SurfaceHolder holder) {
|
||||||
|
super.onSurfaceDestroyed(holder);
|
||||||
|
releasePlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
releasePlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureSource() {
|
||||||
|
Uri videoUri = retrieveVideoUri(LiveWallpaperService.this);
|
||||||
|
if (videoUri != null && playerInstance != null) {
|
||||||
|
MediaItem mediaItem = MediaItem.fromUri(videoUri);
|
||||||
|
MediaSource source = new ProgressiveMediaSource.Factory(
|
||||||
|
new DefaultDataSource.Factory(LiveWallpaperService.this))
|
||||||
|
.createMediaSource(mediaItem);
|
||||||
|
playerInstance.setMediaSource(source);
|
||||||
|
playerInstance.prepare();
|
||||||
|
playerInstance.setPlayWhenReady(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void releasePlayer() {
|
||||||
|
if (playerInstance != null) {
|
||||||
|
playerInstance.release();
|
||||||
|
playerInstance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Uri retrieveVideoUri(Context ctx) {
|
||||||
|
SharedPreferences preferences = ctx.getSharedPreferences("WallpaperPrefs", MODE_PRIVATE);
|
||||||
|
String videoPath = preferences.getString("video_path", "");
|
||||||
|
File videoFile = new File(videoPath);
|
||||||
|
return (videoFile.exists() && videoFile.isFile()) ? Uri.fromFile(videoFile) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,190 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.activity;
|
||||||
|
|
||||||
|
import android.app.WallpaperManager;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.R;
|
||||||
|
import com.live.dynamicwallpaper.callback.OnDownloadCallback;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
import com.live.dynamicwallpaper.databinding.ActivityDynamicBinding;
|
||||||
|
import com.live.dynamicwallpaper.service.LiveWallpaperService;
|
||||||
|
import com.live.dynamicwallpaper.ui.viewmodel.DynamicViewModel;
|
||||||
|
import com.live.dynamicwallpaper.util.MediaFetcher;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class DynamicActivity extends AppCompatActivity {
|
||||||
|
private ActivityDynamicBinding ui;
|
||||||
|
private DynamicData contentData;
|
||||||
|
private DynamicViewModel viewModel;
|
||||||
|
private MediaFetcher mediaFetcher;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
ui = ActivityDynamicBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(ui.getRoot());
|
||||||
|
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (view, insets) -> {
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
mediaFetcher = new MediaFetcher();
|
||||||
|
initializeContent();
|
||||||
|
bindListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeContent() {
|
||||||
|
contentData = (DynamicData) getIntent().getSerializableExtra("dynamicData");
|
||||||
|
if (contentData == null) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int resourceId = contentData.getFlowId();
|
||||||
|
String imagePath = contentData.getImage();
|
||||||
|
|
||||||
|
showLoading();
|
||||||
|
|
||||||
|
viewModel = new ViewModelProvider(this).get(DynamicViewModel.class);
|
||||||
|
String format = contentData.getWallpaperType() == 2 ? "ViewShiftLive" : "ViewLive";
|
||||||
|
|
||||||
|
if (contentData.getWallpaperPath().isEmpty()) {
|
||||||
|
mediaFetcher.fetchVideoFile(this, resourceId, imagePath, format, new OnDownloadCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(File localFile) {
|
||||||
|
if (ui == null) return;
|
||||||
|
contentData.setWallpaperPath(localFile.getAbsolutePath());
|
||||||
|
viewModel.update(contentData);
|
||||||
|
prepareVideoPlayback();
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception e) {
|
||||||
|
if (ui == null) return;
|
||||||
|
hideLoading();
|
||||||
|
Toast.makeText(DynamicActivity.this, "Download error", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.e("LivePreview", "Media fetch failed", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProgress(int percent) {
|
||||||
|
if (isActive() && ui != null && percent >= 0 && percent <= 100) {
|
||||||
|
ui.downloadProgressBar.setProgress(percent);
|
||||||
|
ui.progressText.setText(percent + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
prepareVideoPlayback();
|
||||||
|
hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
observeFavoriteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bindListeners() {
|
||||||
|
ui.back.setOnClickListener(v -> finish());
|
||||||
|
|
||||||
|
ui.like.setOnClickListener(v -> {
|
||||||
|
boolean liked = !contentData.isFavorite();
|
||||||
|
contentData.setFavorite(liked);
|
||||||
|
viewModel.update(contentData);
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.setWallpaperButton.setOnClickListener(v -> applyLiveWallpaper());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prepareVideoPlayback() {
|
||||||
|
if (ui != null && contentData.getWallpaperPath() != null) {
|
||||||
|
File video = new File(contentData.getWallpaperPath());
|
||||||
|
if (video.exists()) {
|
||||||
|
ui.videoView.setVideoPath(contentData.getWallpaperPath());
|
||||||
|
ui.videoView.start();
|
||||||
|
ui.videoView.setOnPreparedListener(media -> media.setLooping(true));
|
||||||
|
} else {
|
||||||
|
Log.w("LivePreview", "Missing video file: " + contentData.getWallpaperPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyLiveWallpaper() {
|
||||||
|
SharedPreferences preferences = getSharedPreferences("WallpaperPrefs", MODE_PRIVATE);
|
||||||
|
preferences.edit().putString("video_path", contentData.getWallpaperPath()).apply();
|
||||||
|
|
||||||
|
WallpaperManager manager = WallpaperManager.getInstance(this);
|
||||||
|
try {
|
||||||
|
manager.clear();
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
|
||||||
|
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
|
||||||
|
new ComponentName(this, LiveWallpaperService.class));
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void observeFavoriteState() {
|
||||||
|
viewModel.getFavoriteStatus(contentData.getWallpaperType(), contentData.getFlowId())
|
||||||
|
.observe(this, data -> updateLikeIcon());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLikeIcon() {
|
||||||
|
if (ui != null) {
|
||||||
|
ui.like.setImageResource(contentData.isFavorite() ? R.drawable.like : R.drawable.dis_like);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showLoading() {
|
||||||
|
if (ui != null) {
|
||||||
|
ui.downloadProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
ui.progressTip.setVisibility(View.VISIBLE);
|
||||||
|
ui.progressText.setVisibility(View.VISIBLE);
|
||||||
|
ui.loadingSpinner.setVisibility(View.VISIBLE);
|
||||||
|
ui.view.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideLoading() {
|
||||||
|
if (isActive() && ui != null) {
|
||||||
|
ui.downloadProgressBar.setVisibility(View.GONE);
|
||||||
|
ui.progressTip.setVisibility(View.GONE);
|
||||||
|
ui.progressText.setVisibility(View.GONE);
|
||||||
|
ui.loadingSpinner.setVisibility(View.GONE);
|
||||||
|
ui.view.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isActive() {
|
||||||
|
return !(isFinishing() || isDestroyed());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (contentData != null && !contentData.getWallpaperPath().isEmpty()) {
|
||||||
|
prepareVideoPlayback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
mediaFetcher.stopDownload();
|
||||||
|
ui = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
|
import com.live.dynamicwallpaper.R;
|
||||||
|
import com.live.dynamicwallpaper.databinding.ActivityMainBinding;
|
||||||
|
import com.live.dynamicwallpaper.databinding.MainTabCustomBinding;
|
||||||
|
import com.live.dynamicwallpaper.ui.adapter.MainAdapter;
|
||||||
|
import com.live.dynamicwallpaper.ui.fragment.MainFragment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
private ActivityMainBinding binding;
|
||||||
|
private final List<Fragment> fragmentList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
initData();
|
||||||
|
initEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
fragmentList.add(MainFragment.newInstance(0));
|
||||||
|
fragmentList.add(MainFragment.newInstance(1));
|
||||||
|
fragmentList.add(MainFragment.newInstance(2));
|
||||||
|
fragmentList.add(MainFragment.newInstance(3));
|
||||||
|
|
||||||
|
MainAdapter adapter = new MainAdapter(this, fragmentList);
|
||||||
|
binding.mainViewpager2.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initEvent() {
|
||||||
|
new TabLayoutMediator(binding.mainTabLayout, binding.mainViewpager2, (tab, position) -> {
|
||||||
|
MainTabCustomBinding mainTabCustomBinding = MainTabCustomBinding.inflate(LayoutInflater.from(this));
|
||||||
|
tab.setCustomView(mainTabCustomBinding.getRoot());
|
||||||
|
setTab(mainTabCustomBinding, position);
|
||||||
|
}).attach();
|
||||||
|
|
||||||
|
binding.mainTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
updateTab(tab, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
updateTab(tab, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTab(TabLayout.Tab tab, boolean isSelected) {
|
||||||
|
if (tab.getCustomView() != null) {
|
||||||
|
MainTabCustomBinding mainTabCustomBinding = MainTabCustomBinding.bind(tab.getCustomView());
|
||||||
|
|
||||||
|
int iconResId = getIconResource(tab.getPosition(), isSelected);
|
||||||
|
mainTabCustomBinding.image.setImageResource(iconResId);
|
||||||
|
|
||||||
|
int textColor = isSelected ? R.color.black : R.color.gray;
|
||||||
|
mainTabCustomBinding.text.setTextColor(ContextCompat.getColor(MainActivity.this, textColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTab(MainTabCustomBinding mainTabCustomBinding, int position) {
|
||||||
|
int iconResId = getIconResource(position, false);
|
||||||
|
int textColorResId = R.color.gray;
|
||||||
|
|
||||||
|
switch (position) {
|
||||||
|
case 1:
|
||||||
|
mainTabCustomBinding.text.setText("Discover");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
mainTabCustomBinding.text.setText("Transform");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
mainTabCustomBinding.text.setText("Favorite");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mainTabCustomBinding.text.setText("Popular");
|
||||||
|
iconResId = R.drawable.popular;
|
||||||
|
textColorResId = R.color.black;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mainTabCustomBinding.image.setImageResource(iconResId);
|
||||||
|
mainTabCustomBinding.text.setTextColor(ContextCompat.getColor(this, textColorResId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIconResource(int position, boolean isSelected) {
|
||||||
|
switch (position) {
|
||||||
|
case 1:
|
||||||
|
return isSelected ? R.drawable.discover : R.drawable.dis_discover;
|
||||||
|
case 2:
|
||||||
|
return isSelected ? R.drawable.transform : R.drawable.dis_transform;
|
||||||
|
case 3:
|
||||||
|
return isSelected ? R.drawable.favorite : R.drawable.dis_favorite;
|
||||||
|
default:
|
||||||
|
return isSelected ? R.drawable.popular : R.drawable.dis_popular;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
|
||||||
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.graphics.Insets;
|
||||||
|
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.live.dynamicwallpaper.R;
|
||||||
|
import com.live.dynamicwallpaper.databinding.ActivitySplashBinding;
|
||||||
|
|
||||||
|
public class SplashActivity extends AppCompatActivity {
|
||||||
|
private ActivitySplashBinding binding;
|
||||||
|
private static final long TOTAL_TIME = 1000;
|
||||||
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
EdgeToEdge.enable(this);
|
||||||
|
|
||||||
|
binding = ActivitySplashBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
|
return insets;
|
||||||
|
});
|
||||||
|
|
||||||
|
Glide.with(this)
|
||||||
|
.load(R.mipmap.ic_launcher)
|
||||||
|
.transform(new RoundedCorners(16))
|
||||||
|
.into(binding.splashImage);
|
||||||
|
|
||||||
|
countDownTimer = new CountDownTimer(TOTAL_TIME, 100) {
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
|
||||||
|
binding.progressBar.setProgress(percentage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
startMain();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
countDownTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startMain() {
|
||||||
|
binding.progressBar.setProgress(100);
|
||||||
|
|
||||||
|
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (countDownTimer != null) {
|
||||||
|
countDownTimer.cancel();
|
||||||
|
}
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,160 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.DiffUtil;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.live.dynamicwallpaper.R;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
import com.live.dynamicwallpaper.ui.activity.DynamicActivity;
|
||||||
|
import com.live.dynamicwallpaper.ui.viewmodel.DynamicViewModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DynamicAdapter extends RecyclerView.Adapter<DynamicAdapter.DynamicViewHolder> {
|
||||||
|
private final DynamicViewModel viewModel;
|
||||||
|
private final Context appContext;
|
||||||
|
private List<DynamicData> dataList;
|
||||||
|
private final Activity hostActivity;
|
||||||
|
private final ImageLoader imageLoader;
|
||||||
|
|
||||||
|
public DynamicAdapter(DynamicViewModel viewModel, Context context, List<DynamicData> data, Activity activity) {
|
||||||
|
this.viewModel = viewModel;
|
||||||
|
this.appContext = context;
|
||||||
|
this.dataList = data;
|
||||||
|
this.hostActivity = activity;
|
||||||
|
this.imageLoader = new GlideImageLoader(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateItems(List<DynamicData> newData) {
|
||||||
|
DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new DataDiffCallback(dataList, newData));
|
||||||
|
this.dataList = newData;
|
||||||
|
diffResult.dispatchUpdatesTo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public DynamicViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(appContext);
|
||||||
|
View view = inflater.inflate(R.layout.item_dynamic, parent, false);
|
||||||
|
return new DynamicViewHolder(view, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull DynamicViewHolder holder, int position) {
|
||||||
|
holder.bindData(dataList.get(position));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return dataList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface ImageLoader {
|
||||||
|
void loadInto(String url, ImageView target);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class GlideImageLoader implements ImageLoader {
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
GlideImageLoader(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadInto(String url, ImageView target) {
|
||||||
|
Glide.with(context)
|
||||||
|
.load(url)
|
||||||
|
.apply(new RequestOptions()
|
||||||
|
.transform(new CenterCrop(), new RoundedCorners(32))
|
||||||
|
.placeholder(R.mipmap.placeholder)
|
||||||
|
.error(R.mipmap.placeholder))
|
||||||
|
.into(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class DataDiffCallback extends DiffUtil.Callback {
|
||||||
|
private final List<DynamicData> oldData;
|
||||||
|
private final List<DynamicData> newData;
|
||||||
|
|
||||||
|
DataDiffCallback(List<DynamicData> oldData, List<DynamicData> newData) {
|
||||||
|
this.oldData = oldData;
|
||||||
|
this.newData = newData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOldListSize() {
|
||||||
|
return oldData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNewListSize() {
|
||||||
|
return newData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
|
||||||
|
return oldData.get(oldItemPosition).getId() == newData.get(newItemPosition).getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
|
||||||
|
return oldData.get(oldItemPosition).equals(newData.get(newItemPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DynamicViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private final ImageView thumbnailView;
|
||||||
|
private final ImageView bookmarkButton;
|
||||||
|
private final DynamicAdapter adapter;
|
||||||
|
|
||||||
|
public DynamicViewHolder(@NonNull View itemView, DynamicAdapter adapter) {
|
||||||
|
super(itemView);
|
||||||
|
this.adapter = adapter;
|
||||||
|
thumbnailView = itemView.findViewById(R.id.item_image_view);
|
||||||
|
bookmarkButton = itemView.findViewById(R.id.item_like);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindData(DynamicData data) {
|
||||||
|
String thumbnailUrl = "https://neutrolabgames.com/LiveLoop/CpanelPix/VideoThumb/" + data.getThumbnail();
|
||||||
|
Log.d("Thumbnail", thumbnailUrl);
|
||||||
|
adapter.imageLoader.loadInto(thumbnailUrl, thumbnailView);
|
||||||
|
configureInteractions(data);
|
||||||
|
refreshBookmarkIcon(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshBookmarkIcon(DynamicData data) {
|
||||||
|
bookmarkButton.setImageResource(data.isFavorite() ? R.drawable.like : R.drawable.dis_like);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void configureInteractions(DynamicData data) {
|
||||||
|
thumbnailView.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(adapter.hostActivity, DynamicActivity.class);
|
||||||
|
intent.putExtra("dynamicData", data);
|
||||||
|
adapter.hostActivity.startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
bookmarkButton.setOnClickListener(v -> handleBookmarkToggle(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleBookmarkToggle(DynamicData data) {
|
||||||
|
boolean newStatus = !data.isFavorite();
|
||||||
|
data.setFavorite(newStatus);
|
||||||
|
adapter.viewModel.update(data);
|
||||||
|
adapter.notifyItemChanged(getAdapterPosition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.adapter;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainAdapter extends FragmentStateAdapter {
|
||||||
|
private final List<Fragment> fragmentList = new ArrayList<>();
|
||||||
|
|
||||||
|
public MainAdapter(@NonNull FragmentActivity fragmentActivity, List<Fragment> fragmentList) {
|
||||||
|
super(fragmentActivity);
|
||||||
|
this.fragmentList.addAll(fragmentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
return fragmentList.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return fragmentList.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.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.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.databinding.FragmentMainBinding;
|
||||||
|
import com.live.dynamicwallpaper.ui.adapter.DynamicAdapter;
|
||||||
|
import com.live.dynamicwallpaper.ui.viewmodel.DynamicViewModel;
|
||||||
|
import com.live.dynamicwallpaper.util.ItemDecoration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MainFragment extends Fragment {
|
||||||
|
private static final String ARG_LIST_TYPE = "list_type";
|
||||||
|
|
||||||
|
private int listType;
|
||||||
|
|
||||||
|
private FragmentMainBinding binding;
|
||||||
|
private DynamicViewModel dynamicViewModel;
|
||||||
|
private DynamicAdapter adapter;
|
||||||
|
|
||||||
|
public MainFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MainFragment newInstance(int listType) {
|
||||||
|
MainFragment fragment = new MainFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putInt(ARG_LIST_TYPE, listType);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
listType = getArguments().getInt(ARG_LIST_TYPE, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
binding = FragmentMainBinding.inflate(inflater, container, false);
|
||||||
|
initData();
|
||||||
|
loadDataByType(listType);
|
||||||
|
return binding.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initData() {
|
||||||
|
dynamicViewModel = new ViewModelProvider(this).get(DynamicViewModel.class);
|
||||||
|
|
||||||
|
binding.recyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
||||||
|
|
||||||
|
adapter = new DynamicAdapter(dynamicViewModel, requireContext(), new ArrayList<>(), requireActivity());
|
||||||
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
//禁止recycler view动画
|
||||||
|
binding.recyclerView.setItemAnimator(null);
|
||||||
|
|
||||||
|
binding.recyclerView.addItemDecoration(new ItemDecoration(20, 15, 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadDataByType(int type) {
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
loadExploreList();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
loadShiftList();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
loadFavoriteList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
loadTrendingList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadExploreList() {
|
||||||
|
dynamicViewModel.getExploreList().observe(getViewLifecycleOwner(), flowEntities -> {
|
||||||
|
adapter.updateItems(flowEntities);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFavoriteList() {
|
||||||
|
dynamicViewModel.getFavoriteList().observe(getViewLifecycleOwner(), flowEntities -> {
|
||||||
|
if (flowEntities.isEmpty()) {
|
||||||
|
binding.text.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.text.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
adapter.updateItems(flowEntities);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadShiftList() {
|
||||||
|
dynamicViewModel.getShiftList().observe(getViewLifecycleOwner(), adapter::updateItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadTrendingList() {
|
||||||
|
dynamicViewModel.getTrendingList().observe(getViewLifecycleOwner(), adapter::updateItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
binding = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.live.dynamicwallpaper.ui.viewmodel;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.data.dao.DynamicDataDao;
|
||||||
|
import com.live.dynamicwallpaper.data.database.AppDatabase;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
import com.live.dynamicwallpaper.data.repository.DynamicRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DynamicViewModel extends AndroidViewModel {
|
||||||
|
private final DynamicRepository dynamicRepository;
|
||||||
|
|
||||||
|
public DynamicViewModel(@NonNull Application application) {
|
||||||
|
super(application);
|
||||||
|
DynamicDataDao dynamicDataDao = AppDatabase.getInstance(application).dynamicDataDao();
|
||||||
|
dynamicRepository = new DynamicRepository(dynamicDataDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(DynamicData dynamicData) {
|
||||||
|
this.dynamicRepository.update(dynamicData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getTrendingList() {
|
||||||
|
return dynamicRepository.getTrendingList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getExploreList() {
|
||||||
|
return dynamicRepository.getExploreList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getShiftList() {
|
||||||
|
return dynamicRepository.getShiftList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<List<DynamicData>> getFavoriteList() {
|
||||||
|
return dynamicRepository.getFavoriteList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<DynamicData> getFavoriteStatus(int type, int id) {
|
||||||
|
return dynamicRepository.getFavoriteStatus(type,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.live.dynamicwallpaper.util;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.MyApplication;
|
||||||
|
import com.live.dynamicwallpaper.data.dao.DynamicDataDao;
|
||||||
|
import com.live.dynamicwallpaper.data.database.AppDatabase;
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
import com.live.dynamicwallpaper.data.repository.DynamicRepository;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InitDatabase {
|
||||||
|
|
||||||
|
public static void initDB() {
|
||||||
|
DynamicDataDao dynamicDataDao = AppDatabase.getInstance(MyApplication.getContext()).dynamicDataDao();
|
||||||
|
DynamicRepository dynamicRepository = new DynamicRepository(dynamicDataDao);
|
||||||
|
|
||||||
|
String[] jsonFiles = {"trending.json", "Explore.json", "Shift.json"};
|
||||||
|
|
||||||
|
List<DynamicData> allFlowEntities = new ArrayList<>();
|
||||||
|
for (String jsonFile : jsonFiles) {
|
||||||
|
List<DynamicData> flowEntities = JsonParse.parseJson(MyApplication.getContext(), jsonFile);
|
||||||
|
if (!flowEntities.isEmpty()) {
|
||||||
|
allFlowEntities.addAll(flowEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allFlowEntities.isEmpty()) {
|
||||||
|
dynamicRepository.insertAll(allFlowEntities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.live.dynamicwallpaper.util;
|
||||||
|
|
||||||
|
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.live.dynamicwallpaper.MyApplication;
|
||||||
|
|
||||||
|
public class ItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
private final int v;
|
||||||
|
private final int h;
|
||||||
|
private final int ex;
|
||||||
|
|
||||||
|
public ItemDecoration(int v, int h, int ex) {
|
||||||
|
this.v = Math.round(dpToPx(v));
|
||||||
|
this.h = Math.round(dpToPx(h));
|
||||||
|
this.ex = Math.round(dpToPx(ex));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state);
|
||||||
|
int spanCount = 1;
|
||||||
|
int spanSize = 1;
|
||||||
|
int spanIndex = 0;
|
||||||
|
|
||||||
|
int childAdapterPosition = 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();
|
||||||
|
if (layoutParams.isFullSpan()) {
|
||||||
|
spanSize = spanCount;
|
||||||
|
}
|
||||||
|
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(childAdapterPosition);
|
||||||
|
spanIndex = layoutParams.getSpanIndex();
|
||||||
|
} else if (layoutManager instanceof LinearLayoutManager) {
|
||||||
|
outRect.left = v;
|
||||||
|
outRect.right = v;
|
||||||
|
outRect.bottom = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (spanSize == spanCount) {
|
||||||
|
outRect.left = v + ex;
|
||||||
|
outRect.right = v + ex;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
int itemAllSpacing = (v * (spanCount + 1) + ex * 2) / spanCount;
|
||||||
|
int left = v * (spanIndex + 1) - itemAllSpacing * spanIndex + ex;
|
||||||
|
int right = itemAllSpacing - left;
|
||||||
|
outRect.left = left;
|
||||||
|
outRect.right = right;
|
||||||
|
|
||||||
|
}
|
||||||
|
outRect.bottom = h;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float dpToPx(float dpValue) {
|
||||||
|
float density = MyApplication.getContext().getResources().getDisplayMetrics().density;
|
||||||
|
return density * dpValue + 0.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
package com.live.dynamicwallpaper.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.data.entity.DynamicData;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JsonParse {
|
||||||
|
private static String loadJSONFromAsset(Context context, String fileName) {
|
||||||
|
StringBuilder jsonString = new StringBuilder();
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||||
|
context.getAssets().open(fileName)));
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
jsonString.append(line);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return jsonString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<DynamicData> parseJson(Context context, String fileName) {
|
||||||
|
List<DynamicData> dynamicDataList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
String jsonString = loadJSONFromAsset(context, fileName);
|
||||||
|
if (jsonString.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("JSON file is empty or invalid.");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray jsonArray = new JSONArray(jsonString);
|
||||||
|
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
JSONObject categoryObject = jsonArray.getJSONObject(i);
|
||||||
|
|
||||||
|
String category = categoryObject.getString("category");
|
||||||
|
String description = categoryObject.getString("description");
|
||||||
|
int downloads = categoryObject.getInt("downloads");
|
||||||
|
int id = categoryObject.getInt("id");
|
||||||
|
String image = categoryObject.getString("image");
|
||||||
|
int pro = categoryObject.getInt("pro");
|
||||||
|
String resolution = categoryObject.getString("resolution");
|
||||||
|
String thumbnail = categoryObject.getString("thumbnail");
|
||||||
|
int wallpapertype = categoryObject.getInt("wallpapertype");
|
||||||
|
|
||||||
|
dynamicDataList.add(new DynamicData(category, description, downloads, id, image, pro, resolution, thumbnail, wallpapertype,"",false));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dynamicDataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
package com.live.dynamicwallpaper.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.live.dynamicwallpaper.callback.OnDownloadCallback;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import okhttp3.Call;
|
||||||
|
import okhttp3.Callback;
|
||||||
|
import okhttp3.FormBody;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class MediaFetcher {
|
||||||
|
|
||||||
|
private static final String ENDPOINT = "https://neutrolabgames.com/LiveLoop/AppData/jmywall.php";
|
||||||
|
|
||||||
|
private static final OkHttpClient httpClient = new OkHttpClient.Builder()
|
||||||
|
.connectTimeout(10, TimeUnit.SECONDS)
|
||||||
|
.readTimeout(10, TimeUnit.SECONDS)
|
||||||
|
.writeTimeout(10, TimeUnit.SECONDS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
private static final Handler uiHandler = new Handler(Looper.getMainLooper());
|
||||||
|
private Call activeCall;
|
||||||
|
|
||||||
|
public MediaFetcher() {
|
||||||
|
activeCall = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fetchVideoFile(Context context, int id, String assetName, String mode, OnDownloadCallback callback) {
|
||||||
|
RequestBody formData = new FormBody.Builder()
|
||||||
|
.add("pi", String.valueOf(id))
|
||||||
|
.add("medium", "5eV6snEwfY7Yv6Ub")
|
||||||
|
.add("alpha", assetName != null ? assetName : "")
|
||||||
|
.add("version", "DL8")
|
||||||
|
.add("quality", mode)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Request httpRequest = new Request.Builder()
|
||||||
|
.url(ENDPOINT)
|
||||||
|
.post(formData)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
WeakReference<Context> contextRef = new WeakReference<>(context);
|
||||||
|
activeCall = httpClient.newCall(httpRequest);
|
||||||
|
|
||||||
|
activeCall.enqueue(new Callback() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call call, @NonNull IOException exception) {
|
||||||
|
runOnUi(() -> {
|
||||||
|
if (callback != null) callback.onFailure(exception);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
|
||||||
|
if (!response.isSuccessful() || response.body() == null) {
|
||||||
|
runOnUi(() -> {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onFailure(new IOException("Failed: " + response.code()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long contentLength = parseContentLength(response);
|
||||||
|
Context ctx = contextRef.get();
|
||||||
|
if (ctx == null) return;
|
||||||
|
|
||||||
|
File storageDir = ctx.getExternalFilesDir(Environment.DIRECTORY_MOVIES);
|
||||||
|
if (storageDir == null) {
|
||||||
|
runOnUi(() -> callback.onFailure(new IOException("Storage unavailable")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String uniqueName = "video_" + System.currentTimeMillis() + "_" + id + ".mp4";
|
||||||
|
File outputFile = new File(storageDir, uniqueName);
|
||||||
|
|
||||||
|
try (InputStream in = response.body().byteStream();
|
||||||
|
FileOutputStream out = new FileOutputStream(outputFile)) {
|
||||||
|
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
long writtenBytes = 0;
|
||||||
|
int read;
|
||||||
|
|
||||||
|
while ((read = in.read(buffer)) != -1) {
|
||||||
|
if (call.isCanceled()) {
|
||||||
|
outputFile.delete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.write(buffer, 0, read);
|
||||||
|
writtenBytes += read;
|
||||||
|
|
||||||
|
if (contentLength > 0) {
|
||||||
|
int percent = (int) (writtenBytes * 100 / contentLength);
|
||||||
|
int safeProgress = Math.max(0, Math.min(100, percent));
|
||||||
|
runOnUi(() -> callback.onProgress(safeProgress));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runOnUi(() -> {
|
||||||
|
if (callback != null) callback.onSuccess(outputFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (IOException ex) {
|
||||||
|
runOnUi(() -> {
|
||||||
|
if (callback != null) callback.onFailure(ex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private long parseContentLength(Response response) {
|
||||||
|
try {
|
||||||
|
String header = response.header("File-Length");
|
||||||
|
if (header != null) {
|
||||||
|
return Long.parseLong(header);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
}
|
||||||
|
return response.body() != null ? response.body().contentLength() : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runOnUi(Runnable task) {
|
||||||
|
if (task != null) {
|
||||||
|
uiHandler.post(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopDownload() {
|
||||||
|
if (activeCall != null && !activeCall.isCanceled()) {
|
||||||
|
activeCall.cancel();
|
||||||
|
}
|
||||||
|
activeCall = null;
|
||||||
|
uiHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
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>
|
||||||
10
app/src/main/res/drawable/activity_background_gradient.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:type="linear"
|
||||||
|
android:angle="135"
|
||||||
|
android:startColor="#FFDEE9"
|
||||||
|
android:centerColor="#B5FFFC"
|
||||||
|
android:endColor="#FFDEE9"
|
||||||
|
android:dither="true" />
|
||||||
|
</shape>
|
||||||
12
app/src/main/res/drawable/back.xml
Normal 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="#FF000000"
|
||||||
|
android:pathData="M516.3,978c-256.9,0 -466,-209 -466,-466s209,-466 466,-466c256.9,0 466,209 466,466 0,72.9 -16.4,142.7 -48.6,207.5 -13.3,26.7 -45.6,37.5 -72.3,24.2 -26.7,-13.3 -37.5,-45.6 -24.2,-72.3 24.8,-49.7 37.3,-103.4 37.3,-159.4 0,-197.5 -160.6,-358.1 -358.1,-358.1 -197.5,0 -358.1,160.7 -358.1,358.1s160.7,358.1 358.1,358.1c70.9,0 139.4,-20.7 198.1,-59.8 24.8,-16.5 58.3,-9.8 74.8,15 16.5,24.8 9.8,58.3 -15,74.8 -76.5,50.9 -165.7,77.8 -257.9,77.8z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M561.8,712.8a53.8,53.8 0,0 1,-38.1 -15.8l-154.4,-154.4a54,54 0,0 1,0 -76.3l162.9,-162.9c21.1,-21.1 55.2,-21.1 76.3,0 21.1,21.1 21.1,55.2 0,76.3l-124.7,124.7 116.3,116.3c21.1,21.1 21.1,55.2 0,76.3a53.8,53.8 0,0 1,-38.1 15.8z"/>
|
||||||
|
</vector>
|
||||||
3
app/src/main/res/drawable/bg_circle_translucent.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||||
|
<solid android:color="#66000000" />
|
||||||
|
</shape>
|
||||||
3
app/src/main/res/drawable/circle_translucent_bg.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
|
||||||
|
<solid android:color="#66000000" />
|
||||||
|
</shape>
|
||||||
12
app/src/main/res/drawable/dis_discover.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="33.5dp"
|
||||||
|
android:height="32dp"
|
||||||
|
android:viewportWidth="1073"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gray"
|
||||||
|
android:pathData="M447.2,302.1c-28.2,0 -53.8,-15.4 -69.1,-41 -10.2,-17.9 -12.8,-38.4 -7.7,-58.9 5.1,-20.5 17.9,-38.4 38.4,-48.6 12.8,-7.7 25.6,-10.2 38.4,-10.2 28.2,0 53.8,15.4 69.1,41 20.5,38.4 7.7,87 -30.7,107.5 -10.2,5.1 -25.6,10.2 -38.4,10.2zM447.2,207.4c-2.6,0 -5.1,0 -7.7,2.6 -2.6,2.6 -5.1,5.1 -7.7,10.2 0,5.1 0,7.7 2.6,12.8s7.7,7.7 12.8,7.7c2.6,0 5.1,0 7.7,-2.6 7.7,-5.1 10.2,-12.8 5.1,-20.5 -2.6,-7.7 -7.7,-10.2 -12.8,-10.2zM357.6,729.6c-46.1,0 -87,-23 -107.5,-64 -33.3,-58.9 -12.8,-135.7 48.6,-169 17.9,-10.2 38.4,-15.4 61.4,-15.4 46.1,0 87,23 107.5,64 15.4,28.2 20.5,61.4 10.2,94.7 -10.2,30.7 -30.7,58.9 -58.9,74.2 -20.5,10.2 -41,15.4 -61.4,15.4zM357.6,545.3c-10.2,0 -20.5,2.6 -30.7,7.7 -15.4,7.7 -25.6,20.5 -28.2,35.8 -5.1,15.4 -2.6,33.3 5.1,46.1 10.2,20.5 30.7,30.7 53.8,30.7 10.2,0 20.5,-2.6 30.7,-7.7 15.4,-7.7 25.6,-20.5 28.2,-35.8 5.1,-15.4 2.6,-33.3 -5.1,-46.1 -10.2,-20.5 -30.7,-30.7 -53.8,-30.7zM716,463.4c-25.6,0 -51.2,-15.4 -64,-38.4 -10.2,-17.9 -12.8,-35.8 -7.7,-56.3 5.1,-17.9 17.9,-33.3 33.3,-43.5 10.2,-5.1 23,-10.2 35.8,-10.2 25.6,0 51.2,15.4 64,38.4 20.5,35.8 7.7,79.4 -28.2,99.8 -7.7,7.7 -20.5,10.2 -33.3,10.2zM716,381.4h-5.1c-2.6,2.6 -5.1,2.6 -5.1,5.1v7.7c2.6,2.6 5.1,5.1 7.7,5.1h5.1c5.1,-2.6 7.7,-7.7 2.6,-12.8 2.6,-2.6 -2.6,-5.1 -5.1,-5.1z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gray"
|
||||||
|
android:pathData="M1033.4,48.6c-28.2,-30.7 -71.7,-48.6 -128,-48.6 -51.2,0 -112.6,15.4 -181.8,43.5l-12.8,5.1 12.8,5.1c23,10.2 43.5,20.5 64,30.7h5.1C836.3,69.1 874.7,64 905.4,64c35.8,0 64,10.2 81.9,28.2 33.3,35.8 30.7,105 -7.7,194.6 -2.6,7.7 -5.1,15.4 -10.2,20.5 -5.1,-10.2 -10.2,-20.5 -15.4,-33.3 -84.5,-151 -245.8,-245.8 -419.8,-245.8 -81.9,0 -163.8,20.5 -233,61.4 -230.4,130.6 -312.3,422.4 -184.3,652.8 43.5,76.8 107.5,140.8 184.3,184.3l-23,7.7c-43.5,15.4 -81.9,20.5 -112.6,20.5 -35.8,0 -64,-10.2 -81.9,-28.2 -30.7,-30.7 -28.2,-102.4 10.2,-189.4v-5.1c-12.8,-20.5 -20.5,-43.5 -28.2,-66.6l-5.1,-10.2 -10.2,20.5c-64,130.6 -66.6,235.5 -10.2,297 28.2,30.7 71.7,48.6 128,48.6 51.2,0 112.6,-15.4 181.8,-43.5 10.2,-5.1 20.5,-10.2 33.3,-15.4 51.2,17.9 102.4,25.6 156.2,25.6 81.9,0 161.3,-20.5 233,-61.4 189.4,-107.5 284.2,-330.2 227.8,-540.2 5.1,-10.2 10.2,-20.5 17.9,-33.3 2.6,-2.6 2.6,-7.7 5.1,-10.2 64,-128 66.6,-235.5 10.2,-294.4zM406.2,880.6c-10.2,5.1 -20.5,10.2 -28.2,15.4 -87,-35.8 -158.7,-97.3 -204.8,-181.8 -112.6,-199.7 -41,-453.1 158.7,-565.8 61.4,-35.8 133.1,-53.8 202.2,-53.8 151,0 289.3,81.9 363.5,212.5 12.8,23 25.6,48.6 33.3,74.2 -5.1,10.2 -10.2,17.9 -17.9,28.2 -56.3,87 -135.7,179.2 -225.3,266.2 -87,79.4 -179.2,148.5 -268.8,199.7l-12.8,5.1zM744.1,878.1c-92.2,51.2 -197.1,64 -291.8,43.5 12.8,-7.7 23,-12.8 35.8,-20.5 81.9,-48.6 163.8,-112.6 243.2,-186.9 79.4,-74.2 148.5,-151 202.2,-227.8 7.7,-10.2 15.4,-23 23,-33.3 20.5,169 -58.9,337.9 -212.5,425z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/dis_favorite.xml
Normal 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="M92.6,497.6c7.7,10.6 7.7,24 0,34.6l-16.4,23.1c-12.5,18.3 -17.3,41.4 -12.5,62.5 4.8,22.1 19.2,40.4 38.5,51l24,13.5c11.5,5.8 17.3,18.3 15.4,30.8l-4.8,26.9c-3.9,22.1 1.9,44.2 16.4,61.6 14.4,17.3 34.6,27.9 56.8,28.9l27.9,1c12.5,1 24,8.7 26.9,21.2l7.7,26.9c9.6,32.7 40.4,55.8 75,55.8 10.6,0 21.2,-1.9 30.8,-6.7l26,-10.6a29.8,29.8 0,0 1,33.7 7.7l18.3,21.2c14.4,16.4 35.6,26 57.7,26s44.3,-9.6 58.7,-26.9l18.3,-21.2c7.7,-9.6 22.1,-12.5 33.7,-7.7l26,10.6a78.4,78.4 0,0 0,29.8 5.8c34.6,0 65.4,-23.1 75,-56.8l7.7,-26.9c2.9,-12.5 14.4,-21.2 26.9,-22.1l27.9,-1.9c22.1,-1 43.3,-12.5 56.8,-29.8 13.5,-17.3 19.2,-40.4 15.4,-61.6l-4.8,-26.9c-1.9,-12.5 3.9,-25 14.4,-30.8l24,-13.5c19.2,-10.6 33.7,-29.8 38.5,-51 4.8,-22.1 0,-44.3 -13.5,-62.5l-16.4,-22.1c-7.7,-10.6 -7.7,-24 0,-34.6l16.4,-23.1c12.5,-18.3 17.3,-41.4 12.5,-62.5 -4.8,-22.1 -19.2,-40.4 -38.5,-51l-25,-13.5c-11.5,-5.8 -17.3,-18.3 -15.4,-30.8l4.8,-26.9c3.8,-22.1 -1.9,-44.3 -16.4,-61.6 -14.4,-17.3 -34.6,-27.9 -56.8,-28.9l-27.9,-1c-12.5,-1 -24.1,-8.7 -26.9,-21.2l-7.7,-26.9c-10.6,-34.6 -40.4,-56.8 -75,-56.8 -10.6,0 -21.2,1.9 -30.8,6.7l-26,10.6c-10.6,4.8 -25,1 -33.7,-7.7l-18.3,-21.2C553.4,60.8 532.2,51.2 510.1,51.2s-44.3,9.6 -58.7,26.9l-18.3,21.2c-7.7,9.6 -22.1,12.5 -33.7,7.7l-26,-10.6a78.4,78.4 0,0 0,-29.8 -5.8c-34.6,0 -65.4,23.1 -75,56.8l-7.7,26.9c-2.9,12.5 -14.4,21.2 -26.9,22.1l-27.9,1.9c-22.1,1 -43.3,12.5 -56.8,29.8 -13.5,17.3 -19.2,40.4 -15.4,61.6l4.8,26.9c1.9,12.5 -3.8,25 -14.4,30.8l-24.1,13.5c-19.2,10.6 -33.7,29.8 -38.5,51 -4.8,21.2 0,44.3 13.5,62.5l17.3,23.1zM109.9,423.5c1.9,-8.7 6.7,-15.4 14.4,-19.2l24,-13.5c28.9,-16.3 45.2,-49.1 38.5,-81.8l-3.9,-27.9c-1.9,-8.7 1,-17.3 5.8,-24 5.8,-6.7 12.5,-10.6 21.2,-11.5l27.9,-1.9a77.1,77.1 0,0 0,70.2 -56.8l7.7,-26.9c3.8,-12.5 15.4,-22.1 28.9,-22.1 3.8,0 7.7,1 11.5,1.9l26,10.6a78.3,78.3 0,0 0,29.8 5.8c22.1,0 44.3,-9.6 58.7,-26.9l18.3,-21.2c5.8,-6.7 13.5,-10.6 22.1,-10.6 8.7,0 16.4,3.9 22.1,9.6l18.3,21.2c14.4,16.4 35.6,26 57.7,26 10.6,0 21.2,-1.9 30.8,-6.7l26,-10.6h10.6c13.5,0 25,8.7 28.9,21.2l7.7,26.9c9.6,31.7 37.5,54.8 71.2,55.8l27.9,1c8.7,0 16.4,3.9 22.1,10.6 5.8,6.7 7.7,15.4 5.8,23.1l-4.8,26.9c-5.8,32.7 10.6,65.4 40.4,81.8l24,13.5c7.7,3.9 12.5,10.6 14.4,19.2a30,30 0,0 1,-4.8 24l-15.4,23.1c-19.2,26.9 -19.2,63.5 1,90.4l16.4,22.1a30.1,30.1 0,0 1,4.8 24c-1.9,8.7 -6.7,15.4 -14.4,19.2l-24,13.5c-28.9,16.3 -45.2,49.1 -38.5,81.8l4.8,26.9c1.9,8.7 -1,17.3 -5.8,24 -5.8,6.7 -12.5,10.6 -21.2,11.5l-27.9,1.9a77.1,77.1 0,0 0,-70.2 56.8l-7.7,26.9c-3.8,12.5 -15.4,22.1 -28.9,22.1 -3.9,0 -7.7,-1 -11.5,-1.9l-26,-10.6a78.3,78.3 0,0 0,-29.8 -5.8c-22.1,0 -44.3,9.6 -58.7,26.9l-18.3,21.2c-5.8,6.7 -13.5,10.6 -22.1,10.6s-16.4,-3.8 -22.1,-9.6l-18.3,-21.2a77.3,77.3 0,0 0,-57.7 -26c-10.6,0 -21.2,1.9 -30.8,6.7l-26,10.6c-3.9,1 -7.7,1 -11.5,1 -13.5,0 -25,-8.7 -28.9,-21.2l-7.7,-26.9c-9.6,-31.7 -37.5,-54.8 -71.2,-55.8l-26.9,-1c-8.7,0 -16.3,-3.9 -22.1,-10.6s-7.7,-15.4 -5.8,-23.1l4.8,-26.9c5.8,-32.7 -10.6,-65.4 -40.4,-81.8l-24,-13.5c-7.7,-3.9 -12.5,-10.6 -14.4,-19.2 -1.9,-8.7 0,-17.3 4.8,-24l16.4,-23.1c19.2,-26.9 19.2,-63.5 -1,-90.4l-16.4,-22.1c-6.7,-7.7 -7.7,-15.4 -6.7,-24.1zM484.1,726.5c7.7,7.7 17.3,11.5 28.9,11.5 10.6,0 21.2,-3.8 28.9,-11.5l145.3,-145.3c25,-25 38.5,-57.7 38.5,-92.4s-13.5,-68.3 -38.5,-92.4c-25,-25 -57.7,-38.5 -92.4,-38.5 -29.8,0 -58.7,9.6 -81.8,28.9 -23.1,-18.3 -52,-28.9 -81.8,-28.9 -34.6,0 -67.3,13.5 -92.4,38.5 -25,25 -38.5,57.7 -38.5,92.4s13.5,67.3 38.5,92.4l145.3,145.3zM372.5,429.3c15.4,-15.4 36.6,-24 58.7,-24 22.1,0 43.3,8.7 58.7,24l5.8,5.8c9.6,9.6 25,9.6 33.7,0l5.8,-5.8c15.4,-15.4 36.6,-24 58.7,-24s43.3,8.7 58.7,24c15.4,15.4 24.1,36.6 24.1,58.7 0,22.1 -8.7,43.3 -24.1,58.7l-139.5,140.5 -139.5,-140.5c-15.4,-15.4 -24,-36.6 -24,-58.7 0,-22.1 7.7,-42.3 23.1,-58.7z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/dis_like.xml
Normal 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="M487,113.1a56.1,56.1 0,0 1,73.2 21.9l1.9,3.5 100.4,203.2 224.4,32.6a56.1,56.1 0,0 1,33.9 92.6l-2.9,3 -162.3,158.1 38.3,223.3a56.1,56.1 0,0 1,-77.7 60.9l-3.6,-1.7 -200.8,-105.5 -200.8,105.4a56.1,56.1 0,0 1,-81.9 -55.3l0.5,-3.8 38.4,-223.3 -162.3,-158.1a56.1,56.1 0,0 1,27.3 -95l3.8,-0.7 224.4,-32.6 100.4,-203.2a56.1,56.1 0,0 1,25.4 -25.5z"/>
|
||||||
|
</vector>
|
||||||
18
app/src/main/res/drawable/dis_popular.xml
Normal 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="M850.4,366.6a32.1,32.1 0,0 0,-34.3 -3.6l-200.2,100.4 -73.7,-206.8c-0.5,-1 -0.5,-1.5 -1,-2.6s-1,-1.5 -1.5,-2.6c0,0 0,-0.5 -0.5,-0.5 -0.5,-0.5 -1,-1 -1,-2 0,-0.5 -0.5,-0.5 -0.5,-1 -0.5,-0.5 -1,-1 -1,-1.5 0,-0.5 -0.5,-0.5 -0.5,-1 -0.5,-0.5 -0.5,-1 -1,-1l-1,-1 -1,-1c-0.5,-0.5 -1,-1 -1.5,-1 0,0 -0.5,-0.5 -1,-0.5 -0.5,-0.5 -1,-1 -2,-1 0,0 -0.5,0 -0.5,-0.5l-3.1,-1.5c-0.5,-0.5 -1.5,-0.5 -2,-1 -0.5,0 -1,0 -1,-0.5 -0.5,0 -1,-0.5 -1.5,-0.5 -0.5,0 -1,0 -1.5,-0.5h-10.8c-1,0 -1.5,0.5 -2.6,0.5h-1c-1,0 -1.5,0.5 -2.6,1h-0.5c-1,0.5 -2,0.5 -3.1,1 -0.5,0 -0.5,0.5 -1,0.5 -0.5,0.5 -1,0.5 -1.5,1 -0.5,0.5 -1,0.5 -1.5,1 -0.5,0 -0.5,0.5 -1,0.5 -0.5,0.5 -1,0.5 -1.5,1l-1,1 -1,1 -1,1c-0.5,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -1,1 -1,1.5 0,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -1,1 -1,1.5 0,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -0.5,1 -1,2s-1,2 -1,3.1l-73.7,206.8 -200.2,-100.4c-11.3,-5.6 -24.6,-4.1 -34.3,3.6s-13.8,21 -10.8,32.8l90.6,346.6c3.6,14.3 16.4,24.1 30.7,24.1h455.7c14.3,0 27.1,-9.7 30.7,-24.1l90.6,-346.6c2,-11.8 -2,-24.6 -11.8,-32.3zM715.3,706h-406.5l-66.6,-254.5 169.5,85c8.2,4.1 17.9,4.6 26.1,1 8.7,-3.6 15.4,-10.2 18.4,-18.9l55.8,-156.2 55.8,156.2c3.1,8.7 9.7,15.4 18.4,18.9 8.7,3.6 17.9,3.1 26.1,-1l169.5,-85 -66.6,254.5zM732.7,864.8h-441.3c-17.9,0 -32.3,-14.3 -32.3,-32.3s14.3,-32.3 32.3,-32.3h441.3c17.9,0 31.7,14.3 31.7,32.3s-14.3,32.3 -31.7,32.3z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gray"
|
||||||
|
android:pathData="M512.5,191m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gray"
|
||||||
|
android:pathData="M877.6,328.2m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/gray"
|
||||||
|
android:pathData="M146.4,328.2m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/dis_transform.xml
Normal 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="M292.6,178.3a114.3,114.3 0,1 0,0 228.6,114.3 114.3,0 0,0 0,-228.6zM114.3,292.6a178.3,178.3 0,1 1,356.6 0,178.3 178.3,0 0,1 -356.6,0zM731.4,617.1a114.3,114.3 0,1 0,0 228.6,114.3 114.3,0 0,0 0,-228.6zM553.1,731.4a178.3,178.3 0,1 1,356.6 0,178.3 178.3,0 0,1 -356.6,0zM68.5,484.8a32,32 0,0 1,31.1 -1.4l142.2,71.1A32,32 0,0 1,213.3 611.8l-92.3,-46.2C147.1,758.2 312.2,906.7 512,906.7a32,32 0,0 1,0 64C258.7,970.7 53.3,765.3 53.3,512a32,32 0,0 1,15.2 -27.2zM480,85.3a32,32 0,0 1,32 -32c253.4,0 458.7,205.4 458.7,458.7a32,32 0,0 1,-46.3 28.6l-142.3,-71.1a32,32 0,0 1,28.6 -57.2l92.3,46.1c-26.2,-192.6 -191.3,-341.1 -391,-341.1a32,32 0,0 1,-32 -32z"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/discover.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="33.5dp"
|
||||||
|
android:height="32dp"
|
||||||
|
android:viewportWidth="1073"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M447.2,302.1c-28.2,0 -53.8,-15.4 -69.1,-41 -10.2,-17.9 -12.8,-38.4 -7.7,-58.9 5.1,-20.5 17.9,-38.4 38.4,-48.6 12.8,-7.7 25.6,-10.2 38.4,-10.2 28.2,0 53.8,15.4 69.1,41 20.5,38.4 7.7,87 -30.7,107.5 -10.2,5.1 -25.6,10.2 -38.4,10.2zM447.2,207.4c-2.6,0 -5.1,0 -7.7,2.6 -2.6,2.6 -5.1,5.1 -7.7,10.2 0,5.1 0,7.7 2.6,12.8s7.7,7.7 12.8,7.7c2.6,0 5.1,0 7.7,-2.6 7.7,-5.1 10.2,-12.8 5.1,-20.5 -2.6,-7.7 -7.7,-10.2 -12.8,-10.2zM357.6,729.6c-46.1,0 -87,-23 -107.5,-64 -33.3,-58.9 -12.8,-135.7 48.6,-169 17.9,-10.2 38.4,-15.4 61.4,-15.4 46.1,0 87,23 107.5,64 15.4,28.2 20.5,61.4 10.2,94.7 -10.2,30.7 -30.7,58.9 -58.9,74.2 -20.5,10.2 -41,15.4 -61.4,15.4zM357.6,545.3c-10.2,0 -20.5,2.6 -30.7,7.7 -15.4,7.7 -25.6,20.5 -28.2,35.8 -5.1,15.4 -2.6,33.3 5.1,46.1 10.2,20.5 30.7,30.7 53.8,30.7 10.2,0 20.5,-2.6 30.7,-7.7 15.4,-7.7 25.6,-20.5 28.2,-35.8 5.1,-15.4 2.6,-33.3 -5.1,-46.1 -10.2,-20.5 -30.7,-30.7 -53.8,-30.7zM716,463.4c-25.6,0 -51.2,-15.4 -64,-38.4 -10.2,-17.9 -12.8,-35.8 -7.7,-56.3 5.1,-17.9 17.9,-33.3 33.3,-43.5 10.2,-5.1 23,-10.2 35.8,-10.2 25.6,0 51.2,15.4 64,38.4 20.5,35.8 7.7,79.4 -28.2,99.8 -7.7,7.7 -20.5,10.2 -33.3,10.2zM716,381.4h-5.1c-2.6,2.6 -5.1,2.6 -5.1,5.1v7.7c2.6,2.6 5.1,5.1 7.7,5.1h5.1c5.1,-2.6 7.7,-7.7 2.6,-12.8 2.6,-2.6 -2.6,-5.1 -5.1,-5.1z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M1033.4,48.6c-28.2,-30.7 -71.7,-48.6 -128,-48.6 -51.2,0 -112.6,15.4 -181.8,43.5l-12.8,5.1 12.8,5.1c23,10.2 43.5,20.5 64,30.7h5.1C836.3,69.1 874.7,64 905.4,64c35.8,0 64,10.2 81.9,28.2 33.3,35.8 30.7,105 -7.7,194.6 -2.6,7.7 -5.1,15.4 -10.2,20.5 -5.1,-10.2 -10.2,-20.5 -15.4,-33.3 -84.5,-151 -245.8,-245.8 -419.8,-245.8 -81.9,0 -163.8,20.5 -233,61.4 -230.4,130.6 -312.3,422.4 -184.3,652.8 43.5,76.8 107.5,140.8 184.3,184.3l-23,7.7c-43.5,15.4 -81.9,20.5 -112.6,20.5 -35.8,0 -64,-10.2 -81.9,-28.2 -30.7,-30.7 -28.2,-102.4 10.2,-189.4v-5.1c-12.8,-20.5 -20.5,-43.5 -28.2,-66.6l-5.1,-10.2 -10.2,20.5c-64,130.6 -66.6,235.5 -10.2,297 28.2,30.7 71.7,48.6 128,48.6 51.2,0 112.6,-15.4 181.8,-43.5 10.2,-5.1 20.5,-10.2 33.3,-15.4 51.2,17.9 102.4,25.6 156.2,25.6 81.9,0 161.3,-20.5 233,-61.4 189.4,-107.5 284.2,-330.2 227.8,-540.2 5.1,-10.2 10.2,-20.5 17.9,-33.3 2.6,-2.6 2.6,-7.7 5.1,-10.2 64,-128 66.6,-235.5 10.2,-294.4zM406.2,880.6c-10.2,5.1 -20.5,10.2 -28.2,15.4 -87,-35.8 -158.7,-97.3 -204.8,-181.8 -112.6,-199.7 -41,-453.1 158.7,-565.8 61.4,-35.8 133.1,-53.8 202.2,-53.8 151,0 289.3,81.9 363.5,212.5 12.8,23 25.6,48.6 33.3,74.2 -5.1,10.2 -10.2,17.9 -17.9,28.2 -56.3,87 -135.7,179.2 -225.3,266.2 -87,79.4 -179.2,148.5 -268.8,199.7l-12.8,5.1zM744.1,878.1c-92.2,51.2 -197.1,64 -291.8,43.5 12.8,-7.7 23,-12.8 35.8,-20.5 81.9,-48.6 163.8,-112.6 243.2,-186.9 79.4,-74.2 148.5,-151 202.2,-227.8 7.7,-10.2 15.4,-23 23,-33.3 20.5,169 -58.9,337.9 -212.5,425z"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/favorite.xml
Normal 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="#FF000000"
|
||||||
|
android:pathData="M92.6,497.6c7.7,10.6 7.7,24 0,34.6l-16.4,23.1c-12.5,18.3 -17.3,41.4 -12.5,62.5 4.8,22.1 19.2,40.4 38.5,51l24,13.5c11.5,5.8 17.3,18.3 15.4,30.8l-4.8,26.9c-3.9,22.1 1.9,44.2 16.4,61.6 14.4,17.3 34.6,27.9 56.8,28.9l27.9,1c12.5,1 24,8.7 26.9,21.2l7.7,26.9c9.6,32.7 40.4,55.8 75,55.8 10.6,0 21.2,-1.9 30.8,-6.7l26,-10.6a29.8,29.8 0,0 1,33.7 7.7l18.3,21.2c14.4,16.4 35.6,26 57.7,26s44.3,-9.6 58.7,-26.9l18.3,-21.2c7.7,-9.6 22.1,-12.5 33.7,-7.7l26,10.6a78.4,78.4 0,0 0,29.8 5.8c34.6,0 65.4,-23.1 75,-56.8l7.7,-26.9c2.9,-12.5 14.4,-21.2 26.9,-22.1l27.9,-1.9c22.1,-1 43.3,-12.5 56.8,-29.8 13.5,-17.3 19.2,-40.4 15.4,-61.6l-4.8,-26.9c-1.9,-12.5 3.9,-25 14.4,-30.8l24,-13.5c19.2,-10.6 33.7,-29.8 38.5,-51 4.8,-22.1 0,-44.3 -13.5,-62.5l-16.4,-22.1c-7.7,-10.6 -7.7,-24 0,-34.6l16.4,-23.1c12.5,-18.3 17.3,-41.4 12.5,-62.5 -4.8,-22.1 -19.2,-40.4 -38.5,-51l-25,-13.5c-11.5,-5.8 -17.3,-18.3 -15.4,-30.8l4.8,-26.9c3.8,-22.1 -1.9,-44.3 -16.4,-61.6 -14.4,-17.3 -34.6,-27.9 -56.8,-28.9l-27.9,-1c-12.5,-1 -24.1,-8.7 -26.9,-21.2l-7.7,-26.9c-10.6,-34.6 -40.4,-56.8 -75,-56.8 -10.6,0 -21.2,1.9 -30.8,6.7l-26,10.6c-10.6,4.8 -25,1 -33.7,-7.7l-18.3,-21.2C553.4,60.8 532.2,51.2 510.1,51.2s-44.3,9.6 -58.7,26.9l-18.3,21.2c-7.7,9.6 -22.1,12.5 -33.7,7.7l-26,-10.6a78.4,78.4 0,0 0,-29.8 -5.8c-34.6,0 -65.4,23.1 -75,56.8l-7.7,26.9c-2.9,12.5 -14.4,21.2 -26.9,22.1l-27.9,1.9c-22.1,1 -43.3,12.5 -56.8,29.8 -13.5,17.3 -19.2,40.4 -15.4,61.6l4.8,26.9c1.9,12.5 -3.8,25 -14.4,30.8l-24.1,13.5c-19.2,10.6 -33.7,29.8 -38.5,51 -4.8,21.2 0,44.3 13.5,62.5l17.3,23.1zM109.9,423.5c1.9,-8.7 6.7,-15.4 14.4,-19.2l24,-13.5c28.9,-16.3 45.2,-49.1 38.5,-81.8l-3.9,-27.9c-1.9,-8.7 1,-17.3 5.8,-24 5.8,-6.7 12.5,-10.6 21.2,-11.5l27.9,-1.9a77.1,77.1 0,0 0,70.2 -56.8l7.7,-26.9c3.8,-12.5 15.4,-22.1 28.9,-22.1 3.8,0 7.7,1 11.5,1.9l26,10.6a78.3,78.3 0,0 0,29.8 5.8c22.1,0 44.3,-9.6 58.7,-26.9l18.3,-21.2c5.8,-6.7 13.5,-10.6 22.1,-10.6 8.7,0 16.4,3.9 22.1,9.6l18.3,21.2c14.4,16.4 35.6,26 57.7,26 10.6,0 21.2,-1.9 30.8,-6.7l26,-10.6h10.6c13.5,0 25,8.7 28.9,21.2l7.7,26.9c9.6,31.7 37.5,54.8 71.2,55.8l27.9,1c8.7,0 16.4,3.9 22.1,10.6 5.8,6.7 7.7,15.4 5.8,23.1l-4.8,26.9c-5.8,32.7 10.6,65.4 40.4,81.8l24,13.5c7.7,3.9 12.5,10.6 14.4,19.2a30,30 0,0 1,-4.8 24l-15.4,23.1c-19.2,26.9 -19.2,63.5 1,90.4l16.4,22.1a30.1,30.1 0,0 1,4.8 24c-1.9,8.7 -6.7,15.4 -14.4,19.2l-24,13.5c-28.9,16.3 -45.2,49.1 -38.5,81.8l4.8,26.9c1.9,8.7 -1,17.3 -5.8,24 -5.8,6.7 -12.5,10.6 -21.2,11.5l-27.9,1.9a77.1,77.1 0,0 0,-70.2 56.8l-7.7,26.9c-3.8,12.5 -15.4,22.1 -28.9,22.1 -3.9,0 -7.7,-1 -11.5,-1.9l-26,-10.6a78.3,78.3 0,0 0,-29.8 -5.8c-22.1,0 -44.3,9.6 -58.7,26.9l-18.3,21.2c-5.8,6.7 -13.5,10.6 -22.1,10.6s-16.4,-3.8 -22.1,-9.6l-18.3,-21.2a77.3,77.3 0,0 0,-57.7 -26c-10.6,0 -21.2,1.9 -30.8,6.7l-26,10.6c-3.9,1 -7.7,1 -11.5,1 -13.5,0 -25,-8.7 -28.9,-21.2l-7.7,-26.9c-9.6,-31.7 -37.5,-54.8 -71.2,-55.8l-26.9,-1c-8.7,0 -16.3,-3.9 -22.1,-10.6s-7.7,-15.4 -5.8,-23.1l4.8,-26.9c5.8,-32.7 -10.6,-65.4 -40.4,-81.8l-24,-13.5c-7.7,-3.9 -12.5,-10.6 -14.4,-19.2 -1.9,-8.7 0,-17.3 4.8,-24l16.4,-23.1c19.2,-26.9 19.2,-63.5 -1,-90.4l-16.4,-22.1c-6.7,-7.7 -7.7,-15.4 -6.7,-24.1zM484.1,726.5c7.7,7.7 17.3,11.5 28.9,11.5 10.6,0 21.2,-3.8 28.9,-11.5l145.3,-145.3c25,-25 38.5,-57.7 38.5,-92.4s-13.5,-68.3 -38.5,-92.4c-25,-25 -57.7,-38.5 -92.4,-38.5 -29.8,0 -58.7,9.6 -81.8,28.9 -23.1,-18.3 -52,-28.9 -81.8,-28.9 -34.6,0 -67.3,13.5 -92.4,38.5 -25,25 -38.5,57.7 -38.5,92.4s13.5,67.3 38.5,92.4l145.3,145.3zM372.5,429.3c15.4,-15.4 36.6,-24 58.7,-24 22.1,0 43.3,8.7 58.7,24l5.8,5.8c9.6,9.6 25,9.6 33.7,0l5.8,-5.8c15.4,-15.4 36.6,-24 58.7,-24s43.3,8.7 58.7,24c15.4,15.4 24.1,36.6 24.1,58.7 0,22.1 -8.7,43.3 -24.1,58.7l-139.5,140.5 -139.5,-140.5c-15.4,-15.4 -24,-36.6 -24,-58.7 0,-22.1 7.7,-42.3 23.1,-58.7z"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/gradient_main.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:startColor="#43CEA2"
|
||||||
|
android:endColor="#185A9D"
|
||||||
|
android:type="linear" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
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>
|
||||||
6
app/src/main/res/drawable/image_gradient_overlay.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#00000000"
|
||||||
|
android:endColor="#80000000"
|
||||||
|
android:angle="90" />
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/like.xml
Normal 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="#E53935"
|
||||||
|
android:pathData="M487,113.1a56.1,56.1 0,0 1,73.2 21.9l1.9,3.5 100.4,203.2 224.4,32.6a56.1,56.1 0,0 1,33.9 92.6l-2.9,3 -162.3,158.1 38.3,223.3a56.1,56.1 0,0 1,-77.7 60.9l-3.6,-1.7 -200.8,-105.5 -200.8,105.4a56.1,56.1 0,0 1,-81.9 -55.3l0.5,-3.8 38.4,-223.3 -162.3,-158.1a56.1,56.1 0,0 1,27.3 -95l3.8,-0.7 224.4,-32.6 100.4,-203.2a56.1,56.1 0,0 1,25.4 -25.5z"/>
|
||||||
|
</vector>
|
||||||
18
app/src/main/res/drawable/popular.xml
Normal 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/black"
|
||||||
|
android:pathData="M850.4,366.6a32.1,32.1 0,0 0,-34.3 -3.6l-200.2,100.4 -73.7,-206.8c-0.5,-1 -0.5,-1.5 -1,-2.6s-1,-1.5 -1.5,-2.6c0,0 0,-0.5 -0.5,-0.5 -0.5,-0.5 -1,-1 -1,-2 0,-0.5 -0.5,-0.5 -0.5,-1 -0.5,-0.5 -1,-1 -1,-1.5 0,-0.5 -0.5,-0.5 -0.5,-1 -0.5,-0.5 -0.5,-1 -1,-1l-1,-1 -1,-1c-0.5,-0.5 -1,-1 -1.5,-1 0,0 -0.5,-0.5 -1,-0.5 -0.5,-0.5 -1,-1 -2,-1 0,0 -0.5,0 -0.5,-0.5l-3.1,-1.5c-0.5,-0.5 -1.5,-0.5 -2,-1 -0.5,0 -1,0 -1,-0.5 -0.5,0 -1,-0.5 -1.5,-0.5 -0.5,0 -1,0 -1.5,-0.5h-10.8c-1,0 -1.5,0.5 -2.6,0.5h-1c-1,0 -1.5,0.5 -2.6,1h-0.5c-1,0.5 -2,0.5 -3.1,1 -0.5,0 -0.5,0.5 -1,0.5 -0.5,0.5 -1,0.5 -1.5,1 -0.5,0.5 -1,0.5 -1.5,1 -0.5,0 -0.5,0.5 -1,0.5 -0.5,0.5 -1,0.5 -1.5,1l-1,1 -1,1 -1,1c-0.5,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -1,1 -1,1.5 0,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -1,1 -1,1.5 0,0.5 -0.5,0.5 -0.5,1 -0.5,0.5 -0.5,1 -1,2s-1,2 -1,3.1l-73.7,206.8 -200.2,-100.4c-11.3,-5.6 -24.6,-4.1 -34.3,3.6s-13.8,21 -10.8,32.8l90.6,346.6c3.6,14.3 16.4,24.1 30.7,24.1h455.7c14.3,0 27.1,-9.7 30.7,-24.1l90.6,-346.6c2,-11.8 -2,-24.6 -11.8,-32.3zM715.3,706h-406.5l-66.6,-254.5 169.5,85c8.2,4.1 17.9,4.6 26.1,1 8.7,-3.6 15.4,-10.2 18.4,-18.9l55.8,-156.2 55.8,156.2c3.1,8.7 9.7,15.4 18.4,18.9 8.7,3.6 17.9,3.1 26.1,-1l169.5,-85 -66.6,254.5zM732.7,864.8h-441.3c-17.9,0 -32.3,-14.3 -32.3,-32.3s14.3,-32.3 32.3,-32.3h441.3c17.9,0 31.7,14.3 31.7,32.3s-14.3,32.3 -31.7,32.3z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/black"
|
||||||
|
android:pathData="M512.5,191m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/black"
|
||||||
|
android:pathData="M877.6,328.2m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/black"
|
||||||
|
android:pathData="M146.4,328.2m-32.3,0a32.3,32.3 0,1 0,64.5 0,32.3 32.3,0 1,0 -64.5,0Z" />
|
||||||
|
</vector>
|
||||||
30
app/src/main/res/drawable/progress_bar_color.xml
Normal 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>
|
||||||
4
app/src/main/res/drawable/rounded_background_gray.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#66000000" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/rounded_rectangle_gradient.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="45"
|
||||||
|
android:startColor="#80CBC4"
|
||||||
|
android:endColor="#0288D1"
|
||||||
|
android:type="linear"
|
||||||
|
android:useLevel="false" />
|
||||||
|
<corners android:radius="16dp" />
|
||||||
|
</shape>
|
||||||
6
app/src/main/res/drawable/top_gradient_overlay.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#66000000"
|
||||||
|
android:endColor="@android:color/transparent"
|
||||||
|
android:angle="90" />
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/transform.xml
Normal 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="#FF000000"
|
||||||
|
android:pathData="M292.6,178.3a114.3,114.3 0,1 0,0 228.6,114.3 114.3,0 0,0 0,-228.6zM114.3,292.6a178.3,178.3 0,1 1,356.6 0,178.3 178.3,0 0,1 -356.6,0zM731.4,617.1a114.3,114.3 0,1 0,0 228.6,114.3 114.3,0 0,0 0,-228.6zM553.1,731.4a178.3,178.3 0,1 1,356.6 0,178.3 178.3,0 0,1 -356.6,0zM68.5,484.8a32,32 0,0 1,31.1 -1.4l142.2,71.1A32,32 0,0 1,213.3 611.8l-92.3,-46.2C147.1,758.2 312.2,906.7 512,906.7a32,32 0,0 1,0 64C258.7,970.7 53.3,765.3 53.3,512a32,32 0,0 1,15.2 -27.2zM480,85.3a32,32 0,0 1,32 -32c253.4,0 458.7,205.4 458.7,458.7a32,32 0,0 1,-46.3 28.6l-142.3,-71.1a32,32 0,0 1,28.6 -57.2l92.3,46.1c-26.2,-192.6 -191.3,-341.1 -391,-341.1a32,32 0,0 1,-32 -32z"/>
|
||||||
|
</vector>
|
||||||
124
app/src/main/res/layout/activity_dynamic.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.activity.DynamicActivity">
|
||||||
|
|
||||||
|
<VideoView
|
||||||
|
android:id="@+id/video_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/set_wallpaper_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:background="@drawable/rounded_rectangle_gradient"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Set it as a dynamic wallpaper"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/like"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:src="@drawable/dis_like"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progress_tip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="Please wait, downloading"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/downloadProgressBar"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/progressText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="0%"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/progress_tip"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/progress_tip"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/progress_tip" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/loadingSpinner"
|
||||||
|
style="?android:attr/progressBarStyle"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/progress_tip"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/progressText"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/progress_tip" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/downloadProgressBar"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:elevation="4dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="0"
|
||||||
|
android:progressDrawable="@drawable/progress_bar_color"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
40
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.activity.MainActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/main_tab_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/title"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
|
app:tabRippleColor="@android:color/transparent" />
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/main_viewpager2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/main_tab_layout" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
48
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?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"
|
||||||
|
tools:context=".ui.activity.SplashActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/splash_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:text="@string/app_name"
|
||||||
|
android:textSize="25sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/splash_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_bar_color"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
27
app/src/main/res/layout/fragment_main.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?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.fragment.MainFragment">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="You haven't collected it yet"
|
||||||
|
android:textColor="@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" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
33
app/src/main/res/layout/item_dynamic.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<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"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
app:cardCornerRadius="12dp"
|
||||||
|
app:cardElevation="4dp">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_image_view"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="250dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_like"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_margin="12dp"
|
||||||
|
android:padding="6dp"
|
||||||
|
android:src="@drawable/dis_like"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
31
app/src/main/res/layout/main_tab_custom.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<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>
|
||||||
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.png
Normal file
|
After Width: | Height: | Size: 7.2 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-hdpi/placeholder.png
Normal file
|
After Width: | Height: | Size: 354 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
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.png
Normal file
|
After Width: | Height: | Size: 12 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.png
Normal file
|
After Width: | Height: | Size: 25 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.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.DynamicWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your dark theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
6
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="gray">#9C979D</color>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Dynamic Wallpaper</string>
|
||||||
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
</resources>
|
||||||
11
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.DynamicWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your light theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||||
|
<item name="android:windowBackground">@drawable/activity_background_gradient</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.DynamicWallpaper" parent="Base.Theme.DynamicWallpaper" />
|
||||||
|
</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 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>
|
||||||
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>
|
||||||
5
app/src/main/res/xml/live_wallpaper.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<wallpaper xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:description="@string/app_name"
|
||||||
|
android:thumbnail="@mipmap/placeholder">
|
||||||
|
</wallpaper>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.live.dynamicwallpaper;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// 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
|
||||||
|
}
|
||||||
21
gradle.properties
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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
|
||||||
|
# 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
@ -0,0 +1,26 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "8.9.1"
|
||||||
|
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"
|
||||||
|
kotlin = "2.1.20"
|
||||||
|
coreKtx = "1.16.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||||
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
|
||||||
|
[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
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Thu Apr 17 10:43:14 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
@ -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
|
||||||
24
settings.gradle.kts
Normal 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 = "Dynamic Wallpaper"
|
||||||
|
include(":app")
|
||||||
|
|
||||||