版本V1.0.0

This commit is contained in:
denghaina 2024-07-29 15:01:39 +08:00
commit 9fc3a53fe1
99 changed files with 5716 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
*.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/

1
app/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

BIN
app/PrettyWallpapers.jks Normal file

Binary file not shown.

View File

@ -0,0 +1,17 @@
-----BEGIN CERTIFICATE-----
MIICqjCCAZICAQEwDQYJKoZIhvcNAQELBQAwGzEZMBcGA1UEAwwQUHJldHR5V2Fs
bHBhcGVyczAeFw0yNDA3MjYwNjAxMjZaFw00OTA3MjAwNjAxMjZaMBsxGTAXBgNV
BAMMEFByZXR0eVdhbGxwYXBlcnMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQDAO2D4CIDwJM3lVrI6Jj5nB35Ocf/aNIOd4NbQedbP1sqZtxaaGUGiqpbf
Aghu7X373rD/tO40qqAqxlDhh78mQl8f2yF0VLr8ig0kCIICvvHTs/wbwKnd1ECA
YXvwLGOj1qmGatWdzCeS5O9ieaWR5RBBtoSvNSSS+YLbez7iw7+vcTJGmpYYgbMa
7fqCI/W/QZjYr3IWghZ7YtEP0RgPaKbIV8w8tBxz3zXjxofYuvgZC3Y6auxTmnyH
2GZYLydqrv+3yZcVp/SM9a1UR15ZCr6vmF3A5i145f9DqPeDkvysY+gPHB4b050+
jnbj97oC6dGMwRHPnuVEO1oy/xcdAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAFsS
ew1w4dsn1b/IwYOeYcyatzKiHZJEci07PsMl/ia11dFApSO/j7re+IR122v5JVnv
Vyzu10Gv6z16WrkGKQ5tUG6GIKPOlqAcIMQ/bGEhyTBGvFnQz1SfwqNNu4kvYHzF
21sbU3AOM8Jhafetn7yEYrpPirYfGsv/5H0LRpYQx2njN8Xr8Ay02JKk22Ow53qO
BLUvjsNOoI8nxmPCsOU6vEY2OvOVNQak2Zgh2GDaYj70if+QjWyn4qMEW8rwWdTj
72t5xEEVELL8LU3BuncHoXbaomcXHYtfnYIDJ07U3zyT5KBeld7A1ngMFUnBuvQi
w+qZKJYMn1O4C/6tWKo=
-----END CERTIFICATE-----

129
app/build.gradle.kts Normal file
View File

@ -0,0 +1,129 @@
import java.text.SimpleDateFormat
import java.util.Date
plugins {
alias(libs.plugins.android.application)
id("org.jetbrains.kotlin.android")
id ("kotlin-kapt")
}
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.example.prettywallpapers"
compileSdk = 34
defaultConfig {
applicationId = "com.wp.pretty.wallpapers.selection"
minSdk = 23
targetSdk = 34
versionCode = 3
versionName = "1.2"
setProperty("archivesBaseName", "Prettywallpapers_v" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
implementation ("com.github.bumptech.glide:glide:4.16.0")
implementation ("com.google.code.gson:gson:2.10.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation ("io.github.youth5201314:banner:2.2.2")
implementation ("com.github.bumptech.glide:glide:4.12.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")
//-----------------------------------------------TopOn(pangle、IronSource、mintegral、unityads、liftoff(vungle)、Bigo)
//Anythink (Necessary)
implementation("com.anythink.sdk:core-tpn:6.3.68")
implementation("com.anythink.sdk:nativead-tpn:6.3.68")
implementation("com.anythink.sdk:banner-tpn:6.3.68")
implementation("com.anythink.sdk:interstitial-tpn:6.3.68")
implementation("com.anythink.sdk:rewardedvideo-tpn:6.3.68")
implementation("com.anythink.sdk:splash-tpn:6.3.68")
//Androidx (Necessary)
implementation("androidx.appcompat:appcompat:1.1.0")
implementation("androidx.browser:browser:1.4.0")
//Vungle
implementation("com.anythink.sdk:adapter-tpn-vungle:6.3.68")
implementation("com.vungle:vungle-ads:7.3.2")
implementation("com.google.android.gms:play-services-basement:18.1.0")
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
//UnityAds
implementation("com.anythink.sdk:adapter-tpn-unityads:6.3.68")
implementation("com.unity3d.ads:unity-ads:4.9.3")
//Ironsource
implementation("com.anythink.sdk:adapter-tpn-ironsource:6.3.68")
implementation("com.ironsource.sdk:mediationsdk:8.1.0")
implementation("com.google.android.gms:play-services-appset:16.0.2")
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
implementation("com.google.android.gms:play-services-basement:18.1.0")
//Bigo
implementation("com.anythink.sdk:adapter-tpn-bigo:6.3.68")
implementation("com.bigossp:bigo-ads:4.7.4")
//Pangle
implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.3.68.1")
implementation( "com.pangle.global:ads-sdk:6.0.0.3")
implementation( "com.google.android.gms:play-services-ads-identifier:18.0.1")
//Mintegral
implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.3.68")
implementation("com.mbridge.msdk.oversea:reward:16.7.51")
implementation("com.mbridge.msdk.oversea:newinterstitial:16.7.51")
implementation("com.mbridge.msdk.oversea:mbnative:16.7.51")
implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.7.51")
implementation("com.mbridge.msdk.oversea:mbsplash:16.7.51")
implementation("com.mbridge.msdk.oversea:mbbanner:16.7.51")
implementation("com.mbridge.msdk.oversea:mbbid:16.7.51")
implementation("androidx.recyclerview:recyclerview:1.1.0")
//Tramini
implementation("com.anythink.sdk:tramini-plugin-tpn:6.3.68")
// Debugger UI Tools
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
//----------------------------------------------TopOn
}

29
app/google-services.json Normal file
View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "303460456405",
"project_id": "pretty-wallpapers-4e049",
"storage_bucket": "pretty-wallpapers-4e049.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:303460456405:android:8d406898372602f1dacf5c",
"android_client_info": {
"package_name": "com.wp.pretty.wallpapers.selection"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDa61RDneXcTtOfed9ExfFsbDaJGk0zr5U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

120
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,120 @@
# 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
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
-keep class com.example.prettywallpapers.list.PrettyPaper{ *; }
-keep class com.example.prettywallpapers.list.PrettyCategory { *; }
#---------------------------------------------Topon
# Vungle
-dontwarn com.vungle.ads.**
-keepclassmembers class com.vungle.ads.** {
*;
}
# Google
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
# START OkHttp + Okio
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**
# A resource is loaded with a relative path so the package of this class must be preserved.
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*
# END OkHttp + Okio
# START Protobuf
-dontwarn com.google.protobuf.**
-keepclassmembers class com.google.protobuf.** {
*;
}
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
# END Protobuf
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
public *;
}
-keepclassmembers class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keep public class com.google.android.gms.ads.** {
public *;
}
-keep class com.ironsource.adapters.** { *;
}
-dontwarn com.ironsource.mediationsdk.**
-dontwarn com.ironsource.adapters.**
-keepattributes JavascriptInterface
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
-keep class com.bytedance.sdk.** { *; }
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.mbridge.** {*; }
-keep interface com.mbridge.** {*; }
-keep class android.support.v4.** { *; }
-dontwarn com.mbridge.**
-keep class **.R$* { public static final int mbridge*; }
-keep public class com.mbridge.* extends androidx.** { *; }
-keep public class androidx.viewpager.widget.PagerAdapter{ *; }
-keep public class androidx.viewpager.widget.ViewPager.OnPageChangeListener{ *; }
-keep interface androidx.annotation.IntDef{ *; }
-keep interface androidx.annotation.Nullable{ *; }
-keep interface androidx.annotation.CheckResult{ *; }
-keep interface androidx.annotation.NonNull{ *; }
-keep public class androidx.fragment.app.Fragment{ *; }
-keep public class androidx.core.content.FileProvider{ *; }
-keep public class androidx.core.app.NotificationCompat{ *; }
-keep public class androidx.appcompat.widget.AppCompatImageView { *; }
-keep public class androidx.recyclerview.*{ *; }
#---------------------------------------------Topon

View File

@ -0,0 +1,26 @@
package com.example.prettywallpapers;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.prettywallpapers", appContext.getPackageName());
}
}

