This commit is contained in:
litingting 2025-05-30 10:04:20 +08:00
commit 2d8c207873
95 changed files with 14761 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

BIN
app/VideoWallpaper.jks Normal file

Binary file not shown.

79
app/build.gradle.kts Normal file
View 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.free.video.wallpaper"
compileSdk = 34
defaultConfig {
//com.free.video.wallpaper
applicationId = "com.free.video.wallpaper"
minSdk = 23
targetSdk = 34
versionCode = 1
versionName = "1.0"
setProperty(
"archivesBaseName",
"Video Wallpaper_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")
}

View File

@ -0,0 +1,125 @@
{
"_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": "1:150505122699528186",
"lastPropertyId": "10:76475728747825161",
"name": "ResultData",
"properties": [
{
"id": "1:2927637172002004906",
"name": "objectId",
"type": 6,
"flags": 1
},
{
"id": "2:1001748290350717302",
"name": "category",
"type": 9
},
{
"id": "3:4120630564091130628",
"name": "description",
"type": 9
},
{
"id": "4:279795966790436055",
"name": "downloads",
"type": 9
},
{
"id": "5:97414655938247912",
"name": "id",
"type": 5
},
{
"id": "6:729161467269206587",
"name": "image",
"type": 9
},
{
"id": "7:5042336858198490957",
"name": "pro",
"type": 5
},
{
"id": "8:6165031016937588605",
"name": "resolution",
"type": 9
},
{
"id": "9:1947268834796297839",
"name": "thumbnail",
"type": 9
},
{
"id": "10:76475728747825161",
"name": "wallpapertype",
"type": 5
}
],
"relations": []
},
{
"id": "3:6621332807843049779",
"lastPropertyId": "6:5780006894715348003",
"name": "FavoriteData",
"properties": [
{
"id": "1:4538292384164106909",
"name": "objectId",
"type": 6,
"flags": 1
},
{
"id": "2:3798352414031850717",
"name": "description",
"type": 9
},
{
"id": "3:6482737152923675363",
"name": "id",
"type": 5
},
{
"id": "4:4529755790081860204",
"name": "image",
"type": 9
},
{
"id": "5:1205919504570971706",
"name": "wallpapertype",
"type": 5
},
{
"id": "6:5780006894715348003",
"name": "thumbnail",
"type": 9
}
],
"relations": []
}
],
"lastEntityId": "3:6621332807843049779",
"lastIndexId": "0:0",
"lastRelationId": "0:0",
"lastSequenceId": "0:0",
"modelVersion": 5,
"modelVersionParserMinimum": 5,
"retiredEntityUids": [
8834432815557132690
],
"retiredIndexUids": [],
"retiredPropertyUids": [
846923696920771332,
2661563405594510728,
3803068480811227076,
2573175242602089587,
4073665339586807072,
6490742020031879416
],
"retiredRelationUids": [],
"version": 1
}

129
app/proguard-rules.pro vendored Normal file
View 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.free.video.wallpaper.content.ResultData { *; }
# 保持 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 *;
}

View File

@ -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());
}
}

View 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="com.free.video.wallpaper.baseapp.MyWallpaperApp"
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="com.free.video.wallpaper.uipage.PageFavorite"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name="com.free.video.wallpaper.uipage.PageSplash"
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="com.free.video.wallpaper.uipage.PageSetLive"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name="com.free.video.wallpaper.uipage.PageMain"
android:screenOrientation="portrait"
android:exported="true"/>
<service
android:name="com.free.video.wallpaper.helper.MyService"
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>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
package com.free.video.wallpaper.baseapp;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewbinding.ViewBinding;
public class BaseViewHolder<T extends ViewBinding> extends RecyclerView.ViewHolder {
private T itemVb;
public BaseViewHolder(@NonNull T itemView) {
super(itemView.getRoot());
itemVb = itemView;
}
public T getItemVb() {
return itemVb;
}
}

View File

@ -0,0 +1,86 @@
package com.free.video.wallpaper.baseapp;
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.free.video.wallpaper.databinding.BaseActivityBinding;
import com.free.video.wallpaper.vmhelper.MyScope;
public abstract class MyBaseActivity<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);
}
}

View File

@ -0,0 +1,54 @@
package com.free.video.wallpaper.baseapp;
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;
import com.free.video.wallpaper.vmhelper.MyScope;
public abstract class MyBaseFragment<T extends ViewBinding> extends Fragment {
private final MyScope mMyScope = new MyScope();
protected T Vb;
protected AppCompatActivity mActivity;
// protected VMApplication vmApplication;
public MyBaseFragment() {
}
@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);
}
}

View File

