V1.1(2)
This commit is contained in:
commit
313a005e38
15
.gitignore
vendored
Normal file
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
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
BIN
app/LiveWallpapers.jks
Normal file
BIN
app/LiveWallpapers.jks
Normal file
Binary file not shown.
79
app/build.gradle.kts
Normal file
79
app/build.gradle.kts
Normal file
@ -0,0 +1,79 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("io.objectbox")
|
||||
// id("com.google.gms.google-services")
|
||||
// id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.hd.live.wall.wallpapers"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
//com.video.livewallpapers
|
||||
applicationId = "com.video.livewallpapers"
|
||||
minSdk = 24
|
||||
targetSdk = 35
|
||||
versionCode = 2
|
||||
versionName = "1.1"
|
||||
setProperty(
|
||||
"archivesBaseName",
|
||||
"Live Wallpapers_V" + versionName + "(${versionCode})_$timestamp"
|
||||
)
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.2.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
|
||||
implementation ("androidx.paging:paging-runtime:3.3.5")
|
||||
implementation ("androidx.paging:paging-runtime-ktx:3.3.5") // 包含 Kotlin 扩展
|
||||
implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.6.0") // LiveData 相关
|
||||
implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0")
|
||||
|
||||
implementation ("com.google.code.gson:gson:2.10.1")
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
|
||||
implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
implementation("io.reactivex.rxjava2:rxjava:2.2.21")
|
||||
implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
|
||||
implementation("com.squareup.retrofit2:adapter-rxjava2:2.9.0")
|
||||
implementation("com.squareup.okhttp3:logging-interceptor:4.11.0")
|
||||
|
||||
// implementation ("com.google.android.exoplayer:exoplayer:2.19.1")
|
||||
implementation("androidx.media3:media3-exoplayer:1.4.1")
|
||||
implementation ("androidx.media3:media3-ui:1.4.1")
|
||||
implementation ("androidx.media3:media3-exoplayer-dash:1.4.1")
|
||||
|
||||
|
||||
}
|
||||
143
app/objectbox-models/default.json
Normal file
143
app/objectbox-models/default.json
Normal file
@ -0,0 +1,143 @@
|
||||
{
|
||||
"_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
|
||||
"_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
|
||||
"_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
|
||||
"entities": [
|
||||
{
|
||||
"id": "4:8292794323070426087",
|
||||
"lastPropertyId": "6:4212645434695623376",
|
||||
"name": "Collection",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:8298445636036003979",
|
||||
"name": "objectId",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:7158874823230274890",
|
||||
"name": "description",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "3:5375266932175922651",
|
||||
"name": "id",
|
||||
"type": 5
|
||||
},
|
||||
{
|
||||
"id": "4:5293361524397058445",
|
||||
"name": "image",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:1349138447762584642",
|
||||
"name": "wallpapertype",
|
||||
"type": 5
|
||||
},
|
||||
{
|
||||
"id": "6:4212645434695623376",
|
||||
"name": "thumbnail",
|
||||
"type": 9
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "5:7601340267654333236",
|
||||
"lastPropertyId": "10:8949963316839507901",
|
||||
"name": "WallData",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:2214896816054231465",
|
||||
"name": "objectId",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:5256827416638347146",
|
||||
"name": "category",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "3:577238083250783022",
|
||||
"name": "description",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:7313378671789270883",
|
||||
"name": "downloads",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:2258603154592717624",
|
||||
"name": "id",
|
||||
"type": 5
|
||||
},
|
||||
{
|
||||
"id": "6:1993477221244805828",
|
||||
"name": "image",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "7:8813713031805410144",
|
||||
"name": "pro",
|
||||
"type": 5
|
||||
},
|
||||
{
|
||||
"id": "8:747269915433860517",
|
||||
"name": "resolution",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "9:3226960032586412811",
|
||||
"name": "thumbnail",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "10:8949963316839507901",
|
||||
"name": "wallpapertype",
|
||||
"type": 5
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "5:7601340267654333236",
|
||||
"lastIndexId": "0:0",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
"modelVersion": 5,
|
||||
"modelVersionParserMinimum": 5,
|
||||
"retiredEntityUids": [
|
||||
8834432815557132690,
|
||||
150505122699528186,
|
||||
6621332807843049779
|
||||
],
|
||||
"retiredIndexUids": [],
|
||||
"retiredPropertyUids": [
|
||||
846923696920771332,
|
||||
2661563405594510728,
|
||||
3803068480811227076,
|
||||
2573175242602089587,
|
||||
4073665339586807072,
|
||||
6490742020031879416,
|
||||
2927637172002004906,
|
||||
1001748290350717302,
|
||||
4120630564091130628,
|
||||
279795966790436055,
|
||||
97414655938247912,
|
||||
729161467269206587,
|
||||
5042336858198490957,
|
||||
6165031016937588605,
|
||||
1947268834796297839,
|
||||
76475728747825161,
|
||||
4538292384164106909,
|
||||
3798352414031850717,
|
||||
6482737152923675363,
|
||||
4529755790081860204,
|
||||
1205919504570971706,
|
||||
5780006894715348003
|
||||
],
|
||||
"retiredRelationUids": [],
|
||||
"version": 1
|
||||
}
|
||||
129
app/proguard-rules.pro
vendored
Normal file
129
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
# 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
|
||||
|
||||
|
||||
# 保持 Gson 和 TypeToken 不被混淆
|
||||
-keep class com.google.gson.** { *; }
|
||||
-keep class com.google.gson.reflect.TypeToken { *; }
|
||||
|
||||
# 保留与泛型相关的 TypeToken 使用,避免泛型信息丢失
|
||||
-keep class * extends com.google.gson.reflect.TypeToken { *; }
|
||||
|
||||
# 保留自定义的类 MyClass 不被混淆
|
||||
-keep class com.hd.live.wall.wallpapers.dbData.WallData { *; }
|
||||
|
||||
# 保持 Gson 序列化相关的字段不被混淆
|
||||
-keepclassmembers class * {
|
||||
@com.google.gson.annotations.SerializedName <fields>;
|
||||
}
|
||||
|
||||
# 保持 Gson 构造方法不被混淆
|
||||
-keepclassmembers class com.google.gson.Gson {
|
||||
public <init>(...);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# 保留 Retrofit 的所有类
|
||||
-keep class retrofit2.** { *; }
|
||||
|
||||
# 保留 RxJava2 的所有类
|
||||
-keep class io.reactivex.** { *; }
|
||||
|
||||
# 保留 CallAdapter 和 Converter 相关类
|
||||
-keep class retrofit2.adapter.** { *; }
|
||||
-keep class retrofit2.converter.** { *; }
|
||||
|
||||
# 保留类型 Token、类型适配器等相关类
|
||||
-keepclassmembers class * {
|
||||
@retrofit2.http.* <methods>;
|
||||
}
|
||||
|
||||
# 保留 Retrofit 和 OkHttp 的类和构造方法
|
||||
-keep class retrofit2.** { *; }
|
||||
-keep class okhttp3.** { *; }
|
||||
|
||||
# 保留 Retrofit 接口和方法
|
||||
-keep class retrofit2.Retrofit { *; }
|
||||
-keep class retrofit2.Call { *; }
|
||||
-keep class retrofit2.http.** { *; }
|
||||
|
||||
# 保留所有使用 Retrofit 注解的字段、方法和类
|
||||
-keepclassmembers class * {
|
||||
@retrofit2.http.* <methods>;
|
||||
}
|
||||
|
||||
# 保留 Converter 和 CallAdapter 相关类
|
||||
-keep class retrofit2.converter.** { *; }
|
||||
-keep class retrofit2.adapter.** { *; }
|
||||
|
||||
# 保留 `@GET`, `@POST` 等注解
|
||||
-keepclassmembers class * {
|
||||
@retrofit2.http.GET <methods>;
|
||||
@retrofit2.http.POST <methods>;
|
||||
@retrofit2.http.PUT <methods>;
|
||||
@retrofit2.http.DELETE <methods>;
|
||||
@retrofit2.http.PATCH <methods>;
|
||||
@retrofit2.http.Headers <methods>;
|
||||
@retrofit2.http.Query <methods>;
|
||||
@retrofit2.http.Body <methods>;
|
||||
@retrofit2.http.Path <methods>;
|
||||
}
|
||||
|
||||
# 保留 OkHttp 相关类
|
||||
-keep class okhttp3.Request { *; }
|
||||
-keep class okhttp3.Response { *; }
|
||||
-keep class okhttp3.OkHttpClient { *; }
|
||||
|
||||
# 保留 OkHttp 相关的拦截器
|
||||
-keep class okhttp3.Interceptor { *; }
|
||||
-keep class okhttp3.logging.HttpLoggingInterceptor { *; }
|
||||
|
||||
# 保留 OkHttp 的构造方法
|
||||
-keepclassmembers class okhttp3.** {
|
||||
public <init>(...);
|
||||
}
|
||||
|
||||
# 保留 OkHttpClient 的链式构建方式
|
||||
-keepclassmembers class okhttp3.OkHttpClient {
|
||||
public okhttp3.OkHttpClient$Builder newBuilder(...);
|
||||
}
|
||||
|
||||
# 保留 HttpLoggingInterceptor 相关类
|
||||
-keep class okhttp3.logging.HttpLoggingInterceptor { *; }
|
||||
|
||||
# 保留 Call 和 Request 方法
|
||||
-keepclassmembers class okhttp3.Call {
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class okhttp3.Request {
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class okhttp3.Response {
|
||||
public *;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.hd.live.wallpapers;
|
||||
|
||||
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.hd.live.wallpapers", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
69
app/src/main/AndroidManifest.xml
Normal file
69
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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=".LiveApp"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/logo"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/logo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.MyLiveWallpaper"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".act.ActivityCollection"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".act.ActivityWel"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".act.ActivitySetWallpaper"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".act.ActivityMain"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
|
||||
<service
|
||||
android:name=".utils.LiveService"
|
||||
android:exported="true"
|
||||
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/wallpaper" />
|
||||
</service>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
4841
app/src/main/assets/Explore.json
Normal file
4841
app/src/main/assets/Explore.json
Normal file
File diff suppressed because it is too large
Load Diff
1036
app/src/main/assets/Shift.json
Normal file
1036
app/src/main/assets/Shift.json
Normal file
File diff suppressed because it is too large
Load Diff
BIN
app/src/main/assets/font.ttf
Normal file
BIN
app/src/main/assets/font.ttf
Normal file
Binary file not shown.
4833
app/src/main/assets/trending.json
Normal file
4833
app/src/main/assets/trending.json
Normal file
File diff suppressed because it is too large
Load Diff
107
app/src/main/java/com/hd/live/wall/wallpapers/LiveApp.java
Normal file
107
app/src/main/java/com/hd/live/wall/wallpapers/LiveApp.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.hd.live.wall.wallpapers;
|
||||
|
||||
import android.app.Application;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
import com.hd.live.wall.wallpapers.utils.dbManager;
|
||||
import com.hd.live.wall.wallpapers.utils.Store;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class LiveApp extends Application {
|
||||
private static Typeface defaultFont;
|
||||
private static LiveApp mApplication;
|
||||
private static String thumbStr = "https://neutrolabgames.com/LiveLoop/CpanelPix/VideoThumb/";
|
||||
|
||||
public static String TAG = "--------------------LIVE----------";
|
||||
public static String getThumbStr() {
|
||||
return thumbStr;
|
||||
}
|
||||
|
||||
public static LiveApp getApplication() {
|
||||
return mApplication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mApplication = this;
|
||||
defaultFont = Typeface.createFromAsset(getAssets(), "font.ttf");
|
||||
// initSDk();
|
||||
dbManager.init(this);
|
||||
String dbinit = Store.INSTANCE.getDbinit();
|
||||
if(dbinit.equals("0")){
|
||||
loadData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Typeface getDefaultFont() {
|
||||
return defaultFont;
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
String name[] = {"trending.json","Explore.json","Shift.json"};
|
||||
ExecutorService cachedThreadPool = Executors.newFixedThreadPool(3);
|
||||
for (int i = 0;i<3;i++){
|
||||
int task = i;
|
||||
cachedThreadPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Gson gson = new Gson();
|
||||
InputStream open = null;
|
||||
try {
|
||||
open = getAssets().open(name[task]);
|
||||
}catch (Exception e){
|
||||
}
|
||||
if(open == null){
|
||||
return;
|
||||
}
|
||||
Type type = new TypeToken<List<WallData>>() {
|
||||
}.getType();
|
||||
String covertStr = helper.getCovertStr(open);
|
||||
List<WallData> data = gson.fromJson(covertStr, type);
|
||||
for (WallData datum : data) {
|
||||
dbManager.insertDb(datum);
|
||||
}
|
||||
Store.INSTANCE.setDbinit("1");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initSDk(){
|
||||
// String APPId ="h6776591bc967e";
|
||||
//
|
||||
// String AppKey ="a359707dba4dcae7ac8bc66d0d163295c";
|
||||
// String debugKey = "d2f08ee302fdd0741819983376817c0bf71bfe67";
|
||||
// ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
//
|
||||
// @Override
|
||||
// public void onResultCallback(boolean isEU) {
|
||||
// if (isEU && ATSDK.getGDPRDataLevel(App.this) == ATSDK.UNKNOWN) {
|
||||
// ATSDK.showGdprAuth(App.this);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onErrorCallback(String errorMsg) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// ATSDK.init( this, APPId, AppKey);
|
||||
//// ATDebuggerUITest.showDebuggerUI(this,debugKey);
|
||||
// AdManager.loadAllAd();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.hd.live.wall.wallpapers.act
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.hd.live.wall.wallpapers.adapter.AdaLike
|
||||
import com.hd.live.wall.wallpapers.base.BasisActivity
|
||||
import com.hd.live.wall.wallpapers.databinding.ActivityCollectionBinding
|
||||
import com.hd.live.wall.wallpapers.utils.ListDecoration
|
||||
import com.hd.live.wall.wallpapers.utils.dbManager
|
||||
import com.hd.live.wall.wallpapers.viewmode.VmCollction
|
||||
import io.objectbox.reactive.DataSubscription
|
||||
|
||||
class ActivityCollection : BasisActivity<ActivityCollectionBinding>() {
|
||||
|
||||
private var dataSubscription: DataSubscription? = null
|
||||
|
||||
private var vmCollction: VmCollction? = null
|
||||
override fun onClick(v: View?) {
|
||||
|
||||
v?.let {
|
||||
if(v == vb.ivBack){
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun getViewBinding(): ActivityCollectionBinding = ActivityCollectionBinding.inflate(layoutInflater)
|
||||
|
||||
override fun onCreateInit() {
|
||||
|
||||
val adaLike = AdaLike(this)
|
||||
vb.recycler.run {
|
||||
adapter = adaLike
|
||||
layoutManager = GridLayoutManager(
|
||||
this@ActivityCollection,
|
||||
2,
|
||||
RecyclerView.VERTICAL,
|
||||
false
|
||||
)
|
||||
addItemDecoration(
|
||||
ListDecoration(
|
||||
this@ActivityCollection,
|
||||
3,
|
||||
3,
|
||||
0
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
vmCollction = getActivityScopeViewModel<VmCollction>(
|
||||
VmCollction::class.java)
|
||||
|
||||
vmCollction!!.likeLiveData.observe(
|
||||
this@ActivityCollection
|
||||
) {
|
||||
adaLike.submitData(lifecycle, it)
|
||||
}
|
||||
dataSubscription = dbManager.setLikeUpdateListener { data ->
|
||||
if (data.size == 0) {
|
||||
vb.layoutEmpty.visibility = View.VISIBLE
|
||||
} else {
|
||||
vb.layoutEmpty.visibility = View.GONE
|
||||
}
|
||||
vmCollction!!.update(data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onInitClick() {
|
||||
vb.ivBack.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun isFullScreen(): Boolean = true
|
||||
|
||||
override fun statusBarLight(): Boolean = true
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
if (dataSubscription != null) {
|
||||
dataSubscription!!.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package com.hd.live.wall.wallpapers.act;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.hd.live.wall.wallpapers.R;
|
||||
import com.hd.live.wall.wallpapers.adapter.AdaViewP;
|
||||
import com.hd.live.wall.wallpapers.base.BasisActivity;
|
||||
import com.hd.live.wall.wallpapers.databinding.ActivityMainBinding;
|
||||
import com.hd.live.wall.wallpapers.databinding.MainTabBinding;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityMain extends BasisActivity<ActivityMainBinding> {
|
||||
|
||||
|
||||
@Override
|
||||
protected ActivityMainBinding getViewBinding() {
|
||||
return ActivityMainBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
fragmentList.add(FragmentLive.newInstance(0));
|
||||
fragmentList.add(FragmentLive.newInstance(3));
|
||||
fragmentList.add(FragmentLive.newInstance(2));
|
||||
// fragmentList.add(FragLike.newInstance());
|
||||
|
||||
AdaViewP adapter = new AdaViewP(this, fragmentList);
|
||||
vb.vp.setAdapter(adapter);
|
||||
new TabLayoutMediator(vb.tab, vb.vp, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
MainTabBinding inflate = MainTabBinding.inflate(getLayoutInflater());
|
||||
tab.setCustomView(inflate.getRoot());
|
||||
switch (position) {
|
||||
case 0:
|
||||
inflate.tabTitle.setText(ContextCompat.getString(ActivityMain.this, R.string.tab_Trending));
|
||||
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(ActivityMain.this, R.drawable.status_fire));
|
||||
break;
|
||||
case 1:
|
||||
inflate.tabTitle.setText(ContextCompat.getString(ActivityMain.this, R.string.tab_Explore));
|
||||
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(ActivityMain.this, R.drawable.status_xplore));
|
||||
break;
|
||||
case 2:
|
||||
inflate.tabTitle.setText(ContextCompat.getString(ActivityMain.this, R.string.tab_Shift));
|
||||
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(ActivityMain.this, R.drawable.status_shift));
|
||||
break;
|
||||
// case 3:
|
||||
// inflate.tabTitle.setText(ContextCompat.getString(ActMain.this, R.string.tab_Favorites));
|
||||
// inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(ActMain.this, R.drawable.selector_tab_like));
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}).attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitClick() {
|
||||
vb.ivFavorite.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(v.equals(vb.ivFavorite)){
|
||||
Intent intent = new Intent(this, ActivityCollection.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,351 @@
|
||||
package com.hd.live.wall.wallpapers.act;
|
||||
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.PlaybackException;
|
||||
import androidx.media3.common.Player;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.datasource.DefaultDataSourceFactory;
|
||||
import androidx.media3.exoplayer.ExoPlayer;
|
||||
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
|
||||
|
||||
import com.hd.live.wall.wallpapers.R;
|
||||
import com.hd.live.wall.wallpapers.base.BasisActivity;
|
||||
import com.hd.live.wall.wallpapers.databinding.ActivitySetWallpapersBinding;
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
import com.hd.live.wall.wallpapers.listener.ListenerResult;
|
||||
import com.hd.live.wall.wallpapers.retrofitman.ResBody;
|
||||
import com.hd.live.wall.wallpapers.retrofitman.DataRequest;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
import com.hd.live.wall.wallpapers.utils.LiveService;
|
||||
import com.hd.live.wall.wallpapers.utils.dbManager;
|
||||
import com.hd.live.wall.wallpapers.utils.Store;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class ActivitySetWallpaper extends BasisActivity<ActivitySetWallpapersBinding> implements ResBody.ProgressListener {
|
||||
|
||||
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
|
||||
private String filePath;
|
||||
private File mFile;
|
||||
|
||||
// private boolean download = false;
|
||||
|
||||
private ExoPlayer exoPlayer;
|
||||
|
||||
|
||||
private int id;
|
||||
private String image;
|
||||
private String describe;
|
||||
private String thumb;
|
||||
private int wallpaperType;
|
||||
|
||||
public static String KEY_ID = "ID";
|
||||
public static String KEY_image = "image";
|
||||
public static String KEY_describe = "describe";
|
||||
public static String KEY_wallpaperType = "wallpaperType";
|
||||
public static String KEY_thumb = "thumb";
|
||||
|
||||
// private boolean loadingui = false;
|
||||
private AtomicBoolean loadingui ;
|
||||
|
||||
private Disposable disposable;
|
||||
private String netFail, fileFail;
|
||||
@Override
|
||||
protected ActivitySetWallpapersBinding getViewBinding() {
|
||||
return ActivitySetWallpapersBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
showLoading(true, false);
|
||||
Intent intent = getIntent();
|
||||
id = intent.getIntExtra(KEY_ID, -1);
|
||||
wallpaperType = intent.getIntExtra(KEY_wallpaperType, -1);
|
||||
image = intent.getStringExtra(KEY_image);
|
||||
describe = intent.getStringExtra(KEY_describe);
|
||||
thumb = intent.getStringExtra(KEY_thumb);
|
||||
vb.tvDescribe.setText(describe);
|
||||
filePath = helper.getCachePath(id);
|
||||
mFile = new File(filePath);
|
||||
initExoPlay();
|
||||
initFavorite();
|
||||
fileFail = getString(R.string.loading_fail);
|
||||
netFail = getString(R.string.check_connection);
|
||||
if (mFile.exists()) {
|
||||
helper.logMsg("------checkPlay-");
|
||||
checkPlay();
|
||||
return;
|
||||
}
|
||||
loadingui = new AtomicBoolean(false);
|
||||
requestVideo();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void requestVideo() {
|
||||
|
||||
if (wallpaperType == 2) {
|
||||
//shift
|
||||
disposable = DataRequest.getInstance().getShiftMp4(id, image, filePath,this, new ListenerResult() {
|
||||
@Override
|
||||
public void onVideoResult(boolean success, String path) {
|
||||
helper.logMsg("-------------success =" + success + "--path=" + path);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (success) {
|
||||
checkPlay();
|
||||
} else {
|
||||
showRetry(netFail);
|
||||
helper.logMsg("-------------loading fail");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
disposable = DataRequest.getInstance().getMp4(id, image, filePath,this, new ListenerResult() {
|
||||
@Override
|
||||
public void onVideoResult(boolean success, String path) {
|
||||
helper.logMsg("-------------success =" + success + "--path=" + path);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (success) {
|
||||
checkPlay();
|
||||
} else {
|
||||
showRetry(netFail);
|
||||
helper.logMsg("-------------loading fail");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void initFavorite() {
|
||||
boolean b = dbManager.queryIsLike(id);
|
||||
vb.imFavorite.setSelected(b);
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
private void initExoPlay() {
|
||||
exoPlayer = new ExoPlayer.Builder(this)
|
||||
.build();
|
||||
exoPlayer.setRepeatMode(ExoPlayer.REPEAT_MODE_ONE);
|
||||
vb.playerView.setPlayer(exoPlayer);
|
||||
exoPlayer.addListener(new Player.Listener() {
|
||||
@Override
|
||||
public void onPlaybackStateChanged(int playbackState) {
|
||||
if (playbackState == Player.STATE_READY) {
|
||||
showLoading(false, true);
|
||||
helper.logMsg("-------onPlaybackStateChanged-----" + exoPlayer.getPlayWhenReady());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkPlay() {
|
||||
playMedia3();
|
||||
}
|
||||
|
||||
private void showLoading(boolean loading, boolean isHorizontal) {
|
||||
if (loading) {
|
||||
vb.layoutRetry.setVisibility(View.GONE);
|
||||
vb.relativeLoading.setVisibility(View.VISIBLE);
|
||||
if (isHorizontal) {
|
||||
vb.horizontalLayout.setVisibility(View.VISIBLE);
|
||||
vb.normalProgress.setVisibility(View.GONE);
|
||||
} else {
|
||||
vb.normalProgress.setVisibility(View.VISIBLE);
|
||||
vb.horizontalLayout.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
if (isHorizontal) {
|
||||
vb.horizontalProgress.setProgress(100);
|
||||
}
|
||||
vb.relativeLoading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showRetry(String msg) {
|
||||
Toast.makeText(ActivitySetWallpaper.this, msg, Toast.LENGTH_SHORT).show();
|
||||
vb.relativeLoading.setVisibility(View.VISIBLE);
|
||||
vb.horizontalLayout.setVisibility(View.GONE);
|
||||
vb.normalProgress.setVisibility(View.GONE);
|
||||
vb.layoutRetry.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitClick() {
|
||||
vb.like.setOnClickListener(this);
|
||||
vb.layoutSet.setOnClickListener(this);
|
||||
vb.layoutBack.setOnClickListener(this);
|
||||
vb.tvRetry.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.equals(vb.like)) {
|
||||
vb.imFavorite.setSelected(!vb.imFavorite.isSelected());
|
||||
boolean selected = vb.imFavorite.isSelected();
|
||||
if (selected) {
|
||||
Collection collection = new Collection(describe, id, image, wallpaperType, thumb);
|
||||
dbManager.insertLike(collection);
|
||||
} else {
|
||||
dbManager.deleteLike(id);
|
||||
}
|
||||
} else if (v.equals(vb.layoutSet)) {
|
||||
setLiveWallpaper();
|
||||
} else if (v.equals(vb.layoutBack)) {
|
||||
finish();
|
||||
} else if (v.equals(vb.tvRetry)) {
|
||||
requestVideo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (exoPlayer != null) {
|
||||
exoPlayer.release();
|
||||
}
|
||||
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
if (disposable != null && !disposable.isDisposed()) {
|
||||
helper.logMsg("-------------dispose");
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
private void playMedia3() {
|
||||
try {
|
||||
helper.logMsg("-------------playMedia3");
|
||||
Uri uriFromFilePath = helper.getUriFromFilePath(this, filePath);
|
||||
MediaItem mediaItem = MediaItem.fromUri(uriFromFilePath);
|
||||
ProgressiveMediaSource mediaSource = createMediaSource(mediaItem);
|
||||
exoPlayer.setMediaSource(mediaSource);
|
||||
exoPlayer.addListener(new Player.Listener() {
|
||||
@Override
|
||||
public void onPlayerError(PlaybackException error) {
|
||||
helper.logMsg("-------------onPlayerError");
|
||||
helper.deleteFile(mFile);
|
||||
showRetry(fileFail);
|
||||
}
|
||||
});
|
||||
exoPlayer.prepare();
|
||||
exoPlayer.play();
|
||||
} catch (Exception e) {
|
||||
helper.logMsg("-------" + e.getMessage());
|
||||
helper.deleteFile(mFile);
|
||||
showRetry(fileFail);
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
public ProgressiveMediaSource createMediaSource(MediaItem mediaItem) {
|
||||
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(
|
||||
this, "user-agent"
|
||||
);
|
||||
ProgressiveMediaSource.Factory factory = new ProgressiveMediaSource.Factory(dataSourceFactory);
|
||||
return factory.createMediaSource(mediaItem);
|
||||
}
|
||||
|
||||
|
||||
private void setLiveWallpaper() {
|
||||
if (mFile.exists()) {
|
||||
Store.INSTANCE.setVideo_path(filePath);
|
||||
helper.logMsg("----------setVideo_path---filePath=" + filePath);
|
||||
}
|
||||
|
||||
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
|
||||
try {
|
||||
wallpaperManager.clear();
|
||||
helper.logMsg("----------clear=");
|
||||
} catch (Exception e) {
|
||||
helper.logMsg("---------e=" + e.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
ComponentName componentName = new ComponentName(ActivitySetWallpaper.this, LiveService.class);
|
||||
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
|
||||
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, componentName);
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
helper.logMsg("---------e=" + e.getMessage());
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProgress(long bytesRead, long contentLength, boolean done) {
|
||||
|
||||
if (contentLength <= 0) {
|
||||
helper.logMsg("contentLength" + contentLength);
|
||||
} else {
|
||||
int progress = (int) ((100 * bytesRead) / contentLength);
|
||||
// Common.logMsg("Download progress: " + progress + "%"+"---loadingui="+loadingui);
|
||||
if (vb.horizontalProgress.getProgress() != progress) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(vb.horizontalLayout.getVisibility() != View.VISIBLE){
|
||||
showLoading(true, true);
|
||||
helper.logMsg("------------showLoading------11-----");
|
||||
}else {
|
||||
helper.logMsg("------------showLoading------22-----");
|
||||
}
|
||||
vb.horizontalProgress.setProgress(progress);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if (done) {
|
||||
helper.logMsg("Download complete!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.hd.live.wall.wallpapers.act;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
import android.view.View;
|
||||
|
||||
import com.hd.live.wall.wallpapers.base.BasisActivity;
|
||||
import com.hd.live.wall.wallpapers.databinding.ActivityWelBinding;
|
||||
|
||||
public class ActivityWel extends BasisActivity<ActivityWelBinding> {
|
||||
|
||||
private static final long SPLASH_TIME_OUT = 2000L;
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@Override
|
||||
protected ActivityWelBinding getViewBinding() {
|
||||
return ActivityWelBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateInit() {
|
||||
countDownTimer = new CountDownTimer(SPLASH_TIME_OUT,100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
|
||||
int v1 = (int) v;
|
||||
vb.progressBar.setProgress(v1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
vb.progressBar.setProgress(100);
|
||||
Intent intent = new Intent(ActivityWel.this, ActivityMain.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean statusBarLight() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(countDownTimer!= null){
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.hd.live.wall.wallpapers.act;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.paging.PagingData;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hd.live.wall.wallpapers.adapter.AdaMain;
|
||||
import com.hd.live.wall.wallpapers.base.BasisFragment;
|
||||
import com.hd.live.wall.wallpapers.databinding.FragmentHomeBinding;
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.utils.ListDecoration;
|
||||
import com.hd.live.wall.wallpapers.viewmode.VmMain;
|
||||
|
||||
public class FragmentLive extends BasisFragment<FragmentHomeBinding> {
|
||||
|
||||
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
|
||||
|
||||
private int wallpaperType;
|
||||
|
||||
private VmMain vmMain;
|
||||
|
||||
public FragmentLive() {
|
||||
|
||||
}
|
||||
public static FragmentLive newInstance(int type) {
|
||||
FragmentLive fragment = new FragmentLive();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_PARAM1, type);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
wallpaperType = getArguments().getInt(ARG_PARAM1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected FragmentHomeBinding getFragmentVb() {
|
||||
return FragmentHomeBinding.inflate(getLayoutInflater());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
AdaMain adaMain = new AdaMain(requireActivity());
|
||||
Vb.recycler.setAdapter(adaMain);
|
||||
Vb.recycler.setLayoutManager(new GridLayoutManager(requireContext(),2, RecyclerView.VERTICAL, false));
|
||||
Vb.recycler.addItemDecoration(new ListDecoration(requireContext(),3,3,0));
|
||||
vmMain = getFragmentScopeViewModel(VmMain.class);
|
||||
vmMain.getPagingData(wallpaperType).observe(getViewLifecycleOwner(), new Observer<PagingData<WallData>>() {
|
||||
@Override
|
||||
public void onChanged(PagingData<WallData> resultDataPagingData) {
|
||||
adaMain.submitData(requireActivity().getLifecycle(),resultDataPagingData);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package com.hd.live.wall.wallpapers.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.paging.PagingDataAdapter;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hd.live.wall.wallpapers.LiveApp;
|
||||
import com.hd.live.wall.wallpapers.R;
|
||||
import com.hd.live.wall.wallpapers.act.ActivitySetWallpaper;
|
||||
import com.hd.live.wall.wallpapers.base.BaseVH;
|
||||
import com.hd.live.wall.wallpapers.databinding.AdaLikeBinding;
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class AdaLike extends PagingDataAdapter<Collection, BaseVH<AdaLikeBinding>> {
|
||||
|
||||
private WeakReference<Activity> contextWeakReference;
|
||||
private Activity MContext;
|
||||
|
||||
public AdaLike(Activity context) {
|
||||
super(DIFF_CALLBACK);
|
||||
contextWeakReference = new WeakReference<>(context);
|
||||
MContext = contextWeakReference.get();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public BaseVH<AdaLikeBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
AdaLikeBinding inflate = AdaLikeBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new BaseVH<>(inflate);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull BaseVH<AdaLikeBinding> holder, int position) {
|
||||
AdaLikeBinding itemVb = holder.getItemVb();
|
||||
Collection item = getItem(position);
|
||||
|
||||
String thumbStr = LiveApp.getThumbStr() + item.getThumbnail();
|
||||
|
||||
Glide.with(MContext)
|
||||
.asDrawable()
|
||||
.load(thumbStr)
|
||||
.placeholder(R.drawable.im_placeholder)
|
||||
.centerCrop()
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
helper.logMsg(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(itemVb.imageThumb);
|
||||
itemVb.imageThumb.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MContext, ActivitySetWallpaper.class);
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_ID, item.getId());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_wallpaperType, item.getWallpapertype());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_image, item.getImage());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_describe, item.getDescription());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_thumb, item.getThumbnail());
|
||||
MContext.startActivity(intent);
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static final DiffUtil.ItemCallback<Collection> DIFF_CALLBACK = new DiffUtil.ItemCallback<Collection>() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull Collection oldItem, @NonNull Collection newItem) {
|
||||
return oldItem.getId() == newItem.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull Collection oldItem, @NonNull Collection newItem) {
|
||||
return oldItem.getId() == newItem.getId();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.hd.live.wall.wallpapers.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.paging.PagingDataAdapter;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hd.live.wall.wallpapers.LiveApp;
|
||||
import com.hd.live.wall.wallpapers.R;
|
||||
import com.hd.live.wall.wallpapers.act.ActivitySetWallpaper;
|
||||
import com.hd.live.wall.wallpapers.base.BaseVH;
|
||||
import com.hd.live.wall.wallpapers.databinding.AdaMainBinding;
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class AdaMain extends PagingDataAdapter<WallData, BaseVH<AdaMainBinding>> {
|
||||
|
||||
private WeakReference<Activity> contextWeakReference;
|
||||
private Activity MContext;
|
||||
|
||||
public AdaMain(Activity context) {
|
||||
super(DIFF_CALLBACK);
|
||||
contextWeakReference = new WeakReference<>(context);
|
||||
MContext = contextWeakReference.get();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public BaseVH<AdaMainBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
AdaMainBinding inflate = AdaMainBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new BaseVH<AdaMainBinding>(inflate);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull BaseVH<AdaMainBinding> holder, int position) {
|
||||
AdaMainBinding itemVb = holder.getItemVb();
|
||||
WallData item = getItem(position);
|
||||
|
||||
String thumbStr = LiveApp.getThumbStr() + item.getThumbnail();
|
||||
|
||||
Glide.with(MContext)
|
||||
.asDrawable()
|
||||
.load(thumbStr)
|
||||
.placeholder(R.drawable.im_placeholder)
|
||||
.centerCrop()
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
helper.logMsg(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(itemVb.imageThumb);
|
||||
itemVb.imageThumb.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(MContext, ActivitySetWallpaper.class);
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_ID, item.getId());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_wallpaperType, item.getWallpapertype());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_image, item.getImage());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_describe, item.getDescription());
|
||||
intent.putExtra(ActivitySetWallpaper.KEY_thumb, item.getThumbnail());
|
||||
MContext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static final DiffUtil.ItemCallback<WallData> DIFF_CALLBACK = new DiffUtil.ItemCallback<WallData>() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull WallData oldItem, @NonNull WallData newItem) {
|
||||
return oldItem.getId() == newItem.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull WallData oldItem, @NonNull WallData newItem) {
|
||||
return oldItem.getId() == newItem.getId();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.hd.live.wall.wallpapers.adapter;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AdaViewP extends FragmentStateAdapter {
|
||||
private final List<Fragment> fragmentList;
|
||||
|
||||
public AdaViewP(@NonNull FragmentActivity fragmentActivity, List<Fragment> fragmentList) {
|
||||
super(fragmentActivity);
|
||||
this.fragmentList = fragmentList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return fragmentList.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.hd.live.wall.wallpapers.base;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
public class BaseVH<T extends ViewBinding> extends RecyclerView.ViewHolder {
|
||||
|
||||
private T itemVb;
|
||||
|
||||
public BaseVH(@NonNull T itemView) {
|
||||
super(itemView.getRoot());
|
||||
itemVb = itemView;
|
||||
}
|
||||
|
||||
public T getItemVb() {
|
||||
return itemVb;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.hd.live.wall.wallpapers.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.core.view.WindowInsetsControllerCompat;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
import com.hd.live.wall.wallpapers.databinding.BaseActivityBinding;
|
||||
|
||||
|
||||
public abstract class BasisActivity<T extends ViewBinding> extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private final MyScope mMyScope = new MyScope();
|
||||
|
||||
protected T vb;
|
||||
|
||||
private Window window;
|
||||
private View decorView;
|
||||
protected View mView;
|
||||
private BaseActivityBinding rootVb;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
vb = getViewBinding();
|
||||
View root = vb.getRoot();
|
||||
rootVb = BaseActivityBinding.inflate(getLayoutInflater(), null, false);
|
||||
rootVb.frameLayout.addView(root);
|
||||
setContentView(rootVb.getRoot());
|
||||
window = getWindow();
|
||||
decorView = window.getDecorView();
|
||||
mView = decorView.getRootView();
|
||||
|
||||
setStatusBar();
|
||||
if (isFullScreen()) {
|
||||
initFullScreen();
|
||||
}
|
||||
onCreateInit();
|
||||
onInitClick();
|
||||
}
|
||||
|
||||
protected abstract T getViewBinding();
|
||||
|
||||
|
||||
protected abstract void onCreateInit();
|
||||
|
||||
protected abstract void onInitClick();
|
||||
|
||||
public abstract boolean isFullScreen();
|
||||
|
||||
public abstract boolean statusBarLight();
|
||||
|
||||
|
||||
private void setStatusBar() {
|
||||
//深色模式
|
||||
WindowInsetsControllerCompat insetsController = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
|
||||
insetsController.setAppearanceLightStatusBars(statusBarLight());
|
||||
}
|
||||
|
||||
private void initFullScreen() {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
protected <K extends ViewModel> K getActivityScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
return mMyScope.getActivityScopeViewModel(this, modelClass);
|
||||
}
|
||||
|
||||
protected <K extends ViewModel> K getApplicationScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
return mMyScope.getApplicationScopeViewModel(modelClass);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.hd.live.wall.wallpapers.base;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.viewbinding.ViewBinding;
|
||||
|
||||
|
||||
public abstract class BasisFragment<T extends ViewBinding> extends Fragment {
|
||||
private final MyScope mMyScope = new MyScope();
|
||||
protected T Vb;
|
||||
|
||||
protected AppCompatActivity mActivity;
|
||||
// protected VMApplication vmApplication;
|
||||
public BasisFragment() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
mActivity = (AppCompatActivity) context;
|
||||
}
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Vb = getFragmentVb();
|
||||
// vmApplication = getApplicationScopeViewModel(VMApplication.class);
|
||||
initView();
|
||||
return Vb.getRoot();
|
||||
}
|
||||
|
||||
protected abstract T getFragmentVb();
|
||||
protected abstract void initView();
|
||||
|
||||
protected <K extends ViewModel> K getFragmentScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
return mMyScope.getFragmentScopeViewModel(this, modelClass);
|
||||
}
|
||||
protected <K extends ViewModel> K getActivityScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
return mMyScope.getActivityScopeViewModel(mActivity, modelClass);
|
||||
}
|
||||
|
||||
protected <K extends ViewModel> K getApplicationScopeViewModel(@NonNull Class<K> modelClass) {
|
||||
return mMyScope.getApplicationScopeViewModel(modelClass);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.hd.live.wall.wallpapers.base;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
public class MyScope {
|
||||
private ViewModelProvider mFragmentProvider;
|
||||
private ViewModelProvider mActivityProvider;
|
||||
private ViewModelProvider mApplicationProvider;
|
||||
|
||||
public <T extends ViewModel> T getFragmentScopeViewModel(@NonNull Fragment fragment, @NonNull Class<T> modelClass) {
|
||||
if (mFragmentProvider == null) mFragmentProvider = new ViewModelProvider(fragment);
|
||||
return mFragmentProvider.get(modelClass);
|
||||
}
|
||||
|
||||
public <T extends ViewModel> T getActivityScopeViewModel(@NonNull AppCompatActivity activity, @NonNull Class<T> modelClass) {
|
||||
if (mActivityProvider == null) mActivityProvider = new ViewModelProvider(activity);
|
||||
return mActivityProvider.get(modelClass);
|
||||
}
|
||||
|
||||
public <T extends ViewModel> T getApplicationScopeViewModel(@NonNull Class<T> modelClass) {
|
||||
if (mApplicationProvider == null)
|
||||
mApplicationProvider = new ViewModelProvider(VmOwner.getInstance());
|
||||
return mApplicationProvider.get(modelClass);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.hd.live.wall.wallpapers.base;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModelStore;
|
||||
import androidx.lifecycle.ViewModelStoreOwner;
|
||||
|
||||
public class VmOwner implements ViewModelStoreOwner {
|
||||
private final static VmOwner sInstance = new VmOwner();
|
||||
private ViewModelStore mAppViewModelStore;
|
||||
|
||||
private VmOwner() {
|
||||
}
|
||||
|
||||
public static VmOwner getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewModelStore getViewModelStore() {
|
||||
if (mAppViewModelStore == null) mAppViewModelStore = new ViewModelStore();
|
||||
return mAppViewModelStore;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.hd.live.wall.wallpapers.dbData;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.objectbox.annotation.Entity;
|
||||
import io.objectbox.annotation.Id;
|
||||
|
||||
|
||||
@Entity
|
||||
public class Collection implements Serializable {
|
||||
@Id
|
||||
private long objectId;
|
||||
|
||||
private String description;
|
||||
private int id;
|
||||
private String image;
|
||||
//0 :trending 1:dnamic 2:shift 3:explore
|
||||
private int wallpapertype;
|
||||
private String thumbnail;
|
||||
public Collection(String description, int id, String image, int wallpapertype, String thumbnail) {
|
||||
this.description = description;
|
||||
this.id = id;
|
||||
this.image = image;
|
||||
this.wallpapertype = wallpapertype;
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
|
||||
public Collection(long objectId, String description, int id, String image, int wallpapertype, String thumbnail) {
|
||||
this.objectId = objectId;
|
||||
this.description = description;
|
||||
this.id = id;
|
||||
this.image = image;
|
||||
this.wallpapertype = wallpapertype;
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
|
||||
public int getWallpapertype() {
|
||||
return wallpapertype;
|
||||
}
|
||||
|
||||
public void setWallpapertype(int wallpapertype) {
|
||||
this.wallpapertype = wallpapertype;
|
||||
}
|
||||
|
||||
|
||||
public String getThumbnail() {
|
||||
return thumbnail;
|
||||
}
|
||||
|
||||
public void setThumbnail(String thumbnail) {
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package com.hd.live.wall.wallpapers.dbData;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.objectbox.annotation.Entity;
|
||||
import io.objectbox.annotation.Id;
|
||||
|
||||
@Entity
|
||||
public class WallData implements Serializable {
|
||||
|
||||
@Id
|
||||
private long objectId;
|
||||
|
||||
private String category;
|
||||
private String description;
|
||||
private String downloads;
|
||||
private int id;
|
||||
private String image;
|
||||
private int pro;
|
||||
|
||||
private String resolution;
|
||||
private String thumbnail;
|
||||
|
||||
//0 :trending 1:dnamic 2:shift 3:explore
|
||||
private int wallpapertype;
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(long objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
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 String getDownloads() {
|
||||
return downloads;
|
||||
}
|
||||
|
||||
public void setDownloads(String downloads) {
|
||||
this.downloads = downloads;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hd.live.wall.wallpapers.listener;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ListenerLike {
|
||||
void onLikeUpdate(List<Collection> data);
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.hd.live.wall.wallpapers.listener;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ListenerNet {
|
||||
|
||||
|
||||
|
||||
@POST("LiveLoop/AppData/jmywall.php")
|
||||
@FormUrlEncoded
|
||||
Observable<ResponseBody> getMP4(@Field("pi") int pi,
|
||||
@Field("medium") String medium,
|
||||
@Field("alpha") String alpha,
|
||||
@Field("version") String version,
|
||||
@Field("quality") String quality);
|
||||
|
||||
|
||||
|
||||
//shift
|
||||
@POST("LiveLoop/AppData/jshiftwall.php")
|
||||
@FormUrlEncoded
|
||||
Observable<ResponseBody> getShiftMP4(@Field("pi") int pi,
|
||||
@Field("medium") String medium,
|
||||
@Field("alpha") String alpha,
|
||||
@Field("version") String version,
|
||||
@Field("quality") String quality);
|
||||
|
||||
//
|
||||
// //Dnamic
|
||||
// @POST("LiveLoop/AppData/jdaytimewall.php")
|
||||
// @FormUrlEncoded
|
||||
// Observable<ResponseBody> getDMP4(@Field("pi") int pi,
|
||||
// @Field("medium") String medium,
|
||||
// @Field("alpha") String alpha,
|
||||
// @Field("version") String version,
|
||||
// @Field("quality") String quality,
|
||||
// @Field("filenumber") String filenumber);
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.hd.live.wall.wallpapers.listener;
|
||||
|
||||
public interface ListenerResult {
|
||||
void onVideoResult(boolean success,String path);
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.hd.live.wall.wallpapers.pages;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.paging.PagingSource;
|
||||
import androidx.paging.PagingState;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
import com.hd.live.wall.wallpapers.utils.dbManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kotlin.coroutines.Continuation;
|
||||
|
||||
public class PageSourceLike extends PagingSource<Integer, Collection> {
|
||||
public static int pageSize = 10;
|
||||
|
||||
public PageSourceLike() {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Integer getRefreshKey(@NonNull PagingState<Integer, Collection> pagingState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object load(@NonNull LoadParams<Integer> loadParams, @NonNull Continuation<? super LoadResult<Integer, Collection>> continuation) {
|
||||
|
||||
try {
|
||||
int page = loadParams.getKey() != null ? loadParams.getKey() : 1;
|
||||
|
||||
List<Collection> data = dbManager.queryLike(page);
|
||||
helper.logMsg("-----loadLIke---------page="+page+"--data="+data.size());
|
||||
return new LoadResult.Page<>(
|
||||
data,
|
||||
page > 1 ? page - 1 : null,
|
||||
data.isEmpty() ? null : page + 1
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new LoadResult.Error<>(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package com.hd.live.wall.wallpapers.pages;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.paging.PagingSource;
|
||||
import androidx.paging.PagingState;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.utils.dbManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import kotlin.coroutines.Continuation;
|
||||
|
||||
public class PageSourceMain extends PagingSource<Integer, WallData> {
|
||||
public static int pageSize = 20;
|
||||
private int wallpaperType;
|
||||
|
||||
public PageSourceMain(int wallpaperType) {
|
||||
this.wallpaperType = wallpaperType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Integer getRefreshKey(@NonNull PagingState<Integer, WallData> pagingState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object load(@NonNull LoadParams<Integer> loadParams, @NonNull Continuation<? super LoadResult<Integer, WallData>> continuation) {
|
||||
|
||||
try {
|
||||
int page = loadParams.getKey() != null ? loadParams.getKey() : 1;
|
||||
|
||||
List<WallData> data = dbManager.queryData(wallpaperType,page);
|
||||
// Common.logMsg("-----load---------"+wallpaperType+"----page="+page+"'--data="+data.size());
|
||||
return new LoadResult.Page<>(
|
||||
data,
|
||||
page > 1 ? page - 1 : null,
|
||||
data.isEmpty() ? null : page + 1
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new LoadResult.Error<>(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,128 @@
|
||||
package com.hd.live.wall.wallpapers.retrofitman;
|
||||
|
||||
import com.hd.live.wall.wallpapers.listener.ListenerNet;
|
||||
import com.hd.live.wall.wallpapers.utils.helper;
|
||||
import com.hd.live.wall.wallpapers.listener.ListenerResult;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.ResponseBody;
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
|
||||
|
||||
public class DataRequest {
|
||||
|
||||
private String base_Host = "https://neutrolabgames.com/";
|
||||
|
||||
private static volatile DataRequest REQUEST_MANAGER;
|
||||
private Retrofit.Builder builder;
|
||||
private OkHttpClient.Builder clientBuilder;
|
||||
|
||||
|
||||
private DataRequest() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private synchronized Retrofit getRetrofit(ResBody.ProgressListener listener) {
|
||||
if (builder == null) {
|
||||
builder = new Retrofit.Builder()
|
||||
.baseUrl(base_Host)
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
|
||||
|
||||
}
|
||||
if(clientBuilder == null){
|
||||
long DEFAULT_TIMEOUT = 5;
|
||||
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
|
||||
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
clientBuilder = new OkHttpClient.Builder()
|
||||
// .addNetworkInterceptor(new GzipInterceptor())
|
||||
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
|
||||
.writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
|
||||
.readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
|
||||
}
|
||||
clientBuilder.addInterceptor(new myInterceptor(listener));
|
||||
|
||||
return builder.client(clientBuilder.build()).build();
|
||||
}
|
||||
|
||||
public static DataRequest getInstance() {
|
||||
if (REQUEST_MANAGER == null) {
|
||||
synchronized (DataRequest.class) {
|
||||
if (REQUEST_MANAGER == null) {
|
||||
REQUEST_MANAGER = new DataRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
return REQUEST_MANAGER;
|
||||
}
|
||||
|
||||
|
||||
public Disposable getMp4(int id, String image, String path, ResBody.ProgressListener progressListener, ListenerResult listener) {
|
||||
Disposable subscribe = getRetrofit(progressListener).create(ListenerNet.class).getMP4(id, "5eV6snEwfY7Yv6Ub", image, "DL8", "ViewLive")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseBody>() {
|
||||
@Override
|
||||
public void accept(ResponseBody body) throws Exception {
|
||||
boolean b = helper.writeFile(body.byteStream(), path);
|
||||
listener.onVideoResult(b, path);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
listener.onVideoResult(false, throwable.getMessage());
|
||||
}
|
||||
});
|
||||
return subscribe;
|
||||
}
|
||||
|
||||
|
||||
public Disposable getShiftMp4(int id, String image, String path, ResBody.ProgressListener progressListener, ListenerResult listener) {
|
||||
Disposable subscribe = getRetrofit(progressListener).create(ListenerNet.class).getShiftMP4(id, "5eV6snEwfY7Yv6Ub", image, "DL8", "ViewShiftLive")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Consumer<ResponseBody>() {
|
||||
@Override
|
||||
public void accept(ResponseBody body) throws Exception {
|
||||
boolean b = helper.writeFile(body.byteStream(), path);
|
||||
listener.onVideoResult(b, path);
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
listener.onVideoResult(false, throwable.getMessage());
|
||||
}
|
||||
});
|
||||
return subscribe;
|
||||
}
|
||||
|
||||
|
||||
// public void getDnamicMp4(int id, String image,String path, OnVideoResultListener listener) {
|
||||
// musicApi.getDMP4(id,"5eV6snEwfY7Yv6Ub",image,"DL8","ViewTimerLive","1" )
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .unsubscribeOn(Schedulers.io())
|
||||
// .observeOn(Schedulers.io())
|
||||
// .subscribe(new ObserverWrapper<>(new OnRequestListener<ResponseBody>() {
|
||||
// @Override
|
||||
// public void onFail(String errorMsg) {
|
||||
// listener.onVideoResult(false,errorMsg);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(ResponseBody data) {
|
||||
// boolean b = Common.writeFile(data.byteStream(), path);
|
||||
// listener.onVideoResult(b,path);
|
||||
// }
|
||||
//
|
||||
// }));
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.hd.live.wall.wallpapers.retrofitman;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.ResponseBody;
|
||||
import okio.Buffer;
|
||||
import okio.BufferedSource;
|
||||
import okio.ForwardingSource;
|
||||
import okio.Okio;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ResBody extends ResponseBody {
|
||||
|
||||
private final ResponseBody responseBody;
|
||||
private final ProgressListener progressListener;
|
||||
private BufferedSource bufferedSource;
|
||||
private String length;
|
||||
|
||||
public ResBody(ResponseBody responseBody, String length, ProgressListener progressListener) {
|
||||
this.responseBody = responseBody;
|
||||
this.progressListener = progressListener;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaType contentType() {
|
||||
return responseBody.contentType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long contentLength() {
|
||||
return responseBody.contentLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedSource source() {
|
||||
if (bufferedSource == null) {
|
||||
bufferedSource = Okio.buffer(new ForwardingSource(responseBody.source()) {
|
||||
long totalBytesRead = 0L;
|
||||
|
||||
@Override
|
||||
public long read(Buffer sink, long byteCount) throws IOException {
|
||||
long bytesRead = super.read(sink, byteCount);
|
||||
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
|
||||
if (progressListener != null) {
|
||||
progressListener.onProgress(totalBytesRead, Long.parseLong(length), bytesRead == -1);
|
||||
}
|
||||
return bytesRead;
|
||||
}
|
||||
});
|
||||
}
|
||||
return bufferedSource;
|
||||
}
|
||||
|
||||
public interface ProgressListener {
|
||||
void onProgress(long bytesRead, long contentLength, boolean done);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.hd.live.wall.wallpapers.retrofitman;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class myInterceptor implements Interceptor {
|
||||
|
||||
private final ResBody.ProgressListener progressListener;
|
||||
|
||||
public myInterceptor(ResBody.ProgressListener progressListener) {
|
||||
this.progressListener = progressListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Response originalResponse = chain.proceed(chain.request());
|
||||
String fileLength = originalResponse.header("File-Length");
|
||||
if (fileLength == null) {
|
||||
fileLength = "0";
|
||||
}
|
||||
return originalResponse.newBuilder()
|
||||
.body(new ResBody(originalResponse.body(), fileLength, progressListener))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.hd.live.wall.wallpapers.utils;
|
||||
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.hd.live.wall.wallpapers.LiveApp;
|
||||
import com.hd.live.wall.wallpapers.R;
|
||||
|
||||
|
||||
public class FontTextView extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
|
||||
public FontTextView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initAttrs(context,attrs);
|
||||
}
|
||||
|
||||
|
||||
private void initAttrs(Context context, AttributeSet attrs){
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MyTextView);
|
||||
boolean aBoolean = typedArray.getBoolean(R.styleable.MyTextView_apply_font,false);
|
||||
if(aBoolean){
|
||||
setTypeface(LiveApp.getDefaultFont());
|
||||
}
|
||||
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.hd.live.wall.wallpapers.utils;
|
||||
|
||||
import android.content.Context;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
public class ListDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private int v, h, ex;
|
||||
|
||||
public ListDecoration(Context context, int v, int h, int ex) {
|
||||
this.v = Math.round(helper.dpToPx(context,v));
|
||||
this.h = Math.round(helper.dpToPx(context,h));
|
||||
this.ex = Math.round(helper.dpToPx(context,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;
|
||||
outRect.bottom = h;
|
||||
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,119 @@
|
||||
package com.hd.live.wall.wallpapers.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.service.wallpaper.WallpaperService
|
||||
import android.view.SurfaceHolder
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.datasource.DefaultDataSourceFactory
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.exoplayer.source.ProgressiveMediaSource
|
||||
import java.io.File
|
||||
|
||||
|
||||
class LiveService : WallpaperService() {
|
||||
|
||||
|
||||
override fun onCreateEngine(): Engine {
|
||||
return VideoWallpaperEngine()
|
||||
}
|
||||
|
||||
inner class VideoWallpaperEngine : Engine() {
|
||||
private var exoPlayer: ExoPlayer? = null
|
||||
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
private fun initExoPlay() {
|
||||
exoPlayer = ExoPlayer.Builder(this@LiveService).build()
|
||||
exoPlayer?.repeatMode = ExoPlayer.REPEAT_MODE_ONE
|
||||
update()
|
||||
}
|
||||
|
||||
override fun onCreate(surfaceHolder: SurfaceHolder?) {
|
||||
super.onCreate(surfaceHolder)
|
||||
helper.logMsg("-----Engine-----onCreate")
|
||||
initExoPlay()
|
||||
|
||||
}
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
override fun onSurfaceCreated(holder: SurfaceHolder?) {
|
||||
super.onSurfaceCreated(holder)
|
||||
val surface = holder?.surface
|
||||
if (surface != null) {
|
||||
exoPlayer?.setVideoSurface(surface)
|
||||
exoPlayer?.videoScalingMode = C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun onVisibilityChanged(visible: Boolean) {
|
||||
super.onVisibilityChanged(visible)
|
||||
helper.logMsg("-------Engine---onVisibilityChanged visible=$visible")
|
||||
if (visible) {
|
||||
update()
|
||||
exoPlayer?.play()
|
||||
} else {
|
||||
exoPlayer?.pause()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onSurfaceDestroyed(holder: SurfaceHolder?) {
|
||||
super.onSurfaceDestroyed(holder)
|
||||
helper.logMsg("------Engine----onSurfaceDestroyed---")
|
||||
exoPlayer?.release()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
helper.logMsg("-------Engine---onDestroy---")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
override fun onSurfaceChanged(
|
||||
holder: SurfaceHolder?,
|
||||
format: Int,
|
||||
width: Int,
|
||||
height: Int
|
||||
) {
|
||||
super.onSurfaceChanged(holder, format, width, height)
|
||||
|
||||
}
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
private fun update() {
|
||||
val uri = getVideoUrl(this@LiveService)
|
||||
// val test = "android.resource://" + packageName + "/" + R.raw.test1
|
||||
if (uri != null) {
|
||||
val fromUri = MediaItem.fromUri(uri)
|
||||
val mediaSource = ProgressiveMediaSource.Factory(
|
||||
DefaultDataSourceFactory(this@LiveService, "user-agent")
|
||||
).createMediaSource(fromUri)
|
||||
exoPlayer?.setMediaSource(mediaSource)
|
||||
exoPlayer?.prepare()
|
||||
exoPlayer?.playWhenReady = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun getVideoUrl(con: Context): Uri? {
|
||||
|
||||
val file = File(Store.video_path)
|
||||
val uri = if (file.isFile && file.exists()) {
|
||||
helper.getUriFromFilePath(con, Store.video_path)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
return uri
|
||||
}
|
||||
}
|
||||
53
app/src/main/java/com/hd/live/wall/wallpapers/utils/Store.kt
Normal file
53
app/src/main/java/com/hd/live/wall/wallpapers/utils/Store.kt
Normal file
@ -0,0 +1,53 @@
|
||||
package com.hd.live.wall.wallpapers.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.hd.live.wall.wallpapers.LiveApp
|
||||
|
||||
object Store {
|
||||
|
||||
val KEY_CURRENT_WAPPPAPER_PATH = "wallpaper_path"
|
||||
val DB_INIT_DATAT = "init_db_data"
|
||||
|
||||
private var shared: SharedPreferences? = null
|
||||
|
||||
var video_path: String
|
||||
get() = queryString(
|
||||
KEY_CURRENT_WAPPPAPER_PATH,
|
||||
""
|
||||
)
|
||||
set(value) {
|
||||
saveString(KEY_CURRENT_WAPPPAPER_PATH, value)
|
||||
}
|
||||
var dbinit: String
|
||||
get() = queryString(
|
||||
DB_INIT_DATAT,
|
||||
"0"
|
||||
)
|
||||
set(value) {
|
||||
saveString(DB_INIT_DATAT, value)
|
||||
}
|
||||
|
||||
private fun getShared(): SharedPreferences {
|
||||
if (shared == null) {
|
||||
shared = LiveApp.getApplication().getSharedPreferences("", Context.MODE_PRIVATE)
|
||||
}
|
||||
return shared!!
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fun saveString(key: String, value: String) {
|
||||
getShared().edit()
|
||||
.putString(key, value).apply()
|
||||
}
|
||||
|
||||
fun queryString(key: String, defaultValue: String): String {
|
||||
return getShared()
|
||||
.getString(key, defaultValue).orEmpty()
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
package com.hd.live.wall.wallpapers.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection_;
|
||||
import com.hd.live.wall.wallpapers.dbData.MyObjectBox;
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData_;
|
||||
import com.hd.live.wall.wallpapers.listener.ListenerLike;
|
||||
import com.hd.live.wall.wallpapers.pages.PageSourceLike;
|
||||
import com.hd.live.wall.wallpapers.pages.PageSourceMain;
|
||||
import java.util.List;
|
||||
import io.objectbox.Box;
|
||||
import io.objectbox.BoxStore;
|
||||
import io.objectbox.android.AndroidScheduler;
|
||||
import io.objectbox.query.Query;
|
||||
import io.objectbox.reactive.DataObserver;
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
import io.objectbox.reactive.DataSubscriptionList;
|
||||
|
||||
public class dbManager {
|
||||
|
||||
private static BoxStore boxStore;
|
||||
|
||||
private static Box<WallData> dataBox;
|
||||
private static Box<Collection> likeBox;
|
||||
|
||||
private static DataSubscription observer;
|
||||
|
||||
|
||||
public static void init(Context context) {
|
||||
boxStore = MyObjectBox.builder().androidContext(context).build();
|
||||
}
|
||||
|
||||
public static Box<WallData> getDataBox() {
|
||||
if (dataBox == null) {
|
||||
dataBox = boxStore.boxFor(WallData.class);
|
||||
}
|
||||
|
||||
return dataBox;
|
||||
}
|
||||
|
||||
public static Box<Collection> getLikeBox() {
|
||||
if (likeBox == null) {
|
||||
likeBox = boxStore.boxFor(Collection.class);
|
||||
}
|
||||
|
||||
return likeBox;
|
||||
}
|
||||
|
||||
public static DataSubscription setLikeUpdateListener(ListenerLike listener) {
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
Query<Collection> build = likeBox.query()
|
||||
.build();
|
||||
return build.subscribe(new DataSubscriptionList())
|
||||
.on(AndroidScheduler.mainThread())
|
||||
.observer(new DataObserver<List<Collection>>() {
|
||||
@Override
|
||||
public void onData(@NonNull List<Collection> data) {
|
||||
helper.logMsg("---OnLikeUpdateListener-------------" + data.size());
|
||||
listener.onLikeUpdate(data);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void insertDb(WallData wallData) {
|
||||
Box<WallData> objectBox = getDataBox();
|
||||
WallData first = objectBox.query()
|
||||
.equal(WallData_.wallpapertype, wallData.getWallpapertype())
|
||||
.equal(WallData_.id, wallData.getId())
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
// Common.logMsg("---insertDb------Wallpapertype------" + resultData.getWallpapertype() + "-------id=" + resultData.getId());
|
||||
objectBox.put(wallData);
|
||||
} else {
|
||||
// Common.logMsg("---insertDb-------------" + resultData.getWallpapertype() + "-------id=" + resultData.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void insertLike(Collection collection) {
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
Collection first = likeBox.query()
|
||||
.equal(Collection_.id, collection.getId())
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
helper.logMsg("---insertLike-----------------id=" + collection.getId());
|
||||
likeBox.put(collection);
|
||||
} else {
|
||||
helper.logMsg("---insertLike-----------------id=" + collection.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void deleteLike(int id) {
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
Collection first = likeBox.query()
|
||||
.equal(Collection_.id, id)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first != null) {
|
||||
likeBox.remove(first);
|
||||
helper.logMsg("---deleteLike-----------------id=" + id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// public static void deleteDownload(Data downloadData) {
|
||||
// Box<Data> objectBoxLike = getObjectBox();
|
||||
// String imId = downloadData.getImId();
|
||||
// Data boxLike = objectBoxLike.query()
|
||||
// .equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
// .build()
|
||||
// .findFirst();
|
||||
// if (boxLike != null) {
|
||||
// if (boxLike.isLike()) {
|
||||
// boxLike.setDownload(false);
|
||||
// objectBoxLike.put(boxLike);
|
||||
// } else {
|
||||
// objectBoxLike.remove(boxLike);
|
||||
// }
|
||||
// Log.d(MyWallpaper.TAG, "--------deleteDownload imId=" + imId);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
public static boolean queryIsLike(int id) {
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
Collection first = likeBox.query()
|
||||
.equal(Collection_.id, id)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static List<Collection> queryAllLike() {
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
return likeBox.query()
|
||||
.build()
|
||||
.find();
|
||||
}
|
||||
|
||||
public static List<WallData> queryData(int wallpaperType, int currentPage) {
|
||||
int offset = (currentPage - 1) * PageSourceMain.pageSize;
|
||||
|
||||
Box<WallData> objectBoxLike = getDataBox();
|
||||
List<WallData> data = objectBoxLike.query()
|
||||
.equal(WallData_.wallpapertype, wallpaperType)
|
||||
.build()
|
||||
.find(offset, PageSourceMain.pageSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
public static List<Collection> queryLike(int currentPage) {
|
||||
int offset = (currentPage - 1) * PageSourceLike.pageSize;
|
||||
Box<Collection> likeBox = getLikeBox();
|
||||
List<Collection> data = likeBox.query()
|
||||
.build()
|
||||
.find(offset, PageSourceLike.pageSize);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<WallData> queryAllData(int wallpaperType) {
|
||||
Box<WallData> objectBoxLike = getDataBox();
|
||||
List<WallData> data = objectBoxLike.query()
|
||||
.equal(WallData_.wallpapertype, wallpaperType)
|
||||
.build()
|
||||
.find();
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.hd.live.wall.wallpapers.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.hd.live.wall.wallpapers.LiveApp;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class helper {
|
||||
private static String TAG = "=============";
|
||||
|
||||
public static String getCovertStr(InputStream stream) {
|
||||
String covertStr = "";
|
||||
try {
|
||||
StringWriter writer = new StringWriter();
|
||||
char[] buffer = new char[stream.available()];
|
||||
Reader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
int a = 0;
|
||||
while ((a = reader.read(buffer)) != -1) {
|
||||
writer.write(buffer, 0, a);
|
||||
}
|
||||
covertStr = writer.toString();
|
||||
} catch (IOException e) {
|
||||
return covertStr;
|
||||
}
|
||||
return covertStr;
|
||||
}
|
||||
|
||||
public static void logMsg(String msg) {
|
||||
Log.d(TAG, msg);
|
||||
}
|
||||
|
||||
public static int dpToPx(Context context,int dp) {
|
||||
return Math.round(dp * (context.getResources().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT));
|
||||
}
|
||||
|
||||
public static int pxToDp(Context context,int px) {
|
||||
return Math.round(px / (context.getResources().getDisplayMetrics().xdpi / DisplayMetrics.DENSITY_DEFAULT));
|
||||
}
|
||||
|
||||
public static Boolean deleteFile(File file) {
|
||||
return file.exists() && file.delete();
|
||||
}
|
||||
|
||||
public static boolean writeFile(InputStream input, String filePath) {
|
||||
try {
|
||||
byte[] byteArray = new byte[4096];
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
int bytesRead;
|
||||
while ((bytesRead = input.read(byteArray)) != -1) {
|
||||
output.write(byteArray, 0, bytesRead);
|
||||
}
|
||||
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
|
||||
fileOutputStream.write(output.toByteArray());
|
||||
output.close();
|
||||
fileOutputStream.close();
|
||||
helper.logMsg("-------------onSuccess return true");
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
Log.d("-----------", "---------ex=" + ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCachePath(int id){
|
||||
LiveApp application = LiveApp.getApplication();
|
||||
String s1 = application.getCacheDir() +"/"+ id+".mp4";
|
||||
return s1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Uri getUriFromFilePath(Context context, String filePath) {
|
||||
File file = new File(filePath);
|
||||
|
||||
// 使用 FileProvider 获取 URI
|
||||
return FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", file);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.hd.live.wall.wallpapers.viewmode;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.paging.Pager;
|
||||
import androidx.paging.PagingConfig;
|
||||
import androidx.paging.PagingData;
|
||||
import androidx.paging.PagingLiveData;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.Collection;
|
||||
import com.hd.live.wall.wallpapers.pages.PageSourceLike;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class VmCollction extends ViewModel {
|
||||
|
||||
public Pager<Integer, Collection> pager;
|
||||
|
||||
|
||||
|
||||
private MutableLiveData<PagingData<Collection>> _likeLiveData = new MutableLiveData<>();
|
||||
public LiveData<PagingData<Collection>> likeLiveData = _likeLiveData ;
|
||||
|
||||
public LiveData<PagingData<Collection>> getPagingData() {
|
||||
Pager<Integer, Collection> integerLikeDataPager = new Pager<>(
|
||||
new PagingConfig(10), // 每页加载 20 条数据
|
||||
PageSourceLike::new
|
||||
);
|
||||
|
||||
return PagingLiveData.getLiveData(integerLikeDataPager);
|
||||
}
|
||||
public void update(List<Collection> data){
|
||||
PagingData<Collection> from = PagingData.from(data);
|
||||
_likeLiveData.postValue(from);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.hd.live.wall.wallpapers.viewmode;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.paging.Pager;
|
||||
import androidx.paging.PagingConfig;
|
||||
import androidx.paging.PagingData;
|
||||
import androidx.paging.PagingLiveData;
|
||||
|
||||
import com.hd.live.wall.wallpapers.dbData.WallData;
|
||||
import com.hd.live.wall.wallpapers.pages.PageSourceMain;
|
||||
|
||||
|
||||
public class VmMain extends ViewModel {
|
||||
|
||||
public LiveData<PagingData<WallData>> getPagingData(int wallpaperType) {
|
||||
|
||||
return PagingLiveData.getLiveData(new Pager<>(
|
||||
new PagingConfig(10),
|
||||
() -> new PageSourceMain(wallpaperType)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
6
app/src/main/res/color/selector_title.xml
Normal file
6
app/src/main/res/color/selector_title.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/color_7D88FA" android:state_selected="true"/>
|
||||
<item android:color="@color/tab_gray_color" android:state_selected="false"/>
|
||||
|
||||
</selector>
|
||||
9
app/src/main/res/drawable/back_ff.xml
Normal file
9
app/src/main/res/drawable/back_ff.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
39
app/src/main/res/drawable/im_no_collection.xml
Normal file
39
app/src/main/res/drawable/im_no_collection.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="72.7dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1163"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M1103.8,383.2h-15a15,15 0,0 0,0 30h15v15a15,15 0,0 0,30 0v-15h15a15,15 0,0 0,0 -30h-15v-15a15,15 0,0 0,-30 0v15z"
|
||||
android:fillColor="#F4F4F4"/>
|
||||
<path
|
||||
android:pathData="M0,151.7a25.3,25.3 0,1 0,50.6 0,25.3 25.3,0 0,0 -50.6,0z"
|
||||
android:fillColor="#F4F4F4"/>
|
||||
<path
|
||||
android:pathData="M970,763.9L839.8,455.1H310.6L180.4,763.9H177V1024h796.4V763.9z"
|
||||
android:fillColor="#F8F8F8"/>
|
||||
<path
|
||||
android:pathData="M973.4,1024H177V763.9h3.4L310.6,455.1h529.1L970,763.9h2.5l0.9,7.3V1024h-0zM191.9,1009.4h766.6l-0.4,-235.3 -128.3,-304.3H320.6L191.9,774.9v234.5z"
|
||||
android:fillColor="#CCCCCC"/>
|
||||
<path
|
||||
android:pathData="M309.8,657.4L189.6,1005.9l15.5,5.5 120.2,-348.5L309.8,657.4zM828,657.4L948.1,1005.9 932.7,1011.4 812.5,662.9 828,657.4z"
|
||||
android:fillColor="#CCCCCC"/>
|
||||
<path
|
||||
android:pathData="M492.3,758.5H177v265.5h796.4V758.5H658.2a83,83 0,1 1,-165.9 0z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M973.4,1024H177V758.5h315l0.6,6.9c3.5,42.7 39.8,76.1 82.7,76.1 42.9,0 79.2,-33.4 82.7,-76.1l0.6,-6.9H973.4v265.5h-0zM191.9,1009.1h766.6V773.4H671.9c-7.2,47 -48.5,83 -96.7,83 -48.3,0 -89.5,-35.9 -96.8,-83H191.9V1009.1z"
|
||||
android:fillColor="#CCCCCC"/>
|
||||
<path
|
||||
android:pathData="M303.4,455.1h531v227.6H303.4z"
|
||||
android:fillColor="#F4F4F4"/>
|
||||
<path
|
||||
android:pathData="M834.4,682.7L303.4,682.7L303.4,455.1h531v227.6zM318.3,668L819.5,668L819.5,469.7L318.3,469.7v198.3z"
|
||||
android:fillColor="#CCCCCC"/>
|
||||
<path
|
||||
android:pathData="M506.3,593.1c11,-5.9 21.9,-12.1 32.7,-18.4 4.3,-2.7 5.8,-8.6 3.4,-13.3 -2.4,-4.7 -7.8,-6.5 -12.2,-4.1 -10.3,6.1 -21.1,12.1 -32.2,18.1a9.9,9.9 0,0 0,-5 8.3,10.2 10.2,0 0,0 4.1,8.8 8.6,8.6 0,0 0,9.1 0.6zM570.3,555.1a764,764 0,0 0,32.3 -19.9,9 9,0 0,0 2.6,-12.8 9.6,9.6 0,0 0,-13.1 -2.5,754.3 754.3,0 0,1 -31.5,19.4 9.1,9.1 0,0 0,-3 12.5,9.6 9.6,0 0,0 12.7,3.3zM635.2,516.8a519,519 0,0 0,31.5 -21.8c4.1,-3.1 4.5,-8.4 0.8,-11.9 -3.7,-3.5 -10,-3.7 -14.1,-0.7a500.2,500.2 0,0 1,-30.3 20.9c-4.1,2.9 -4.8,8 -1.5,11.5 3.2,3.6 9.3,4.4 13.7,1.8zM684.7,477.2c7.9,-10.1 15.2,-20.8 22,-32 2.4,-4.5 1.4,-10.4 -2.3,-13.5 -3.7,-3.1 -8.7,-2.2 -11.5,1.9 -6.3,10.5 -13.2,20.5 -20.6,30a11.3,11.3 0,0 0,0.5 14.1c3.5,3.7 8.8,3.5 11.9,-0.6zM734.8,399.8c-1.9,4.2 -6.3,6 -9.9,3.9 -3.7,-2.1 -5.3,-7.2 -3.6,-11.6 4.3,-10.5 7.6,-21 9.9,-31.7 1.1,-4.6 5.2,-7.3 9.1,-6.2 3.9,1.2 6.4,5.9 5.5,10.6 -2.6,12 -6.3,23.8 -10.9,35zM745.9,332.3a80.2,80.2 0,0 0,-11.3 -37.8c-2.4,-4 -7.2,-5 -10.7,-2.2 -3.5,2.8 -4.3,8.3 -1.9,12.2 5,8.3 8,17.9 8.6,28.8 0.4,4.7 4,8.2 8.1,7.9 4.1,-0.3 7.3,-4.3 7.2,-9zM703,263.3a123.8,123.8 0,0 0,-35.6 -10.3,9.1 9.1,0 0,0 -8.1,2.8 7.2,7.2 0,0 0,-1.3 7.8c1.1,2.6 3.7,4.5 6.8,4.9 10.5,1.4 20.7,4.3 30.2,8.7 2.7,1.4 6.1,1.4 8.8,-0.1a7.6,7.6 0,0 0,4.1 -7.1,7.8 7.8,0 0,0 -4.9,-6.6zM621.6,253c-15.3,3.1 -28.3,9.8 -37.3,19.8a11.6,11.6 0,0 0,-2.5 10c0.7,3.6 3.1,6.5 6.1,7.6 3.1,1.1 6.4,0.1 8.7,-2.4 6.2,-6.8 16,-11.9 28.1,-14.4 4.9,-1 8.1,-6.4 7.3,-12.1 -0.9,-5.7 -5.5,-9.5 -10.4,-8.5zM581.9,315.4c3.3,11.3 10.4,23.1 21.3,35.5a9.3,9.3 0,0 0,13.1 0.8,9.4 9.4,0 0,0 0.8,-13.2c-9.2,-10.4 -14.9,-20 -17.4,-28.3a9.3,9.3 0,1 0,-15.6 -3.8,9.4 9.4,0 0,0 -2.2,9.1zM623.1,372.6a118.4,118.4 0,0 0,35.4 18.9c3.1,1 6.4,0.1 8.8,-2.5a11.3,11.3 0,0 0,2.5 -9.9c-0.8,-3.6 -3.2,-6.4 -6.3,-7.4a101.3,101.3 0,0 1,-30.2 -16.2c-4.1,-2.8 -9.5,-1.5 -12.2,3.1 -2.7,4.6 -1.7,10.8 2.1,14.1zM704.2,391.9a8.3,8.3 0,0 1,-7.5 -4.3,10.1 10.1,0 0,1 -0.4,-9.3 8.5,8.5 0,0 1,7.2 -5c10.6,-0.6 21.1,-2.7 31.3,-6.1a7.9,7.9 0,0 1,8.4 2c2.3,2.3 3.2,5.8 2.5,9.1a9,9 0,0 1,-6 6.8c-11.5,4 -23.4,6.3 -35.5,6.9zM785.3,378c11.4,-6 22.4,-12.8 32.9,-20.2a9.1,9.1 0,0 0,1.8 -12.6,9.5 9.5,0 0,0 -12.8,-2.4 276.6,276.6 0,0 1,-30.8 18.9,9.2 9.2,0 0,0 -5.2,7.9 9.2,9.2 0,0 0,4.5 8.3c2.9,1.7 6.6,1.8 9.6,0.1zM838.7,326.9a498.7,498.7 0,0 0,30.8 -22.6c3.8,-3.2 3.7,-8.2 -0.4,-11.3a12.7,12.7 0,0 0,-14.5 0c-9.5,7.5 -19.4,14.8 -29.6,21.7 -4.1,3 -4.4,7.9 -0.7,11.2 3.7,3.3 10.1,3.7 14.4,1zM887.1,287.6c7.5,-10.3 14.7,-20.9 21.6,-31.7 2.6,-4.4 1.8,-10.5 -1.9,-13.7 -3.7,-3.2 -8.9,-2.5 -11.8,1.7 -6.7,10.5 -13.7,20.7 -21,30.7 -2.8,4.2 -2.3,10.3 1.2,13.8 3.5,3.5 8.7,3.1 11.8,-0.8zM939.8,223.1a748.9,748.9 0,0 0,19.7 -31.9,9.5 9.5,0 0,0 0.1,-9.4 9.1,9.1 0,0 0,-7.8 -4.8,9.1 9.1,0 0,0 -8,4.6 740,740 0,0 1,-19.3 31.2,9.5 9.5,0 0,0 -0.9,9.5 9.1,9.1 0,0 0,7.8 5.3,9.1 9.1,0 0,0 8.2,-4.5zM976,159.6c3.2,-6.7 6.3,-13.5 9.4,-20.3 1.7,-4.4 0.1,-9.6 -3.8,-11.8 -3.9,-2.2 -8.6,-0.6 -10.7,3.6a795.9,795.9 0,0 1,-9.1 19.9c-2.1,4.4 -0.6,10 3.3,12.4 3.9,2.4 8.8,0.7 11,-3.7z"
|
||||
android:fillColor="#CCCCCC"/>
|
||||
<path
|
||||
android:pathData="M651.1,88.5C626.7,88.5 606.8,68.6 606.8,44.2S626.7,0 651.1,0 695.3,19.8 695.3,44.2 675.5,88.5 651.1,88.5zM651.1,16.3A28,28 0,0 0,623.1 44.2c0,15.4 12.5,28 28,28A28,28 0,0 0,679.1 44.2,28 28,0 0,0 651.1,16.3z"
|
||||
android:fillColor="#D8D8D8"/>
|
||||
</vector>
|
||||
25
app/src/main/res/drawable/im_placeholder.xml
Normal file
25
app/src/main/res/drawable/im_placeholder.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M972.8,0a51.2,51.2 0,0 1,51.2 51.2v921.6a51.2,51.2 0,0 1,-51.2 51.2H51.2a51.2,51.2 0,0 1,-51.2 -51.2V51.2a51.2,51.2 0,0 1,51.2 -51.2h921.6z"
|
||||
android:fillColor="#BEBEBE"/>
|
||||
<path
|
||||
android:pathData="M755.2,448L1024,716.8v256a51.2,51.2 0,0 1,-51.2 51.2H51.2a51.2,51.2 0,0 1,-51.2 -51.2v-113.2l294.4,-294.4 171.8,171.8L755.2,448z"
|
||||
android:strokeAlpha="0.694"
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillAlpha="0.694"/>
|
||||
<path
|
||||
android:pathData="M332.8,332.8m-102.4,0a102.4,102.4 0,1 0,204.8 0,102.4 102.4,0 1,0 -204.8,0Z"
|
||||
android:strokeAlpha="0.694"
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillAlpha="0.694"/>
|
||||
<path
|
||||
android:pathData="M972.8,0a51.2,51.2 0,0 1,51.2 51.2v921.6a51.2,51.2 0,0 1,-51.2 51.2L51.2,1024a51.2,51.2 0,0 1,-51.2 -51.2L0,51.2a51.2,51.2 0,0 1,51.2 -51.2h921.6zM870.4,153.6L153.6,153.6v716.8h716.8L870.4,153.6z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
<path
|
||||
android:pathData="M972.8,0a51.2,51.2 0,0 1,51.2 51.2v921.6a51.2,51.2 0,0 1,-51.2 51.2L51.2,1024a51.2,51.2 0,0 1,-51.2 -51.2L0,51.2a51.2,51.2 0,0 1,51.2 -51.2h921.6zM972.8,25.6L51.2,25.6a25.6,25.6 0,0 0,-25.4 22.6L25.6,51.2v921.6a25.6,25.6 0,0 0,22.6 25.4L51.2,998.4h921.6a25.6,25.6 0,0 0,25.4 -22.6L998.4,972.8L998.4,51.2a25.6,25.6 0,0 0,-22.6 -25.4L972.8,25.6z"
|
||||
android:fillColor="#D9D9D9"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/line_explore.xml
Normal file
9
app/src/main/res/drawable/line_explore.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/color_7D88FA"
|
||||
android:pathData="M512,465.1c-25.6,0 -46.9,21.3 -46.9,46.9s21.3,46.9 46.9,46.9c25.6,0 46.9,-21.3 46.9,-46.9s-21.3,-46.9 -46.9,-46.9zM512,85.3C277.3,85.3 85.3,277.3 85.3,512s192,426.7 426.7,426.7 426.7,-192 426.7,-426.7S746.7,85.3 512,85.3zM605.9,605.9L256,768l162.1,-349.9L768,256l-162.1,349.9z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/line_favorite.xml
Normal file
9
app/src/main/res/drawable/line_favorite.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M910.9,364.8l-1.3,-10.1a237,237 0,0 0,-6.2 -28,201.4 201.4,0 0,0 -42.6,-80 46.1,46.1 0,0 0,-3.8 -4.5,212 212,0 0,0 -160,-71.7c-75.7,0 -146.7,29.8 -185.1,74.1 -38.4,-44.3 -109.6,-74.1 -185.1,-74.1a212,212 0,0 0,-160 71.7,46.1 46.1,0 0,0 -3.8,4.5 201.4,201.4 0,0 0,-42.6 80,237 237,0 0,0 -6.2,28l-1.3,10.1A186.4,186.4 0,0 0,112 385.9a205.3,205.3 0,0 0,1.1 21.3c16,194.1 368,423.2 382.9,433l16,10.4 16,-10.4c15,-9.6 367,-238.7 382.9,-433a205.3,205.3 0,0 0,1.1 -21.3,186.4 186.4,0 0,0 -1.1,-21.1z"
|
||||
android:fillColor="@color/color_red"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/line_shift.xml
Normal file
9
app/src/main/res/drawable/line_shift.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/color_7D88FA"
|
||||
android:pathData="M469.3,173.7L469.3,87.5c-85.8,8.5 -163.8,42.7 -227.2,94.3l60.8,60.8c47.4,-36.5 104.1,-61.2 166.4,-68.9zM781.9,181.8A425.2,425.2 0,0 0,554.7 87.5v86.2c62.3,7.9 119,32.4 166.4,69.1l60.8,-61zM850.3,469.3h86.2c-8.5,-85.8 -42.7,-163.8 -94.3,-227.2l-60.8,60.8c36.5,47.4 61.2,104.1 68.9,166.4zM242.8,302.9l-60.8,-60.8C130.1,305.5 96,383.6 87.5,469.3h86.2c7.9,-62.3 32.4,-119 69.1,-166.4zM173.7,554.7L87.5,554.7c8.5,85.8 42.7,163.8 94.3,227.2l60.8,-60.8A343.4,343.4 0,0 1,173.7 554.7zM640,512c0,-70.6 -57.4,-128 -128,-128s-128,57.4 -128,128 57.4,128 128,128 128,-57.4 128,-128zM781.2,720.9l60.8,60.8C893.9,718.5 928,640.4 936.5,554.7h-86.2c-7.7,62.1 -32.4,119 -69.1,166.2zM554.7,850.3v86.2c85.8,-8.5 163.8,-42.7 227.2,-94.3l-60.8,-60.8a342.5,342.5 0,0 1,-166.4 68.9zM242.1,842.2C305.5,893.9 383.6,928 469.3,936.5v-86.2c-62.3,-7.9 -119,-32.4 -166.4,-69.1l-60.8,61z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/line_trending.xml
Normal file
9
app/src/main/res/drawable/line_trending.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M401.9,9.2A65,65 0,0 1,466.6 8c291.6,135.5 456.7,416.8 446.5,652 -4.4,98.8 -39.7,190.3 -108.3,257.1 -68.6,66.9 -167.1,105.9 -291.8,106.1a379.3,379.3 0,0 1,-402.4 -363.3v-0.6a320.4,320.4 0,0 1,164.6 -288.2,36.6 36.6,0 0,1 51.2,17.2A366.1,366.1 0,0 0,400.1 497.1c36.1,-47.2 52.8,-108.1 52.3,-175.1 -0.6,-79.7 -25.6,-165.2 -67.6,-238A55.6,55.6 0,0 1,401.9 9.2z"
|
||||
android:fillColor="@color/color_7D88FA"/>
|
||||
</vector>
|
||||
8
app/src/main/res/drawable/main_bg.xml
Normal file
8
app/src/main/res/drawable/main_bg.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient android:startColor="@color/color_E9BCFE"
|
||||
android:endColor="@color/color_ACDFFE"
|
||||
android:angle="225"/>
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/outline_explore.xml
Normal file
9
app/src/main/res/drawable/outline_explore.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/tab_gray_color"
|
||||
android:pathData="M512,465.1c-25.6,0 -46.9,21.3 -46.9,46.9s21.3,46.9 46.9,46.9c25.6,0 46.9,-21.3 46.9,-46.9s-21.3,-46.9 -46.9,-46.9zM512,85.3C277.3,85.3 85.3,277.3 85.3,512s192,426.7 426.7,426.7 426.7,-192 426.7,-426.7S746.7,85.3 512,85.3zM605.9,605.9L256,768l162.1,-349.9L768,256l-162.1,349.9z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/outline_favorite.xml
Normal file
9
app/src/main/res/drawable/outline_favorite.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M908.8,214.4c-9.6,-12.8 -19.2,-22.4 -28.8,-32 -112,-115.2 -230.4,-105.6 -342.4,-16 -9.6,6.4 -19.2,16 -28.8,25.6 -9.6,-9.6 -19.2,-16 -28.8,-25.6 -112,-86.4 -230.4,-99.2 -342.4,16 -9.6,9.6 -19.2,19.2 -25.6,32 -134.4,195.2 -60.8,387.2 137.6,560 44.8,38.4 89.6,73.6 137.6,102.4 16,9.6 32,19.2 44.8,28.8 9.6,6.4 12.8,9.6 19.2,9.6 3.2,3.2 6.4,3.2 12.8,6.4 3.2,3.2 9.6,3.2 16,6.4 25.6,6.4 64,3.2 89.6,-12.8 3.2,0 9.6,-3.2 16,-9.6 12.8,-6.4 28.8,-16 44.8,-28.8 48,-28.8 92.8,-64 137.6,-102.4 201.6,-176 275.2,-368 140.8,-560zM736,732.8c-41.6,35.2 -86.4,70.4 -131.2,99.2 -16,9.6 -28.8,19.2 -44.8,25.6 -6.4,3.2 -12.8,6.4 -16,9.6 -6.4,3.2 -16,6.4 -25.6,9.6h-28.8s-3.2,0 -3.2,-3.2c-3.2,0 -6.4,-3.2 -9.6,-3.2 -3.2,-3.2 -9.6,-6.4 -16,-9.6 -12.8,-6.4 -28.8,-16 -44.8,-25.6 -44.8,-28.8 -89.6,-60.8 -131.2,-99.2C105.6,576 41.6,412.8 153.6,246.4c6.4,-9.6 16,-16 22.4,-25.6 89.6,-96 182.4,-86.4 275.2,-12.8 9.6,6.4 16,12.8 22.4,19.2l28.8,32 6.4,6.4 16,-16c12.8,-12.8 25.6,-25.6 41.6,-38.4C659.2,137.6 752,128 841.6,224c6.4,9.6 16,16 22.4,25.6 118.4,156.8 54.4,323.2 -128,483.2z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/outline_shift.xml
Normal file
9
app/src/main/res/drawable/outline_shift.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/tab_gray_color"
|
||||
android:pathData="M469.3,173.7L469.3,87.5c-85.8,8.5 -163.8,42.7 -227.2,94.3l60.8,60.8c47.4,-36.5 104.1,-61.2 166.4,-68.9zM781.9,181.8A425.2,425.2 0,0 0,554.7 87.5v86.2c62.3,7.9 119,32.4 166.4,69.1l60.8,-61zM850.3,469.3h86.2c-8.5,-85.8 -42.7,-163.8 -94.3,-227.2l-60.8,60.8c36.5,47.4 61.2,104.1 68.9,166.4zM242.8,302.9l-60.8,-60.8C130.1,305.5 96,383.6 87.5,469.3h86.2c7.9,-62.3 32.4,-119 69.1,-166.4zM173.7,554.7L87.5,554.7c8.5,85.8 42.7,163.8 94.3,227.2l60.8,-60.8A343.4,343.4 0,0 1,173.7 554.7zM640,512c0,-70.6 -57.4,-128 -128,-128s-128,57.4 -128,128 57.4,128 128,128 128,-57.4 128,-128zM781.2,720.9l60.8,60.8C893.9,718.5 928,640.4 936.5,554.7h-86.2c-7.7,62.1 -32.4,119 -69.1,166.2zM554.7,850.3v86.2c85.8,-8.5 163.8,-42.7 227.2,-94.3l-60.8,-60.8a342.5,342.5 0,0 1,-166.4 68.9zM242.1,842.2C305.5,893.9 383.6,928 469.3,936.5v-86.2c-62.3,-7.9 -119,-32.4 -166.4,-69.1l-60.8,61z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/outline_trending.xml
Normal file
9
app/src/main/res/drawable/outline_trending.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="256dp"
|
||||
android:height="256dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M401.9,9.2A65,65 0,0 1,466.6 8c291.6,135.5 456.7,416.8 446.5,652 -4.4,98.8 -39.7,190.3 -108.3,257.1 -68.6,66.9 -167.1,105.9 -291.8,106.1a379.3,379.3 0,0 1,-402.4 -363.3v-0.6a320.4,320.4 0,0 1,164.6 -288.2,36.6 36.6,0 0,1 51.2,17.2A366.1,366.1 0,0 0,400.1 497.1c36.1,-47.2 52.8,-108.1 52.3,-175.1 -0.6,-79.7 -25.6,-165.2 -67.6,-238A55.6,55.6 0,0 1,401.9 9.2z"
|
||||
android:fillColor="@color/tab_gray_color"/>
|
||||
</vector>
|
||||
6
app/src/main/res/drawable/oval.xml
Normal file
6
app/src/main/res/drawable/oval.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/color_8004122A" />
|
||||
|
||||
</shape>
|
||||
20
app/src/main/res/drawable/progessbar_splash.xml
Normal file
20
app/src/main/res/drawable/progessbar_splash.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<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="@color/color_989292" /> <!-- 背景颜色 -->
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<gradient
|
||||
android:startColor="@color/color_C384F9"
|
||||
android:endColor="@color/color_4483FD"
|
||||
android:angle="0" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
20
app/src/main/res/drawable/progress_main.xml
Normal file
20
app/src/main/res/drawable/progress_main.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<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/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="20dp" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="@color/color_C384F9"
|
||||
android:startColor="@color/color_4483FD" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
8
app/src/main/res/drawable/rectangle_16.xml
Normal file
8
app/src/main/res/drawable/rectangle_16.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<gradient android:startColor="@color/color_C384F9"
|
||||
android:endColor="@color/color_4483FD"/>
|
||||
<corners android:radius="16dp" />
|
||||
</shape>
|
||||
10
app/src/main/res/drawable/rectangle_retry.xml
Normal file
10
app/src/main/res/drawable/rectangle_retry.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="@color/color_FA3E5B"
|
||||
android:startColor="@color/color_FC3498" />
|
||||
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/status_collection.xml
Normal file
5
app/src/main/res/drawable/status_collection.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_selected="true" android:drawable="@drawable/line_favorite"/>
|
||||
<item android:state_selected="false" android:drawable="@drawable/outline_favorite"/>
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/status_fire.xml
Normal file
6
app/src/main/res/drawable/status_fire.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/outline_trending" android:state_selected="false"/>
|
||||
<item android:drawable="@drawable/line_trending" android:state_selected="true"/>
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/status_shift.xml
Normal file
6
app/src/main/res/drawable/status_shift.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/outline_shift" android:state_selected="false"/>
|
||||
<item android:drawable="@drawable/line_shift" android:state_selected="true"/>
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/status_xplore.xml
Normal file
6
app/src/main/res/drawable/status_xplore.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/outline_explore" android:state_selected="false"/>
|
||||
<item android:drawable="@drawable/line_explore" android:state_selected="true"/>
|
||||
|
||||
</selector>
|
||||
61
app/src/main/res/layout/activity_collection.xml
Normal file
61
app/src/main/res/layout/activity_collection.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="34dp"
|
||||
android:background="@drawable/main_bg"
|
||||
tools:context=".act.ActivityCollection">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:padding="9dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/back_ff" />
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/iv_back"
|
||||
android:layout_alignBottom="@id/iv_back"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/tab_Favorites"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/title_color"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/title" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_empty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/im_no_collection" />
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/empty_favorite_describe"
|
||||
android:textColor="@color/hint_text_color"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
51
app/src/main/res/layout/activity_main.xml
Normal file
51
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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"
|
||||
android:paddingTop="34dp"
|
||||
android:background="@drawable/main_bg"
|
||||
tools:context=".act.ActivityMain">
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:padding="8dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/title_color"
|
||||
android:textSize="18sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_favorite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/title"
|
||||
android:layout_alignBottom="@id/title"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/line_favorite" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/tab"
|
||||
android:layout_below="@id/title" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/transparent"
|
||||
app:tabBackground="@color/transparent"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabRippleColor="@null" />
|
||||
|
||||
</RelativeLayout>
|
||||
194
app/src/main/res/layout/activity_set_wallpapers.xml
Normal file
194
app/src/main/res/layout/activity_set_wallpapers.xml
Normal file
@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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/top_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".act.ActivitySetWallpaper">
|
||||
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/player_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:background="@color/white"
|
||||
app:resize_mode="zoom"
|
||||
app:show_buffering="never"
|
||||
app:show_shuffle_button="false"
|
||||
app:show_subtitle_button="false"
|
||||
app:show_vr_button="false"
|
||||
app:use_controller="false">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relative_loading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_white_80"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/horizontal_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/loading_wait"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/horizontal_progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="6dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progress_main" />
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/normal_progress"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/white"
|
||||
android:visibility="visible" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_retry"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/tv_load_fail"
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/load_fail_describe"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/tv_retry"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/rectangle_retry"
|
||||
android:gravity="center"
|
||||
android:text="@string/Retry"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:apply_font="true" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.media3.ui.PlayerView>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="10dp">
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/tv_describe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:text="Eternal hues dance in the void's embrace 🎗️"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:apply_font="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_describe">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="37dp"
|
||||
android:background="@drawable/rectangle_16"
|
||||
android:padding="6dp">
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/i_favorite"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="25dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/set"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:apply_font="true" />
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/like"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/oval">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_favorite"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/status_collection" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layout_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:background="@drawable/oval"
|
||||
android:padding="11dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_ff" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
62
app/src/main/res/layout/activity_wel.xml
Normal file
62
app/src/main/res/layout/activity_wel.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout 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/adaMain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/splash_image"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="240dp"
|
||||
android:src="@mipmap/logo"
|
||||
app:roundPercent="0.2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/splash_image"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="11dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/title_color"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/progress_bar"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="11dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:text="@string/sub_title"
|
||||
android:textColor="@color/title_color"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="6dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginEnd="22dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:max="100"
|
||||
android:progress="100"
|
||||
android:progressDrawable="@drawable/progessbar_splash" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
6
app/src/main/res/layout/ada_like.xml
Normal file
6
app/src/main/res/layout/ada_like.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/image_thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp" />
|
||||
7
app/src/main/res/layout/ada_main.xml
Normal file
7
app/src/main/res/layout/ada_main.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/image_thumb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp" />
|
||||
9
app/src/main/res/layout/base_activity.xml
Normal file
9
app/src/main/res/layout/base_activity.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
16
app/src/main/res/layout/fragment_home.xml
Normal file
16
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".act.FragmentLive">
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
31
app/src/main/res/layout/main_tab.xml
Normal file
31
app/src/main/res/layout/main_tab.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tab_im"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/status_xplore" />
|
||||
</FrameLayout>
|
||||
|
||||
<com.hd.live.wall.wallpapers.utils.FontTextView
|
||||
android:id="@+id/tab_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="11sp"
|
||||
app:apply_font="true"
|
||||
android:textColor="@color/selector_title"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
</LinearLayout>
|
||||
BIN
app/src/main/res/mipmap-xxxhdpi/logo.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 220 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
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.MyLiveWallpaper" 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/attrs.xml
Normal file
6
app/src/main/res/values/attrs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="MyTextView">
|
||||
<attr name="apply_font" format="boolean"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
25
app/src/main/res/values/colors.xml
Normal file
25
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="tab_gray_color">#878080</color>
|
||||
|
||||
<color name="color_white_80">#33FFFFFF</color>
|
||||
<color name="color_red">#BA2828</color>
|
||||
<color name="hint_text_color">#BFBDBD</color>
|
||||
|
||||
<color name="color_989292">#989292</color>
|
||||
|
||||
<color name="color_8004122A">#80D4D5D6</color>
|
||||
<color name="color_FA3E5B">#FA3E5B</color>
|
||||
<color name="color_FC3498">#FC3498</color>
|
||||
<color name="title_color">#000000</color>
|
||||
|
||||
|
||||
<color name="color_ACDFFE">#ACDFFE</color>
|
||||
<color name="color_E9BCFE">#E9BCFE</color>
|
||||
<color name="color_4483FD">#4483FD</color>
|
||||
<color name="color_7D88FA">#7D88FA</color>
|
||||
<color name="color_C384F9">#C384F9</color>
|
||||
</resources>
|
||||
15
app/src/main/res/values/strings.xml
Normal file
15
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<resources>
|
||||
<string name="app_name">Live Wallpapers</string>
|
||||
<string name="tab_Trending">Trending</string>
|
||||
<string name="tab_Explore">Explore</string>
|
||||
<string name="tab_Shift">Shift</string>
|
||||
<string name="tab_Favorites">Favorites</string>
|
||||
<string name="set">Set</string>
|
||||
<string name="load_fail_describe">Loading failed, please check the network and try again</string>
|
||||
<string name="Retry">Retry</string>
|
||||
<string name="empty_favorite_describe">Go add your favorite wallpapers</string>
|
||||
<string name="check_connection">Please check your network connection</string>
|
||||
<string name="loading_wait">Downloading video, please wait patiently</string>
|
||||
<string name="sub_title">Add a unique vitality to your phone and experience Live Wallpapers now</string>
|
||||
<string name="loading_fail">Some unknown errors occurred during downloading, please try again later</string>
|
||||
</resources>
|
||||
9
app/src/main/res/values/themes.xml
Normal file
9
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.MyLiveWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.MyLiveWallpaper" parent="Base.Theme.MyLiveWallpaper" />
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
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>
|
||||
8
app/src/main/res/xml/file_paths.xml
Normal file
8
app/src/main/res/xml/file_paths.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 允许访问应用的内部存储文件 -->
|
||||
<files-path name="internal_files" path="." />
|
||||
<cache-path name="inner_app_cache" path="." />
|
||||
<!-- 允许访问应用的外部存储文件(如果有的话) -->
|
||||
<external-path name="external_files" path="." />
|
||||
</paths>
|
||||
5
app/src/main/res/xml/wallpaper.xml
Normal file
5
app/src/main/res/xml/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/logo">
|
||||
</wallpaper>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.hd.live.wallpapers;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
14
build.gradle.kts
Normal file
14
build.gradle.kts
Normal file
@ -0,0 +1,14 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.6.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
|
||||
|
||||
// id("com.google.gms.google-services") version "4.4.2" apply false
|
||||
// id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||
}
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath("io.objectbox:objectbox-gradle-plugin:4.0.3")
|
||||
}
|
||||
}
|
||||
21
gradle.properties
Normal file
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=-Xmx4096m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed Dec 11 14:55:39 CST 2024
|
||||
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
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
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
|
||||
6
keystore.properties
Normal file
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
||||
app_name=Live Wallpapers
|
||||
package_name=com.video.livewallpapers
|
||||
keystoreFile=app/LiveWallpapers.jks
|
||||
key_alias=LiveWallpaperskey0
|
||||
key_store_password=LiveWallpapers
|
||||
key_password=LiveWallpapers
|
||||
20
settings.gradle.kts
Normal file
20
settings.gradle.kts
Normal file
@ -0,0 +1,20 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Live Wallpapers"
|
||||
include(":app")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user