View File

@ -0,0 +1,45 @@
<?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.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<application
android:name=".base.PrettyWallPaper"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/pretty_logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/pretty_logo"
android:supportsRtl="true"
android:theme="@style/Theme.PrettyWallPapers"
tools:targetApi="31">
<activity
android:name=".activity.PrettyPaperActivity"
android:exported="false" />
<activity
android:name=".activity.PrettyCategoryListActivity"
android:exported="false" />
<activity
android:name=".activity.IntoActivity"
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.MainActivity"
android:exported="false" />
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
<!-- source file: nonchina_jcenter/network_sdk/vungle/7.3.2/AndroidManifest.xml -->
</application>
</manifest>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
package com.example.prettywallpapers.activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
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 com.example.prettywallpapers.R;
import com.example.prettywallpapers.toponad.AdManager;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
public class IntoActivity extends AppCompatActivity {
private CountDownTimer countDownTimer;
private Long tim = 8000L;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_into);
countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new Function0<Unit>() {
@Override
public Unit invoke() {
startMainActivity();
return null;
}
});
countDownTimer.start();
}
private void startMainActivity() {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
countDownTimer.cancel();
}
}

View File

@ -0,0 +1,94 @@
package com.example.prettywallpapers.activity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.transition.Transition;
import com.example.prettywallpapers.fragment.HomeFragment;
import com.example.prettywallpapers.fragment.LikeFragment;
import com.example.prettywallpapers.prettyadapter.FragmentAdapter;
import com.example.prettywallpapers.prettyadapter.ViewPaperAdapter;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.youth.banner.Banner;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.base.PrettyWallPaper;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;
import com.youth.banner.adapter.BannerImageAdapter;
import com.youth.banner.holder.BannerImageHolder;
import com.youth.banner.indicator.CircleIndicator;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private ViewPager2 viewPager2;
private ImageView image_set;
private RelativeLayout relative_main;
private TabLayout tabLayout;
List<String> stringList = new ArrayList<>();
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image_set = findViewById(R.id.image_set);
image_set.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
relative_main = findViewById(R.id.relative_main);
init();
viewPager2 = findViewById(R.id.view_page_main);
viewPager2.setAdapter(new FragmentAdapter(this));
tabLayout = findViewById(R.id.app_table);
TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(tabLayout, viewPager2, new TabLayoutMediator.TabConfigurationStrategy() {
@Override
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
switch (position) {
case 0:
tab.setText(R.string.home);
break;
case 1:
tab.setText(R.string.like);
break;
}
}
});
tabLayoutMediator.attach();
}
private void init() {
Window window = getWindow();
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
relative_main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
}

View File