@ -0,0 +1,107 @@
package com.free.video.wallpaper.baseapp;
import android.app.Application;
import android.graphics.Typeface;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.helper.Commontool;
import com.free.video.wallpaper.helper.ObjectBoxManager;
import com.free.video.wallpaper.helper.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 MyWallpaperApp extends Application {
private static Typeface defaultFont;
private static MyWallpaperApp mApplication;
private static String thumbStr = "https://neutrolabgames.com/LiveLoop/CpanelPix/VideoThumb/";
public static String TAG = "--------------------LIVE----------";
public static String getThumbStr() {
return thumbStr;
}
public static MyWallpaperApp getApplication() {
return mApplication;
}
@Override
public void onCreate() {
super.onCreate();
mApplication = this;
defaultFont = Typeface.createFromAsset(getAssets(), "font.ttf");
// initSDk();
ObjectBoxManager.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<ResultData>>() {
}.getType();
String covertStr = Commontool.getCovertStr(open);
List<ResultData> data = gson.fromJson(covertStr, type);
for (ResultData datum : data) {
ObjectBoxManager.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();
}
}

View File

@ -0,0 +1,92 @@
package com.free.video.wallpaper.content;
import java.io.Serializable;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;
@Entity
public class FavoriteData 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 FavoriteData(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 FavoriteData(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;
}
}

View File

@ -0,0 +1,108 @@
package com.free.video.wallpaper.content;
import java.io.Serializable;
import io.objectbox.annotation.Entity;
import io.objectbox.annotation.Id;
@Entity
public class ResultData 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;
}
}

View File

@ -0,0 +1,97 @@
package com.free.video.wallpaper.helper;
import android.content.Context;
import android.net.Uri;
import android.util.DisplayMetrics;
import android.util.Log;
import androidx.core.content.FileProvider;
import com.free.video.wallpaper.baseapp.MyWallpaperApp;
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 Commontool {
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 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();
Commontool.logMsg("-------------onSuccess return true");
return true;
} catch (Exception ex) {
Log.d("-----------", "---------ex=" + ex.getMessage());
return false;
}
}
public static String getCachePath(int id){
MyWallpaperApp application = MyWallpaperApp.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);
}
}

View File

@ -0,0 +1,73 @@
package com.free.video.wallpaper.helper;
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 MyItemDecoration extends RecyclerView.ItemDecoration {
private int v, h, ex;
public MyItemDecoration(Context context, int v, int h, int ex) {
this.v = Math.round(Commontool.dpToPx(context,v));
this.h = Math.round(Commontool.dpToPx(context,h));
this.ex = Math.round(Commontool.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;
}
}
}

View File

@ -0,0 +1,119 @@
package com.free.video.wallpaper.helper
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 MyService : 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@MyService).build()
exoPlayer?.repeatMode = ExoPlayer.REPEAT_MODE_ONE
update()
}
override fun onCreate(surfaceHolder: SurfaceHolder?) {
super.onCreate(surfaceHolder)
Commontool.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)
Commontool.logMsg("-------Engine---onVisibilityChanged visible=$visible")
if (visible) {
update()
exoPlayer?.play()
} else {
exoPlayer?.pause()
}
}
override fun onSurfaceDestroyed(holder: SurfaceHolder?) {
super.onSurfaceDestroyed(holder)
Commontool.logMsg("------Engine----onSurfaceDestroyed---")
exoPlayer?.release()
}
override fun onDestroy() {
super.onDestroy()
Commontool.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@MyService)
// val test = "android.resource://" + packageName + "/" + R.raw.test1
if (uri != null) {
val fromUri = MediaItem.fromUri(uri)
val mediaSource = ProgressiveMediaSource.Factory(
DefaultDataSourceFactory(this@MyService, "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()) {
Commontool.getUriFromFilePath(con, Store.video_path)
} else {
null
}
return uri
}
}

View File

@ -0,0 +1,36 @@
package com.free.video.wallpaper.helper;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import com.free.video.wallpaper.baseapp.MyWallpaperApp;
import com.free.video.wallpaper.R;
public class MyText extends androidx.appcompat.widget.AppCompatTextView {
public MyText(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(MyWallpaperApp.getDefaultFont());
}
typedArray.recycle();
}
}

View File

