Minimalist Wallpaper 1.0.0(1)
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
*.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
|
||||
.idea/
|
||||
app/release/minimalistwallpaper_v1.0.1(2)_07_22_17_54-release.apk
|
||||
app/release/minimalistwallpaper_v1.0.1(2)_07_22_18_03-release.aab
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
65
app/build.gradle.kts
Normal file
@ -0,0 +1,65 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id ("kotlin-kapt")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.tool.minimalistwallpaper"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.tool.minimalistwallpaper"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
setProperty("archivesBaseName", "minimalistwallpaper_v" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isShrinkResources =true
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
buildFeatures{
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
val room_version = "2.6.1"
|
||||
implementation("androidx.room:room-runtime:$room_version")
|
||||
annotationProcessor("androidx.room:room-compiler:$room_version")
|
||||
kapt("androidx.room:room-compiler:$room_version")
|
||||
implementation("androidx.room:room-ktx:$room_version")
|
||||
implementation("androidx.room:room-rxjava2:$room_version")
|
||||
implementation("androidx.room:room-rxjava3:$room_version")
|
||||
implementation("androidx.room:room-guava:$room_version")
|
||||
testImplementation("androidx.room:room-testing:$room_version")
|
||||
implementation("androidx.room:room-paging:$room_version")
|
||||
|
||||
implementation ("io.github.youth5201314:banner:2.2.3")
|
||||
implementation ("com.guolindev.permissionx:permissionx:1.7.1")
|
||||
}
|
||||
33
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# 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
|
||||
-keepclassmembers class com.tool.minimalistwallpaper.MinimalistWPSkin{
|
||||
public static final java.lang.String DB_Name;
|
||||
public static final int DB_Version;
|
||||
}
|
||||
-keepclassmembers class *{
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
|
||||
-keep class com.tool.minimalistwallpaper.data.MydataBase { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.MyDAO { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.Mydata { *; }
|
||||
-keep class com.tool.minimalistwallpaper.data.Otherdata { *; }
|
||||
20
app/release/output-metadata.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "APK",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.tool.minimalistwallpaper",
|
||||
"variantName": "release",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 2,
|
||||
"versionName": "1.0.1",
|
||||
"outputFile": "minimalistwallpaper_v1.0.1(2)_07_22_17_54-release.apk"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.tool.minimalistwallpaper;
|
||||
|
||||
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.fun.minimalistwallpaper", 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.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
android:name=".MinimalistWPSkin"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/logo"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/logo"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
tools:targetApi="31" >
|
||||
<activity
|
||||
android:name=".activity.SplashActivity"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AllActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activity.PreViewActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:exported="true" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
12208
app/src/main/assets/wallpaper.json
Normal file
@ -0,0 +1,70 @@
|
||||
package com.tool.minimalistwallpaper;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
|
||||
import com.tool.minimalistwallpaper.data.Mydata;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MinimalistWPSkin extends Application {
|
||||
public static final String APP_Name = "MinimalistWP";
|
||||
public static final String DB_Name = "MinimalistWP_database";
|
||||
public static final String Table_Name = "MinimalistWP_table";
|
||||
public static final int DB_Version = 1;
|
||||
public static MinimalistWPSkin app;
|
||||
private static Context context;
|
||||
public static List<Mydata> myDataArrayList;
|
||||
private static boolean isinsert;
|
||||
private static final String PREFS_NAME = "MyPrefs";
|
||||
private static final String KEY_IS_INSERTED = "isinserted";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getApplicationContext();
|
||||
|
||||
List<Mydata> myData = Mytools.parseJsonToList("wallpaper.json");
|
||||
myDataArrayList = myData;
|
||||
SharedPreferences prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
isinsert = prefs.getBoolean(KEY_IS_INSERTED, false);
|
||||
if (!isinsert) {
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MydataBase.getInstance().myDAO().insertAll(getOtherdata());
|
||||
isinsert = true;
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putBoolean(KEY_IS_INSERTED, isinsert);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public static Context getAppContext() {
|
||||
return context;
|
||||
}
|
||||
public static List<Mydata> getMyDataArrayList() {
|
||||
|
||||
return myDataArrayList;
|
||||
}
|
||||
public static List<Otherdata> getOtherdata() {
|
||||
List<Mydata> mydata = MinimalistWPSkin.getMyDataArrayList();
|
||||
List<Otherdata> newlist = new ArrayList<>();
|
||||
for (Mydata myDataItem : mydata) {
|
||||
List<Otherdata> dataList = myDataItem.getList();
|
||||
for (Otherdata otherdata : dataList) {
|
||||
if (otherdata.getBanner() != null && !otherdata.getBanner().isEmpty())
|
||||
newlist.add(otherdata);
|
||||
}
|
||||
}
|
||||
|
||||
return newlist;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.adapter.MainRvAdapter;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.ActivityAllBinding;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.SpaceItem;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AllActivity extends AppCompatActivity {
|
||||
ActivityAllBinding binding;
|
||||
private List<Otherdata> otherdata = new ArrayList<>();
|
||||
private MainRvAdapter mainRvListAdapter;
|
||||
private String name;
|
||||
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityAllBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_all), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
|
||||
Intent intent = getIntent();
|
||||
name = intent.getStringExtra(StaticValue.KEY_name);
|
||||
binding.allTitle.setText(name);
|
||||
initData();
|
||||
binding.allRv.addItemDecoration(spaceItem);
|
||||
binding.allBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
private void initData() {
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Otherdata> existingData = MydataBase.getInstance().myDAO().getallwp(name);
|
||||
if (!existingData.isEmpty()){
|
||||
otherdata = existingData;
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mainRvListAdapter = new MainRvAdapter(AllActivity.this,otherdata);
|
||||
binding.allRv.setLayoutManager(new GridLayoutManager(AllActivity.this, 2));
|
||||
binding.allRv.setAdapter(mainRvListAdapter);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// Log.e("zzj", " allactivity onResume " + PreViewActivity.KEY_Change);
|
||||
if (PreViewActivity.KEY_Change){
|
||||
initData();
|
||||
PreViewActivity.KEY_Change = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.adapter.PageAdapter;
|
||||
import com.tool.minimalistwallpaper.databinding.ActivityMainBinding;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
ActivityMainBinding binding;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_main), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
binding.mainViewpager.setAdapter(new PageAdapter(getSupportFragmentManager()));
|
||||
binding.mainTabLayout.setupWithViewPager(binding.mainViewpager);
|
||||
setmainTabIcons(binding.mainTabLayout);
|
||||
binding.mainViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
setTabIcons(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
private void setTabIcons(final int position) {
|
||||
for (int i = 0; i < binding.mainTabLayout.getTabCount(); i++) {
|
||||
final TabLayout.Tab tab = binding.mainTabLayout.getTabAt(i);
|
||||
if (tab != null) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
tab.setIcon(position == 0 ? R.drawable.home_check : R.drawable.home_uncheck);
|
||||
break;
|
||||
case 1:
|
||||
tab.setIcon(position == 1 ? R.drawable.class_check : R.drawable.class_uncheck);
|
||||
break;
|
||||
case 2:
|
||||
tab.setIcon(position == 2 ? R.drawable.like_check : R.drawable.like_uncheck);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void setmainTabIcons(TabLayout tabLayout) {
|
||||
for (int i = 0; i < tabLayout.getTabCount(); i++) {
|
||||
TabLayout.Tab tab = tabLayout.getTabAt(i);
|
||||
if (tab != null) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
tab.setIcon(R.drawable.home_check);
|
||||
break;
|
||||
case 1:
|
||||
tab.setIcon(R.drawable.class_uncheck);
|
||||
break;
|
||||
case 2:
|
||||
tab.setIcon(R.drawable.like_uncheck);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,453 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.GestureDetectorCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.ActivityPreViewBinding;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
import com.tool.minimalistwallpaper.tools.Utils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
|
||||
public class PreViewActivity extends AppCompatActivity {
|
||||
ActivityPreViewBinding binding;
|
||||
private static final int REQUEST_CODE_WRITE_STORAGE_PERMISSION = 100;
|
||||
private String preurl, downurl;
|
||||
private Otherdata otherdata;
|
||||
private Bitmap setmap, downloadmap;
|
||||
private Boolean islike = false;
|
||||
private File downrs;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private BroadcastReceiver wallpaperChangedReceiver;
|
||||
private GestureDetector gestureDetector;
|
||||
public static boolean KEY_Change = false;
|
||||
private Otherdata checkdata = new Otherdata();
|
||||
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityPreViewBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_preview), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
initData();
|
||||
initEvent();
|
||||
|
||||
wallpaperChangedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (Intent.ACTION_WALLPAPER_CHANGED.equals(intent.getAction())) {
|
||||
finish();
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.set_successful), Toast.LENGTH_SHORT).show();
|
||||
unregisterReceiver(wallpaperChangedReceiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
|
||||
registerReceiver(wallpaperChangedReceiver, filter);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void initEvent() {
|
||||
binding.preBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
binding.preLike.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
checkLike();
|
||||
}
|
||||
});
|
||||
binding.preSetwp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
binding.imgSetwallpaper.setVisibility(View.GONE);
|
||||
binding.pgSetwallpaper.setVisibility(View.VISIBLE);
|
||||
List<String> permissions = new ArrayList<>();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions.add(android.Manifest.permission.READ_MEDIA_IMAGES);
|
||||
}
|
||||
permissions.add(android.Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissions.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
permissions.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
PermissionX.init(PreViewActivity.this)
|
||||
.permissions(permissions)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (!allGranted) {
|
||||
binding.imgSetwallpaper.setVisibility(View.VISIBLE);
|
||||
binding.pgSetwallpaper.setVisibility(View.GONE);
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.permission_tips), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
setWp(setmap);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
binding.preDownwp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
binding.imgDownload.setVisibility(View.GONE);
|
||||
binding.pgDonwnload.setVisibility(View.VISIBLE);
|
||||
downWp();
|
||||
}
|
||||
});
|
||||
|
||||
gestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent e) {
|
||||
if (!otherdata.getLike()) {
|
||||
binding.imgLike.setBackgroundResource(R.drawable.pre_like_check);
|
||||
islike = true;
|
||||
otherdata.setLike(true);
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MydataBase.getInstance().myDAO().update(otherdata);
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
binding.preImage.setOnTouchListener(new View.OnTouchListener() {
|
||||
private Handler handler = new Handler();
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
gestureDetector.onTouchEvent(event);
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
binding.consBack.setVisibility(View.GONE);
|
||||
hidemenu();
|
||||
}
|
||||
}, 1000);
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
showmenu();
|
||||
binding.consBack.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void downWp() {
|
||||
List<String> permissions = new ArrayList<>();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
permissions.add(android.Manifest.permission.READ_MEDIA_IMAGES);
|
||||
}
|
||||
permissions.add(android.Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
permissions.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
permissions.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
PermissionX.init(PreViewActivity.this)
|
||||
.permissions(permissions)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (!allGranted) {
|
||||
binding.imgDownload.setVisibility(View.VISIBLE);
|
||||
binding.pgDonwnload.setVisibility(View.GONE);
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.permission_tips), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
downloadwp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void downloadwp() {
|
||||
if (downloadmap != null) {
|
||||
Glide.with(this)
|
||||
.load(downurl)
|
||||
.downloadOnly(new CustomTarget<File>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull File resource, @Nullable Transition<? super File> transition) {
|
||||
downrs = resource;
|
||||
saveImageToGallery(downrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_failed), Toast.LENGTH_SHORT).show();
|
||||
binding.imgDownload.setVisibility(View.VISIBLE);
|
||||
binding.pgDonwnload.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void saveImageToGallery(File imageFile) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
if (Utils.INSTANCE.saveImageToGallery(PreViewActivity.this, downloadmap, downrs.getName() + ".jpg")) {
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_successful), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MediaStore.Images.Media.DISPLAY_NAME, "Image_" + System.currentTimeMillis());
|
||||
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
|
||||
values.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES);
|
||||
Uri externalUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
ContentResolver resolver = getContentResolver();
|
||||
try {
|
||||
Uri insertUri = resolver.insert(externalUri, values);
|
||||
if (insertUri != null) {
|
||||
OutputStream outputStream = resolver.openOutputStream(insertUri);
|
||||
if (outputStream != null) {
|
||||
FileInputStream inputStream = new FileInputStream(imageFile);
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_successful), Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(PreViewActivity.this, getString(R.string.download_failed), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setWp(Bitmap bitmap) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
wallpaperManager.setBitmap(bitmap);
|
||||
} catch (IOException a) {
|
||||
// Toast.makeText(PreViewActivity.this, getString(R.string.set_failed), Toast.LENGTH_SHORT).show();
|
||||
a.printStackTrace();
|
||||
}
|
||||
// Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
|
||||
//// intent.setData(getImageUri(PreViewActivity.this, bitmap));
|
||||
//// intent.setDataAndType(getImageUri(PreViewActivity.this, bitmap), "image/*");
|
||||
// try {
|
||||
// startActivity(intent);
|
||||
// } catch (ActivityNotFoundException e) {
|
||||
// try {
|
||||
// wallpaperManager.setBitmap(bitmap);
|
||||
// } catch (IOException a) {
|
||||
//// Toast.makeText(PreViewActivity.this, getString(R.string.set_failed), Toast.LENGTH_SHORT).show();
|
||||
// a.printStackTrace();
|
||||
// }
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public Uri getImageUri(Context context, Bitmap bitmap) {
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
|
||||
String path = MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, "Title", null);
|
||||
return Uri.parse(path);
|
||||
}
|
||||
|
||||
|
||||
private void checkLike() {
|
||||
if (!islike) {
|
||||
binding.imgLike.setBackgroundResource(R.drawable.pre_like_check);
|
||||
islike = true;
|
||||
otherdata.setLike(true);
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MydataBase.getInstance().myDAO().update(otherdata);
|
||||
// Log.e("zzj", "checkLike true " + otherdata.source);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
binding.imgLike.setBackgroundResource(R.drawable.pre_like_uncheck);
|
||||
islike = false;
|
||||
otherdata.setLike(false);
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MydataBase.getInstance().myDAO().update(otherdata);
|
||||
// Log.e("zzj", "checkLike false " + otherdata.source);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
hidemenu();
|
||||
binding.preImage.setVisibility(View.GONE);
|
||||
binding.preBack.setVisibility(View.VISIBLE);
|
||||
binding.prePg.setVisibility(View.VISIBLE);
|
||||
binding.pgDonwnload.setVisibility(View.GONE);
|
||||
binding.pgSetwallpaper.setVisibility(View.GONE);
|
||||
Intent intent = getIntent();
|
||||
preurl = intent.getStringExtra(StaticValue.KEY_original);
|
||||
downurl = intent.getStringExtra(StaticValue.KEY_source);
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Otherdata> existingData = MydataBase.getInstance().myDAO().getliketitle(downurl);
|
||||
if (!existingData.isEmpty()) {
|
||||
otherdata = existingData.get(0);
|
||||
checkdata.setLike(otherdata.getLike());
|
||||
// Log.e("zzj", " preview getotherdatalike " + otherdata.getLike());
|
||||
islike = otherdata.getLike();
|
||||
if (islike) {
|
||||
binding.imgLike.setBackgroundResource(R.drawable.pre_like_check);
|
||||
} else {
|
||||
binding.imgLike.setBackgroundResource(R.drawable.pre_like_uncheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(preurl)
|
||||
// .encodeQuality(50)
|
||||
// .encodeFormat(Bitmap.CompressFormat.JPEG)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
binding.preImage.setImageBitmap(resource);
|
||||
setmap = resource;
|
||||
downloadmap = resource;
|
||||
binding.prePg.setVisibility(View.GONE);
|
||||
binding.preImage.setVisibility(View.VISIBLE);
|
||||
showmenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void hidemenu() {
|
||||
binding.preMenu.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void showmenu() {
|
||||
binding.preMenu.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// Log.e("zzj", " preview onPause ");
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (otherdata.getLike() != checkdata.getLike()) {
|
||||
// Log.e("zzj", " preview === saveotherlike " + otherdata.getLike());
|
||||
otherdata.setLike(false);
|
||||
KEY_Change = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// unregisterReceiver(wallpaperChangedReceiver);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
if (binding.preImage != null) {
|
||||
Log.e("zzj", " ");
|
||||
Glide.with(this)
|
||||
.clear(binding.preImage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.tool.minimalistwallpaper.activity;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_splash);
|
||||
|
||||
EdgeToEdge.enable(this);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_splash), (v, insets) -> {
|
||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
countDownTimer = new CountDownTimer(1000, 100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
||||
}
|
||||
},2000);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
satrView();
|
||||
}
|
||||
};
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private void satrView() {
|
||||
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,144 @@
|
||||
package com.tool.minimalistwallpaper.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
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.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.activity.AllActivity;
|
||||
import com.tool.minimalistwallpaper.activity.PreViewActivity;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class CategoryRvAdapter extends RecyclerView.Adapter<CategoryRvAdapter.ThumVH> {
|
||||
private Context myContext;
|
||||
private List<Otherdata> myDataList;
|
||||
|
||||
public CategoryRvAdapter(Context context, List<Otherdata> list) {
|
||||
myContext = context;
|
||||
myDataList = getUniqueDataList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull ThumVH holder) {
|
||||
super.onViewRecycled(holder);
|
||||
// if (holder.getImageViewThumb() != null) {
|
||||
// Log.e("zzj", "+++++++++++++++++");
|
||||
// Glide.with(myContext)
|
||||
// .clear(holder.getImageViewThumb());
|
||||
// }
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CategoryRvAdapter.ThumVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(myContext).inflate(R.layout.category_list, parent, false);
|
||||
return new CategoryRvAdapter.ThumVH(view);
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CategoryRvAdapter.ThumVH holder, int position) {
|
||||
Otherdata myData = myDataList.get(position);
|
||||
|
||||
holder.getCategorytext().setText(myData.getName());
|
||||
Glide.with(myContext)
|
||||
.load(myData.getBanner())
|
||||
.placeholder(R.mipmap.logo)
|
||||
// .encodeQuality(90)
|
||||
// .encodeFormat(Bitmap.CompressFormat.JPEG)
|
||||
// .downsample(DownsampleStrategy.CENTER_INSIDE)
|
||||
.addListener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
Log.e("zzj", "load --------" + resource.toString());
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.transform(new RoundedCorners(Mytools.dp2Px(16)))
|
||||
.into(holder.getImageViewThumb());
|
||||
holder.getConstraintLayout().setOnClickListener(v -> {
|
||||
Intent intent = new Intent(myContext, AllActivity.class);
|
||||
intent.putExtra(StaticValue.KEY_name, myData.getName());
|
||||
myContext.startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private List<Otherdata> getUniqueDataList(List<Otherdata> list) {
|
||||
List<Otherdata> uniqueList = new ArrayList<>();
|
||||
Set<String> namesSet = new HashSet<>();
|
||||
|
||||
for (Otherdata data : list) {
|
||||
if (!namesSet.contains(data.getName())) {
|
||||
uniqueList.add(data);
|
||||
namesSet.add(data.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return myDataList.size();
|
||||
}
|
||||
|
||||
public class ThumVH extends RecyclerView.ViewHolder {
|
||||
private ImageView imageViewThumb;
|
||||
private ConstraintLayout constraintLayout;
|
||||
private TextView categorytext;
|
||||
|
||||
public TextView getCategorytext() {
|
||||
return categorytext;
|
||||
}
|
||||
|
||||
public ThumVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageViewThumb = itemView.findViewById(R.id.category_image);
|
||||
constraintLayout = itemView.findViewById(R.id.category_cons);
|
||||
categorytext = itemView.findViewById(R.id.category_title);
|
||||
}
|
||||
|
||||
public ImageView getImageViewThumb() {
|
||||
return imageViewThumb;
|
||||
}
|
||||
|
||||
public ConstraintLayout getConstraintLayout() {
|
||||
return constraintLayout;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.tool.minimalistwallpaper.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.activity.PreViewActivity;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LikeAdapter extends RecyclerView.Adapter<LikeAdapter.MainRvVH> {
|
||||
private Context mcontext;
|
||||
private List<Otherdata> myDataList;
|
||||
|
||||
public LikeAdapter(Context context) {
|
||||
mcontext = context;
|
||||
myDataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void setData(List<Otherdata> myDatadataList) {
|
||||
this.myDataList = myDatadataList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
||||
public LikeAdapter.MainRvVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mcontext).inflate(R.layout.like__list, parent, false);
|
||||
|
||||
return new LikeAdapter.MainRvVH(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull MainRvVH holder) {
|
||||
super.onViewRecycled(holder);
|
||||
if (holder.getImage() != null) {
|
||||
Log.e("zzj", "===================");
|
||||
Glide.with(mcontext)
|
||||
.clear(holder.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LikeAdapter.MainRvVH holder, int position) {
|
||||
Otherdata otherdata = myDataList.get(position);
|
||||
String url = otherdata.getSource();
|
||||
String pre = otherdata.getPreviewThumb();
|
||||
String pre1 = otherdata.getOriginal();
|
||||
Glide.with(mcontext)
|
||||
.load(pre)
|
||||
.transform(new RoundedCorners(Mytools.dp2Px(16)))
|
||||
.placeholder(R.mipmap.logo)
|
||||
// .encodeQuality(50)
|
||||
// .encodeFormat(Bitmap.CompressFormat.JPEG)
|
||||
.into(holder.getImage());
|
||||
holder.getImage().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(mcontext, PreViewActivity.class);
|
||||
intent.putExtra(StaticValue.KEY_source, url);
|
||||
intent.putExtra(StaticValue.KEY_original, pre1);
|
||||
mcontext.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return myDataList.size();
|
||||
}
|
||||
|
||||
public class MainRvVH extends RecyclerView.ViewHolder {
|
||||
private ImageView image;
|
||||
|
||||
public MainRvVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
image = itemView.findViewById(R.id.main_list_rv_img);
|
||||
}
|
||||
|
||||
public ImageView getImage() {
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
package com.tool.minimalistwallpaper.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.BoolRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.DownsampleStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.activity.PreViewActivity;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainRvAdapter extends RecyclerView.Adapter<MainRvAdapter.ThumVH> {
|
||||
private Context myContext;
|
||||
private List<Otherdata> myDataList;
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
public MainRvAdapter(Context context, List<Otherdata> list) {
|
||||
myContext = context;
|
||||
myDataList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull ThumVH holder) {
|
||||
super.onViewRecycled(holder);
|
||||
if (holder.getImageViewThumb() != null) {
|
||||
Log.e("zzj", "----------------------");
|
||||
Glide.with(myContext)
|
||||
.clear(holder.getImageViewThumb());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MainRvAdapter.ThumVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(myContext).inflate(R.layout.image_list, parent, false);
|
||||
return new MainRvAdapter.ThumVH(view);
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MainRvAdapter.ThumVH holder, int position) {
|
||||
Otherdata myData = myDataList.get(position);
|
||||
Boolean like = myData.getLike();
|
||||
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Otherdata> existingData = MydataBase.getInstance().myDAO().getliketitle(myData.getSource());
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!existingData.isEmpty()) {
|
||||
Otherdata otherdata = existingData.get(0);
|
||||
boolean islike = otherdata.getLike();
|
||||
if (islike) {
|
||||
// Log.e("zzj","onBindViewHolder true "+ otherdata.source);
|
||||
holder.getLike().setBackgroundResource(R.drawable.pre_like_check);
|
||||
} else {
|
||||
// Log.e("zzj","onBindViewHolder false "+ otherdata.source);
|
||||
holder.getLike().setBackgroundResource(R.drawable.pre_like_uncheck);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
holder.getLike().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Otherdata> existingData = MydataBase.getInstance().myDAO().getliketitle(myData.getSource());
|
||||
if (!existingData.isEmpty()) {
|
||||
Otherdata otherdata = existingData.get(0);
|
||||
boolean islike = otherdata.getLike();
|
||||
otherdata.setLike(!islike);
|
||||
MydataBase.getInstance().myDAO().update(otherdata);
|
||||
holder.getLike().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!islike) {
|
||||
holder.getLike().setBackgroundResource(R.drawable.pre_like_check);
|
||||
} else {
|
||||
holder.getLike().setBackgroundResource(R.drawable.pre_like_uncheck);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Glide.with(myContext)
|
||||
.load(myData.getPreviewThumb())
|
||||
.placeholder(R.mipmap.logo)
|
||||
.encodeQuality(90)
|
||||
.encodeFormat(Bitmap.CompressFormat.JPEG)
|
||||
.downsample(DownsampleStrategy.AT_MOST)
|
||||
.transform(new RoundedCorners(Mytools.dp2Px(16)))
|
||||
.into(holder.getImageViewThumb());
|
||||
holder.getConstraintLayout().setOnClickListener(v -> {
|
||||
Intent intent = new Intent(myContext, PreViewActivity.class);
|
||||
intent.putExtra(StaticValue.KEY_source, myData.getSource());
|
||||
intent.putExtra(StaticValue.KEY_original, myData.getOriginal());
|
||||
myContext.startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return myDataList.size();
|
||||
}
|
||||
|
||||
public class ThumVH extends RecyclerView.ViewHolder {
|
||||
private ImageView imageViewThumb, like;
|
||||
private ConstraintLayout constraintLayout;
|
||||
|
||||
public ImageView getLike() {
|
||||
return like;
|
||||
}
|
||||
|
||||
public ThumVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageViewThumb = itemView.findViewById(R.id.image_view_thumb_id);
|
||||
constraintLayout = itemView.findViewById(R.id.constraint_layout_id);
|
||||
like = itemView.findViewById(R.id.list_like);
|
||||
}
|
||||
|
||||
public ImageView getImageViewThumb() {
|
||||
return imageViewThumb;
|
||||
}
|
||||
|
||||
public ConstraintLayout getConstraintLayout() {
|
||||
return constraintLayout;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.tool.minimalistwallpaper.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
|
||||
import com.tool.minimalistwallpaper.fragment.CategoryFragment;
|
||||
import com.tool.minimalistwallpaper.fragment.LikeFragment;
|
||||
import com.tool.minimalistwallpaper.fragment.MainFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageAdapter extends FragmentStatePagerAdapter {
|
||||
private final List<Fragment> list = new ArrayList<>();
|
||||
|
||||
public PageAdapter(@NonNull FragmentManager fm) {
|
||||
super(fm);
|
||||
list.add(new MainFragment());
|
||||
list.add(new CategoryFragment());
|
||||
list.add(new LikeFragment());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.tool.minimalistwallpaper.data;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface MyDAO {
|
||||
@Query("SELECT * FROM MinimalistWP_table")
|
||||
List<Otherdata> getAll();
|
||||
|
||||
@Query("select * from MinimalistWP_table where source =:source ")
|
||||
List<Otherdata> getliketitle(String source);
|
||||
|
||||
@Query("select * from MinimalistWP_table where name =:name ")
|
||||
List<Otherdata> getallwp(String name);
|
||||
|
||||
@Query("SELECT * FROM MinimalistWP_table WHERE islike = :islike")
|
||||
List<Otherdata> getlikewp(boolean islike);
|
||||
|
||||
@Insert
|
||||
void insertAll(List<Otherdata> likeDataList);
|
||||
|
||||
@Update
|
||||
void update(Otherdata otherdata);
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.tool.minimalistwallpaper.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class Mydata {
|
||||
public String name;
|
||||
private List<Otherdata> list =new ArrayList<>();
|
||||
|
||||
public List<Otherdata> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<Otherdata> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.tool.minimalistwallpaper.data;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
|
||||
|
||||
@Database(entities = {Otherdata.class}, version = MinimalistWPSkin.DB_Version,exportSchema = false)
|
||||
public abstract class MydataBase extends RoomDatabase {
|
||||
public abstract MyDAO myDAO();
|
||||
|
||||
private static MydataBase INSTANCE;
|
||||
|
||||
public static MydataBase getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (MydataBase.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Room.databaseBuilder(MinimalistWPSkin.getAppContext(), MydataBase.class, MinimalistWPSkin.DB_Name).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.tool.minimalistwallpaper.data;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@Entity(tableName = MinimalistWPSkin.Table_Name)
|
||||
public class Otherdata implements Serializable {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
public String name;
|
||||
public String banner;
|
||||
public String original;
|
||||
public String previewThumb;
|
||||
public String source;
|
||||
public Boolean islike;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getBanner() {
|
||||
return banner;
|
||||
}
|
||||
|
||||
public void setBanner(String banner) {
|
||||
this.banner = banner;
|
||||
}
|
||||
|
||||
public String getOriginal() {
|
||||
return original;
|
||||
}
|
||||
|
||||
public void setOriginal(String original) {
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
public String getPreviewThumb() {
|
||||
return previewThumb;
|
||||
}
|
||||
|
||||
public void setPreviewThumb(String previewThumb) {
|
||||
this.previewThumb = previewThumb;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public Boolean getLike() {
|
||||
return islike;
|
||||
}
|
||||
|
||||
public void setLike(Boolean like) {
|
||||
this.islike = like;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.tool.minimalistwallpaper.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
import com.tool.minimalistwallpaper.adapter.CategoryRvAdapter;
|
||||
import com.tool.minimalistwallpaper.databinding.FragmentCategoryBinding;
|
||||
import com.tool.minimalistwallpaper.tools.SpaceItem;
|
||||
|
||||
|
||||
public class CategoryFragment extends Fragment {
|
||||
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
|
||||
FragmentCategoryBinding binding;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentCategoryBinding.inflate(inflater, container, false);
|
||||
|
||||
binding.categoryRv.setAdapter(new CategoryRvAdapter(requireContext(), MinimalistWPSkin.getOtherdata()));
|
||||
binding.categoryRv.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
binding.categoryRv.addItemDecoration(spaceItem);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.tool.minimalistwallpaper.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.adapter.LikeAdapter;
|
||||
import com.tool.minimalistwallpaper.data.MydataBase;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.FragmentLikeBinding;
|
||||
import com.tool.minimalistwallpaper.tools.Mytools;
|
||||
import com.tool.minimalistwallpaper.tools.SpaceItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class LikeFragment extends Fragment {
|
||||
FragmentLikeBinding binding;
|
||||
private List<Otherdata> existingData = new ArrayList<>();
|
||||
private LikeAdapter likeAdapter;
|
||||
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentLikeBinding.inflate(inflater, container, false);
|
||||
initData();
|
||||
binding.likeRv.addItemDecoration(spaceItem);
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
Mytools.runIO(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
existingData = MydataBase.getInstance().myDAO().getlikewp(true);
|
||||
requireActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (existingData.isEmpty()) {
|
||||
binding.nolikeText.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.nolikeText.setVisibility(View.GONE);
|
||||
}
|
||||
likeAdapter = new LikeAdapter(requireContext());
|
||||
likeAdapter.setData(existingData);
|
||||
binding.likeRv.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
||||
binding.likeRv.setAdapter(likeAdapter);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initData();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
package com.tool.minimalistwallpaper.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
import com.tool.minimalistwallpaper.R;
|
||||
import com.tool.minimalistwallpaper.activity.PreViewActivity;
|
||||
import com.tool.minimalistwallpaper.adapter.MainRvAdapter;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
import com.tool.minimalistwallpaper.databinding.FragmentMainBinding;
|
||||
import com.tool.minimalistwallpaper.tools.SpaceItem;
|
||||
import com.tool.minimalistwallpaper.tools.StaticValue;
|
||||
import com.youth.banner.adapter.BannerImageAdapter;
|
||||
import com.youth.banner.holder.BannerImageHolder;
|
||||
import com.youth.banner.indicator.CircleIndicator;
|
||||
import com.youth.banner.listener.OnBannerListener;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MainFragment extends Fragment {
|
||||
FragmentMainBinding binding;
|
||||
private List<Otherdata> randomOriginals = new ArrayList<>();
|
||||
private List<Otherdata> list = new ArrayList<>();
|
||||
private SpaceItem spaceItem = new SpaceItem(12, 12, 12);
|
||||
private static List<Otherdata> allOtherdata = new ArrayList<>();
|
||||
private MainRvAdapter mainRvAdapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Log.e("zzj", " mainfragmnet onCreateView " + PreViewActivity.KEY_Change);
|
||||
binding = FragmentMainBinding.inflate(inflater, container, false);
|
||||
if (savedInstanceState != null) {
|
||||
list = (List<Otherdata>) savedInstanceState.getSerializable("list");
|
||||
randomOriginals = (List<Otherdata>) savedInstanceState.getSerializable("banner");
|
||||
}
|
||||
|
||||
mainRvAdapter = new MainRvAdapter(requireContext(), list);
|
||||
|
||||
initBanner();
|
||||
|
||||
initData();
|
||||
|
||||
|
||||
binding.mainRv.addItemDecoration(spaceItem);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putSerializable("list", (Serializable) list);
|
||||
outState.putSerializable("banner", (Serializable) randomOriginals);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
List<Otherdata> othList = generateRandomOtherdata(0, 10);
|
||||
// list.clear();
|
||||
// list.addAll(othList);
|
||||
for (Otherdata otherdata : othList) {
|
||||
if (list.size() < 10) {
|
||||
list.add(otherdata);
|
||||
}
|
||||
}
|
||||
|
||||
binding.mainRv.setAdapter(mainRvAdapter);
|
||||
binding.mainRv.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initBanner() {
|
||||
List<Otherdata> otherdataList = generateRandomOtherdata(0, 4);
|
||||
for (Otherdata data : otherdataList) {
|
||||
if (randomOriginals.size() < 4) {
|
||||
randomOriginals.add(data);
|
||||
}
|
||||
}
|
||||
binding.banner.setAdapter(new BannerImageAdapter<Otherdata>(randomOriginals) {
|
||||
@Override
|
||||
public void onBindView(BannerImageHolder holder, Otherdata data, int position, int size) {
|
||||
ImageView imageView = holder.imageView;
|
||||
Glide.with(requireContext())
|
||||
.load(data.getPreviewThumb())
|
||||
.placeholder(R.color.load_bg)
|
||||
.encodeQuality(50)
|
||||
.into(imageView);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
}
|
||||
});
|
||||
binding.banner.setOnBannerListener(new OnBannerListener() {
|
||||
@Override
|
||||
public void OnBannerClick(Object data, int position) {
|
||||
Otherdata otherdata = randomOriginals.get(position);
|
||||
String url = otherdata.getSource();
|
||||
String pre = otherdata.getOriginal();
|
||||
Intent intent = new Intent(requireContext(), PreViewActivity.class);
|
||||
intent.putExtra(StaticValue.KEY_original, pre);
|
||||
intent.putExtra(StaticValue.KEY_source, url);
|
||||
requireContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
binding.banner.setIndicator(new CircleIndicator(requireContext()));
|
||||
binding.banner.setBannerRound(16);
|
||||
binding.banner.setIndicatorRadius(100);
|
||||
}
|
||||
|
||||
private static List<Otherdata> generateRandomOtherdata(int star, int end) {
|
||||
|
||||
// Mytools.runIO(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// allOtherdata = MydataBase.getInstance().myDAO().getAll();
|
||||
// Log.e("zzj",allOtherdata.toString());
|
||||
// Collections.shuffle(allOtherdata);
|
||||
// }
|
||||
// });
|
||||
allOtherdata = MinimalistWPSkin.getOtherdata();
|
||||
Collections.shuffle(allOtherdata);
|
||||
|
||||
return allOtherdata.subList(star, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// Log.e("zzj", " mainfragmnet onResume " + PreViewActivity.KEY_Change);
|
||||
if (PreViewActivity.KEY_Change) {
|
||||
initData();
|
||||
PreViewActivity.KEY_Change = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.tool.minimalistwallpaper.tools;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
|
||||
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin;
|
||||
import com.tool.minimalistwallpaper.data.Mydata;
|
||||
import com.tool.minimalistwallpaper.data.Otherdata;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class Mytools {
|
||||
private static ExecutorService executorService;
|
||||
|
||||
public static void runIO(Runnable task) {
|
||||
getExecutorService().execute(task);
|
||||
}
|
||||
|
||||
private static ExecutorService getExecutorService() {
|
||||
if (executorService == null) {
|
||||
executorService = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
return executorService;
|
||||
}
|
||||
|
||||
private static JSONArray loadJSONFromAsset(String filename) {
|
||||
String json;
|
||||
try {
|
||||
AssetManager assetManager = MinimalistWPSkin.getAppContext().getAssets();
|
||||
InputStream inputStream = assetManager.open(filename);
|
||||
int size = inputStream.available();
|
||||
byte[] buffer = new byte[size];
|
||||
inputStream.read(buffer);
|
||||
inputStream.close();
|
||||
json = new String(buffer, StandardCharsets.UTF_8);
|
||||
return new JSONArray(json);
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static List<Mydata> parseJsonToList(String filename) {
|
||||
List<Mydata> dataList = new ArrayList<>();
|
||||
try {
|
||||
JSONArray jsonObject = loadJSONFromAsset(filename);
|
||||
for (int a = 0; a < jsonObject.length(); a++) {
|
||||
JSONObject list = jsonObject.getJSONObject(a);
|
||||
Mydata myData = new Mydata();
|
||||
List<Otherdata> otherdataList = new ArrayList<>();
|
||||
myData.setName(list.getString("name"));
|
||||
JSONArray classArray = list.getJSONArray("data");
|
||||
for (int i = 0; i < classArray.length(); i++) {
|
||||
JSONObject item = classArray.getJSONObject(i);
|
||||
Otherdata otherdata = new Otherdata();
|
||||
otherdata.setLike(false);
|
||||
otherdata.setName(myData.getName());
|
||||
boolean banner = item.has("banner");
|
||||
if (banner) {
|
||||
otherdata.setBanner(item.getString("banner"));
|
||||
} else {
|
||||
otherdata.setBanner("1");
|
||||
}
|
||||
otherdata.setOriginal(item.getString("original"));
|
||||
otherdata.setPreviewThumb(item.getString("previewThumb"));
|
||||
otherdata.setSource(item.getString("source"));
|
||||
otherdataList.add(otherdata);
|
||||
}
|
||||
myData.setList(otherdataList);
|
||||
dataList.add(myData);
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return dataList;
|
||||
}
|
||||
public static int dp2Px(int dp) {
|
||||
float scale = MinimalistWPSkin.getAppContext().getResources().getDisplayMetrics().density;
|
||||
return (int) (dp * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.tool.minimalistwallpaper.tools;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class SpaceItem extends RecyclerView.ItemDecoration {
|
||||
private int ex_space = 0;
|
||||
private int v_space = 0;
|
||||
private int h_space = 0;
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
|
||||
int position = parent.getChildAdapterPosition(view);
|
||||
int spanSize = 1;
|
||||
int spanIndex = 0;
|
||||
int spanCount = 1;
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager1 = (GridLayoutManager) layoutManager;
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount = layoutManager1.getSpanCount();
|
||||
spanSize = layoutManager1.getSpanSizeLookup().getSpanSize(position);
|
||||
spanIndex = layoutParams.getSpanIndex();
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (spanSize == spanCount) {
|
||||
outRect.left = v_space + ex_space;
|
||||
outRect.right = v_space + ex_space;
|
||||
outRect.bottom = h_space;
|
||||
} else {
|
||||
int itemAllSpacing = (v_space * (spanCount + 1) + ex_space * 2) / spanCount;
|
||||
int left = v_space * (spanIndex + 1) - itemAllSpacing * spanIndex + ex_space;
|
||||
int right = itemAllSpacing - left;
|
||||
outRect.left = left;
|
||||
outRect.right = right;
|
||||
outRect.bottom = h_space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SpaceItem(int v_space, int h_space, int ex_space) {
|
||||
this.ex_space = ex_space;
|
||||
this.h_space = h_space;
|
||||
this.v_space = v_space;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.tool.minimalistwallpaper.tools;
|
||||
|
||||
public class StaticValue {
|
||||
public static String KEY_name = "key_name";
|
||||
public static String KEY_banner = "key_banner";
|
||||
public static String KEY_change = "key_change";
|
||||
public static String KEY_source = "key_source";
|
||||
public static String KEY_original = "KEY_original";
|
||||
public static String KEY_previewThumb = "KEY_previewThumb";
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.tool.minimalistwallpaper.tools
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
import com.tool.minimalistwallpaper.MinimalistWPSkin
|
||||
import com.tool.minimalistwallpaper.R
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
|
||||
object Utils {
|
||||
|
||||
fun saveImageToGallery(context: Context, image: Bitmap, fileName:String): Boolean {
|
||||
|
||||
val storePath: String = getBitmapFileDir()
|
||||
val appDir = File(storePath)
|
||||
if (!appDir.exists()) {
|
||||
appDir.mkdir()
|
||||
}
|
||||
val file = File(appDir, fileName)
|
||||
try {
|
||||
val fos = FileOutputStream(file)
|
||||
|
||||
val isSuccess = image.compress(Bitmap.CompressFormat.JPEG, 100, fos)
|
||||
fos.flush()
|
||||
fos.close()
|
||||
|
||||
val uri = Uri.fromFile(file)
|
||||
context.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri))
|
||||
return isSuccess
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun getBitmapFileDir(): String {
|
||||
return if (Build.VERSION.SDK_INT < 29) {
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator + MinimalistWPSkin.APP_Name
|
||||
} else {
|
||||
Environment.DIRECTORY_PICTURES + File.separator + MinimalistWPSkin.APP_Name
|
||||
}
|
||||
}
|
||||
fun setWallpaperToast(context: Activity, isSuccess: Boolean, pb: ProgressBar) {
|
||||
if (isSuccess) {
|
||||
context.runOnUiThread {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.set_successful),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
pb.isVisible = false
|
||||
}
|
||||
} else {
|
||||
context.runOnUiThread {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.set_failed),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
pb.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
10
app/src/main/res/drawable/banner_bg.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white"/>
|
||||
<corners
|
||||
android:topLeftRadius="16dp"
|
||||
android:bottomRightRadius="16dp"
|
||||
android:bottomLeftRadius="16dp"
|
||||
android:topRightRadius="16dp" />
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/class_check.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M288,98.2c105.1,0 190.2,85.2 190.2,190.2v178.2c0,6.6 -5.4,12 -12,12L288,478.6c-105.1,0 -190.2,-85.2 -190.2,-190.2 0,-105.3 84.8,-190.2 190.2,-190.2zM289.7,547.8h176.5c6.6,0 12,5.4 12,12v176.5c0,105.4 -86.3,192.7 -191.7,191.9 -103.9,-0.8 -188,-84.9 -188.8,-188.8 -0.7,-105.3 86.6,-191.6 192,-191.6zM737.6,98.2c104.9,0 190,85 190.2,189.9 0.2,104.8 -87,190.6 -191.9,190.6L559.4,478.7c-6.6,0 -12,-5.4 -12,-12L547.4,288.5c0,-105.1 85.1,-190.3 190.2,-190.3zM559.4,547.8h176.5c105.4,0 192.7,86.3 191.9,191.7 -0.8,103.9 -84.9,188 -188.8,188.8 -105.4,0.8 -191.7,-86.5 -191.7,-191.9L547.3,559.8c0.1,-6.6 5.5,-12 12.1,-12z"
|
||||
android:fillColor="#2c2c2c"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/class_uncheck.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M444.3,481.7L273,481.7c-115.1,0 -208.8,-93.7 -208.8,-208.8S157.8,64.1 273,64.1s208.8,93.7 208.8,208.8v171.3c0,20.7 -16.8,37.5 -37.5,37.5zM273,139c-73.8,0 -133.9,60.1 -133.9,133.9s60,133.9 133.9,133.9h133.9L406.9,272.9C406.8,199 346.8,139 273,139zM751,481.8L579.7,481.8c-20.7,0 -37.5,-16.8 -37.5,-37.5L542.2,273c0,-115.1 93.7,-208.8 208.8,-208.8S959.8,157.8 959.8,273 866.2,481.8 751,481.8zM617.2,406.9L751,406.9c73.8,0 133.9,-60.1 133.9,-133.9s-60,-133.9 -133.9,-133.9 -133.8,60 -133.8,133.9v133.9zM273,959.9c-115.1,0 -208.8,-93.7 -208.8,-208.8S157.8,542.2 273,542.2h171.3c20.7,0 37.5,16.8 37.5,37.5L481.8,751c0,115.2 -93.7,208.9 -208.8,208.9zM273,617.2c-73.8,0 -133.9,60.1 -133.9,133.9s60,133.8 133.9,133.8 133.8,-60 133.8,-133.9L406.8,617.2L273,617.2zM751,959.9c-115.1,0 -208.8,-93.7 -208.8,-208.8L542.2,579.8c0,-20.7 16.8,-37.5 37.5,-37.5L751,542.3c115.1,0 208.8,93.7 208.8,208.8S866.2,959.9 751,959.9zM617.2,617.2v133.9c0,73.9 60,133.9 133.8,133.9s133.9,-60 133.9,-133.9 -60,-133.9 -133.9,-133.9L617.2,617.2z"
|
||||
android:fillColor="@color/black"/>
|
||||
</vector>
|
||||
23
app/src/main/res/drawable/home_check.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="17"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M0.851,7.45L8.5,1.5L16.149,7.45V16.799C16.149,17.25 15.97,17.682 15.652,18.001C15.333,18.32 14.901,18.499 14.45,18.499H2.551C2.1,18.499 1.668,18.32 1.349,18.001C1.03,17.682 0.851,17.25 0.851,16.799V7.45Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.69985"
|
||||
android:fillColor="#353535"
|
||||
android:strokeColor="#353535"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M5.949,18.498V11.014H11.048V18.498"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M5.949,18.498V11.014H11.048V18.498"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.69985"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
20
app/src/main/res/drawable/home_uncheck.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="17dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="17"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M0.851,7.45L8.5,1.5L16.149,7.45V16.799C16.149,17.25 15.97,17.682 15.652,18.001C15.333,18.32 14.9,18.499 14.45,18.499H2.551C2.1,18.499 1.667,18.32 1.349,18.001C1.03,17.682 0.851,17.25 0.851,16.799V7.45Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.69985"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#353535"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M5.95,18.5V10H11.049V18.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.69985"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#353535"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/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>
|
||||
20
app/src/main/res/drawable/icon_back.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<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="M2.899,12H20.899"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M8.899,18L2.899,12L8.899,6"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
27
app/src/main/res/drawable/icon_download.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<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="M3,12.004V21H21V12"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M16.5,11.5L12,16L7.5,11.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M11.996,3V16"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#333333"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/like_check.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="19dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="19"
|
||||
android:viewportHeight="18">
|
||||
<path
|
||||
android:pathData="M16.771,2.826C16.351,2.406 15.852,2.072 15.302,1.845C14.753,1.617 14.165,1.5 13.57,1.5C12.976,1.5 12.387,1.617 11.838,1.845C11.289,2.072 10.79,2.406 10.37,2.826L9.498,3.698L8.626,2.826C7.777,1.977 6.626,1.5 5.425,1.5C4.225,1.5 3.074,1.977 2.225,2.826C1.376,3.675 0.899,4.826 0.899,6.027C0.899,7.227 1.376,8.378 2.225,9.227L3.097,10.099L9.498,16.5L15.899,10.099L16.771,9.227C17.191,8.807 17.525,8.308 17.752,7.759C17.98,7.21 18.097,6.621 18.097,6.027C18.097,5.432 17.98,4.844 17.752,4.294C17.525,3.745 17.191,3.246 16.771,2.826Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.64547"
|
||||
android:fillColor="#353535"
|
||||
android:strokeColor="#353535"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/like_uncheck.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="19dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="19"
|
||||
android:viewportHeight="18">
|
||||
<path
|
||||
android:pathData="M16.771,2.826C16.351,2.406 15.852,2.072 15.303,1.845C14.753,1.617 14.165,1.5 13.57,1.5C12.976,1.5 12.387,1.617 11.838,1.845C11.289,2.072 10.79,2.406 10.37,2.826L9.498,3.698L8.626,2.826C7.777,1.977 6.626,1.5 5.425,1.5C4.225,1.5 3.074,1.977 2.225,2.826C1.376,3.675 0.899,4.826 0.899,6.027C0.899,7.227 1.376,8.378 2.225,9.227L3.097,10.099L9.498,16.5L15.899,10.099L16.771,9.227C17.191,8.807 17.525,8.308 17.752,7.759C17.98,7.21 18.097,6.621 18.097,6.027C18.097,5.432 17.98,4.844 17.752,4.294C17.525,3.745 17.191,3.246 16.771,2.826Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.64547"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#353535"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/load_banner.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="844dp"
|
||||
android:height="343dp"
|
||||
android:viewportWidth="844"
|
||||
android:viewportHeight="343">
|
||||
<path
|
||||
android:pathData="M16,0L828,0A16,16 0,0 1,844 16L844,327A16,16 0,0 1,828 343L16,343A16,16 0,0 1,0 327L0,16A16,16 0,0 1,16 0z"
|
||||
android:fillColor="#D9D9D9"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/load_category.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="857dp"
|
||||
android:height="482dp"
|
||||
android:viewportWidth="857"
|
||||
android:viewportHeight="482">
|
||||
<path
|
||||
android:pathData="M34,0L823,0A34,34 0,0 1,857 34L857,448A34,34 0,0 1,823 482L34,482A34,34 0,0 1,0 448L0,34A34,34 0,0 1,34 0z"
|
||||
android:fillColor="#D9D9D9"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/load_main.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="423dp"
|
||||
android:height="755dp"
|
||||
android:viewportWidth="423"
|
||||
android:viewportHeight="755">
|
||||
<path
|
||||
android:pathData="M423,36L423,719A36,36 0,0 1,387 755L36,755A36,36 0,0 1,0 719L0,36A36,36 0,0 1,36 0L387,0A36,36 0,0 1,423 36z"
|
||||
android:fillColor="#D9D9D9"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/main_table.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:right="-1dp" android:left="-1dp" android:bottom="-1dp">
|
||||
<shape>
|
||||
<stroke android:width="1dp" android:color="@color/gray" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
13
app/src/main/res/drawable/pre_like_check.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="17">
|
||||
<path
|
||||
android:pathData="M6.25,1.333C3.719,1.333 1.667,3.385 1.667,5.917C1.667,10.5 7.083,14.667 10,15.636C12.917,14.667 18.333,10.5 18.333,5.917C18.333,3.385 16.281,1.333 13.75,1.333C12.2,1.333 10.829,2.103 10,3.281C9.171,2.103 7.8,1.333 6.25,1.333Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.66667"
|
||||
android:fillColor="#E83636"
|
||||
android:strokeColor="#E83636"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/pre_like_uncheck.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="17dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="17">
|
||||
<path
|
||||
android:pathData="M6.25,1.333C3.719,1.333 1.667,3.385 1.667,5.917C1.667,10.5 7.083,14.667 10,15.636C12.917,14.667 18.333,10.5 18.333,5.917C18.333,3.385 16.281,1.333 13.75,1.333C12.2,1.333 10.83,2.103 10,3.281C9.171,2.103 7.8,1.333 6.25,1.333Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.66667"
|
||||
android:fillColor="#D7D7D7"
|
||||
android:strokeColor="#D7D7D7"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/prew_menu_bg.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/white"/>
|
||||
<corners
|
||||
android:topLeftRadius="46dp"
|
||||
android:bottomLeftRadius="46dp"
|
||||
android:bottomRightRadius="46dp"
|
||||
android:topRightRadius="46dp" />
|
||||
|
||||
</shape>
|
||||
40
app/src/main/res/layout/activity_all.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/activity_all"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="16dp"
|
||||
tools:context=".activity.AllActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/all_back"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="@drawable/icon_back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/all_title"
|
||||
app:layout_constraintTop_toTopOf="@id/all_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/all_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/all_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/all_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
29
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?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/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/main_viewpager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/main_tabLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/main_tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/main_table"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:tabIndicatorHeight="0dp" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
160
app/src/main/res/layout/activity_pre_view.xml
Normal file
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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/activity_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray"
|
||||
tools:context=".activity.PreViewActivity">
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pre_pg"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pre_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/pre_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:padding="16dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/pre_downwp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/prew_menu_bg"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pg_donwnload"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:indeterminateTint="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_download"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:background="@drawable/icon_download"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/pre_setwp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/prew_menu_bg"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pg_setwallpaper"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:indeterminateTint="@color/black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/img_setwallpaper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/setwallpaper_text"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/pre_like"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/prew_menu_bg"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_like"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="26dp"
|
||||
android:background="@drawable/pre_like_uncheck"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cons_back"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="top|start"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:background="@drawable/prew_menu_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/pre_back"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/icon_back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
51
app/src/main/res/layout/activity_splash.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/activity_splash"
|
||||
tools:context=".activity.SplashActivity">
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
app:cardCornerRadius="15dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@mipmap/logo" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/logo" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:indeterminateTint="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
29
app/src/main/res/layout/category_list.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/category_cons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/category_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="170dp"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
29
app/src/main/res/layout/fragment_category.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.CategoryFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/category"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/category_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="6dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/category_title" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
42
app/src/main/res/layout/fragment_like.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.LikeFragment">
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="6dp"
|
||||
android:id="@+id/like_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/like_title"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_marginTop="6dp"
|
||||
android:id="@+id/like_rv"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/like_title"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nolike_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/nolike_tips"
|
||||
android:textColor="@color/gray"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
52
app/src/main/res/layout/fragment_main.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.MainFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/main_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.youth.banner.Banner
|
||||
android:id="@+id/banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="160dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/banner_bg"
|
||||
app:layout_constraintTop_toBottomOf="@id/main_title" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recommend"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:text="@string/main_recommend"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/banner" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/main_rv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/recommend" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
28
app/src/main/res/layout/image_list.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/constraint_layout_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view_thumb_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/list_like"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/pre_like_uncheck"
|
||||
app:layout_constraintBottom_toBottomOf="@id/image_view_thumb_id"
|
||||
app:layout_constraintEnd_toEndOf="@id/image_view_thumb_id" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
16
app/src/main/res/layout/like__list.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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_list_rv_img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo.png
Normal file
|
After Width: | Height: | Size: 40 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.MinimalistWallpaper" 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="gray">#ffaaaaaa</color>
|
||||
<color name="load_bg">#D9D9D9</color>
|
||||
</resources>
|
||||
13
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<resources>
|
||||
<string name="app_name">Minimalist Wallpaper</string>
|
||||
<string name="main_recommend">Recommend</string>
|
||||
<string name="download_successful">Wallpaper download successful</string>
|
||||
<string name="download_failed">Wallpaper download failed</string>
|
||||
<string name="permission_tips">Permission denied</string>
|
||||
<string name="like_title">My favorite</string>
|
||||
<string name="nolike_tips">At present, you don\'t have a favorite wallpaper \n Go to the homepage and take a look</string>
|
||||
<string name="setwallpaper_text">Set as wallpaper</string>
|
||||
<string name="category">Category</string>
|
||||
<string name="set_successful">Wallpaper settings successful</string>
|
||||
<string name="set_failed">Failed to set wallpaper</string>
|
||||
</resources>
|
||||
15
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.MinimalistWallpaper" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.MinimalistWallpaper" parent="Base.Theme.MinimalistWallpaper" />
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<item name="android:statusBarColor" />
|
||||
</style>
|
||||
</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.tool.minimalistwallpaper;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
5
build.gradle.kts
Normal file
@ -0,0 +1,5 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" 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. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Fri Jul 05 17:27:51 CST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
gradlew
vendored
Normal file
@ -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
|
||||
18
settings.gradle.kts
Normal file
@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Minimalist Wallpaper"
|
||||
include(":app")
|
||||
|
||||