@ -0,0 +1,91 @@
package com.example.prettywallpapers.activity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.base.MySpace;
import com.example.prettywallpapers.list.PrettyCategory;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.prettyadapter.InfoAdapter;
import com.example.prettywallpapers.prettyadapter.SeeAllInFoAdapter;
import com.example.prettywallpapers.toponad.AdManager;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
public class PrettyCategoryListActivity extends AppCompatActivity {
private TextView category_name;
private RecyclerView recycle_name;
private ImageView imageView_back;
private PrettyCategory prettyCategoryall;
private LinearLayout category_name_main;
private List<PrettyCategory> prettyCategories;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pretty_category_list);
//category_name = findViewById(R.id.category_name_main);
category_name = findViewById(R.id.category_name);
category_name.setTypeface(Typeface.createFromAsset(getAssets(),"myfront.ttf"));
imageView_back = findViewById(R.id.image_back);
imageView_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showad(true);
}
});
recycle_name =findViewById(R.id.name_list_recycle);
gotoGetData();
setNameRecycleView();
}
private void showad(boolean b) {
AdManager.showAD(PrettyCategoryListActivity.this, new Function1<Integer, Unit>() {
@Override
public Unit invoke(Integer integer) {
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
if (b)
finish();
}
return null;
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
showad(false);
}
private void gotoGetData() {
Intent intent = getIntent();
prettyCategoryall = (PrettyCategory)intent.getSerializableExtra(MyValues.PREETY_NAME);
assert prettyCategoryall != null;
category_name.setText(prettyCategoryall.getName());
}
private void setNameRecycleView() {
MySpace mySpace = new MySpace(1,20,1);
GridLayoutManager gridLayoutManager = new GridLayoutManager(this,2);
recycle_name.setLayoutManager(gridLayoutManager);
recycle_name.addItemDecoration(mySpace);
SeeAllInFoAdapter seeAllInFoAdapter = new SeeAllInFoAdapter(prettyCategoryall.getList(),this);
recycle_name.setAdapter(seeAllInFoAdapter);
}
}

View File

@ -0,0 +1,315 @@
package com.example.prettywallpapers.activity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.WallpaperManager;
import android.content.ContentValues;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperDao;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.toponad.AdManager;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
public class PrettyPaperActivity extends AppCompatActivity {
private RelativeLayout relative_main;
private TextView text_set;
private ImageView paper_image;
private WallpaperManager wallpaperManager;
private ImageView image_down;
private ImageView image_share;
private String image;
private ImageView image_hert;
private ImageView imageView_back;
private boolean like = true;
private PrettyPaperDatabase db;
private boolean liked;
private List<PrettyPaper> likelist;
private List<PrettyPaperEntity> LIST;
private PrettyPaper resource;
private boolean islike1 = false;
private PrettyPaperEntity one;
private SwitchType switchType;
private String switchtype;
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 0) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//保存图片到相册
downPreview(image);
} else {
Toast.makeText(this, "你拒绝了该权限,无法保存图片!", Toast.LENGTH_SHORT).show();
}
}
}
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pretty_paper);
relative_main =findViewById(R.id.paper_main);
init();
text_set = findViewById(R.id.text_set);
wallpaperManager = WallpaperManager.getInstance(this);
paper_image = findViewById(R.id.paper_image);
image_down = findViewById(R.id.image_down);
image_share = findViewById(R.id.image_share);
imageView_back = findViewById(R.id.paper_back);
image_hert = findViewById(R.id.image_heart);
image_hert.setBackgroundResource(R.drawable.unselect_like);
gotoGetData();
image_hert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!islike1) {
image_hert.setBackgroundResource(R.drawable.unselect_like);
islike1 = true;
mytool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().deletelike(image);
}
});
} else {
image_hert.setBackgroundResource(R.drawable.select_like);
islike1 = false;
PrettyPaperEntity prettyPaperEntity = new PrettyPaperEntity();
prettyPaperEntity.setPaperlike(like);
prettyPaperEntity.setImage(image);
mytool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().insertLikeData(prettyPaperEntity);
}
});
//Toast.makeText(PrettyPaperActivity.this,getString(R.string.like_success),Toast.LENGTH_LONG).show();
}
}
});
image_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(PrettyPaperActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(PrettyPaperActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
} else {
//保存图片到相册
downPreview(image);
}
}
});
text_set.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showad();
}
});
image_share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
shareImage();
}
});
imageView_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private void showad() {
AdManager.showAD(PrettyPaperActivity.this, new Function1<Integer, Unit>() {
@Override
public Unit invoke(Integer integer) {
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
Toast.makeText(PrettyPaperActivity.this, getString(R.string.set_wait), Toast.LENGTH_SHORT).show();
if (image != null) {
loadPreview(image);
} else {
Toast.makeText(PrettyPaperActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
return null;
}
});
}
private void loadPreview(String image) {
Glide.with(this)
.asBitmap()
.load(image)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
setPhoneWallpaper(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
private void downPreview(String preURl) {
Glide.with(this)
.asBitmap()
.load(preURl)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
SaveImage(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
private void setPhoneWallpaper(Bitmap bitmap) {
try {
wallpaperManager.setBitmap(bitmap);
Toast.makeText(this, getString(R.string.set_success), Toast.LENGTH_SHORT).show();
} catch (IOException ioException) {
Toast.makeText(this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
private void gotoGetData() {
Intent intent = getIntent();
image = intent.getStringExtra(MyValues.PAPER_IMAGE);
mytool.runIO(new Runnable() {
@Override
public void run() {
LIST = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().queryimage(image);
if (LIST.isEmpty()) {
} else {
image_hert.setBackgroundResource(R.drawable.select_like);
islike1 = true;
}
}
});
Glide.with(this).load(image).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) {
return false;
}
}).into(paper_image);
}
private void init() {
Window window = getWindow();
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
relative_main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
}
public void shareImage(){
Intent sharedIntent = new Intent();
sharedIntent.setAction(Intent.ACTION_SEND);
sharedIntent.setType("text/*");
sharedIntent.putExtra(Intent.EXTRA_TEXT,image); //设置要分享的内容
startActivity(Intent.createChooser(sharedIntent, "Share"));
}
private void SaveImage(Bitmap bitmap) {
new Thread(new Runnable() {
@Override
public void run() {
try {
Uri saveUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues());
if (TextUtils.isEmpty(saveUri.toString())) {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Looper.loop();
return;
}
OutputStream outputStream = getContentResolver().openOutputStream(saveUri);
if (bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream)) {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Looper.loop();
} else {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
Looper.loop();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}

View File

@ -0,0 +1,53 @@
package com.example.prettywallpapers.base;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class MySpace extends RecyclerView.ItemDecoration {
private int ex_space = 0;
private int h_space = 0;
private int v_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);//每个item的跨度大小
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 MySpace(int ex_space, int h_space, int v_space) {
this.ex_space = ex_space;
this.h_space = h_space;
this.v_space = v_space;
}
}

View File

@ -0,0 +1,75 @@
package com.example.prettywallpapers.base;
import android.app.Application;
import android.util.Log;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.example.prettywallpapers.list.PrettyCategory;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.toponad.AdManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Set;
public class PrettyWallPaper extends Application {
private static List<PrettyCategory> prettyCategories;
public static String TAG = "-----AD";
private String AppId = "h66a246bc81483";
private String AppKey = "aa66c6b36a70016db7e34aae6bce0f9bd";
@Override
public void onCreate() {
super.onCreate();
MyValues.prettyWallPaper = this;
initad();
try {
InputStream myfile = getAssets().open("prank_wallpaer.json");
String mypapers = Readmyfile.getCovertStr(myfile);
if(mypapers != null){
Gson gson = new Gson();
prettyCategories = gson.fromJson(mypapers,new TypeToken<List<PrettyCategory>>(){}.getType());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void initad() {
ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
@Override
public void onResultCallback(boolean isEU) {
Log.e(TAG, "onResultCallback:" + isEU);
if (isEU && ATSDK.getGDPRDataLevel(PrettyWallPaper.this) == ATSDK.UNKNOWN) {
ATSDK.showGdprAuth(MyValues.prettyWallPaper);
}
}
@Override
public void onErrorCallback(String errorMsg) {
Log.e(TAG, "onErrorCallback:" + errorMsg);
}
});
ATSDK.init( this, AppId, AppKey);
AdManager.loadAllAd();
}
public static List<PrettyCategory> getCategorylist(){
if (prettyCategories != null){
return prettyCategories;
}else {
return prettyCategories;
}
}
}

View File

@ -0,0 +1,33 @@
package com.example.prettywallpapers.base;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
public class Readmyfile {
public static String getCovertStr(InputStream stream) {
String covertStr = "";
try {
StringWriter writer = new StringWriter();
char[] buffer = new char[stream.available()];
Reader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
int a = 0;
while ((a = reader.read(buffer)) != -1) {
writer.write(buffer, 0, a);
}
covertStr = writer.toString();
} catch (IOException e) {
return covertStr;
}
return covertStr;
}
/* public static int dp2Px(int dp) {
float scale = Sounds.mAppContext.getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}*/
}

View File

@ -0,0 +1,89 @@
package com.example.prettywallpapers.fragment;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.base.PrettyWallPaper;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;
import com.youth.banner.Banner;
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.util.ArrayList;
import java.util.List;
public class HomeFragment extends Fragment {
private RecyclerView recyclerView_prettywall;
private Banner banner;
private List<PrettyPaper> prettyPapers;
private SwitchType switchintent;
List<String> stringList = new ArrayList<>();
@SuppressLint("MissingInflatedId")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home, container, false);
banner = view.findViewById(R.id.banner);
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/148499404d85516a86eeb5c2c30fafbd.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/989ccbceb5d165cc4b44ced23af4d5fb.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/b655bc8400774e2dc940b5a8291e2ca5.jpeg");
banner.setAdapter(new BannerImageAdapter<String>(stringList) {
@Override
public void onBindView(BannerImageHolder holder, String data, int position, int size) {
Glide.with(holder.itemView).load(data).apply(RequestOptions.bitmapTransform(new RoundedCorners(30))).into(holder.imageView);
}
});
banner.setOnBannerListener(new OnBannerListener() {
@Override
public void OnBannerClick(Object data, int position) {
//Log.d("-----data","------data"+data);
Intent intent = new Intent(getActivity(), PrettyPaperActivity.class);
//intent.putExtra(MyValues.TYPE,"1");
//Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
intent.putExtra(MyValues.PAPER_IMAGE,String.valueOf(data));
Log.d("-----data","------data"+String.valueOf(data));
startActivity(intent);
}
});
banner.setIndicator(new CircleIndicator(getActivity()));
recyclerView_prettywall = view.findViewById(R.id.recyclerview_pretty);
setPrettyWallpaper();
return view;
}
private void setPrettyWallpaper() {
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),1);
recyclerView_prettywall.setLayoutManager(gridLayoutManager);
WallpaperAdapter wallpaperAdapter = new WallpaperAdapter(PrettyWallPaper.getCategorylist(),getActivity());
recyclerView_prettywall.setAdapter(wallpaperAdapter);
}
}

View File

@ -0,0 +1,81 @@
package com.example.prettywallpapers.fragment;
import android.annotation.SuppressLint;
import android.graphics.Typeface;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
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 com.example.prettywallpapers.R;
import com.example.prettywallpapers.prettyadapter.LIkePaperAdapter;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import java.util.ArrayList;
import java.util.List;
public class LikeFragment extends Fragment {
//private PaperVM paperVM;
private RecyclerView like_recycle;
private TextView text_id;
private ImageView like_back;
private LIkePaperAdapter lIkePaperAdapter;
private boolean islike = true;
private List<PrettyPaperEntity> list = new ArrayList<>();
@SuppressLint("MissingInflatedId")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
Log.d("----0,","----------+onCreateView");
View view = inflater.inflate(R.layout.fragment_like, container, false);
like_recycle = view.findViewById(R.id.like_recycle);
text_id = view.findViewById(R.id.text_id);
text_id.setTypeface(Typeface.createFromAsset(getActivity().getAssets(),"myfront.ttf"));
/*Bundle bundle = new Bundle();
bundle.putBoolean(MyValues.fragment_type, like);
this.setArguments(bundle);*/
setRecycleLike();
return view;
}
private void setRecycleLike() {
mytool.runIO(new Runnable() {
@Override
public void run() {
list = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().getAllUsers();
requireActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
LIkePaperAdapter lIkePaperAdapter = new LIkePaperAdapter(requireContext(), list);
Log.d("----------adapter","_____apapet"+lIkePaperAdapter);
like_recycle.setAdapter(lIkePaperAdapter);
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(),2);
like_recycle.setLayoutManager(gridLayoutManager);
}
});
}
});
}
@Override
public void onResume() {
super.onResume();
setRecycleLike();
Log.d("----0,","----------+onResume");
}
}