@ -0,0 +1,188 @@
package com.free.video.wallpaper.helper;
import android.content.Context;
import androidx.annotation.NonNull;
import com.free.video.wallpaper.listener.OnLikeUpdateListener;
import com.free.video.wallpaper.content.FavoriteData;
import com.free.video.wallpaper.content.FavoriteData_;
import com.free.video.wallpaper.content.MyObjectBox;
import com.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.content.ResultData_;
import com.free.video.wallpaper.mypagesource.LikePS;
import com.free.video.wallpaper.mypagesource.MainPS;
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 ObjectBoxManager {
private static BoxStore boxStore;
private static Box<ResultData> dataBox;
private static Box<FavoriteData> likeBox;
private static DataSubscription observer;
public static void init(Context context) {
boxStore = MyObjectBox.builder().androidContext(context).build();
}
public static Box<ResultData> getDataBox() {
if (dataBox == null) {
dataBox = boxStore.boxFor(ResultData.class);
}
return dataBox;
}
public static Box<FavoriteData> getLikeBox() {
if (likeBox == null) {
likeBox = boxStore.boxFor(FavoriteData.class);
}
return likeBox;
}
public static DataSubscription setLikeUpdateListener(OnLikeUpdateListener listener) {
Box<FavoriteData> likeBox = getLikeBox();
Query<FavoriteData> build = likeBox.query()
.build();
return build.subscribe(new DataSubscriptionList())
.on(AndroidScheduler.mainThread())
.observer(new DataObserver<List<FavoriteData>>() {
@Override
public void onData(@NonNull List<FavoriteData> data) {
Commontool.logMsg("---OnLikeUpdateListener-------------" + data.size());
listener.onLikeUpdate(data);
}
});
}
public static void insertDb(ResultData resultData) {
Box<ResultData> objectBox = getDataBox();
ResultData first = objectBox.query()
.equal(ResultData_.wallpapertype, resultData.getWallpapertype())
.equal(ResultData_.id, resultData.getId())
.build()
.findFirst();
if (first == null) {
// Common.logMsg("---insertDb------Wallpapertype------" + resultData.getWallpapertype() + "-------id=" + resultData.getId());
objectBox.put(resultData);
} else {
// Common.logMsg("---insertDb-------------" + resultData.getWallpapertype() + "-------id=" + resultData.getId());
}
}
public static void insertLike(FavoriteData favoriteData) {
Box<FavoriteData> likeBox = getLikeBox();
FavoriteData first = likeBox.query()
.equal(FavoriteData_.id, favoriteData.getId())
.build()
.findFirst();
if (first == null) {
Commontool.logMsg("---insertLike-----------------id=" + favoriteData.getId());
likeBox.put(favoriteData);
} else {
Commontool.logMsg("---insertLike-----------------id=" + favoriteData.getId());
}
}
public static void deleteLike(int id) {
Box<FavoriteData> likeBox = getLikeBox();
FavoriteData first = likeBox.query()
.equal(FavoriteData_.id, id)
.build()
.findFirst();
if (first != null) {
likeBox.remove(first);
Commontool.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<FavoriteData> likeBox = getLikeBox();
FavoriteData first = likeBox.query()
.equal(FavoriteData_.id, id)
.build()
.findFirst();
if (first != null) {
return true;
} else {
return false;
}
}
public static List<FavoriteData> queryAllLike() {
Box<FavoriteData> likeBox = getLikeBox();
return likeBox.query()
.build()
.find();
}
public static List<ResultData> queryData(int wallpaperType, int currentPage) {
int offset = (currentPage - 1) * MainPS.pageSize;
Box<ResultData> objectBoxLike = getDataBox();
List<ResultData> data = objectBoxLike.query()
.equal(ResultData_.wallpapertype, wallpaperType)
.build()
.find(offset, MainPS.pageSize);
return data;
}
public static List<FavoriteData> queryLike(int currentPage) {
int offset = (currentPage - 1) * LikePS.pageSize;
Box<FavoriteData> likeBox = getLikeBox();
List<FavoriteData> data = likeBox.query()
.build()
.find(offset, LikePS.pageSize);
return data;
}
public static List<ResultData> queryAllData(int wallpaperType) {
Box<ResultData> objectBoxLike = getDataBox();
List<ResultData> data = objectBoxLike.query()
.equal(ResultData_.wallpapertype, wallpaperType)
.build()
.find();
return data;
}
}

View File

@ -0,0 +1,53 @@
package com.free.video.wallpaper.helper
import android.content.Context
import android.content.SharedPreferences
import com.free.video.wallpaper.baseapp.MyWallpaperApp
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 = MyWallpaperApp.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()
}
}

View File

@ -0,0 +1,57 @@
package com.free.video.wallpaper.httpcontent;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import java.io.IOException;
public class NetBody extends ResponseBody {
private final ResponseBody responseBody;
private final ProgressListener progressListener;
private BufferedSource bufferedSource;
private String length;
public NetBody(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);
}
}

View File

@ -0,0 +1,28 @@
package com.free.video.wallpaper.httpcontent;
import okhttp3.Interceptor;
import okhttp3.Response;
import java.io.IOException;
public class NetLanjie implements Interceptor {
private final NetBody.ProgressListener progressListener;
public NetLanjie(NetBody.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 NetBody(originalResponse.body(), fileLength, progressListener))
.build();
}
}

View File

