V1.0.0.0(1)
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
BIN
app/ShinyWallpaper.jks
Normal file
BIN
app/ShinyWallpapertest.jks
Normal file
53
app/build.gradle.kts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import java.util.Date
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
}
|
||||||
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
|
android {
|
||||||
|
namespace = "com.wallpaper.shinywallpaper"
|
||||||
|
compileSdk = 34
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.wallpaper.shinywallpaper"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 34
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0.0"
|
||||||
|
setProperty("archivesBaseName", "Shiny 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_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation(libs.appcompat)
|
||||||
|
implementation(libs.material)
|
||||||
|
implementation(libs.activity)
|
||||||
|
implementation(libs.constraintlayout)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.ext.junit)
|
||||||
|
androidTestImplementation(libs.espresso.core)
|
||||||
|
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||||
|
annotationProcessor ("com.github.bumptech.glide:compiler:4.16.0")
|
||||||
|
implementation ("androidx.viewpager2:viewpager2:1.1.0")
|
||||||
|
implementation ("androidx.recyclerview:recyclerview:1.3.2")
|
||||||
|
implementation ("com.google.android.material:material:1.4.0")
|
||||||
|
val roomVersion = "2.5.0"
|
||||||
|
implementation("androidx.room:room-runtime:$roomVersion")
|
||||||
|
annotationProcessor("androidx.room:room-compiler:$roomVersion")
|
||||||
|
}
|
||||||
49
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# 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
|
||||||
|
# ------------Room--------------------------------------
|
||||||
|
|
||||||
|
-keepclassmembers class com.wallpaper.shinywallpaper.StaticValue {
|
||||||
|
public static final java.lang.String key_app_database;
|
||||||
|
public static final int key_app_database_version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@androidx.room.Query <methods>;
|
||||||
|
}
|
||||||
|
-keep class com.wallpaper.shinywallpaper.Database.AppDataBase { *; }
|
||||||
|
-keepclassmembers class com.wallpaper.shinywallpaper.Database.FavoriteImageDao { *; }
|
||||||
|
-keep class com.wallpaper.shinywallpaper.Database.FavoriteImage { *; }
|
||||||
|
# ------------Room--------------------------------------
|
||||||
|
|
||||||
|
# ------------Glide--------------------------------------
|
||||||
|
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||||||
|
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||||||
|
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
||||||
|
**[] $VALUES;
|
||||||
|
public *;
|
||||||
|
}
|
||||||
|
# for DexGuard only
|
||||||
|
# -keepresourcexmlelements manifest/application/meta-data@value=GlideModule
|
||||||
|
# ------------Glide--------------------------------------
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.wallpaper.shinywallpaper;
|
||||||
|
|
||||||
|
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.example.ShinyWallpaper", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
43
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="32" />
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".Application.MainApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.ShinyWallpaper"
|
||||||
|
tools:targetApi="31">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".SecondSub.SubFullScreenImageActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".SecondSub.FullScreenImageActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".SecondSub.SubRecyclerViewActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".Main.MainActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
BIN
app/src/main/assets/Inter-Medium.ttf
Normal file
2203
app/src/main/assets/pink_wallpaper.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Application;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class MainApplication extends Application {
|
||||||
|
/**
|
||||||
|
* 全局的上下文
|
||||||
|
*/
|
||||||
|
private static Context mContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
mContext = getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取context
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Context getContext(){
|
||||||
|
return mContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLowMemory() {
|
||||||
|
super.onLowMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Database;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.room.Database;
|
||||||
|
import androidx.room.Room;
|
||||||
|
import androidx.room.RoomDatabase;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
@Database(entities = {FavoriteImage.class}, version = StaticValue.key_app_database_version,exportSchema = false)
|
||||||
|
public abstract class AppDataBase extends RoomDatabase {
|
||||||
|
public abstract FavoriteImageDao favoriteImageDao();
|
||||||
|
|
||||||
|
private static volatile AppDataBase INSTANCE;
|
||||||
|
|
||||||
|
public static AppDataBase getDatabase(final Context context) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
synchronized (AppDataBase.class) {
|
||||||
|
if (INSTANCE == null) {
|
||||||
|
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||||
|
AppDataBase.class, StaticValue.key_app_database)
|
||||||
|
.fallbackToDestructiveMigration() // 如果版本号更改,销毁现有数据库并重新创建
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Database;
|
||||||
|
|
||||||
|
import androidx.room.Entity;
|
||||||
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class FavoriteImage {
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
public int id;
|
||||||
|
|
||||||
|
public String sourceUrl;
|
||||||
|
public String preUrl;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceUrl() {
|
||||||
|
return sourceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceUrl(String sourceUrl) {
|
||||||
|
this.sourceUrl = sourceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreUrl() {
|
||||||
|
return preUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreUrl(String preUrl) {
|
||||||
|
this.preUrl = preUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Database;
|
||||||
|
|
||||||
|
import androidx.room.Dao;
|
||||||
|
import androidx.room.Delete;
|
||||||
|
import androidx.room.Insert;
|
||||||
|
import androidx.room.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
public interface FavoriteImageDao {
|
||||||
|
@Insert
|
||||||
|
void insert(FavoriteImage favoriteImage);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM FavoriteImage")
|
||||||
|
List<FavoriteImage> getAll();
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
void delete(FavoriteImage favoriteImage);
|
||||||
|
|
||||||
|
@Query("DELETE FROM FavoriteImage WHERE sourceUrl = :imageUrl")
|
||||||
|
void deleteBySourceUrl(String imageUrl);
|
||||||
|
|
||||||
|
@Query("DELETE FROM FavoriteImage WHERE preUrl = :imageUrl")
|
||||||
|
void deleteByPreUrl(String imageUrl);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM FavoriteImage WHERE sourceUrl = :imageUrl")
|
||||||
|
FavoriteImage getBySourceUrl(String imageUrl);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM FavoriteImage WHERE preUrl = :imageUrl")
|
||||||
|
FavoriteImage getByPreUrl(String imageUrl);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(*) FROM FavoriteImage WHERE sourceUrl = :url")
|
||||||
|
int isImageFavorite(String url);
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Favorite;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Database.AppDataBase;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.FavoriteImage;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.FavoriteImageDao;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class FavoriteFragment extends Fragment {
|
||||||
|
|
||||||
|
private AppDataBase db;
|
||||||
|
private FavoriteImageDao favoriteImageDao;
|
||||||
|
private FavoriteRecyclerViewAdapter adapter;
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
private ImageView placeholderImage;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view=inflater.inflate(R.layout.fragment_favorite,container,false);
|
||||||
|
|
||||||
|
db = AppDataBase.getDatabase(requireContext());
|
||||||
|
favoriteImageDao = db.favoriteImageDao();
|
||||||
|
recyclerView = view.findViewById(R.id.favorite_recycler_view);
|
||||||
|
placeholderImage = view.findViewById(R.id.placeholder_image);
|
||||||
|
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||||
|
|
||||||
|
adapter = new FavoriteRecyclerViewAdapter();
|
||||||
|
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
refreshData();
|
||||||
|
|
||||||
|
return view;
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshData() {
|
||||||
|
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<FavoriteImage> favoriteImages = favoriteImageDao.getAll();
|
||||||
|
requireActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (favoriteImages.isEmpty()) {
|
||||||
|
recyclerView.setVisibility(View.GONE);
|
||||||
|
placeholderImage.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
recyclerView.setVisibility(View.VISIBLE);
|
||||||
|
placeholderImage.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
adapter.updateData(favoriteImages);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Favorite;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.FavoriteImage;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
import com.wallpaper.shinywallpaper.SecondSub.FullScreenImageActivity;
|
||||||
|
import com.wallpaper.shinywallpaper.SecondSub.SubFullScreenImageActivity;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FavoriteRecyclerViewAdapter extends RecyclerView.Adapter<FavoriteRecyclerViewAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<FavoriteImage> favoriteImages;
|
||||||
|
|
||||||
|
public FavoriteRecyclerViewAdapter() {
|
||||||
|
this.favoriteImages = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.sub_item_image, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
FavoriteImage favoriteImage = favoriteImages.get(position);
|
||||||
|
String imageUrl = favoriteImage.getPreUrl();
|
||||||
|
|
||||||
|
Glide.with(MainApplication.getContext())
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(false)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(imageUrl)
|
||||||
|
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||||
|
.error(R.drawable.rectangular_placeholder_map)
|
||||||
|
.transform(new CenterCrop())
|
||||||
|
.into(holder.imageView);
|
||||||
|
|
||||||
|
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
ImageItem imageItem = new ImageItem(favoriteImage.getSourceUrl(), favoriteImage.getPreUrl());
|
||||||
|
Intent intent = new Intent(holder.itemView.getContext(), FullScreenImageActivity.class);
|
||||||
|
intent.putExtra("123421", imageItem);
|
||||||
|
holder.itemView.getContext().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(@NonNull ViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
ImageView imageView = holder.imageView;
|
||||||
|
if (imageView != null) {
|
||||||
|
Glide.with(MainApplication.getContext()).clear(imageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return favoriteImages.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateData(List<FavoriteImage> newFavoriteImages) {
|
||||||
|
favoriteImages = newFavoriteImages;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
public ImageView imageView;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
imageView = view.findViewById(R.id.sub_image_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.FirstSub;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Json.Category;
|
||||||
|
import com.wallpaper.shinywallpaper.Utils.JsonParser;
|
||||||
|
import com.wallpaper.shinywallpaper.Utils.LoadJSON;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class MainFragment extends Fragment {
|
||||||
|
|
||||||
|
private List<Category> categoryList =new ArrayList<>();
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.fragment_main, container, false);
|
||||||
|
|
||||||
|
RecyclerView recyclerView = view.findViewById(R.id.main_fragment_recycler);
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(getContext(),1));
|
||||||
|
|
||||||
|
// 从assets文件夹中读取JSON文件
|
||||||
|
String jsonString = LoadJSON.loadJSONFromAsset("pink_wallpaper.json");
|
||||||
|
|
||||||
|
List<Category> categories = JsonParser.parseJson(jsonString);
|
||||||
|
|
||||||
|
recyclerView.setAdapter(new MainRecyclerViewAdapter(getContext(), categories));
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.FirstSub;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.Category;
|
||||||
|
import com.wallpaper.shinywallpaper.SecondSub.SubRecyclerViewActivity;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainRecyclerViewAdapter extends RecyclerView.Adapter<MainRecyclerViewAdapter.MyViewHolder> {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<Category> categoryList;
|
||||||
|
|
||||||
|
public MainRecyclerViewAdapter(Context context,List<Category> categoryList) {
|
||||||
|
this.categoryList = categoryList;
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_image, parent, false);
|
||||||
|
return new MyViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||||
|
|
||||||
|
Category category = categoryList.get(position);
|
||||||
|
|
||||||
|
String originalName = category.getName();
|
||||||
|
// 检查名称是否为空,以避免空指针异常
|
||||||
|
if (originalName != null && !originalName.isEmpty()) {
|
||||||
|
// 将首字母大写
|
||||||
|
String capitalizedName = originalName.substring(0, 1).toUpperCase() + originalName.substring(1);
|
||||||
|
// 设置文本字体
|
||||||
|
holder.textView.setTypeface(Typeface.createFromAsset(context.getAssets(), "Inter-Medium.ttf"));
|
||||||
|
//设置文本
|
||||||
|
holder.textView.setText(capitalizedName);
|
||||||
|
} else {
|
||||||
|
// 如果名称为空,可以设置一个默认值或者不设置
|
||||||
|
holder.textView.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!category.getList().isEmpty()) {
|
||||||
|
Glide.with(MainApplication.getContext())
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(category.getList().get(0).getSourceUrl())
|
||||||
|
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||||
|
.error(R.drawable.rectangular_placeholder_map)
|
||||||
|
.transform(new CenterCrop())
|
||||||
|
.into(holder.imageView);
|
||||||
|
|
||||||
|
holder.imageView.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(context, SubRecyclerViewActivity.class);
|
||||||
|
intent.putExtra(StaticValue.key_category, category);
|
||||||
|
context.startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(@NonNull MyViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
ImageView imageView=holder.imageView;
|
||||||
|
if (imageView!=null){
|
||||||
|
Glide.with(MainApplication.getContext()).clear(imageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return categoryList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView imageView;
|
||||||
|
TextView textView;
|
||||||
|
|
||||||
|
public MyViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.image_view);
|
||||||
|
textView = itemView.findViewById(R.id.text_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Json;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Category implements Serializable {
|
||||||
|
private String name;
|
||||||
|
private List<ImageItem> list;
|
||||||
|
|
||||||
|
public Category(String name, List<ImageItem> list) {
|
||||||
|
this.name = name;
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ImageItem> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Json;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ImageItem implements Serializable {
|
||||||
|
private String sourceUrl;
|
||||||
|
private String preUrl;
|
||||||
|
|
||||||
|
public ImageItem(String sourceUrl, String preUrl) {
|
||||||
|
this.sourceUrl = sourceUrl;
|
||||||
|
this.preUrl = preUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceUrl() {
|
||||||
|
return sourceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPreUrl() {
|
||||||
|
return preUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Main;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.google.android.material.tabs.TabLayoutMediator;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
ViewPager2 viewPager2 = findViewById(R.id.main_viewpager);
|
||||||
|
TabLayout tabLayout = findViewById(R.id.main_tablayout);
|
||||||
|
|
||||||
|
MainViewPagerAdapter adapter = new MainViewPagerAdapter(this);
|
||||||
|
viewPager2.setAdapter(adapter);
|
||||||
|
|
||||||
|
|
||||||
|
//关联tabLayout和viewpager2,设置tabLayout标签样式
|
||||||
|
new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> {
|
||||||
|
View customView = LayoutInflater.from(this).inflate(R.layout.main_tablayout_custom, null);
|
||||||
|
tab.setCustomView(customView);
|
||||||
|
|
||||||
|
ImageView tabIcon = customView.findViewById(R.id.main_tab_custom);
|
||||||
|
View tabIndicator = customView.findViewById(R.id.tab_indicator);
|
||||||
|
if (tabIcon != null) {
|
||||||
|
if (position == 0) {
|
||||||
|
tabIcon.setImageResource(R.drawable.select_main_category);
|
||||||
|
tabIndicator.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
tabIcon.setImageResource(R.drawable.unselect_main_favorite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).attach();
|
||||||
|
|
||||||
|
//设置标签选中事件
|
||||||
|
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(TabLayout.Tab tab) {
|
||||||
|
View customView = tab.getCustomView();
|
||||||
|
if (customView != null) {
|
||||||
|
ImageView tabIcon = customView.findViewById(R.id.main_tab_custom);
|
||||||
|
View tabIndicator = customView.findViewById(R.id.tab_indicator);
|
||||||
|
if (tabIcon != null) {
|
||||||
|
if (tab.getPosition() == 0) {
|
||||||
|
tabIcon.setImageResource(R.drawable.select_main_category);
|
||||||
|
tabIndicator.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
tabIcon.setImageResource(R.drawable.select_main_favorite);
|
||||||
|
tabIndicator.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
View customView = tab.getCustomView();
|
||||||
|
if (customView != null) {
|
||||||
|
ImageView tabIcon = customView.findViewById(R.id.main_tab_custom);
|
||||||
|
View tabIndicator = customView.findViewById(R.id.tab_indicator);
|
||||||
|
if (tabIcon != null) {
|
||||||
|
if (tab.getPosition() == 0) {
|
||||||
|
tabIcon.setImageResource(R.drawable.unselect_main_category);
|
||||||
|
tabIndicator.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
tabIcon.setImageResource(R.drawable.unselect_main_favorite);
|
||||||
|
tabIndicator.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
// 处理Tab重新选中事件
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Main;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Favorite.FavoriteFragment;
|
||||||
|
import com.wallpaper.shinywallpaper.FirstSub.MainFragment;
|
||||||
|
|
||||||
|
public class MainViewPagerAdapter extends FragmentStateAdapter {
|
||||||
|
public MainViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
|
||||||
|
super(fragmentActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Fragment createFragment(int position) {
|
||||||
|
|
||||||
|
if (position == 0) {
|
||||||
|
return new MainFragment();
|
||||||
|
} else {
|
||||||
|
return new FavoriteFragment();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,251 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.SecondSub;
|
||||||
|
|
||||||
|
import static com.wallpaper.shinywallpaper.Utils.GallerySaver.REQUEST_CODE_WRITE_EXTERNAL_STORAGE;
|
||||||
|
|
||||||
|
import android.app.WallpaperManager;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.AppDataBase;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.FavoriteImage;
|
||||||
|
import com.wallpaper.shinywallpaper.Database.FavoriteImageDao;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
import com.wallpaper.shinywallpaper.Utils.GallerySaver;
|
||||||
|
|
||||||
|
public class FullScreenImageActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ImageView fullScreenImageView;
|
||||||
|
private ImageButton setWallpaperButton;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private ImageButton btnBack;
|
||||||
|
private ImageButton btnDownload;
|
||||||
|
private ImageButton btnShare;
|
||||||
|
private ImageButton btnFavorite;
|
||||||
|
private AppDataBase db;
|
||||||
|
private FavoriteImageDao favoriteImageDao;
|
||||||
|
private GallerySaver gallerySaver;
|
||||||
|
private boolean isFavorite;
|
||||||
|
private ImageView overlayView;
|
||||||
|
private ImageItem imageItem;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_full_screen_image);
|
||||||
|
|
||||||
|
// Window w = getWindow();
|
||||||
|
// // 设置无边界布局标志,仅扩展到状态栏
|
||||||
|
// w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
// // 移除半透明状态栏标志
|
||||||
|
// w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
//// 设置半透明状态栏
|
||||||
|
//// w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
// // 设置透明状态栏
|
||||||
|
// w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
// w.setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
// w.setNavigationBarColor(Color.TRANSPARENT);
|
||||||
|
|
||||||
|
|
||||||
|
btnBack = findViewById(R.id.btn_back);
|
||||||
|
btnDownload = findViewById(R.id.btn_download);
|
||||||
|
btnShare = findViewById(R.id.btn_share);
|
||||||
|
btnFavorite = findViewById(R.id.btn_favorite);
|
||||||
|
fullScreenImageView = findViewById(R.id.fullscreen_image_view);
|
||||||
|
setWallpaperButton = findViewById(R.id.setWallpaperButton);
|
||||||
|
progressBar = findViewById(R.id.progressBar);
|
||||||
|
overlayView = findViewById(R.id.overlayView);
|
||||||
|
gallerySaver=new GallerySaver(this,progressBar,overlayView);
|
||||||
|
|
||||||
|
// 接收传递的 ImageItem 对象
|
||||||
|
Intent intent = getIntent();
|
||||||
|
imageItem = (ImageItem) intent.getSerializableExtra("123421");
|
||||||
|
|
||||||
|
Log.d("FullScreenImageActivity", "Received Intent: " + intent.getExtras());
|
||||||
|
|
||||||
|
if (imageItem == null) {
|
||||||
|
finish(); // Exit activity if no image URL is provided
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
db = AppDataBase.getDatabase(this);
|
||||||
|
favoriteImageDao = db.favoriteImageDao();
|
||||||
|
|
||||||
|
// Load image into ImageView
|
||||||
|
Glide.with(MainApplication.getContext())
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(imageItem.getSourceUrl())
|
||||||
|
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||||
|
.error(R.drawable.rectangular_placeholder_map)
|
||||||
|
.centerCrop()
|
||||||
|
.transform(new RoundedCorners(40))
|
||||||
|
.into(fullScreenImageView);
|
||||||
|
|
||||||
|
// Check if the image is already in favorites
|
||||||
|
checkIfFavorite();
|
||||||
|
|
||||||
|
btnFavorite.setOnClickListener(v -> {
|
||||||
|
if (isFavorite) {
|
||||||
|
removeFromFavorites();
|
||||||
|
} else {
|
||||||
|
addToFavorites();
|
||||||
|
}
|
||||||
|
updateFavoriteButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
btnDownload.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showProgress();
|
||||||
|
FullScreenImageActivity activity = (FullScreenImageActivity) v.getContext();
|
||||||
|
gallerySaver.saveToGallery(activity, imageItem.getSourceUrl());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnBack.setOnClickListener(v -> finish());
|
||||||
|
btnShare.setOnClickListener(v -> shareImageUrl(imageItem.getSourceUrl()));
|
||||||
|
setWallpaperButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showProgress();
|
||||||
|
|
||||||
|
setWallpaper();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fullScreenImageView.setOnClickListener(v -> toFullScreen());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
if (requestCode == REQUEST_CODE_WRITE_EXTERNAL_STORAGE) {
|
||||||
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// 权限被授予,可以执行保存操作
|
||||||
|
gallerySaver.saveToGallery(this, imageItem.getSourceUrl());
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Description The write permission to the external storage is denied", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setWallpaper() {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
fullScreenImageView.setDrawingCacheEnabled(true);
|
||||||
|
Bitmap bitmap = ((BitmapDrawable) fullScreenImageView.getDrawable()).getBitmap();
|
||||||
|
WallpaperManager wallpaperManager = WallpaperManager.getInstance(getApplicationContext());
|
||||||
|
wallpaperManager.setBitmap(bitmap);
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
hideProgress();
|
||||||
|
setWallpaperButton.setEnabled(true); // Re-enable the button
|
||||||
|
Toast.makeText(getApplicationContext(), StaticValue.key_wallpaper_setting_is_successful, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
hideProgress();
|
||||||
|
Toast.makeText(getApplicationContext(), StaticValue.key_failed_to_set_wallpaper, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void toFullScreen() {
|
||||||
|
Intent intent = new Intent(this, SubFullScreenImageActivity.class);
|
||||||
|
intent.putExtra(StaticValue.key_imageUrl_1, imageItem.getSourceUrl());
|
||||||
|
this.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shareImageUrl(String imageUrl) {
|
||||||
|
Intent sendIntent = new Intent();
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, imageItem.getSourceUrl());
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(Intent.createChooser(sendIntent, StaticValue.key_share_to));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void checkIfFavorite() {
|
||||||
|
new Thread(() -> {
|
||||||
|
isFavorite = favoriteImageDao.getBySourceUrl(imageItem.getSourceUrl()) != null;
|
||||||
|
isFavorite = favoriteImageDao.getByPreUrl(imageItem.getPreUrl()) != null;
|
||||||
|
runOnUiThread(this::updateFavoriteButton);
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToFavorites() {
|
||||||
|
new Thread(() -> {
|
||||||
|
FavoriteImage favoriteImage = new FavoriteImage();
|
||||||
|
favoriteImage.sourceUrl = imageItem.getSourceUrl();
|
||||||
|
favoriteImage.preUrl = imageItem.getPreUrl();
|
||||||
|
favoriteImageDao.insert(favoriteImage);
|
||||||
|
isFavorite = true;
|
||||||
|
runOnUiThread(this::updateFavoriteButton);
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeFromFavorites() {
|
||||||
|
new Thread(() -> {
|
||||||
|
favoriteImageDao.deleteByPreUrl(imageItem.getPreUrl());
|
||||||
|
favoriteImageDao.deleteBySourceUrl(imageItem.getSourceUrl());
|
||||||
|
isFavorite = false;
|
||||||
|
runOnUiThread(this::updateFavoriteButton);
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateFavoriteButton() {
|
||||||
|
if (btnFavorite == null) {
|
||||||
|
Log.e("FullScreenImageActivity", "btnFavorite is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFavorite) {
|
||||||
|
btnFavorite.setImageResource(R.drawable.favorite); // Replace with the actual drawable resource
|
||||||
|
} else {
|
||||||
|
btnFavorite.setImageResource(R.drawable.not_favorite); // Replace with the actual drawable resource
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showProgress() {
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
overlayView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideProgress() {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
overlayView.setVisibility(View.GONE);
|
||||||
|
// Optionally, enable other buttons
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.SecondSub;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
public class SubFullScreenImageActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ImageView subFullScreen;
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_sub_full_screen_image);
|
||||||
|
|
||||||
|
subFullScreen = findViewById(R.id.sub_fullscreen);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
Window w = getWindow();
|
||||||
|
// 设置无边界布局标志,仅扩展到状态栏
|
||||||
|
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
// 移除半透明状态栏标志
|
||||||
|
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
// 设置半透明状态栏
|
||||||
|
// w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
// 设置透明状态栏
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
w.setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
w.setNavigationBarColor(Color.TRANSPARENT);
|
||||||
|
w.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 接收传递的参数
|
||||||
|
imageUrl = getIntent().getStringExtra(StaticValue.key_imageUrl_1);
|
||||||
|
if (imageUrl == null||imageUrl.isEmpty()) {
|
||||||
|
Log.d("nx","nx "+imageUrl);
|
||||||
|
finish(); // Exit activity if no image URL is provided
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!imageUrl.isEmpty()) {
|
||||||
|
Glide.with(this)
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(imageUrl)
|
||||||
|
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||||
|
.error(R.drawable.rectangular_placeholder_map)
|
||||||
|
.fitCenter()
|
||||||
|
.into(subFullScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
subFullScreen.setOnClickListener(v -> finish());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.SecondSub;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Json.Category;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SubRecyclerViewActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private ImageButton btnBack;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_sub_recycler_view);
|
||||||
|
|
||||||
|
// Window w = getWindow();
|
||||||
|
// // 设置无边界布局标志,仅扩展到状态栏
|
||||||
|
// w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||||
|
// // 设置半透明状态栏
|
||||||
|
//// w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
// // 设置透明状态栏
|
||||||
|
// w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
// w.setStatusBarColor(Color.TRANSPARENT);
|
||||||
|
// w.setNavigationBarColor(Color.TRANSPARENT);
|
||||||
|
|
||||||
|
|
||||||
|
btnBack = findViewById(R.id.sub_fragment_recycler_back);
|
||||||
|
|
||||||
|
RecyclerView recyclerView = findViewById(R.id.sub_fragment_recycler);
|
||||||
|
recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
|
||||||
|
|
||||||
|
Category category = (Category) getIntent().getSerializableExtra(StaticValue.key_category);
|
||||||
|
List<ImageItem> imageList = category.getList();
|
||||||
|
|
||||||
|
recyclerView.setAdapter(new SubRecyclerViewAdapter(this, imageList));
|
||||||
|
|
||||||
|
btnBack.setOnClickListener(v -> finish());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.SecondSub;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||||
|
import com.wallpaper.shinywallpaper.R;
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SubRecyclerViewAdapter extends RecyclerView.Adapter<SubRecyclerViewAdapter.MyViewHolder> {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<ImageItem> imageList;
|
||||||
|
|
||||||
|
public SubRecyclerViewAdapter(Context context,List<ImageItem> imageList) {
|
||||||
|
this.context = context;
|
||||||
|
this.imageList = imageList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.sub_item_image, parent, false);
|
||||||
|
return new MyViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||||
|
|
||||||
|
|
||||||
|
ImageItem imageItem = imageList.get(position);
|
||||||
|
Glide.with(MainApplication.getContext())
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(imageItem.getPreUrl())
|
||||||
|
.placeholder(R.drawable.rectangular_placeholder_map)
|
||||||
|
.error(R.drawable.rectangular_placeholder_map)
|
||||||
|
.transform(new CenterCrop())
|
||||||
|
.into(holder.imageView);
|
||||||
|
|
||||||
|
|
||||||
|
holder.imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(holder.itemView.getContext(), FullScreenImageActivity.class);
|
||||||
|
intent.putExtra("123421", imageItem);
|
||||||
|
holder.itemView.getContext().startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewRecycled(@NonNull MyViewHolder holder) {
|
||||||
|
super.onViewRecycled(holder);
|
||||||
|
ImageView imageView=holder.imageView;
|
||||||
|
if (imageView!=null){
|
||||||
|
Glide.with(MainApplication.getContext()).clear(imageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return imageList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView imageView;
|
||||||
|
|
||||||
|
public MyViewHolder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.sub_image_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.wallpaper.shinywallpaper;
|
||||||
|
|
||||||
|
public class StaticValue {
|
||||||
|
|
||||||
|
public static final String key_imageUrl = "key_imageUrl";
|
||||||
|
|
||||||
|
public static final String key_imageUrl_1 = "key_imageUrl1";
|
||||||
|
|
||||||
|
public static final String key_category = "key_category";
|
||||||
|
|
||||||
|
public static final String key_image_downloaded = "Image downloaded";
|
||||||
|
|
||||||
|
public static final String key_download_failure = "Download failure";
|
||||||
|
|
||||||
|
public static final String key_app_database = "app_database";
|
||||||
|
public static final int key_app_database_version = 1;
|
||||||
|
|
||||||
|
public static final String key_wallpaper_setting_is_successful = "Wallpaper setting is successful";
|
||||||
|
|
||||||
|
public static final String key_failed_to_set_wallpaper = "Failed to set wallpaper";
|
||||||
|
|
||||||
|
public static final String key_file_does_not_exist = "File does not exist";
|
||||||
|
public static final String key_share_to = "Share to...";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Utils;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.StaticValue;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
public class GallerySaver {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
public static final int REQUEST_CODE_WRITE_EXTERNAL_STORAGE = 123;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private ImageView overlayView;
|
||||||
|
|
||||||
|
public GallerySaver(Context context, ProgressBar progressBar, ImageView overlayView) {
|
||||||
|
this.context = context;
|
||||||
|
this.progressBar = progressBar;
|
||||||
|
this.overlayView = overlayView;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断安卓版本,如果大于等于TIRAMISU不请求直接执行,如果小于,判断权限执行请求
|
||||||
|
public void saveToGallery(Activity activity, String imageUrl) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
// 直接执行保存操作
|
||||||
|
new SaveImageTask(activity, progressBar).execute(imageUrl);
|
||||||
|
} else {
|
||||||
|
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(activity,
|
||||||
|
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
|
REQUEST_CODE_WRITE_EXTERNAL_STORAGE);
|
||||||
|
} else {
|
||||||
|
new SaveImageTask(activity, progressBar).execute(imageUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SaveImageTask extends AsyncTask<String, Void, Uri> {
|
||||||
|
|
||||||
|
private Activity activity;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
|
public SaveImageTask(Activity activity, ProgressBar progressBar) {
|
||||||
|
this.activity = activity;
|
||||||
|
this.progressBar = progressBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
|
if (progressBar != null) {
|
||||||
|
progressBar.setVisibility(View.VISIBLE); // 显示进度条
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Uri doInBackground(String... params) {
|
||||||
|
String imageUrl = params[0];
|
||||||
|
String displayName = System.currentTimeMillis() + ".jpg";
|
||||||
|
ContentValues contentValues = new ContentValues();
|
||||||
|
contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, displayName);
|
||||||
|
contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
contentValues.put(MediaStore.Images.Media.IS_PENDING, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri collectionUri;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
collectionUri = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
|
||||||
|
} else {
|
||||||
|
collectionUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri imageUri = activity.getContentResolver().insert(collectionUri, contentValues);
|
||||||
|
|
||||||
|
if (imageUri != null) {
|
||||||
|
try {
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) new URL(imageUrl).openConnection();
|
||||||
|
connection.setDoInput(true);
|
||||||
|
connection.connect();
|
||||||
|
InputStream inputStream = connection.getInputStream();
|
||||||
|
|
||||||
|
try (OutputStream outputStream = activity.getContentResolver().openOutputStream(imageUri)) {
|
||||||
|
if (outputStream != null) {
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
contentValues.clear();
|
||||||
|
contentValues.put(MediaStore.Images.Media.IS_PENDING, 0);
|
||||||
|
activity.getContentResolver().update(imageUri, contentValues, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageUri;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e("GallerySaver", "Error saving image to gallery", e);
|
||||||
|
activity.getContentResolver().delete(imageUri, null, null);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("GallerySaver", "Failed to insert image into MediaStore");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Uri uri) {
|
||||||
|
super.onPostExecute(uri);
|
||||||
|
if (progressBar != null && overlayView != null) {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
overlayView.setVisibility(View.GONE);// 隐藏进度条
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri != null) {
|
||||||
|
// 成功保存图片后的操作
|
||||||
|
Toast.makeText(activity, StaticValue.key_image_downloaded, Toast.LENGTH_SHORT).show();
|
||||||
|
Log.d("GallerySaver", "Image saved to gallery: " + uri);
|
||||||
|
} else {
|
||||||
|
// 保存图片失败后的操作
|
||||||
|
Toast.makeText(activity, StaticValue.key_download_failure, Toast.LENGTH_SHORT).show();
|
||||||
|
Log.e("GallerySaver", "Failed to save image to gallery");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Utils;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Json.Category;
|
||||||
|
import com.wallpaper.shinywallpaper.Json.ImageItem;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JsonParser {
|
||||||
|
public static List<Category> parseJson(String jsonString) {
|
||||||
|
List<Category> categories = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//字符串转换为数组
|
||||||
|
JSONArray jsonArray = new JSONArray(jsonString);
|
||||||
|
//遍历数组里的每一个元素
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
//获取name字段的值
|
||||||
|
JSONObject categoryObject = jsonArray.getJSONObject(i);
|
||||||
|
String name = categoryObject.getString("name");
|
||||||
|
|
||||||
|
JSONArray listArray = categoryObject.getJSONArray("list");
|
||||||
|
List<ImageItem> imageList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int j = 0; j < listArray.length(); j++) {
|
||||||
|
JSONObject imageObject = listArray.getJSONObject(j);
|
||||||
|
String sourceUrl = imageObject.getString("sourceUrl");
|
||||||
|
String preUrl = imageObject.getString("preUrl");
|
||||||
|
|
||||||
|
imageList.add(new ImageItem(sourceUrl, preUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
categories.add(new Category(name, imageList));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.wallpaper.shinywallpaper.Utils;
|
||||||
|
|
||||||
|
import com.wallpaper.shinywallpaper.Application.MainApplication;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class LoadJSON {
|
||||||
|
|
||||||
|
public static String loadJSONFromAsset(String fileName) {
|
||||||
|
StringBuilder jsonString = new StringBuilder();
|
||||||
|
try {
|
||||||
|
//读取filename文件,转换为字符流
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(MainApplication.getContext().getAssets().open(fileName)));
|
||||||
|
String line;
|
||||||
|
//逐行读取文件内容,直到文件末尾
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
jsonString.append(line);
|
||||||
|
}
|
||||||
|
//关闭读取器,释放资源
|
||||||
|
reader.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//对象转换为字符串并返回
|
||||||
|
return jsonString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
17
app/src/main/res/drawable/back.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="32dp"
|
||||||
|
android:height="32dp"
|
||||||
|
android:viewportWidth="32"
|
||||||
|
android:viewportHeight="32">
|
||||||
|
<path
|
||||||
|
android:pathData="M16,0L16,0A16,16 0,0 1,32 16L32,16A16,16 0,0 1,16 32L16,32A16,16 0,0 1,0 16L0,16A16,16 0,0 1,16 0z"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:fillAlpha="0.2"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M19.334,10L12.667,16.001L19.334,22.003"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="1.5"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#ffffff"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/component_1.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/component1" />
|
||||||
|
<corners android:radius="60dp" />
|
||||||
|
<size
|
||||||
|
android:width="224dp"
|
||||||
|
android:height="56dp" />
|
||||||
|
</shape>
|
||||||
8
app/src/main/res/drawable/component_2.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/component2" />
|
||||||
|
<corners android:radius="23dp" />
|
||||||
|
<size
|
||||||
|
android:width="280dp"
|
||||||
|
android:height="68dp"/>
|
||||||
|
</shape>
|
||||||
13
app/src/main/res/drawable/download.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="44dp"
|
||||||
|
android:height="44dp"
|
||||||
|
android:viewportWidth="44"
|
||||||
|
android:viewportHeight="44">
|
||||||
|
<path
|
||||||
|
android:pathData="M22,0L22,0A22,22 0,0 1,44 22L44,22A22,22 0,0 1,22 44L22,44A22,22 0,0 1,0 22L0,22A22,22 0,0 1,22 0z"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:fillAlpha="0.3"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M14.5,30C14.224,30 14,29.776 14,29.5V28.815V27.629V26.944C14,26.668 14.224,26.444 14.5,26.444H15.278C15.554,26.444 15.778,26.668 15.778,26.944V27.129C15.778,27.406 16.002,27.629 16.278,27.629H27.722C27.998,27.629 28.222,27.406 28.222,27.129V26.944C28.222,26.668 28.446,26.444 28.722,26.444H29.5C29.776,26.444 30,26.668 30,26.944V27.629V28.815V29.5C30,29.776 29.776,30 29.5,30H14.5ZM16.611,20.198C16.303,19.878 16.534,19.344 16.979,19.351L19.926,19.394V14.5C19.926,14.224 20.15,14 20.426,14H23.574C23.85,14 24.074,14.224 24.074,14.5V19.335L27.061,19.334C27.5,19.334 27.726,19.858 27.425,20.177L22.424,25.471C22.228,25.678 21.898,25.68 21.7,25.475L16.611,20.198Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
14
app/src/main/res/drawable/favorite.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,3L15,9H21.001L16,14L18,21L12,17.5L6,21L8,14L3,9H9L12,3Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#EC0505"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#EC0505"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
393
app/src/main/res/drawable/favorite_blank.xml
Normal file
9
app/src/main/res/drawable/favorite_title.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="134dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="146"
|
||||||
|
android:viewportHeight="18">
|
||||||
|
<path
|
||||||
|
android:pathData="M0.39,1H4.56L8.97,11.75H9.16L13.56,1H17.73V17H14.45V6.59H14.32L10.18,16.92H7.95L3.8,6.55H3.67V17H0.39V1ZM19.58,1H23.37L27.02,7.89H27.18L30.83,1H34.62L28.78,11.34V17H25.42V11.34L19.58,1ZM41.55,17V1H52.15V3.79H44.94V7.6H51.45V10.39H44.94V17H41.55ZM55.18,17H51.56L57.08,1H61.44L66.96,17H63.33L59.32,4.66H59.2L55.18,17ZM54.96,10.71H63.52V13.35H54.96V10.71ZM69.78,1L73.64,13.16H73.79L77.67,1H81.42L75.9,17H71.54L66.02,1H69.78ZM97.14,9C97.14,10.74 96.81,12.23 96.15,13.45C95.49,14.68 94.6,15.61 93.46,16.26C92.33,16.9 91.06,17.22 89.65,17.22C88.23,17.22 86.95,16.9 85.82,16.25C84.69,15.6 83.8,14.67 83.14,13.45C82.49,12.22 82.16,10.74 82.16,9C82.16,7.26 82.49,5.77 83.14,4.55C83.8,3.32 84.69,2.39 85.82,1.75C86.95,1.1 88.23,0.78 89.65,0.78C91.06,0.78 92.33,1.1 93.46,1.75C94.6,2.39 95.49,3.32 96.15,4.55C96.81,5.77 97.14,7.26 97.14,9ZM93.71,9C93.71,7.87 93.54,6.92 93.21,6.14C92.87,5.36 92.4,4.78 91.79,4.38C91.18,3.97 90.47,3.77 89.65,3.77C88.83,3.77 88.12,3.97 87.51,4.38C86.9,4.78 86.43,5.36 86.09,6.14C85.75,6.92 85.59,7.87 85.59,9C85.59,10.13 85.75,11.08 86.09,11.86C86.43,12.64 86.9,13.22 87.51,13.63C88.12,14.03 88.83,14.23 89.65,14.23C90.47,14.23 91.18,14.03 91.79,13.63C92.4,13.22 92.87,12.64 93.21,11.86C93.54,11.08 93.71,10.13 93.71,9ZM99.65,17V1H105.96C107.17,1 108.2,1.22 109.06,1.65C109.91,2.08 110.57,2.68 111.02,3.47C111.47,4.25 111.69,5.17 111.69,6.23C111.69,7.29 111.47,8.2 111.01,8.97C110.55,9.73 109.89,10.31 109.02,10.72C108.15,11.13 107.1,11.33 105.88,11.33H101.65V8.61H105.33C105.97,8.61 106.51,8.52 106.94,8.34C107.36,8.17 107.68,7.9 107.89,7.55C108.1,7.19 108.21,6.75 108.21,6.23C108.21,5.7 108.1,5.25 107.89,4.88C107.68,4.52 107.36,4.24 106.93,4.05C106.5,3.86 105.96,3.77 105.31,3.77H103.03V17H99.65ZM108.29,9.72L112.27,17H108.53L104.64,9.72H108.29ZM117.47,1V17H114.09V1H117.47ZM119.64,3.79V1H132.78V3.79H127.89V17H124.54V3.79H119.64ZM134.95,17V1H145.73V3.79H138.33V7.6H145.17V10.39H138.33V14.21H145.76V17H134.95Z"
|
||||||
|
android:fillColor="#232122"/>
|
||||||
|
</vector>
|
||||||
7
app/src/main/res/drawable/gradient.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:endColor="#80000000"
|
||||||
|
android:startColor="#00FFFFFF"/>
|
||||||
|
</shape>
|
||||||
74
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector
|
||||||
|
android:height="108dp"
|
||||||
|
android:width="108dp"
|
||||||
|
android:viewportHeight="108"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
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: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>
|
||||||
9
app/src/main/res/drawable/indicator.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="22dp"
|
||||||
|
android:height="4dp"
|
||||||
|
android:viewportWidth="32"
|
||||||
|
android:viewportHeight="4">
|
||||||
|
<path
|
||||||
|
android:pathData="M0,4C0,1.791 1.791,0 4,0H28C30.209,0 32,1.791 32,4H0Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
7
app/src/main/res/drawable/main_tablayout_background.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</selector>
|
||||||
9
app/src/main/res/drawable/main_title.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="134dp"
|
||||||
|
android:height="16dp"
|
||||||
|
android:viewportWidth="134"
|
||||||
|
android:viewportHeight="16">
|
||||||
|
<path
|
||||||
|
android:pathData="M4.99,16L0.41,-0H4.11L6.76,11.12H6.89L9.81,-0H12.98L15.89,11.14H16.03L18.68,-0H22.38L17.8,16H14.5L11.45,5.54H11.33L8.29,16H4.99ZM25.33,16H21.71L27.23,-0H31.59L37.11,16H33.48L29.47,3.66H29.35L25.33,16ZM25.11,9.71H33.67V12.35H25.11V9.71ZM39.03,16V-0H42.41V13.21H49.27V16H39.03ZM51.51,16V-0H54.9V13.21H61.76V16H51.51ZM64,16V-0H70.31C71.52,-0 72.56,0.23 73.41,0.7C74.26,1.15 74.92,1.79 75.36,2.61C75.82,3.42 76.04,4.36 76.04,5.42C76.04,6.48 75.81,7.42 75.36,8.23C74.9,9.05 74.23,9.68 73.36,10.13C72.5,10.59 71.45,10.81 70.22,10.81H66.2V8.1H69.68C70.33,8.1 70.86,7.99 71.29,7.77C71.71,7.54 72.03,7.22 72.24,6.82C72.45,6.41 72.56,5.95 72.56,5.42C72.56,4.89 72.45,4.43 72.24,4.03C72.03,3.63 71.71,3.32 71.29,3.1C70.86,2.88 70.32,2.77 69.66,2.77H67.38V16H64ZM79.15,16H75.53L81.05,-0H85.41L90.92,16H87.3L83.29,3.66H83.17L79.15,16ZM78.92,9.71H87.49V12.35H78.92V9.71ZM92.85,16V-0H99.16C100.38,-0 101.41,0.23 102.26,0.7C103.12,1.15 103.77,1.79 104.22,2.61C104.67,3.42 104.9,4.36 104.9,5.42C104.9,6.48 104.67,7.42 104.21,8.23C103.75,9.05 103.09,9.68 102.22,10.13C101.35,10.59 100.31,10.81 99.08,10.81H95.05V8.1H98.53C99.18,8.1 99.72,7.99 100.14,7.77C100.57,7.54 100.88,7.22 101.09,6.82C101.31,6.41 101.41,5.95 101.41,5.42C101.41,4.89 101.31,4.43 101.09,4.03C100.88,3.63 100.57,3.32 100.14,3.1C99.71,2.88 99.17,2.77 98.51,2.77H96.23V16H92.85ZM107.09,16V-0H117.88V2.79H110.48V6.6H117.32V9.39H110.48V13.21H117.91V16H107.09ZM120.56,16V-0H126.88C128.09,-0 129.12,0.22 129.97,0.65C130.83,1.08 131.48,1.68 131.93,2.47C132.38,3.25 132.61,4.17 132.61,5.23C132.61,6.29 132.38,7.2 131.92,7.97C131.46,8.73 130.8,9.31 129.93,9.72C129.07,10.13 128.02,10.33 126.79,10.33H122.56V7.61H126.24C126.89,7.61 127.43,7.52 127.85,7.34C128.28,7.17 128.6,6.9 128.81,6.55C129.02,6.19 129.13,5.75 129.13,5.23C129.13,4.7 129.02,4.25 128.81,3.88C128.6,3.52 128.28,3.24 127.85,3.05C127.42,2.86 126.88,2.77 126.23,2.77H123.95V16H120.56ZM129.21,8.72L133.18,16H129.45L125.56,8.72H129.21Z"
|
||||||
|
android:fillColor="#232122"/>
|
||||||
|
</vector>
|
||||||
14
app/src/main/res/drawable/not_favorite.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,3L15,9H21.001L16,14L18,21L12,17.5L6,21L8,14L3,9H9L12,3Z"
|
||||||
|
android:strokeLineJoin="round"
|
||||||
|
android:strokeWidth="2"
|
||||||
|
android:fillColor="#CAC4C4"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeColor="#CAC4C4"
|
||||||
|
android:strokeLineCap="round"/>
|
||||||
|
</vector>
|
||||||
15
app/src/main/res/drawable/rectangular_placeholder_map.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="109dp"
|
||||||
|
android:height="200dp"
|
||||||
|
android:viewportWidth="109"
|
||||||
|
android:viewportHeight="200">
|
||||||
|
<path
|
||||||
|
android:pathData="M0.33,0h108.33v200h-108.33z"
|
||||||
|
android:fillColor="#EDEDED"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M44.67,90.67V109.33H64.67V90.67H44.67ZM63.13,92.36V102.83L59.28,99.62L55.36,102.32L50.05,96.16L46.21,98.44V92.36H63.13Z"
|
||||||
|
android:fillColor="#B7B7B7"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M58,96C58,96.18 58.03,96.35 58.1,96.51C58.17,96.67 58.27,96.82 58.39,96.94C58.51,97.07 58.66,97.17 58.82,97.23C58.98,97.3 59.16,97.33 59.33,97.33C59.51,97.33 59.68,97.3 59.84,97.23C60.01,97.17 60.15,97.07 60.28,96.94C60.4,96.82 60.5,96.67 60.57,96.51C60.63,96.35 60.67,96.18 60.67,96C60.67,95.83 60.63,95.65 60.57,95.49C60.5,95.33 60.4,95.18 60.28,95.06C60.15,94.93 60.01,94.84 59.84,94.77C59.68,94.7 59.51,94.67 59.33,94.67C59.16,94.67 58.98,94.7 58.82,94.77C58.66,94.84 58.51,94.93 58.39,95.06C58.27,95.18 58.17,95.33 58.1,95.49C58.03,95.65 58,95.83 58,96Z"
|
||||||
|
android:fillColor="#B7B7B7"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/select_main_category.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="22dp"
|
||||||
|
android:height="20dp"
|
||||||
|
android:viewportWidth="22"
|
||||||
|
android:viewportHeight="20">
|
||||||
|
<path
|
||||||
|
android:pathData="M18.791,8.463C18.154,9.099 17.29,9.457 16.39,9.457C15.489,9.457 14.626,9.099 13.989,8.463L12.657,7.13C12.342,6.815 12.091,6.44 11.921,6.028C11.75,5.617 11.662,5.175 11.662,4.729C11.662,4.283 11.75,3.841 11.921,3.43C12.091,3.018 12.342,2.643 12.657,2.328L13.99,0.995C14.305,0.679 14.68,0.429 15.092,0.259C15.504,0.088 15.945,0 16.391,0C16.837,0 17.279,0.088 17.691,0.259C18.103,0.429 18.477,0.679 18.792,0.995L20.126,2.328C20.763,2.965 21.12,3.829 21.12,4.729C21.12,5.629 20.763,6.493 20.126,7.13L18.791,8.463ZM9.559,5.671C9.559,6.572 9.201,7.436 8.564,8.073C7.927,8.71 7.064,9.068 6.163,9.068H4.277C3.831,9.068 3.389,8.98 2.977,8.809C2.565,8.639 2.19,8.389 1.875,8.073C1.559,7.758 1.309,7.383 1.139,6.971C0.968,6.559 0.88,6.117 0.88,5.671V3.785C0.88,3.339 0.968,2.897 1.139,2.485C1.309,2.073 1.559,1.699 1.875,1.383C2.19,1.068 2.565,0.818 2.977,0.647C3.389,0.477 3.831,0.389 4.277,0.389H6.163C6.609,0.389 7.05,0.477 7.463,0.648C7.875,0.818 8.249,1.068 8.564,1.384C8.88,1.699 9.13,2.073 9.3,2.486C9.471,2.898 9.559,3.339 9.559,3.785V5.671ZM20.73,16.606C20.73,17.507 20.372,18.371 19.735,19.007C19.098,19.644 18.234,20.002 17.333,20.002H15.447C14.547,20.002 13.683,19.644 13.046,19.007C12.409,18.371 12.051,17.507 12.051,16.606V14.72C12.051,13.819 12.409,12.955 13.046,12.318C13.683,11.681 14.547,11.324 15.447,11.324H17.333C18.234,11.324 19.098,11.681 19.735,12.318C20.372,12.955 20.73,13.819 20.73,14.72V16.606ZM9.559,16.606C9.559,17.507 9.201,18.371 8.564,19.007C7.927,19.644 7.064,20.002 6.163,20.002H4.277C3.376,20.002 2.512,19.644 1.875,19.007C1.238,18.371 0.88,17.507 0.88,16.606V14.72C0.88,14.274 0.968,13.832 1.139,13.42C1.309,13.008 1.559,12.633 1.875,12.318C2.19,12.002 2.565,11.752 2.977,11.582C3.389,11.411 3.831,11.323 4.277,11.324H6.163C6.609,11.324 7.05,11.411 7.463,11.582C7.875,11.753 8.249,12.003 8.564,12.318C8.88,12.634 9.13,13.008 9.3,13.42C9.471,13.832 9.559,14.274 9.559,14.72V16.606Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/select_main_favorite.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M21.437,11.118C21.862,10.682 22.001,10.049 21.813,9.475C21.625,8.902 21.13,8.486 20.536,8.397L15.945,7.695C15.737,7.665 15.569,7.536 15.48,7.348L13.452,3.035C13.185,2.462 12.63,2.105 11.997,2.105C11.364,2.105 10.81,2.462 10.543,3.035L8.524,7.339C8.435,7.527 8.257,7.655 8.059,7.685L3.468,8.387C2.875,8.476 2.38,8.892 2.192,9.465C1.994,10.039 2.142,10.672 2.568,11.108L5.962,14.6C6.1,14.738 6.16,14.946 6.13,15.134L5.338,20.001C5.239,20.614 5.497,21.228 6.001,21.584C6.278,21.781 6.605,21.881 6.921,21.881C7.189,21.881 7.456,21.811 7.703,21.673L11.7,19.467C11.888,19.368 12.106,19.368 12.294,19.467L16.301,21.692C16.846,21.989 17.499,21.96 18.003,21.604C18.518,21.247 18.765,20.644 18.666,20.021L17.875,15.154C17.845,14.956 17.904,14.758 18.043,14.619L21.437,11.118Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
13
app/src/main/res/drawable/setting_wallpaper.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="44dp"
|
||||||
|
android:height="44dp"
|
||||||
|
android:viewportWidth="44"
|
||||||
|
android:viewportHeight="44">
|
||||||
|
<path
|
||||||
|
android:pathData="M22,0L22,0A22,22 0,0 1,44 22L44,22A22,22 0,0 1,22 44L22,44A22,22 0,0 1,0 22L0,22A22,22 0,0 1,22 0z"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:fillAlpha="0.3"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M28.77,15.793H28.459C28.418,15.793 28.378,15.785 28.34,15.769C28.302,15.753 28.268,15.73 28.239,15.701C28.181,15.642 28.148,15.562 28.148,15.479V14.241C28.148,13.559 27.595,13 26.918,13H15.23C14.554,13 14,13.559 14,14.241V18.586C14,19.268 14.554,19.827 15.23,19.827H26.918C27.595,19.827 28.148,19.268 28.148,18.586V17.347C28.148,17.235 28.208,17.132 28.304,17.076C28.351,17.049 28.404,17.034 28.459,17.034C28.514,17.034 28.567,17.049 28.614,17.076C28.662,17.104 28.701,17.143 28.728,17.191C28.756,17.239 28.77,17.292 28.77,17.347V20.755C28.77,20.838 28.737,20.917 28.679,20.976C28.65,21.005 28.616,21.028 28.578,21.044C28.54,21.06 28.5,21.068 28.459,21.068H21.657C20.978,21.068 20.427,21.624 20.427,22.309V23.5C19.765,23.517 19.228,24.066 19.228,24.737V29.759C19.228,30.441 19.782,31 20.459,31H21.689C22.366,31 22.919,30.441 22.919,29.759V24.738C22.919,24.055 22.366,23.496 21.689,23.496H21.657V22.309H28.77C29.449,22.309 30,21.754 30,21.068V17.034C30,16.349 29.449,15.793 28.77,15.793ZM15.534,14.857C15.534,14.694 15.599,14.536 15.714,14.42C15.829,14.304 15.986,14.238 16.15,14.237H25.992C26.156,14.238 26.312,14.304 26.428,14.42C26.543,14.536 26.608,14.694 26.607,14.857C26.608,15.021 26.543,15.178 26.428,15.295C26.312,15.411 26.156,15.477 25.992,15.478H16.15C15.986,15.477 15.829,15.411 15.714,15.295C15.599,15.178 15.534,15.021 15.534,14.857Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
13
app/src/main/res/drawable/share.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="44dp"
|
||||||
|
android:height="44dp"
|
||||||
|
android:viewportWidth="44"
|
||||||
|
android:viewportHeight="44">
|
||||||
|
<path
|
||||||
|
android:pathData="M22,0L22,0A22,22 0,0 1,44 22L44,22A22,22 0,0 1,22 44L22,44A22,22 0,0 1,0 22L0,22A22,22 0,0 1,22 0z"
|
||||||
|
android:fillColor="#ffffff"
|
||||||
|
android:fillAlpha="0.3"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M22.767,17.305V14.64C23.009,13.526 23.933,14.205 23.933,14.205L30.347,19.679C31.757,20.647 30.443,21.375 30.443,21.375L24.127,26.801C22.863,27.722 22.767,26.316 22.767,26.316V23.846C16.353,21.86 13.729,29.806 13.729,29.806C13.486,30.242 13.34,29.806 13.34,29.806C10.86,17.887 22.767,17.305 22.767,17.305Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/unselect_main_category.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M19.791,10.463C19.154,11.099 18.29,11.457 17.39,11.457C16.489,11.457 15.626,11.099 14.989,10.463L13.657,9.13C13.342,8.815 13.091,8.44 12.921,8.028C12.75,7.617 12.662,7.175 12.662,6.729C12.662,6.283 12.75,5.841 12.921,5.43C13.091,5.018 13.342,4.643 13.657,4.328L14.99,2.995C15.305,2.679 15.68,2.429 16.092,2.259C16.504,2.088 16.945,2 17.391,2C17.837,2 18.279,2.088 18.691,2.259C19.103,2.429 19.477,2.679 19.792,2.995L21.127,4.328C21.763,4.965 22.12,5.829 22.12,6.729C22.12,7.629 21.763,8.493 21.127,9.13L19.791,10.463ZM10.559,7.671C10.559,8.572 10.201,9.436 9.564,10.073C8.927,10.71 8.064,11.068 7.163,11.068H5.277C4.831,11.068 4.389,10.98 3.977,10.809C3.565,10.639 3.19,10.389 2.875,10.073C2.559,9.758 2.309,9.383 2.139,8.971C1.968,8.559 1.88,8.118 1.88,7.671V5.785C1.88,5.339 1.968,4.897 2.139,4.485C2.309,4.073 2.559,3.699 2.875,3.383C3.19,3.068 3.565,2.818 3.977,2.647C4.389,2.477 4.831,2.389 5.277,2.389H7.163C7.609,2.389 8.051,2.477 8.463,2.648C8.875,2.818 9.249,3.068 9.564,3.384C9.88,3.699 10.13,4.074 10.3,4.486C10.471,4.898 10.559,5.339 10.559,5.785V7.671ZM21.73,18.606C21.73,19.507 21.372,20.371 20.735,21.007C20.098,21.644 19.234,22.002 18.334,22.002H16.447C15.547,22.002 14.683,21.644 14.046,21.007C13.409,20.371 13.051,19.507 13.051,18.606V16.72C13.051,15.819 13.409,14.955 14.046,14.318C14.683,13.681 15.547,13.324 16.447,13.324H18.334C19.234,13.324 20.098,13.681 20.735,14.318C21.372,14.955 21.73,15.819 21.73,16.72V18.606ZM10.559,18.606C10.559,19.507 10.201,20.371 9.564,21.007C8.927,21.644 8.064,22.002 7.163,22.002H5.277C4.376,22.002 3.512,21.644 2.875,21.007C2.238,20.371 1.88,19.507 1.88,18.606V16.72C1.88,16.274 1.968,15.832 2.139,15.42C2.309,15.008 2.559,14.633 2.875,14.318C3.19,14.002 3.565,13.752 3.977,13.582C4.389,13.411 4.831,13.323 5.277,13.324H7.163C7.609,13.324 8.051,13.411 8.463,13.582C8.875,13.753 9.249,14.003 9.564,14.318C9.88,14.634 10.13,15.008 10.3,15.42C10.471,15.832 10.559,16.274 10.559,16.72V18.606Z"
|
||||||
|
android:fillColor="#6B6B6B"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/unselect_main_favorite.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="20dp"
|
||||||
|
android:height="20dp"
|
||||||
|
android:viewportWidth="20"
|
||||||
|
android:viewportHeight="20">
|
||||||
|
<path
|
||||||
|
android:pathData="M19.437,9.117C19.862,8.682 20.001,8.049 19.813,7.475C19.625,6.902 19.13,6.486 18.536,6.397L13.945,5.695C13.737,5.665 13.569,5.536 13.48,5.348L11.452,1.035C11.185,0.462 10.63,0.105 9.997,0.105C9.364,0.105 8.81,0.462 8.543,1.035L6.524,5.339C6.435,5.527 6.257,5.655 6.059,5.685L1.468,6.387C0.875,6.476 0.38,6.892 0.192,7.465C-0.006,8.039 0.142,8.672 0.568,9.108L3.962,12.6C4.1,12.738 4.16,12.946 4.13,13.134L3.338,18.001C3.239,18.614 3.497,19.228 4.001,19.584C4.278,19.781 4.605,19.881 4.921,19.881C5.189,19.881 5.456,19.811 5.703,19.673L9.7,17.467C9.888,17.368 10.106,17.368 10.294,17.467L14.301,19.692C14.845,19.989 15.499,19.96 16.003,19.604C16.518,19.247 16.765,18.644 16.666,18.021L15.875,13.154C15.845,12.956 15.904,12.758 16.043,12.619L19.437,9.117Z"
|
||||||
|
android:fillColor="#6B6B6B"/>
|
||||||
|
</vector>
|
||||||
116
app/src/main/res/layout/activity_full_screen_image.xml
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context=".SecondSub.FullScreenImageActivity">
|
||||||
|
|
||||||
|
<!-- Existing views -->
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_image"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btn_back">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/fullscreen_image_view"
|
||||||
|
android:layout_width="279dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btn_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btn_favorite"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:src="@drawable/not_favorite"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/bottom_image"
|
||||||
|
android:layout_width="280dp"
|
||||||
|
android:layout_height="68dp"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:background="@drawable/component_2"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btn_share"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:src="@drawable/share"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/bottom_image"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/btn_download"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/bottom_image"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/bottom_image" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btn_download"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:src="@drawable/download"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/bottom_image"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/setWallpaperButton"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/btn_share"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/bottom_image" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/setWallpaperButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:src="@drawable/setting_wallpaper"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/bottom_image"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/bottom_image"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/btn_download"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/bottom_image" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/overlayView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#80000000"
|
||||||
|
android:clickable="true"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
30
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?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/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context=".Main.MainActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/main_viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/main_tablayout"
|
||||||
|
android:layout_width="224dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="35dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
|
app:tabMode="fixed"
|
||||||
|
app:tabGravity="fill"
|
||||||
|
app:tabIndicatorFullWidth="false"
|
||||||
|
android:background="@drawable/component_1"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
16
app/src/main/res/layout/activity_sub_full_screen_image.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".SecondSub.SubFullScreenImageActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sub_fullscreen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
26
app/src/main/res/layout/activity_sub_recycler_view.xml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?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=".SecondSub.SubRecyclerViewActivity">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/sub_fragment_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="56dp"
|
||||||
|
android:layout_alignParentTop="true"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/sub_fragment_recycler_back"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/back"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentStart="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
29
app/src/main/res/layout/fragment_favorite.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Favorite.FavoriteFragment">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:src="@drawable/favorite_title"/>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/favorite_recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="53dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/placeholder_image"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:src="@drawable/favorite_blank"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
24
app/src/main/res/layout/fragment_main.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".FirstSub.MainFragment">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:src="@drawable/main_title"/>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/main_fragment_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:paddingTop="53dp"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
31
app/src/main/res/layout/item_image.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingTop="12dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:background="@drawable/gradient"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
android:textAppearance="@style/nature"/>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
25
app/src/main/res/layout/main_tablayout_custom.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/main_tab_custom"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
|
android:layout_gravity="center_horizontal"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/tab_indicator"
|
||||||
|
android:layout_width="22dp"
|
||||||
|
android:layout_height="4dp"
|
||||||
|
android:background="@drawable/indicator"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
android:layout_gravity="center_horizontal"/>
|
||||||
|
</LinearLayout>
|
||||||
16
app/src/main/res/layout/sub_item_image.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sub_image_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +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="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +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="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 108 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 179 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 34 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.ShinyWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your dark theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
7
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="component1">#252525</color>
|
||||||
|
<color name="component2">#4D000000</color>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Shiny Wallpaper</string>
|
||||||
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
|
<string name="favorite_context">At present, you don\'t have a favorite wallpaperGo to the homepage and take a look</string>
|
||||||
|
</resources>
|
||||||
10
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="nature">
|
||||||
|
<item name="android:textSize">20sp</item>
|
||||||
|
<item name="android:textColor">#FFFFFF</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</resources>
|
||||||
9
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Base.Theme.ShinyWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||||
|
<!-- Customize your light theme here. -->
|
||||||
|
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.ShinyWallpaper" parent="Base.Theme.ShinyWallpaper" />
|
||||||
|
</resources>
|
||||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -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>
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.wallpaper.shinywallpaper;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
build.gradle.kts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
}
|
||||||
21
gradle.properties
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
22
gradle/libs.versions.toml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "8.1.3"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.2.1"
|
||||||
|
espressoCore = "3.6.1"
|
||||||
|
appcompat = "1.7.0"
|
||||||
|
material = "1.12.0"
|
||||||
|
activity = "1.9.1"
|
||||||
|
constraintlayout = "2.1.4"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||||
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||||
|
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||||
|
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#Fri Jul 26 10:08:49 CST 2024
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
185
gradlew
vendored
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
89
gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
app_name=Shiny Wallpaper
|
||||||
|
package_name=com.wallpaper.shinywallpaper
|
||||||
|
keystoreFile=app/ShinyWallpaper.jks
|
||||||
|
key_alias=ShinyWallpaperkey0
|
||||||
|
key_store_password=ShinyWallpaper
|
||||||
|
key_password=ShinyWallpaper
|
||||||
24
settings.gradle.kts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "ShinyWallpaper"
|
||||||
|
include(":app")
|
||||||
|
|
||||||