View File

@ -0,0 +1,25 @@
package com.example.prettywallpapers.list;
import java.io.Serializable;
import java.util.List;
public class PrettyCategory implements Serializable {
private String name;
private List<PrettyPaper> list;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<PrettyPaper> getList() {
return list;
}
public void setList(List<PrettyPaper> list) {
this.list = list;
}
}

View File

@ -0,0 +1,33 @@
package com.example.prettywallpapers.list;
import java.io.Serializable;
public class PrettyPaper implements Serializable {
private String sourceUrl;
private String preUrl;
private boolean islike=false;
public boolean getIslike() {
return islike;
}
public void setIslike(boolean islike) {
this.islike = islike;
}
public String getSourceUrl() {
return sourceUrl;
}
public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public String getPreUrl() {
return preUrl;
}
public void setPreUrl(String preUrl) {
this.preUrl = preUrl;
}
}

View File

@ -0,0 +1,11 @@
package com.example.prettywallpapers.listener;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import java.util.List;
public interface QueryPaperListener {
void onQueryResult(List<PrettyPaperEntity> list);
}

View File

@ -0,0 +1,7 @@
package com.example.prettywallpapers.listener;
public interface SwitchType {
public default String switchtype(String i){
return i;
}
}

View File

@ -0,0 +1,16 @@
package com.example.prettywallpapers.myvalue;
import com.example.prettywallpapers.base.PrettyWallPaper;
public class MyValues {
public static final String IMAGE = "image";
public static final String PREETY_NAME = "pretty_name";
public static String TYPE = "type";
public static String mylike;
public static final String PAPER_IMAGE = "paper image";
public static final String pre_image = "image";
public static final String TABLE_NAME = "table_name";
public static PrettyWallPaper prettyWallPaper;
public static final String DB_NAME="paper_name";
public static final String banner_image = "image";
}

View File

@ -0,0 +1,31 @@
package com.example.prettywallpapers.prettyadapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.example.prettywallpapers.fragment.HomeFragment;
import com.example.prettywallpapers.fragment.LikeFragment;
public class FragmentAdapter extends FragmentStateAdapter {
public FragmentAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fragmentActivity);
}
@NonNull
@Override
public Fragment createFragment(int position) {
switch (position){
case 0:
return new HomeFragment();
default:
return new LikeFragment();
}
}
@Override
public int getItemCount() {
return 2;
}
}

View File

@ -0,0 +1,87 @@
package com.example.prettywallpapers.prettyadapter;
import static com.example.prettywallpapers.myvalue.MyValues.*;
import android.content.Context;
import android.content.Intent;
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 androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
import java.util.List;
public class InfoAdapter extends RecyclerView.Adapter<InfoViewHolder> {
private List<PrettyPaper> prettyPapers;
private Context context;
private SwitchType switchintent;
public InfoAdapter(List<PrettyPaper> paperList, Context mycontext){
prettyPapers = paperList;
context = mycontext;
}
@NonNull
@Override
public InfoViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View myview = LayoutInflater.from(context).inflate(R.layout.pretty_category_image,parent,false);
return new InfoViewHolder(myview);
}
@Override
public void onBindViewHolder(@NonNull InfoViewHolder holder, int position) {
PrettyPaper prettyPaper = prettyPapers.get(position);
ImageView imageView = holder.getImageView();
//Log.e("----------paper","-----------paper"+prettyPaper.getSourceUrl());
Glide.with(context)
.load(prettyPaper.getSourceUrl())
.error(R.mipmap.sit)
.transform(new RoundedCorners(100))
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
//Log.e("-----paper", "onLoadFailed-----------------categorylist.getCategoryUrl()=---"+prettyPaper.getSourceUrl()+"---------e="+e.getMessage());
return false;
}
@Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
return false;
}
})
.into(imageView);
holder.getImage_layout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, PrettyPaperActivity.class);
//intent.putExtra(MyValues.TYPE,"2");
//Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaper.getSourceUrl());
Log.d("-----MyValues.paper","------MyValues.TYPE"+MyValues.PAPER_IMAGE);
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return prettyPapers.size();
}
}