@ -0,0 +1,140 @@
package com.free.video.wallpaper.httpcontent;
import com.free.video.wallpaper.listener.OnNetDataApi;
import com.free.video.wallpaper.helper.Commontool;
import com.free.video.wallpaper.listener.OnVideoresultListener;
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 RetrofitHelper {
private String base_Host = "https://neutrolabgames.com/";
private static volatile RetrofitHelper REQUEST_MANAGER;
private Retrofit retrofit;
// public MediaType JSON = MediaType.get("application/json; charset=utf-8");
private OnNetDataApi onNetDataApi;
private Retrofit.Builder builder;
private OkHttpClient.Builder clientBuilder;
private RetrofitHelper() {
}
private synchronized Retrofit getRetrofit(NetBody.ProgressListener listener) {
if (builder == null) {
// retrofit = new Retrofit.Builder()
// .baseUrl(base_Host)
// .client(client)
//// .addConverterFactory(ScalarsConverterFactory.create()) // 支持返回 String 类型
//// .addConverterFactory(GsonConverterFactory.create())
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
// .build();
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 NetLanjie(listener));
return builder.client(clientBuilder.build()).build();
}
public static RetrofitHelper getInstance() {
if (REQUEST_MANAGER == null) {
synchronized (RetrofitHelper.class) {
if (REQUEST_MANAGER == null) {
REQUEST_MANAGER = new RetrofitHelper();
}
}
}
return REQUEST_MANAGER;
}
public Disposable getMp4(int id, String image, String path, NetBody.ProgressListener progressListener, OnVideoresultListener listener) {
Disposable subscribe = getRetrofit(progressListener).create(OnNetDataApi.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 = Commontool.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, NetBody.ProgressListener progressListener, OnVideoresultListener listener) {
Disposable subscribe = getRetrofit(progressListener).create(OnNetDataApi.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 = Commontool.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);
// }
//
// }));
// }
}

View File

@ -0,0 +1,9 @@
package com.free.video.wallpaper.listener;
import com.free.video.wallpaper.content.FavoriteData;
import java.util.List;
public interface OnLikeUpdateListener {
void onLikeUpdate(List<FavoriteData> data);
}

View File

@ -0,0 +1,43 @@
package com.free.video.wallpaper.listener;
import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
public interface OnNetDataApi {
@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);
}

View File

@ -0,0 +1,5 @@
package com.free.video.wallpaper.listener;
public interface OnVideoresultListener {
void onVideoResult(boolean success,String path);
}

View File

@ -0,0 +1,109 @@
package com.free.video.wallpaper.mylist;
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.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.free.video.wallpaper.baseapp.MyWallpaperApp;
import com.free.video.wallpaper.R;
import com.free.video.wallpaper.baseapp.BaseViewHolder;
import com.free.video.wallpaper.databinding.ItemFavoriteBinding;
import com.free.video.wallpaper.content.FavoriteData;
import com.free.video.wallpaper.uipage.PageSetLive;
import com.free.video.wallpaper.helper.Commontool;
import java.lang.ref.WeakReference;
public class LikeAdapter extends PagingDataAdapter<FavoriteData, BaseViewHolder<ItemFavoriteBinding>> {
private WeakReference<Activity> contextWeakReference;
private Activity MContext;
public LikeAdapter(Activity context) {
super(DIFF_CALLBACK);
contextWeakReference = new WeakReference<>(context);
MContext = contextWeakReference.get();
}
@NonNull
@Override
public BaseViewHolder<ItemFavoriteBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemFavoriteBinding inflate = ItemFavoriteBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new BaseViewHolder<>(inflate);
}
@Override
public void onBindViewHolder(@NonNull BaseViewHolder<ItemFavoriteBinding> holder, int position) {
ItemFavoriteBinding itemVb = holder.getItemVb();
FavoriteData item = getItem(position);
String thumbStr = MyWallpaperApp.getThumbStr() + item.getThumbnail();
Glide.with(MContext)
.asDrawable()
.load(thumbStr)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(Commontool.dpToPx(MContext, 4))))
.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) {
Commontool.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, PageSetLive.class);
intent.putExtra(PageSetLive.KEY_ID, item.getId());
intent.putExtra(PageSetLive.KEY_wallpaperType, item.getWallpapertype());
intent.putExtra(PageSetLive.KEY_image, item.getImage());
intent.putExtra(PageSetLive.KEY_describe, item.getDescription());
intent.putExtra(PageSetLive.KEY_thumb, item.getThumbnail());
MContext.startActivity(intent);
}
});
}
private static final DiffUtil.ItemCallback<FavoriteData> DIFF_CALLBACK = new DiffUtil.ItemCallback<FavoriteData>() {
@Override
public boolean areItemsTheSame(@NonNull FavoriteData oldItem, @NonNull FavoriteData newItem) {
return oldItem.getId() == newItem.getId();
}
@Override
public boolean areContentsTheSame(@NonNull FavoriteData oldItem, @NonNull FavoriteData newItem) {
return oldItem.getId() == newItem.getId();
}
};
}

View File

@ -0,0 +1,106 @@
package com.free.video.wallpaper.mylist;
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.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.free.video.wallpaper.baseapp.MyWallpaperApp;
import com.free.video.wallpaper.R;
import com.free.video.wallpaper.baseapp.BaseViewHolder;
import com.free.video.wallpaper.databinding.ItemMainBinding;
import com.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.uipage.PageSetLive;
import com.free.video.wallpaper.helper.Commontool;
import java.lang.ref.WeakReference;
public class MainAdapter extends PagingDataAdapter<ResultData, BaseViewHolder<ItemMainBinding>> {
private WeakReference<Activity> contextWeakReference;
private Activity MContext;
public MainAdapter(Activity context) {
super(DIFF_CALLBACK);
contextWeakReference = new WeakReference<>(context);
MContext = contextWeakReference.get();
}
@NonNull
@Override
public BaseViewHolder<ItemMainBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemMainBinding inflate = ItemMainBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new BaseViewHolder<ItemMainBinding>(inflate);
}
@Override
public void onBindViewHolder(@NonNull BaseViewHolder<ItemMainBinding> holder, int position) {
ItemMainBinding itemVb = holder.getItemVb();
ResultData item = getItem(position);
String thumbStr = MyWallpaperApp.getThumbStr() + item.getThumbnail();
Glide.with(MContext)
.asDrawable()
.load(thumbStr)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(Commontool.dpToPx(MContext, 4))))
.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) {
Commontool.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, PageSetLive.class);
intent.putExtra(PageSetLive.KEY_ID, item.getId());
intent.putExtra(PageSetLive.KEY_wallpaperType, item.getWallpapertype());
intent.putExtra(PageSetLive.KEY_image, item.getImage());
intent.putExtra(PageSetLive.KEY_describe, item.getDescription());
intent.putExtra(PageSetLive.KEY_thumb, item.getThumbnail());
MContext.startActivity(intent);
}
});
}
private static final DiffUtil.ItemCallback<ResultData> DIFF_CALLBACK = new DiffUtil.ItemCallback<ResultData>() {
@Override
public boolean areItemsTheSame(@NonNull ResultData oldItem, @NonNull ResultData newItem) {
return oldItem.getId() == newItem.getId();
}
@Override
public boolean areContentsTheSame(@NonNull ResultData oldItem, @NonNull ResultData newItem) {
return oldItem.getId() == newItem.getId();
}
};
}

