功能完成

This commit is contained in:
litingting 2024-12-24 17:36:18 +08:00
parent d47bed73a5
commit 997672756d
46 changed files with 700 additions and 1758 deletions

BIN
123test.jks Normal file

Binary file not shown.

View File

@ -1,26 +1,31 @@
import java.util.Date
import java.text.SimpleDateFormat
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("io.objectbox")
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.live.mylivewallpaper"
compileSdk = 35
defaultConfig {
applicationId = "com.live.mylivewallpaper"
applicationId = "com.live.mylivewallpaper.test"
minSdk = 23
targetSdk = 35
versionCode = 1
versionName = "1.0"
versionName = "1.0.0"
setProperty(
"archivesBaseName",
"Live Wallpaper_V" + versionName + "(${versionCode})_$timestamp"
)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"

104
app/proguard-rules.pro vendored
View File

@ -19,3 +19,107 @@
# 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.live.mylivewallpaper.data.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 *;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

View File

@ -8,6 +8,7 @@ import com.google.gson.reflect.TypeToken;
import com.live.mylivewallpaper.data.ResultData;
import com.live.mylivewallpaper.help.Common;
import com.live.mylivewallpaper.help.Db;
import com.live.mylivewallpaper.help.Shared;
import java.io.InputStream;
import java.lang.reflect.Type;
@ -35,9 +36,13 @@ public class App extends Application {
mApplication = this;
defaultFont = Typeface.createFromAsset(getAssets(), "font.ttf");
Db.init(this);
String dbinit = Shared.INSTANCE.getDbinit();
if(dbinit.equals("0")){
loadData();
}
}
public static Typeface getDefaultFont() {
return defaultFont;
}
@ -50,7 +55,7 @@ public class App extends Application {
cachedThreadPool.execute(new Runnable() {
@Override
public void run() {
// Common.logMsg("执行任务 "+task+"---开始--"+Thread.currentThread().getName());
Common.logMsg("执行任务 "+task+"---开始--"+Thread.currentThread().getName());
Gson gson = new Gson();
InputStream open = null;
try {
@ -67,7 +72,8 @@ public class App extends Application {
for (ResultData datum : data) {
Db.insertDb(datum);
}
// Common.logMsg("执行任务 "+task+"---完成--"+Thread.currentThread().getName());
Shared.INSTANCE.setDbinit("1");
Common.logMsg("执行任务 "+task+"---完成--"+Thread.currentThread().getName());
}
});
}

View File

@ -10,6 +10,7 @@ import android.view.View;
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;
@ -24,24 +25,25 @@ import com.live.mylivewallpaper.help.Db;
import com.live.mylivewallpaper.help.LiveWallpaperService;
import com.live.mylivewallpaper.help.Shared;
import com.live.mylivewallpaper.listener.OnVideoResultListener;
import com.live.mylivewallpaper.request.ProgressResponseBody;
import com.live.mylivewallpaper.request.RetrofitManager;
import java.io.File;
public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
import io.reactivex.disposables.Disposable;
public class VideoActivity extends BaseActivity<ActivityVideoBinding> implements ProgressResponseBody.ProgressListener {
private CountDownTimer countDownTimer;
private long time = 5000;
private SurfaceHolder mySurfaceHolder;
private String filePath;
private File mFile;
private boolean download = false;
private SimpleExoPlayer exoPlayer;
private ExoPlayer exoPlayer;
private int id;
@ -56,6 +58,9 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
public static String KEY_wallpaperType = "wallpaperType";
public static String KEY_thumb = "thumb";
private boolean loadingui = false;
private Disposable disposable;
@Override
protected ActivityVideoBinding getViewBinding() {
return ActivityVideoBinding.inflate(getLayoutInflater());
@ -63,39 +68,46 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
@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_image);
describe = intent.getStringExtra(KEY_describe);
thumb = intent.getStringExtra(KEY_thumb);
vb.tvDescribe.setText(describe);
showLoading(true);
initFavorite();
filePath = Common.getCachePath(id);
mFile = new File(filePath);
initExoPlay();
initFavorite();
if (mFile.exists()) {
showLoading(false);
Common.logMsg("------checkPlay-");
download = true;
checkPlay();
return;
}
RetrofitManager.getInstance().getMp4(id, image, filePath, new OnVideoResultListener() {
requestVideo();
}
private void requestVideo() {
if (wallpaperType == 2) {
//shift
disposable = RetrofitManager.getInstance(this).getShiftMp4(id, image, filePath, new OnVideoResultListener() {
@Override
public void onVideoResult(boolean success, String path) {
Common.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() {
@Override
public void run() {
showLoading(false);
if (success) {
download = true;
checkPlay();
} else {
// TODO: 2024/12/23 下载失败
// showLoading(false,false);
showRetry();
Common.logMsg("-------------loading fail");
}
}
@ -103,8 +115,29 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
}
});
} else {
disposable = RetrofitManager.getInstance(this).getMp4(id, image, filePath, new OnVideoResultListener() {
@Override
public void onVideoResult(boolean success, String path) {
Common.logMsg("-------------success =" + success + "--path=" + path);
runOnUiThread(new Runnable() {
@Override
public void run() {
if (success) {
download = true;
checkPlay();
} else {
// TODO: 2024/12/23 下载失败
showRetry();
Common.logMsg("-------------loading fail");
}
}
});
}
});
}
}
private void initFavorite() {
boolean b = Db.queryIsLike(id);
@ -113,54 +146,59 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
@OptIn(markerClass = UnstableApi.class)
private void initExoPlay() {
exoPlayer = new SimpleExoPlayer.Builder(this)
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);
Common.logMsg("-------onPlaybackStateChanged-----" + exoPlayer.getPlayWhenReady());
}
}
});
}
private void checkPlay() {
if (download) {
playMedia3();
}
}
private void showLoading(boolean loading) {
private void showLoading(boolean loading, boolean isHorizontal) {
if (loading) {
// vb.topLayout.setBackgroundColor(getColor(R.color.color_white_80));
vb.relativeLoading.setVisibility(View.VISIBLE);
countDownTimer = new CountDownTimer(time, 100L) {
@Override
public void onTick(long millisUntilFinished) {
float v = 100 - (float) millisUntilFinished / time * 100;
int v1 = (int) v;
vb.progress.setProgress(v1);
}
@Override
public void onFinish() {
}
};
countDownTimer.start();
if (isHorizontal) {
vb.horizontalProgress.setVisibility(View.VISIBLE);
vb.normalProgress.setVisibility(View.GONE);
} else {
vb.progress.setProgress(100);
// vb.topLayout.setBackgroundColor(getColor(R.color.transparent));
vb.normalProgress.setVisibility(View.VISIBLE);
vb.horizontalProgress.setVisibility(View.GONE);
}
} else {
if (isHorizontal) {
vb.horizontalProgress.setProgress(100);
}
vb.relativeLoading.setVisibility(View.GONE);
}
}
private void showRetry() {
vb.relativeLoading.setVisibility(View.VISIBLE);
vb.horizontalProgress.setVisibility(View.GONE);
vb.normalProgress.setVisibility(View.GONE);
vb.layoutRetry.setVisibility(View.VISIBLE);
}
@Override
protected void onInitClick() {
vb.layoutFavorite.setOnClickListener(this);
vb.layoutSet.setOnClickListener(this);
vb.layoutBack.setOnClickListener(this);
vb.tvRetry.setOnClickListener(this);
}
@Override
@ -188,6 +226,8 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
setLiveWallpaper();
} else if (v.equals(vb.layoutBack)) {
finish();
} else if (v.equals(vb.tvRetry)) {
requestVideo();
}
@ -200,11 +240,14 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
if (exoPlayer != null) {
exoPlayer.release();
}
Common.logMsg("-----Video-------onDestroy");
if (countDownTimer != null) {
countDownTimer.cancel();
countDownTimer = null;
}
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
}
}
@ -255,4 +298,28 @@ public class VideoActivity extends BaseActivity<ActivityVideoBinding> {
}
@Override
public void onProgress(long bytesRead, long contentLength, boolean done) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Common.logMsg("------------onProgress=" + Thread.currentThread().getName());
if (contentLength <= 0) {
} else {
if (!loadingui) {
showLoading(true, true);
loadingui = true;
}
int progress = (int) ((100 * bytesRead) / contentLength);
Common.logMsg("Download progress: " + progress + "%");
vb.horizontalProgress.setProgress(progress);
}
if (done) {
Common.logMsg("Download complete!");
}
}
});
}
}