View File

@ -0,0 +1,41 @@
package com.example.prettywallpapers.prettyadapter;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.R;
import java.io.Serializable;
public class InfoViewHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private LinearLayout image_layout;
public InfoViewHolder(View myview) {
super(myview);
imageView = myview.findViewById(R.id.recycle_image);
image_layout = myview.findViewById(R.id.recycle_image_lay);
}
public ImageView getImageView() {
return imageView;
}
public void setImageView(ImageView imageView) {
this.imageView = imageView;
}
public LinearLayout getImage_layout() {
return image_layout;
}
public void setImage_layout(LinearLayout image_layout) {
this.image_layout = image_layout;
}
}

View File

@ -0,0 +1,100 @@
package com.example.prettywallpapers.prettyadapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import java.util.List;
public class LIkePaperAdapter extends RecyclerView.Adapter<LikeHolder> {
private List<PrettyPaperEntity> paperEntities ;
private Context mycontext;
private boolean mylike;
public LIkePaperAdapter(Context context,List<PrettyPaperEntity> entities){
mycontext = context;
paperEntities = entities;
}
@NonNull
@Override
public LikeHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mycontext).inflate(R.layout.like_recycle,parent,false);
return new LikeHolder(view);
}
@Override
public void onBindViewHolder(@NonNull LikeHolder holder, @SuppressLint("RecyclerView") int position) {
PrettyPaperEntity prettyPaperEntities = paperEntities.get(position);
Log.d("------------entity","---------entity"+paperEntities.size());
//ImageView imageView = holder.getImageView();
Glide.with(mycontext).load(prettyPaperEntities.getImage())
.transform(new RoundedCorners(90))
.listener(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) {
return false;
}
}).into(holder.getImageView());
holder.getImageView_like().setBackgroundResource(R.drawable.select_like);
holder.getImageView_like().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
paperEntities.remove(prettyPaperEntities);
notifyItemRemoved(position);
mytool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().delete(prettyPaperEntities);
//PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(prettyPaperEntities);
// Log.d("---entities","-----entities"+entities.size());
//Toast.makeText(PrettyPaperActivity.this,"succes",Toast.LENGTH_LONG).show();
}
});
//mytool.updateRoom(prettyPaperEntities);
}
});
holder.getImageView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mycontext, PrettyPaperActivity.class);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaperEntities.getImage());
mycontext.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return paperEntities.size();
}
}

View File

@ -0,0 +1,35 @@
package com.example.prettywallpapers.prettyadapter;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.R;
public class LikeHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private ImageView imageView_like;
public LikeHolder(@NonNull View mview) {
super(mview);
imageView = mview.findViewById(R.id.like_paper_recycle_image);
imageView_like =mview.findViewById(R.id.recycle_like);
}
public ImageView getImageView() {
return imageView;
}
public void setImageView(ImageView imageView) {
this.imageView = imageView;
}
public ImageView getImageView_like() {
return imageView_like;
}
public void setImageView_like(ImageView imageView_like) {
this.imageView_like = imageView_like;
}
}

View File

@ -0,0 +1,77 @@
package com.example.prettywallpapers.prettyadapter;
import android.content.Context;
import android.content.Intent;
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 androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.myvalue.MyValues;
import java.util.List;
public class SeeAllInFoAdapter extends RecyclerView.Adapter<SeeAllInFoViewHolder> {
private List<PrettyPaper> prettyPapers;
private Context context;
public SeeAllInFoAdapter(List<PrettyPaper> paperList, Context mycontext){
prettyPapers = paperList;
context = mycontext;
}
@NonNull
@Override
public SeeAllInFoViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.name_list_recycle,parent,false);
return new SeeAllInFoViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull SeeAllInFoViewHolder holder, int position) {
PrettyPaper prettyPaper = prettyPapers.get(position);
ImageView imageView = holder.getImageView();
Glide.with(context).load(prettyPaper.getSourceUrl())
.error(R.mipmap.sit)
.transform(new RoundedCorners(70))
.listener(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) {
return false;
}
}).into(imageView);
holder.getImage_layout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, PrettyPaperActivity.class);
// intent.putExtra(MyValues.TYPE,"2");
// Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaper.getSourceUrl());
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return prettyPapers.size();
}
}

View File

@ -0,0 +1,38 @@
package com.example.prettywallpapers.prettyadapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.R;
public class SeeAllInFoViewHolder extends RecyclerView.ViewHolder {
private ImageView imageView;
private LinearLayout image_layout;
public SeeAllInFoViewHolder(@NonNull View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.recycle_image);
image_layout = itemView.findViewById(R.id.recycle_image_lay);
}
public ImageView getImageView() {
return imageView;
}
public void setImageView(ImageView imageView) {
this.imageView = imageView;
}
public LinearLayout getImage_layout() {
return image_layout;
}
public void setImage_layout(LinearLayout image_layout) {
this.image_layout = image_layout;
}
}

View File

@ -0,0 +1,37 @@
package com.example.prettywallpapers.prettyadapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
public class ViewPaperAdapter extends FragmentPagerAdapter {
private List<Fragment> fragmentList;
private String[] tablename;
public ViewPaperAdapter(@NonNull FragmentManager fm, List<Fragment> list,String[] tabletitle) {
super(fm);
fragmentList = list;
tablename = tabletitle;
}
@NonNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return tablename[position];
}
}

View File

@ -0,0 +1,42 @@
package com.example.prettywallpapers.prettyadapter;
import android.graphics.Typeface;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.R;
public class WallPaperViewHolder extends RecyclerView.ViewHolder {
private TextView textView;
private TextView see_all;
private RecyclerView recyclerView_image;
public WallPaperViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.pretty_category_name);
recyclerView_image = itemView.findViewById(R.id.pretty_category_image);
see_all = itemView.findViewById(R.id.see_all);
}
public TextView getTextView() {
return textView;
}
public TextView getSee_all() {
return see_all;
}
public RecyclerView getRecyclerView_image() {
return recyclerView_image;
}
public void setTextView(TextView textView) {
this.textView = textView;
}
}

View File