View File

@ -0,0 +1,30 @@
package com.free.video.wallpaper.mylist;
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 ViewPagerAdapter extends FragmentStateAdapter {
private final List<Fragment> fragmentList;
public ViewPagerAdapter(@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();
}
}

View File

@ -0,0 +1,49 @@
package com.free.video.wallpaper.mypagesource;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.paging.PagingSource;
import androidx.paging.PagingState;
import com.free.video.wallpaper.content.FavoriteData;
import com.free.video.wallpaper.helper.Commontool;
import com.free.video.wallpaper.helper.ObjectBoxManager;
import java.util.List;
import kotlin.coroutines.Continuation;
public class LikePS extends PagingSource<Integer, FavoriteData> {
public static int pageSize = 10;
public LikePS() {
}
@Nullable
@Override
public Integer getRefreshKey(@NonNull PagingState<Integer, FavoriteData> pagingState) {
return null;
}
@Nullable
@Override
public Object load(@NonNull LoadParams<Integer> loadParams, @NonNull Continuation<? super LoadResult<Integer, FavoriteData>> continuation) {
try {
int page = loadParams.getKey() != null ? loadParams.getKey() : 1;
List<FavoriteData> data = ObjectBoxManager.queryLike(page);
Commontool.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);
}
}
}

View File

@ -0,0 +1,49 @@
package com.free.video.wallpaper.mypagesource;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.paging.PagingSource;
import androidx.paging.PagingState;
import com.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.helper.ObjectBoxManager;
import java.util.List;
import kotlin.coroutines.Continuation;
public class MainPS extends PagingSource<Integer, ResultData> {
public static int pageSize = 20;
private int wallpaperType;
public MainPS(int wallpaperType) {
this.wallpaperType = wallpaperType;
}
@Nullable
@Override
public Integer getRefreshKey(@NonNull PagingState<Integer, ResultData> pagingState) {
return null;
}
@Nullable
@Override
public Object load(@NonNull LoadParams<Integer> loadParams, @NonNull Continuation<? super LoadResult<Integer, ResultData>> continuation) {
try {
int page = loadParams.getKey() != null ? loadParams.getKey() : 1;
List<ResultData> data = ObjectBoxManager.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);
}
}
}

View File