View File

@ -50,12 +50,12 @@ public class WelcomeActivity extends BaseActivity<ActivityWelcomeBinding> {
@Override
public boolean isFullScreen() {
return false;
return true;
}
@Override
public boolean statusBarLight() {
return false;
return true;
}
@Override

View File

@ -1,6 +1,7 @@
package com.live.mylivewallpaper.fragment;
import android.os.Bundle;
import android.view.View;
import androidx.lifecycle.Observer;
import androidx.paging.PagingData;
@ -12,6 +13,7 @@ import com.live.mylivewallpaper.adapter.MainAdapter;
import com.live.mylivewallpaper.base.BaseFragment;
import com.live.mylivewallpaper.data.LikeData;
import com.live.mylivewallpaper.data.ResultData;
import com.live.mylivewallpaper.databinding.FragmentLikeBinding;
import com.live.mylivewallpaper.databinding.FragmentMainBinding;
import com.live.mylivewallpaper.help.Common;
import com.live.mylivewallpaper.help.Db;
@ -19,13 +21,16 @@ import com.live.mylivewallpaper.help.ItemDecoration;
import com.live.mylivewallpaper.listener.OnLikeUpdateListener;
import com.live.mylivewallpaper.viewmode.VmLikeFragment;
import java.util.List;
import io.objectbox.reactive.DataSubscription;
public class LikeFragment extends BaseFragment<FragmentMainBinding> {
public class LikeFragment extends BaseFragment<FragmentLikeBinding> {
private DataSubscription dataSubscription;
private VmLikeFragment vmLikeFragment;
public LikeFragment() {
}
@ -35,16 +40,12 @@ public class LikeFragment extends BaseFragment<FragmentMainBinding> {
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected FragmentMainBinding getFragmentVb() {
return FragmentMainBinding.inflate(getLayoutInflater());
protected FragmentLikeBinding getFragmentVb() {
return FragmentLikeBinding.inflate(getLayoutInflater());
}
@Override
@ -54,17 +55,23 @@ public class LikeFragment extends BaseFragment<FragmentMainBinding> {
Vb.recycler.setLayoutManager(new GridLayoutManager(requireContext(), 2, RecyclerView.VERTICAL, false));
Vb.recycler.addItemDecoration(new ItemDecoration(requireContext(), 5, 5, 0));
vmLikeFragment = getFragmentScopeViewModel(VmLikeFragment.class);
vmLikeFragment.getPagingData().observe(getViewLifecycleOwner(), resultDataPagingData -> {
vmLikeFragment.likeLiveData.observe(getViewLifecycleOwner(), new Observer<PagingData<LikeData>>() {
@Override
public void onChanged(PagingData<LikeData> data) {
Common.logMsg("---onChanged-------------");
likeAdapter.submitData(requireActivity().getLifecycle(), resultDataPagingData);
likeAdapter.submitData(requireActivity().getLifecycle(), data);
}
});
dataSubscription = Db.setLikeUpdateListener(new OnLikeUpdateListener() {
@Override
public void onLikeUpdate() {
vmLikeFragment.getPagingData().observe(getViewLifecycleOwner(), resultDataPagingData -> {
Common.logMsg("---onChanged-2------------");
likeAdapter.submitData(requireActivity().getLifecycle(), resultDataPagingData);
});
public void onLikeUpdate(List<LikeData> data) {
if(data.size() == 0){
Vb.layoutEmpty.setVisibility(View.VISIBLE);
}else {
Vb.layoutEmpty.setVisibility(View.GONE);
}
vmLikeFragment.update(data);
}
});
}

View File

@ -63,7 +63,7 @@ public class Db {
@Override
public void onData(@NonNull List<LikeData> data) {
Common.logMsg("---OnLikeUpdateListener-------------" + data.size());
listener.onLikeUpdate();
listener.onLikeUpdate(data);
}
});

View File

@ -7,6 +7,7 @@ import com.live.mylivewallpaper.App
object Shared {
val KEY_CURRENT_WAPPPAPER_PATH = "wallpaper_path"
val DB_INIT_DATAT = "init_db_data"
private var shared: SharedPreferences? = null
@ -18,7 +19,14 @@ object Shared {
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) {
@ -29,7 +37,7 @@ object Shared {
}
private const val defaultFile = "chat_mate"
fun saveString(key: String, value: String) {

View File

@ -1,5 +1,9 @@
package com.live.mylivewallpaper.listener;
import com.live.mylivewallpaper.data.LikeData;
import java.util.List;
public interface OnLikeUpdateListener {
void onLikeUpdate();
void onLikeUpdate(List<LikeData> data);
}

View File

@ -36,7 +36,7 @@ public class MyLikeSource extends PagingSource<Integer, LikeData> {
int page = loadParams.getKey() != null ? loadParams.getKey() : 1;
List<LikeData> data = Db.queryLike(page);
Common.logMsg("-----loadLIke---------page="+page+"'--data="+data.size());
Common.logMsg("-----loadLIke---------page="+page+"--data="+data.size());
return new LoadResult.Page<>(
data,
page > 1 ? page - 1 : null,

View File

@ -9,7 +9,7 @@ import retrofit2.http.POST;
public interface MusicApi {
//首页数据
@POST("LiveLoop/AppData/jmywall.php")
@FormUrlEncoded
Observable<ResponseBody> getMP4(@Field("pi") int pi,
@ -19,4 +19,25 @@ public interface MusicApi {
@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,28 @@
package com.live.mylivewallpaper.request;
import okhttp3.Interceptor;
import okhttp3.Response;
import java.io.IOException;
public class ProgressInterceptor implements Interceptor {
private final ProgressResponseBody.ProgressListener progressListener;
public ProgressInterceptor(ProgressResponseBody.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 ProgressResponseBody(originalResponse.body(), fileLength, progressListener))
.build();
}
}

View File

@ -0,0 +1,57 @@
package com.live.mylivewallpaper.request;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import java.io.IOException;
public class ProgressResponseBody extends ResponseBody {
private final ResponseBody responseBody;
private final ProgressListener progressListener;
private BufferedSource bufferedSource;
private String length;
public ProgressResponseBody(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

@ -1,22 +1,19 @@
package com.live.mylivewallpaper.request;
import com.google.gson.Gson;
import com.live.mylivewallpaper.data.ResultData;
import com.live.mylivewallpaper.help.Common;
import com.live.mylivewallpaper.listener.OnVideoResultListener;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
@ -35,18 +32,14 @@ public class RetrofitManager {
public MediaType JSON = MediaType.get("application/json; charset=utf-8");
private MusicApi musicApi;
private List<ResultData> shiftList =new ArrayList<>();
private List<ResultData> ExploreList =new ArrayList<>();
private List<ResultData> TrendingList =new ArrayList<>();
private List<ResultData> DnamicList =new ArrayList<>();
private RetrofitManager(ProgressResponseBody.ProgressListener listener) {
private RetrofitManager() {
musicApi = getRetrofit().create(MusicApi.class);
musicApi = getRetrofit(listener).create(MusicApi.class);
}
private synchronized Retrofit getRetrofit() {
private synchronized Retrofit getRetrofit(ProgressResponseBody.ProgressListener listener) {
if (retrofit == null) {
long DEFAULT_TIMEOUT = 5;
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
@ -56,7 +49,7 @@ public class RetrofitManager {
.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(new ProgressInterceptor(listener))
.build();
retrofit = new Retrofit.Builder()
.baseUrl(base_Host)
@ -69,11 +62,11 @@ public class RetrofitManager {
return retrofit;
}
public static RetrofitManager getInstance() {
public static RetrofitManager getInstance(ProgressResponseBody.ProgressListener listener) {
if (REQUEST_MANAGER == null) {
synchronized (RetrofitManager.class) { //,防止线程问题
synchronized (RetrofitManager.class) {
if (REQUEST_MANAGER == null) {
REQUEST_MANAGER = new RetrofitManager();
REQUEST_MANAGER = new RetrofitManager(listener);
}
}
}
@ -81,24 +74,65 @@ public class RetrofitManager {
}
public void getMp4(int id, String image,String path, OnVideoResultListener listener) {
musicApi.getMP4(id,"5eV6snEwfY7Yv6Ub",image,"DL8","ViewLive" )
public Disposable getMp4(int id, String image, String path, OnVideoResultListener listener) {
Disposable subscribe = musicApi.getMP4(id, "5eV6snEwfY7Yv6Ub", image, "DL8", "ViewLive")
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(new ObserverWrapper<>(new OnRequestListener<ResponseBody>() {
.subscribe(new Consumer<ResponseBody>() {
@Override
public void onFail(String errorMsg) {
listener.onVideoResult(false,null);
}
@Override
public void onSuccess(ResponseBody data) {
boolean b = Common.writeFile(data.byteStream(), path);
public void accept(ResponseBody body) throws Exception {
boolean b = Common.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, OnVideoResultListener listener) {
Disposable subscribe = musicApi.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 = Common.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

@ -11,6 +11,8 @@ import androidx.paging.PagingLiveData;
import com.live.mylivewallpaper.data.LikeData;
import com.live.mylivewallpaper.paging.MyLikeSource;
import java.util.List;
public class VmLikeFragment extends ViewModel {
@ -18,8 +20,8 @@ public class VmLikeFragment extends ViewModel {
private MutableLiveData<PagingData<LikeData>> _playList = new MutableLiveData<>();
public LiveData<PagingData<LikeData>> likeLiveData = _playList ;
private MutableLiveData<PagingData<LikeData>> _likeLiveData = new MutableLiveData<>();
public LiveData<PagingData<LikeData>> likeLiveData = _likeLiveData ;
public LiveData<PagingData<LikeData>> getPagingData() {
Pager<Integer, LikeData> integerLikeDataPager = new Pager<>(
@ -29,6 +31,10 @@ public class VmLikeFragment extends ViewModel {
return PagingLiveData.getLiveData(integerLikeDataPager);
}
public void update(List<LikeData> data){
PagingData<LikeData> from = PagingData.from(data);
_likeLiveData.postValue(from);
}
}

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/tab_selected_color"
android:startColor="@color/white" />
</shape>

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

@ -1,170 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@ -11,9 +11,9 @@
<shape>
<corners android:radius="20dp" />
<gradient
android:startColor="#1CC8EE"
android:centerColor="#69FE73"
android:endColor="#CBD64B"
android:startColor="#9ae6f6"
android:centerColor="#39bce2"
android:endColor="#6c4adf"
android:angle="0" />
</shape>
</clip>

View File

@ -5,7 +5,6 @@
android:id="@+id/top_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".activity.VideoActivity">
<androidx.media3.ui.PlayerView
@ -13,6 +12,7 @@
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"
@ -20,20 +20,7 @@
app:show_vr_button="false"
app:use_controller="false" />
<FrameLayout
android:id="@+id/layout_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="37dp"
android:background="@drawable/bg_shape_favorite"
android:padding="11dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/im_back" />
</FrameLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -108,11 +95,13 @@
android:id="@+id/relative_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:background="@color/color_white_80"
android:visibility="gone">
android:visibility="visible">
<ProgressBar
android:id="@+id/progress"
android:id="@+id/horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="6dp"
@ -121,7 +110,63 @@
android:progress="0"
android:progressDrawable="@drawable/progress_bar_horizontal" />
</RelativeLayout>
<ProgressBar
android:id="@+id/normal_progress"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:indeterminateTint="@color/black"
android:visibility="gone" />
<LinearLayout
android:id="@+id/layout_retry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"
android:orientation="vertical">
<com.live.mylivewallpaper.help.MyTextView
android:id="@+id/tv_load_fail"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingExtra="4dp"
android:text="@string/fail_describe"
android:textColor="@color/black"
android:textSize="16sp"
app:apply_font="true" />
<com.live.mylivewallpaper.help.MyTextView
android:id="@+id/tv_retry"
android:layout_width="120dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/btn_retry_bg"
android:gravity="center"
android:text="@string/Retry"
android:textColor="@color/white"
android:textSize="17sp"
app:apply_font="true" />
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/layout_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="37dp"
android:background="@drawable/bg_shape_favorite"
android:padding="11dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/im_back" />
</FrameLayout>
</RelativeLayout>

View File

@ -36,7 +36,7 @@
android:layout_height="6dp"
android:layout_marginBottom="80dp"
android:max="100"
android:progress="0"
android:progress="1"
android:progressDrawable="@drawable/welcom_pb"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -0,0 +1,39 @@
<?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=".fragment.MainFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:id="@+id/layout_empty"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/empty_favorite" />
<com.live.mylivewallpaper.help.MyTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/empty_favorite"
android:layout_marginTop="16dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:textColor="@color/hint_text_color"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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="wrap_content"
android:layout_height="match_parent"
tools:context=".fragment.MainFragment">
@ -12,4 +12,6 @@
android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
</RelativeLayout>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -4,7 +4,8 @@
<color name="white">#FFFFFFFF</color>
<color name="transparent">#00000000</color>
<color name="tab_normal_color">#878080</color>
<color name="tab_selected_color">#DDB94D</color>
<color name="tab_selected_color">#fea701</color>
<color name="color_white_80">#80FFFFFF</color>
<color name="color_red">#BA2828</color>
<color name="hint_text_color">#BFBDBD</color>
</resources>

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">MyLiveWallpaper</string>
<string name="app_name">Live Wallpaper</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="tab_title_1">Trending</string>
@ -7,4 +7,7 @@
<string name="tab_title_3">Shift</string>
<string name="tab_title_4">Favorites</string>
<string name="set">Set</string>
<string name="fail_describe">Loading failed, please check the network and try again</string>
<string name="Retry">Retry</string>
<string name="empty_favorite">You haven not collected any wallpapers yet!</string>
</resources>