@ -0,0 +1,69 @@
package com.example.prettywallpapers.prettyadapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.prettywallpapers.activity.PrettyCategoryListActivity;
import com.example.prettywallpapers.list.PrettyCategory;
import java.util.List;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.myvalue.MyValues;
public class WallpaperAdapter extends RecyclerView.Adapter<WallPaperViewHolder> {
private List<PrettyCategory> prettyCategory;
private Context context;
private RecyclerView pretty_category_image;
private TextView see_all;
public WallpaperAdapter(List<PrettyCategory> categorylist, Context mycontext){
prettyCategory = categorylist;
Log.d("------------size","-------------size"+prettyCategory);
context = mycontext;
}
@SuppressLint("MissingInflatedId")
@NonNull
@Override
public WallPaperViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View myview = LayoutInflater.from(context).inflate(R.layout.recyclerview_pretty,parent,false);
return new WallPaperViewHolder(myview);
}
@SuppressLint("CheckResult")
@Override
public void onBindViewHolder(@NonNull WallPaperViewHolder holder, int position) {
PrettyCategory prettycategory = prettyCategory.get(position);
// Log.d("------------size","-------------size"+prettycategory);
holder.getTextView().setText(prettycategory.getName());
holder.getSee_all().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, PrettyCategoryListActivity.class);
intent.putExtra(MyValues.PREETY_NAME, prettycategory);
//intent.putExtra(MyValues.TYPE,1);
context.startActivity(intent);
}
});
InfoAdapter infoAdapter = new InfoAdapter(prettycategory.getList(),context);
RecyclerView recyclerViewImage = holder.getRecyclerView_image();
recyclerViewImage.setLayoutManager(new LinearLayoutManager(context, RecyclerView.HORIZONTAL, false));
recyclerViewImage.setAdapter(infoAdapter);
}
@Override
public int getItemCount() {
return prettyCategory.size();
}
}

View File

@ -0,0 +1,32 @@
package com.example.prettywallpapers.room;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@Dao
public interface PrettyPaperDao {
@Query("select * from table_name where likeid=:likeid")
PrettyPaperEntity QueryLikeId(String likeid);
@Update
void UpdateLikePaper(PrettyPaperEntity prettyPaperEntity);
@Query("SELECT * FROM table_name")
List<PrettyPaperEntity> getAllUsers();
@Insert(onConflict = OnConflictStrategy.IGNORE)
void insertLikeData(PrettyPaperEntity prettyPaperEntity);
@Query("select * from table_name where paperlike=:isLike")
List<PrettyPaperEntity> queryData(boolean isLike);
@Delete()
void delete(PrettyPaperEntity prettyPaperEntity);
@Query("select * from table_name where image=:image")
List<PrettyPaperEntity> queryimage(String image);
@Query("delete from table_name where image=:image")
void deletelike(String image);
}

View File

@ -0,0 +1,26 @@
package com.example.prettywallpapers.room;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import com.example.prettywallpapers.myvalue.MyValues;
@Database(
entities = {PrettyPaperEntity.class},
version = 1,
exportSchema = false
)
public abstract class PrettyPaperDatabase extends RoomDatabase {
private static PrettyPaperDatabase prettyPaperDatabase;
public abstract PrettyPaperDao getPrettyPaperDao();
public static synchronized PrettyPaperDatabase getPrettyPaperDatabase(){
if(prettyPaperDatabase == null){
prettyPaperDatabase = Room.databaseBuilder(MyValues.prettyWallPaper,PrettyPaperDatabase.class,MyValues.DB_NAME).build();
}
return prettyPaperDatabase;
}
}

View File

@ -0,0 +1,41 @@
package com.example.prettywallpapers.room;
import androidx.room.Entity;
import androidx.room.Index;
import androidx.room.PrimaryKey;
import com.example.prettywallpapers.myvalue.MyValues;
@Entity(tableName = MyValues.TABLE_NAME,indices = {@Index(value = "image",unique = true)})
public class PrettyPaperEntity {
@PrimaryKey(autoGenerate = true)
private int likeid;
private Boolean paperlike;
private String image;
public int getLikeid() {
return likeid;
}
public void setLikeid(int likeid) {
this.likeid = likeid;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Boolean getPaperlike() {
return paperlike;
}
public void setPaperlike(Boolean paperlike) {
this.paperlike = paperlike;
}
}

View File

@ -0,0 +1,66 @@
package com.example.prettywallpapers.room;
import android.os.Handler;
import android.os.Looper;
import com.example.prettywallpapers.listener.QueryPaperListener;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class mytool {
private static ExecutorService executorService;
private static Handler mainHandler;//处理线程通信和消息分发的重要工具
public static void runIO(Runnable task) {
getExecutorService().execute(task);
}
private static ExecutorService getExecutorService() {
if (executorService == null) {
executorService = Executors.newSingleThreadExecutor();
}
return executorService;
}
private static Handler getMainHandler() {
if (mainHandler == null) {
mainHandler = new Handler(Looper.getMainLooper());
}
return mainHandler;
}
public static void insertRoom(List<PrettyPaperEntity> list) {
getExecutorService().execute(new Runnable() {
@Override
public void run() {
for (PrettyPaperEntity entityApp : list) {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().insertLikeData(entityApp);
}
}
});
}
/* public static void queryRoom(boolean islike, QueryPaperListener listener) {
executorService.execute(new Runnable() {
@Override
public void run() {
List<PrettyPaperEntity> list = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().queryData(islike);
*//*post() 方法将一个 Runnable 对象添加到主线程的消息队列中以便在主线程上执行
->{}是匿名发送一个任务到主线程中*//*
getMainHandler().post(() -> { //getMainHandler()是获取主线程的handler方法handler是处理线程间通信的机制允许将任务发送到其他线程的消息队列中
listener.onQueryResult(list);//在任务执行时会调用listener.onQueryResult(appList)方法
});
}
});
}*/
public static void updateRoom(PrettyPaperEntity entity) {
executorService.execute(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(entity);
}
});
}
}

View File

@ -0,0 +1,9 @@
package com.example.prettywallpapers.toponad
interface AdListener {
fun showSuccess()
fun showFail()
fun showClose()
}

View File