@ -0,0 +1,67 @@
package com.free.video.wallpaper.uipage;
import android.os.Bundle;
import androidx.lifecycle.Observer;
import androidx.paging.PagingData;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.free.video.wallpaper.mylist.MainAdapter;
import com.free.video.wallpaper.baseapp.MyBaseFragment;
import com.free.video.wallpaper.databinding.MainFragmentBinding;
import com.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.helper.MyItemDecoration;
import com.free.video.wallpaper.vmhelper.ViewModeMain;
public class MainFragment extends MyBaseFragment<MainFragmentBinding> {
private static final String ARG_PARAM1 = "param1";
private int wallpaperType;
private ViewModeMain viewModeMain;
public MainFragment() {
}
public static MainFragment newInstance(int type) {
MainFragment fragment = new MainFragment();
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 MainFragmentBinding getFragmentVb() {
return MainFragmentBinding.inflate(getLayoutInflater());
}
@Override
protected void initView() {
MainAdapter mainAdapter = new MainAdapter(requireActivity());
Vb.recycler.setAdapter(mainAdapter);
Vb.recycler.setLayoutManager(new GridLayoutManager(requireContext(),2, RecyclerView.VERTICAL, false));
Vb.recycler.addItemDecoration(new MyItemDecoration(requireContext(),5,5,0));
viewModeMain = getFragmentScopeViewModel(ViewModeMain.class);
viewModeMain.getPagingData(wallpaperType).observe(getViewLifecycleOwner(), new Observer<PagingData<ResultData>>() {
@Override
public void onChanged(PagingData<ResultData> resultDataPagingData) {
mainAdapter.submitData(requireActivity().getLifecycle(),resultDataPagingData);
}
});
}
}

View File

@ -0,0 +1,88 @@
package com.free.video.wallpaper.uipage
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.free.video.wallpaper.baseapp.MyBaseActivity
import com.free.video.wallpaper.databinding.PageFavoriteBinding
import com.free.video.wallpaper.helper.MyItemDecoration
import com.free.video.wallpaper.helper.ObjectBoxManager
import com.free.video.wallpaper.mylist.LikeAdapter
import com.free.video.wallpaper.vmhelper.ViewModelLike
import io.objectbox.reactive.DataSubscription
class PageFavorite : MyBaseActivity<PageFavoriteBinding>() {
private var dataSubscription: DataSubscription? = null
private var viewModelLike: ViewModelLike? = null
override fun onClick(v: View?) {
v?.let {
if(v == vb.ivBack){
finish()
}
}
}
override fun getViewBinding(): PageFavoriteBinding = PageFavoriteBinding.inflate(layoutInflater)
override fun onCreateInit() {
val likeAdapter = LikeAdapter(this)
vb.recycler.run {
adapter = likeAdapter
layoutManager = GridLayoutManager(
this@PageFavorite,
2,
RecyclerView.VERTICAL,
false
)
addItemDecoration(
MyItemDecoration(
this@PageFavorite,
8,
8,
8
)
)
}
viewModelLike = getActivityScopeViewModel<ViewModelLike>(
ViewModelLike::class.java)
viewModelLike!!.likeLiveData.observe(
this@PageFavorite
) {
likeAdapter.submitData(lifecycle, it)
}
dataSubscription = ObjectBoxManager.setLikeUpdateListener { data ->
if (data.size == 0) {
vb.layoutEmpty.visibility = View.VISIBLE
} else {
vb.layoutEmpty.visibility = View.GONE
}
viewModelLike!!.update(data)
}
}
override fun onInitClick() {
vb.ivBack.setOnClickListener(this)
}
override fun isFullScreen(): Boolean = true
override fun statusBarLight(): Boolean = false
override fun onDestroy() {
super.onDestroy()
if (dataSubscription != null) {
dataSubscription!!.cancel()
}
}
}

View File

@ -0,0 +1,89 @@
package com.free.video.wallpaper.uipage;
import android.content.Intent;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.free.video.wallpaper.R;
import com.free.video.wallpaper.baseapp.MyBaseActivity;
import com.free.video.wallpaper.databinding.ItemTabViewBinding;
import com.free.video.wallpaper.databinding.PageMainBinding;
import com.free.video.wallpaper.mylist.ViewPagerAdapter;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import java.util.ArrayList;
import java.util.List;
public class PageMain extends MyBaseActivity<PageMainBinding> {
@Override
protected PageMainBinding getViewBinding() {
return PageMainBinding.inflate(getLayoutInflater());
}
@Override
protected void onCreateInit() {
List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(MainFragment.newInstance(0));
fragmentList.add(MainFragment.newInstance(3));
fragmentList.add(MainFragment.newInstance(2));
// fragmentList.add(FragLike.newInstance());
ViewPagerAdapter adapter = new ViewPagerAdapter(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) {
ItemTabViewBinding inflate = ItemTabViewBinding.inflate(getLayoutInflater());
tab.setCustomView(inflate.getRoot());
switch (position) {
case 0:
inflate.tabTitle.setText(ContextCompat.getString(PageMain.this, R.string.tab_Trending));
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(PageMain.this, R.drawable.selector_tren));
break;
case 1:
inflate.tabTitle.setText(ContextCompat.getString(PageMain.this, R.string.tab_Explore));
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(PageMain.this, R.drawable.selector_ex));
break;
case 2:
inflate.tabTitle.setText(ContextCompat.getString(PageMain.this, R.string.tab_Shift));
inflate.tabIm.setImageDrawable(ContextCompat.getDrawable(PageMain.this, R.drawable.selector_shi));
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 false;
}
@Override
public void onClick(View v) {
if(v.equals(vb.ivFavorite)){
Intent intent = new Intent(this, PageFavorite.class);
startActivity(intent);
}
}
}

View File

@ -0,0 +1,352 @@
package com.free.video.wallpaper.uipage;
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.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.free.video.wallpaper.R;
import com.free.video.wallpaper.baseapp.MyBaseActivity;
import com.free.video.wallpaper.content.FavoriteData;
import com.free.video.wallpaper.databinding.PageSetLiveBinding;
import com.free.video.wallpaper.helper.Commontool;
import com.free.video.wallpaper.helper.MyService;
import com.free.video.wallpaper.helper.ObjectBoxManager;
import com.free.video.wallpaper.helper.Store;
import com.free.video.wallpaper.httpcontent.NetBody;
import com.free.video.wallpaper.httpcontent.RetrofitHelper;
import com.free.video.wallpaper.listener.OnVideoresultListener;
import java.io.File;
import java.util.concurrent.atomic.AtomicBoolean;
import io.reactivex.disposables.Disposable;
public class PageSetLive extends MyBaseActivity<PageSetLiveBinding> implements NetBody.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;
@Override
protected PageSetLiveBinding getViewBinding() {
return PageSetLiveBinding.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 = Commontool.getCachePath(id);
mFile = new File(filePath);
initExoPlay();
initFavorite();
if (mFile.exists()) {
Commontool.logMsg("------checkPlay-");
checkPlay();
return;
}
loadingui = new AtomicBoolean(false);
requestVideo();
}
private void requestVideo() {
if (wallpaperType == 2) {
//shift
disposable = RetrofitHelper.getInstance().getShiftMp4(id, image, filePath,this, new OnVideoresultListener() {
@Override
public void onVideoResult(boolean success, String path) {
Commontool.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (success) {
checkPlay();
} else {
showRetry();
Commontool.logMsg("-------------loading fail");
}
}
});
}
});
} else {
disposable = RetrofitHelper.getInstance().getMp4(id, image, filePath,this, new OnVideoresultListener() {
@Override
public void onVideoResult(boolean success, String path) {
Commontool.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (success) {
checkPlay();
} else {
showRetry();
Commontool.logMsg("-------------loading fail");
}
}
});
}
});
}
}
private void initFavorite() {
boolean b = ObjectBoxManager.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);
Commontool.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() {
Toast.makeText(PageSetLive.this, getString(R.string.check_connection), 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) {
FavoriteData favoriteData = new FavoriteData(describe, id, image, wallpaperType, thumb);
ObjectBoxManager.insertLike(favoriteData);
} else {
ObjectBoxManager.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()) {
Commontool.logMsg("-------------dispose");
disposable.dispose();
}
}
@OptIn(markerClass = UnstableApi.class)
private void playMedia3() {
try {
Commontool.logMsg("-------------playMedia3");
Uri uriFromFilePath = Commontool.getUriFromFilePath(this, filePath);
MediaItem mediaItem = MediaItem.fromUri(uriFromFilePath);
ProgressiveMediaSource mediaSource = createMediaSource(mediaItem);
exoPlayer.setMediaSource(mediaSource);
exoPlayer.prepare();
exoPlayer.play();
} catch (Exception e) {
Commontool.logMsg("-------" + e.getMessage());
}
}
@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);
Commontool.logMsg("----------setVideo_path---filePath=" + filePath);
}
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try {
wallpaperManager.clear();
Commontool.logMsg("----------clear=");
} catch (Exception e) {
Commontool.logMsg("---------e=" + e.getMessage());
}
try {
ComponentName componentName = new ComponentName(PageSetLive.this, MyService.class);
Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, componentName);
startActivity(intent);
} catch (Exception e) {
Commontool.logMsg("---------e=" + e.getMessage());
}
finish();
}
@Override
public void onProgress(long bytesRead, long contentLength, boolean done) {
if (contentLength <= 0) {
Commontool.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);
Commontool.logMsg("------------showLoading------11-----");
}else {
Commontool.logMsg("------------showLoading------22-----");
}
vb.horizontalProgress.setProgress(progress);
}
});
}
}
if (done) {
Commontool.logMsg("Download complete!");
}
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// if (contentLength <= 0) {
// Common.logMsg("contentLength" +contentLength);
// } else {
// showLoading(true, true);
// int progress = (int) ((100 * bytesRead) / contentLength);
// Common.logMsg("Download progress: " + progress + "%"+"---loadingui="+loadingui);
// vb.horizontalProgress.setProgress(progress);
// }
// if (done) {
// Common.logMsg("Download complete!");
// }
// }
// });
}
}

View File

@ -0,0 +1,85 @@
package com.free.video.wallpaper.uipage;
import android.content.Intent;
import android.os.CountDownTimer;
import android.view.View;
import com.free.video.wallpaper.baseapp.MyBaseActivity;
import com.free.video.wallpaper.databinding.PageSplashBinding;
public class PageSplash extends MyBaseActivity<PageSplashBinding> {
private static final long SPLASH_TIME_OUT = 2000L;
private CountDownTimer countDownTimer;
@Override
protected PageSplashBinding getViewBinding() {
return PageSplashBinding.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(PageSplash.this, PageMain.class);
startActivity(intent);
finish();
}
};
// countDownTimer = AdManager.showWelcomeAd(WelcomeActivity.this, SPLASH_TIME_OUT, new CountAction() {
// @Override
// public void onCount(long millisUntilFinished) {
// float v = 100 - (float) millisUntilFinished / SPLASH_TIME_OUT * 100;
// int v1 = (int) v;
// vb.progressBar.setProgress(v1);
// }
// }, new GoMainAction() {
// @Override
// public void onGo() {
// vb.progressBar.setProgress(100);
// Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
// startActivity(intent);
// finish();
// }
// });
countDownTimer.start();
}
@Override
protected void onInitClick() {
}
@Override
public boolean isFullScreen() {
return true;
}
@Override
public boolean statusBarLight() {
return false;
}
@Override
public void onClick(View view) {
}
@Override
protected void onDestroy() {
super.onDestroy();
if(countDownTimer!= null){
countDownTimer.cancel();
countDownTimer = null;
}
}
}

View File

@ -0,0 +1,24 @@
package com.free.video.wallpaper.vmhelper;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;
public class MyOwner implements ViewModelStoreOwner {
private final static MyOwner sInstance = new MyOwner();
private ViewModelStore mAppViewModelStore;
private MyOwner() {
}
public static MyOwner getInstance() {
return sInstance;
}
@NonNull
@Override
public ViewModelStore getViewModelStore() {
if (mAppViewModelStore == null) mAppViewModelStore = new ViewModelStore();
return mAppViewModelStore;
}
}

View File

@ -0,0 +1,29 @@
package com.free.video.wallpaper.vmhelper;
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(MyOwner.getInstance());
return mApplicationProvider.get(modelClass);
}
}

View File

@ -0,0 +1,24 @@
package com.free.video.wallpaper.vmhelper;
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.free.video.wallpaper.content.ResultData;
import com.free.video.wallpaper.mypagesource.MainPS;
public class ViewModeMain extends ViewModel {
public LiveData<PagingData<ResultData>> getPagingData(int wallpaperType) {
return PagingLiveData.getLiveData(new Pager<>(
new PagingConfig(10),
() -> new MainPS(wallpaperType)
));
}
}

View File