@ -0,0 +1,174 @@
package com.example.prettywallpapers.toponad
import android.app.Activity
import android.os.CountDownTimer
import android.util.Log
import com.anythink.core.api.ATAdInfo
import com.anythink.core.api.AdError
import com.anythink.interstitial.api.ATInterstitial
import com.anythink.interstitial.api.ATInterstitialListener
import com.example.prettywallpapers.base.PrettyWallPaper
import com.example.prettywallpapers.myvalue.MyValues
object AdManager {
const val type_no_cache = 0
const val type_has_cache = 1
const val type_show_success = 2
const val type_show_close = 3
const val type_show_fail = 4
const val place1Id = "n66a247222a867"
const val place2Id = "n66a24721a7080"
const val place3Id = "n66a247212ee08"
val list = mutableListOf<ATInterstitial>()
@JvmStatic
fun loadAllAd() {
if (list.size <= 0) {
val mInterstitialAd1 = ATInterstitial(MyValues.prettyWallPaper, place1Id)
val mInterstitialAd2 = ATInterstitial(MyValues.prettyWallPaper, place2Id)
val mInterstitialAd3 = ATInterstitial(MyValues.prettyWallPaper, place3Id)
list.add(mInterstitialAd1)
list.add(mInterstitialAd2)
list.add(mInterstitialAd3)
}
for (ad in list) {
if (!ad.isAdReady) {
setCallBack(ad,object :AdListener{
override fun showSuccess() {
}
override fun showFail() {
}
override fun showClose() {
}
})
ad.load()
}
}
}
@JvmStatic
fun getReadyAd(): ATInterstitial? {
list.shuffle()
for (ad in list) {
if (ad.isAdReady) {
return ad
}
}
return null
}
@JvmStatic
fun showWelcomeAd(activity: Activity,totalTim: Long, goMain: () -> Unit): CountDownTimer {
var alreadyShow = false
var timer = object : CountDownTimer(totalTim, 100) {
override fun onTick(millisUntilFinished: Long) {
if (!alreadyShow) {
showAD(activity) {
if (it == type_has_cache) {
alreadyShow = true
}
if (it == type_show_close || it == type_show_fail) {
goMain.invoke()
}
}
}
}
override fun onFinish() {
if (!alreadyShow) {
showAD(activity) {
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
goMain.invoke()
}
}
}
}
}
return timer
}
private fun setCallBack(ad: ATInterstitial, listener: AdListener) {
ad.setAdListener(object : ATInterstitialListener {
override fun onInterstitialAdLoaded() {
Log.d(PrettyWallPaper.TAG, "LoadLoaded ${ad.mPlacementId}")
}
override fun onInterstitialAdLoadFail(p0: AdError?) {
Log.d(PrettyWallPaper.TAG, "LoadFail:${p0?.code} ${p0?.desc}")
}
override fun onInterstitialAdClicked(p0: ATAdInfo?) {
}
override fun onInterstitialAdShow(p0: ATAdInfo?) {
Log.d(PrettyWallPaper.TAG, "AdShow ${p0?.showId} ")
listener.showSuccess()
ad.load()
}
override fun onInterstitialAdClose(p0: ATAdInfo?) {
listener.showClose()
}
override fun onInterstitialAdVideoStart(p0: ATAdInfo?) {
}
override fun onInterstitialAdVideoEnd(p0: ATAdInfo?) {
}
override fun onInterstitialAdVideoError(p0: AdError?) {
listener.showFail()
}
})
}
@JvmStatic
fun showAD(activity: Activity, action: (type: Int) -> Unit) {
val readyAd = getReadyAd()
if (readyAd!= null) {
Log.d(PrettyWallPaper.TAG, "readyAd ${readyAd.mPlacementId} ")
action.invoke(type_has_cache)
setCallBack(readyAd,object : AdListener {
override fun showSuccess() {
action.invoke(type_show_success)
}
override fun showFail() {
action.invoke(type_show_fail)
}
override fun showClose() {
action.invoke(type_show_close)
}
})
readyAd.show(activity)
} else {
action.invoke(type_no_cache)
}
}
}

View File

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

View 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,16.002V18C3,19.657 4.343,21 6,21H18C19.657,21 21,19.657 21,18V16"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
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="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M11.996,3V16"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
</vector>

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

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

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="32dp"
android:height="32dp"
android:viewportWidth="32"
android:viewportHeight="32"
>
<group>
<clip-path
android:pathData="M16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16C0 7.16344 7.16344 0 16 0Z"
/>
<path
android:pathData="M0 0V32H32V0"
android:fillColor="#33FFFFFF"
/>
</group>
</vector>

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="159.5dp"
android:height="40dp"
android:viewportWidth="159.5"
android:viewportHeight="40"
>
<group>
<clip-path
android:pathData="M0 0H159.5V40H0V0Z"
/>
<path
android:pathData="M0 0V40H159.5V0"
android:fillColor="#CCFFFFFF"
/>
</group>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M7.5,4C4.462,4 2,6.462 2,9.5C2,15 8.5,20 12,21.163C15.5,20 22,15 22,9.5C22,6.462 19.538,4 16.5,4C14.64,4 12.995,4.923 12,6.337C11.005,4.923 9.36,4 7.5,4Z"
android:fillColor="#FF4D4D"/>
</vector>

View File

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

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="200dp"
android:height="48dp"
android:viewportWidth="200"
android:viewportHeight="48"
>
<group>
<clip-path
android:pathData="M24 0H176C189.255 0 200 10.7452 200 24C200 37.2548 189.255 48 176 48H24C10.7452 48 0 37.2548 0 24C0 10.7452 10.7452 0 24 0Z"
/>
<path
android:pathData="M0 0V48H200V0"
android:fillColor="#2A2D37"
/>
</group>
</vector>

View File

@ -0,0 +1,18 @@
<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="M4,12.161C4,12.973 4.323,13.752 4.897,14.327C5.471,14.901 6.25,15.224 7.063,15.224C7.875,15.224 8.654,14.901 9.228,14.327C9.802,13.752 10.125,12.973 10.125,12.161C10.125,11.349 9.802,10.57 9.228,9.996C8.654,9.421 7.875,9.099 7.063,9.099C6.25,9.099 5.471,9.421 4.897,9.996C4.323,10.57 4,11.349 4,12.161Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M13.668,18.286C13.668,18.918 13.919,19.524 14.366,19.972C14.813,20.419 15.42,20.67 16.052,20.67C16.684,20.67 17.291,20.419 17.738,19.972C18.185,19.524 18.436,18.918 18.436,18.286C18.436,17.653 18.185,17.047 17.738,16.6C17.291,16.153 16.684,15.901 16.052,15.901C15.42,15.901 14.813,16.153 14.366,16.6C13.919,17.047 13.668,17.653 13.668,18.286Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M15.231,5.713C15.231,6.346 15.483,6.952 15.93,7.399C16.377,7.847 16.983,8.098 17.616,8.098C18.248,8.098 18.855,7.847 19.302,7.399C19.749,6.952 20,6.346 20,5.713C20,5.081 19.749,4.475 19.302,4.027C18.855,3.58 18.248,3.329 17.616,3.329C16.983,3.329 16.377,3.58 15.93,4.027C15.483,4.475 15.231,5.081 15.231,5.713Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M8.112,14.417L8.793,13.238L15.374,17.037L14.693,18.217L8.112,14.417ZM8.298,10.434L15.718,6.149L16.4,7.329L8.979,11.614L8.298,10.434Z"
android:fillColor="#ffffff"/>
</vector>