@ -0,0 +1,40 @@
package com.free.video.wallpaper.vmhelper;
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.free.video.wallpaper.content.FavoriteData;
import com.free.video.wallpaper.mypagesource.LikePS;
import java.util.List;
public class ViewModelLike extends ViewModel {
public Pager<Integer, FavoriteData> pager;
private MutableLiveData<PagingData<FavoriteData>> _likeLiveData = new MutableLiveData<>();
public LiveData<PagingData<FavoriteData>> likeLiveData = _likeLiveData ;
public LiveData<PagingData<FavoriteData>> getPagingData() {
Pager<Integer, FavoriteData> integerLikeDataPager = new Pager<>(
new PagingConfig(10), // 每页加载 20 条数据
LikePS::new
);
return PagingLiveData.getLiveData(integerLikeDataPager);
}
public void update(List<FavoriteData> data){
PagingData<FavoriteData> from = PagingData.from(data);
_likeLiveData.postValue(from);
}
}

View File

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

View 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_FA3E5B"
android:startColor="@color/color_FC3498" />
</shape>
</clip>
</item>
</layer-list>

View File

@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="7dp"/>
<stroke
android:width="1dp"
android:color="@color/white" />
</shape>

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

View File

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

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

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

View 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/white"
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>

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

View 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/white"
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>

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

View 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/white"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
android:fillColor="@color/black"/>
</vector>

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

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="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>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="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>

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

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="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>

View File

@ -0,0 +1,21 @@
<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/title_color"
android:centerColor="@color/title_color"
android:endColor="@color/title_color"
android:angle="0" />
</shape>
</clip>
</item>
</layer-list>

View File

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

View 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/im_like_red"/>
<item android:state_selected="false" android:drawable="@drawable/im_like_white_stoke"/>
</selector>

View File

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

View File

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

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

View File

@ -0,0 +1,9 @@
<?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"
android:background="@drawable/bg_main_stoke"
android:padding="5dp"
app:roundPercent="0.1" />

View File

@ -0,0 +1,10 @@
<?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:background="@drawable/bg_main_stoke"
android:layout_width="match_parent"
android:padding="5dp"
android:layout_height="230dp"
app:roundPercent="0.1" />

View 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/selector_ex" />
</FrameLayout>
<com.free.video.wallpaper.helper.MyText
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>

View 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="com.free.video.wallpaper.uipage.MainFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>

View 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:background="@color/main_bg_color"
android:paddingTop="34dp"
tools:context="com.free.video.wallpaper.uipage.PageFavorite">
<ImageView
android:id="@+id/iv_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="9dp"
android:layout_marginStart="12dp"
android:src="@drawable/im_white_back" />
<com.free.video.wallpaper.helper.MyText
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_empty" />
<com.free.video.wallpaper.helper.MyText
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>

View 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="@color/main_bg_color"
tools:context="com.free.video.wallpaper.uipage.PageMain">
<com.free.video.wallpaper.helper.MyText
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/im_like_red" />
<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>

View 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="com.free.video.wallpaper.uipage.PageSetLive">
<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.free.video.wallpaper.helper.MyText
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="4dp"
android:layout_marginTop="10dp"
android:max="100"
android:progress="100"
android:progressDrawable="@drawable/bg_layer_list" />
</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.free.video.wallpaper.helper.MyText
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.free.video.wallpaper.helper.MyText
android:id="@+id/tv_retry"
android:layout_width="120dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/bg_shape_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.free.video.wallpaper.helper.MyText
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/bg_rect_16"
android:padding="6dp">
<com.free.video.wallpaper.helper.MyText
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/bg_oval_alah">
<ImageView
android:id="@+id/im_favorite"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center"
android:src="@drawable/selector_favorite" />
</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/bg_oval_alah"
android:padding="11dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/im_white_back" />
</FrameLayout>
</RelativeLayout>

View File

@ -0,0 +1,50 @@
<?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/mainAdapter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/main_bg_color">
<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/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="1"
android:progressDrawable="@drawable/progessbar_splash" />
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

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

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

View File

@ -0,0 +1,27 @@
<?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="tab_light_color">#fe8086</color>-->
<color name="color_white_80">#33FFFFFF</color>
<color name="color_red">#BA2828</color>
<color name="hint_text_color">#BFBDBD</color>
<!-- <color name="s_color">#4A4243</color>-->
<!-- <color name="c_color">#B36E72</color>-->
<!-- <color name="e_color">#EF565E</color>-->
<!-- <color name="color_04122A">#04122A</color>-->
<color name="color_989292">#989292</color>
<!-- <color name="color_F01101">#F01101</color>-->
<color name="color_8004122A">#80D4D5D6</color>
<color name="color_FA3E5B">#FA3E5B</color>
<color name="color_FC3498">#FC3498</color>
<color name="title_color">#F4F6F1</color>
<color name="color_493C3C">#F18D57</color>
<color name="main_bg_color">#080906</color>
</resources>

View File

@ -0,0 +1,14 @@
<resources>
<string name="app_name">Video Wallpaper</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 Video Wallpaper now</string>
</resources>

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

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older 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>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

View File

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

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

View File

@ -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
View 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.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.8.10" 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
View 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

Binary file not shown.

View 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.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

6
keystore.properties Normal file
View File

@ -0,0 +1,6 @@
app_name=Video Wallpaper
package_name=com.free.video.wallpaper
keystoreFile=app/VideoWallpaper.jks
key_alias=VideoWallpaperkey0
key_store_password=VideoWallpaper
key_password=VideoWallpaper

20
settings.gradle.kts Normal file
View File

@ -0,0 +1,20 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Video Wallpaper"
include(":app")