View File

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

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="77dp"
android:height="29dp"
android:viewportWidth="77"
android:viewportHeight="29"
>
<group>
<clip-path
android:pathData="M14.5 0H62.5C70.5081 0 77 6.49187 77 14.5C77 22.5081 70.5081 29 62.5 29H14.5C6.49187 29 0 22.5081 0 14.5C0 6.49187 6.49187 0 14.5 0Z"
/>
<path
android:pathData="M0 0V29H77V0"
android:fillColor="#FFFFFF"
/>
</group>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="25"
android:viewportHeight="24">
<path
android:pathData="M8,4C4.962,4 2.5,6.462 2.5,9.5C2.5,15 9,20 12.5,21.163C16,20 22.5,15 22.5,9.5C22.5,6.462 20.038,4 17,4C15.14,4 13.495,4.923 12.5,6.337C11.505,4.923 9.86,4 8,4Z"
android:fillColor="#ffffff"
/>
</vector>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.IntoActivity">
<ImageView
android:id="@+id/pretty_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/pretty_logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="200dp"/>
<TextView
android:id="@+id/pretty_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="@color/black"
android:layout_below="@+id/pretty_logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:textSize="24sp"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/pretty_text"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"/>
</RelativeLayout>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.MainActivity">
<LinearLayout
android:id="@+id/main_top"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/top_lay"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/pretty_main"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="10dp"
app:srcCompat="@mipmap/pretty_logo" />
<TextView
android:id="@+id/textview_softlock"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginStart="60dp"
android:text="@string/app_name"
android:gravity="center_vertical"
android:textColor="@color/name"
android:textSize="23sp"
android:textStyle="bold|italic" />
<ImageView
android:id="@+id/image_set"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
app:srcCompat="@mipmap/hand" />
</RelativeLayout>
</LinearLayout>
<androidx.viewpager2.widget.ViewPager2
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/view_page_main"
android:layout_below="@+id/main_top"/>
<FrameLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/app_table"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
app:tabSelectedTextColor="@color/pretty_text"
app:tabIndicatorColor="@color/pretty_text"
android:background="@drawable/table_bg">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home">
</com.google.android.material.tabs.TabItem>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/like" />
</com.google.android.material.tabs.TabLayout>
</FrameLayout>
</RelativeLayout>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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/category_name_main"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PrettyCategoryListActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_marginTop="25dp"
android:layout_marginStart="20dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/pre_back"/>
<TextView
android:id="@+id/category_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="26sp"
android:textStyle="italic" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/name_list_recycle"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/paper_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PrettyPaperActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:id="@+id/paper_image"/>
<FrameLayout
android:layout_marginTop="55dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/paper_back"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@mipmap/back"/>
</FrameLayout>
<FrameLayout
android:layout_width="32dp"
android:layout_height="256dp"
android:layout_marginTop="438dp"
android:layout_marginStart="319dp"
android:layout_centerVertical="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:background="@drawable/image_background"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image_heart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/unselect_like" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/image_down"
android:layout_marginTop="80dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/image_background"
android:src="@drawable/download"/>
<ImageView
android:id="@+id/image_share"
android:layout_marginTop="160dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/image_background"
android:src="@drawable/share"/>
</FrameLayout>
<FrameLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:paddingBottom="90dp"
android:orientation="vertical">
<TextView
android:id="@+id/text_set"
android:text="Set wallpaper"
android:textColor="@color/white"
android:gravity="center"
android:textSize="19sp"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="48dp"
android:background="@drawable/set_wall"/>
</FrameLayout>
</RelativeLayout>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.HomeFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/pretty_main"
android:orientation="vertical">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="5dp"
android:id="@+id/recyclerview_pretty"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</FrameLayout>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".fragment.LikeFragment">
<TextView
android:id="@+id/text_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/like"
android:textSize="24sp"
android:gravity="center_horizontal"
android:layout_marginTop="40dp"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/like_recycle"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:layout_height="wrap_content">
<ImageView
android:layout_width="150dp"
android:layout_height="210dp"
android:id="@+id/like_paper_recycle_image"
android:scaleType="fitXY"/>
<RelativeLayout
android:layout_width="150dp"
android:layout_marginTop="170dp"
android:gravity="center"
android:background="@drawable/like_background"
android:layout_height="40dp">
<ImageView
android:id="@+id/recycle_like"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/selector_like"
/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_marginStart="3dp"
android:id="@+id/recycle_image_lay"
android:layout_height="wrap_content">
<ImageView
android:layout_width="170dp"
android:layout_height="250dp"
android:id="@+id/recycle_image"
android:scaleType="fitXY" />
</LinearLayout>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_marginStart="20dp"
android:id="@+id/recycle_image_lay"
android:layout_height="wrap_content">
<ImageView
android:layout_width="160dp"
android:layout_height="150dp"
android:id="@+id/recycle_image"
android:scaleType="centerCrop" />
</LinearLayout>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:id="@+id/pretty_category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:textSize="20sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:background="@drawable/text_background"
android:layout_alignParentEnd="true"
android:layout_marginEnd="24dp">
<TextView
android:id="@+id/see_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/see_all_text"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingLeft="16dp"
android:textStyle="bold"
android:paddingRight="16dp"
android:textSize="14sp"
android:gravity="top"
android:textColor="@color/pretty_text" />
</LinearLayout>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/pretty_category_image"
android:layout_marginTop="10dp"
android:scaleType="fitXY" />
</LinearLayout>

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -0,0 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.PrettyWallPapers" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFF</color>
<color name="pretty_main">#ECF6FF</color>
<color name="pretty_text">#5B8BED</color>
<color name="name">#415E9A</color>
<color name="pretty_back">#91ABDF</color>
</resources>

View File

@ -0,0 +1,16 @@
<resources>
<string name="app_name">Pretty Wallpapers</string>
<string name="see_all_text">See all</string>
<string name="main_text">The beauty of minimalism at your fingertips—Minimalist Wallpaper Master, bringing elegance to your screen</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="home">Home</string>
<string name="like">Like</string>
<string name="like_success">Likes have been added</string>
<string name="like_cancle">Likes have been canceled</string>
<string name="set_wallpaper_fail">Sorry,There was a problem setting the wallpaper</string>
<string name="set_success">Successfully! Set success!</string>
<string name="set_wait">Setting wallpaper, please wait</string>
<string name="save_success">The save was successful</string>
<string name="save_fail">Sorry,Save failed</string>
</resources>

View File

@ -0,0 +1,13 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.PrettyWallPapers" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.PrettyWallPapers" parent="Base.Theme.PrettyWallPapers">
<item name="android:statusBarColor">@color/pretty_back</item>
<item name="colorOnSecondary">@color/white</item>
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
</resources>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

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

View File

@ -0,0 +1,17 @@
package com.example.prettywallpapers;
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
View File

@ -0,0 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}

21
gradle.properties Normal file
View File

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

22
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,22 @@
[versions]
agp = "8.4.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.0"
constraintlayout = "2.1.4"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
#Fri Jul 05 10:36:19 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

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

89
gradlew.bat vendored Normal file
View File

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

5
info Normal file
View File

@ -0,0 +1,5 @@
包名com.example.pretty.wallpapers.selection
应用名Pretty WallPapers
签名文件PrettyWallPapers.jks
别名PrettyWallPaperskey0
密码PrettyWallPapers

37
settings.gradle.kts Normal file
View File

@ -0,0 +1,37 @@
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
//Anythink(Core)
maven("https://jfrog.anythinktech.com/artifactory/overseas_sdk")
//Ironsource
maven("https://android-sdk.is.com/")
//Mintegral
maven("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
//Pangle
maven ( "https://artifact.bytedance.com/repository/pangle")
//TopOn集成测试工具
// maven ( "https://jfrog.anythinktech.com/artifactory/debugger")
}
}
rootProject.name = "Pretty WallPapers"
include(":app")