init
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
160
app/build.gradle.kts
Normal file
@ -0,0 +1,160 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("io.objectbox")
|
||||
kotlin("kapt")
|
||||
// id("com.google.gms.google-services")
|
||||
// id("com.google.firebase.crashlytics")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.hd.phone.fresh.walls"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.hd.phone.mico.test"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
|
||||
setProperty("archivesBaseName", "HD Wallpaper_V" + versionName + "(${versionCode})_$timestamp")
|
||||
testInstrumentationRunner = "androidx.live.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures{
|
||||
viewBinding = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.11.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||
implementation ("jp.wasabeef:glide-transformations:4.3.0") // Glide Transformations
|
||||
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||
|
||||
implementation ("com.squareup.leakcanary:leakcanary-android:2.9.1")
|
||||
|
||||
|
||||
|
||||
//------------------firebase
|
||||
// implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
|
||||
// implementation("com.google.firebase:firebase-crashlytics")
|
||||
// implementation("com.google.firebase:firebase-analytics")
|
||||
// implementation("com.google.firebase:firebase-config")
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo)
|
||||
|
||||
// //Anythink (Necessary)
|
||||
// implementation("com.anythink.sdk:core-tpn:6.4.07")
|
||||
// implementation("com.anythink.sdk:nativead-tpn:6.4.07")
|
||||
// implementation("com.anythink.sdk:banner-tpn:6.4.07")
|
||||
// implementation("com.anythink.sdk:interstitial-tpn:6.4.07")
|
||||
// implementation("com.anythink.sdk:rewardedvideo-tpn:6.4.07")
|
||||
// implementation("com.anythink.sdk:splash-tpn:6.4.07")
|
||||
//
|
||||
// //Androidx (Necessary)
|
||||
// implementation("androidx.appcompat:appcompat:1.1.0")
|
||||
// implementation("androidx.browser:browser:1.4.0")
|
||||
//
|
||||
// //StartApp
|
||||
// implementation("com.anythink.sdk:adapter-tpn-startapp:6.4.07")
|
||||
// implementation("com.startapp:inapp-sdk:5.0.2")
|
||||
//
|
||||
// //Appnext
|
||||
// implementation("com.anythink.sdk:adapter-tpn-appnext:6.4.07")
|
||||
// implementation("com.appnext.sdk:ads:2.7.1.473")
|
||||
// implementation("com.appnext.sdk:banners:2.7.1.473")
|
||||
// implementation("com.appnext.sdk:native-ads2:2.7.1.473")
|
||||
// implementation("com.appnext.sdk:actions:2.4.6.472")
|
||||
// implementation("androidx.constraintlayout:constraintlayout:2.0.4")
|
||||
//
|
||||
// //Vungle
|
||||
// implementation("com.anythink.sdk:adapter-tpn-vungle:6.4.07")
|
||||
// implementation("com.vungle:vungle-ads:7.4.0")
|
||||
// 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.4.07")
|
||||
// implementation("com.unity3d.ads:unity-ads:4.12.2")
|
||||
//
|
||||
// //Ironsource
|
||||
// implementation("com.anythink.sdk:adapter-tpn-ironsource:6.4.07")
|
||||
// implementation("com.ironsource.sdk:mediationsdk:8.2.1")
|
||||
// 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.4.07")
|
||||
// implementation("com.bigossp:bigo-ads:4.9.0")
|
||||
//
|
||||
// //Pangle
|
||||
// implementation("com.anythink.sdk:adapter-tpn-pangle-nonchina:6.4.07")
|
||||
// implementation("com.pangle.global:ads-sdk:6.1.0.9")
|
||||
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
//
|
||||
// //Inmobi
|
||||
// implementation("com.anythink.sdk:adapter-tpn-inmobi:6.4.07")
|
||||
// implementation("com.inmobi.monetization:inmobi-ads-kotlin:10.7.5")
|
||||
//
|
||||
// //Mintegral
|
||||
// implementation("com.anythink.sdk:adapter-tpn-mintegral-nonchina:6.4.07")
|
||||
// implementation("com.mbridge.msdk.oversea:reward:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:newinterstitial:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:mbnative:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:mbnativeadvanced:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:mbsplash:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:mbbanner:16.8.11")
|
||||
// implementation("com.mbridge.msdk.oversea:mbbid:16.8.11")
|
||||
// implementation("androidx.recyclerview:recyclerview:1.1.0")
|
||||
//
|
||||
// //Chartboost
|
||||
// implementation("com.anythink.sdk:adapter-tpn-chartboost:6.4.07")
|
||||
// implementation("com.chartboost:chartboost-sdk:9.7.0")
|
||||
// implementation("com.chartboost:chartboost-mediation-sdk:4.9.1")
|
||||
// implementation("com.chartboost:chartboost-mediation-adapter-chartboost:4.9.7.0.0")
|
||||
// implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
|
||||
// implementation("com.squareup.okhttp3:logging-interceptor:4.10.0")
|
||||
// implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
||||
// implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
|
||||
// implementation("com.squareup.retrofit2:retrofit:2.9.0")
|
||||
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
|
||||
// implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
|
||||
//
|
||||
// //Fyber
|
||||
// implementation("com.anythink.sdk:adapter-tpn-fyber:6.4.07")
|
||||
// implementation("com.fyber:marketplace-sdk:8.3.0")
|
||||
// implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
|
||||
//
|
||||
// // Debugger UI Tools
|
||||
// implementation ("com.anythink.sdk:debugger-ui:1.0.7")
|
||||
|
||||
}
|
||||
97
app/objectbox-models/default.json
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
|
||||
"_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
|
||||
"_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
|
||||
"entities": [
|
||||
{
|
||||
"id": "3:817335537070466014",
|
||||
"lastPropertyId": "14:3380197792593924336",
|
||||
"name": "Data",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:7567671966987007993",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:2590164264280025677",
|
||||
"name": "description",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "3:8912833100894718986",
|
||||
"name": "fullUrl",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:7138929457594592554",
|
||||
"name": "previewUrl1080",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:3957870060050722570",
|
||||
"name": "previewUrl400",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "6:2943285943884558608",
|
||||
"name": "previewUrl200",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "7:7262008615134929676",
|
||||
"name": "authorName",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "8:7105947400861196483",
|
||||
"name": "authorHeader",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "9:1954934496493857304",
|
||||
"name": "authorHtml",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "12:8582031355111471002",
|
||||
"name": "imId",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "13:8410380097928190493",
|
||||
"name": "isLike",
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"id": "14:3380197792593924336",
|
||||
"name": "isDownload",
|
||||
"type": 1
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "3:817335537070466014",
|
||||
"lastIndexId": "0:0",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
"modelVersion": 5,
|
||||
"modelVersionParserMinimum": 5,
|
||||
"retiredEntityUids": [
|
||||
8119453540460508569,
|
||||
8776066878034520742
|
||||
],
|
||||
"retiredIndexUids": [],
|
||||
"retiredPropertyUids": [
|
||||
8848640050018073106,
|
||||
4870222079156330783,
|
||||
4966768060561274983,
|
||||
8892036187720267027,
|
||||
1670319685727744805,
|
||||
3855211567189961055
|
||||
],
|
||||
"retiredRelationUids": [],
|
||||
"version": 1
|
||||
}
|
||||
154
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
# 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.hd.phone.fresh.walls.json.** { *; }
|
||||
-keep class com.google.gson.** { *; }
|
||||
-keepattributes Signature
|
||||
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------Topon
|
||||
-keep class com.startapp.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keep class com.truenet.** {
|
||||
*;
|
||||
}
|
||||
|
||||
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile,
|
||||
LineNumberTable, *Annotation*, EnclosingMethod
|
||||
-dontwarn android.webkit.JavascriptInterface
|
||||
-dontwarn com.startapp.**
|
||||
|
||||
-dontwarn org.jetbrains.annotations.**
|
||||
-keep class com.appnext.** { *; }
|
||||
-dontwarn com.appnext.**
|
||||
# Vungle
|
||||
-dontwarn com.vungle.ads.**
|
||||
-keepclassmembers class com.vungle.ads.** {
|
||||
*;
|
||||
}
|
||||
-keep 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.** { *; }
|
||||
-keep class com.inmobi.** { *; }
|
||||
-keep public class com.google.android.gms.**
|
||||
-dontwarn com.google.android.gms.**
|
||||
-dontwarn com.squareup.picasso.**
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
|
||||
public *;
|
||||
}
|
||||
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
|
||||
public *;
|
||||
}
|
||||
# skip the Picasso library classes
|
||||
-keep class com.squareup.picasso.** {*;}
|
||||
-dontwarn com.squareup.okhttp.**
|
||||
# skip Moat classes
|
||||
-keep class com.moat.** {*;}
|
||||
-dontwarn com.moat.**
|
||||
# skip IAB classes
|
||||
-keep class com.iab.** {*;}
|
||||
-dontwarn com.iab.**
|
||||
-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.*{ *; }
|
||||
-keep class com.chartboost.** { *; }
|
||||
@ -0,0 +1,26 @@
|
||||
package com.hd.phone.fresh.walls;
|
||||
|
||||
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 live, 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 live.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.hd.kwallpapers.wallpapers.live", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
41
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?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"
|
||||
android:maxSdkVersion="32" />
|
||||
|
||||
<application
|
||||
android:name=".MyWallpaper"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/logo_foreground"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/logo_foreground"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Wallpaper"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.ActivityWelcome"
|
||||
android:theme="@style/Theme.WelWallpaper"
|
||||
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=".ui.ActivitySet"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.ActivityMain"
|
||||
android:exported="false"/>
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
20702
app/src/main/assets/Animals.json
Normal file
20702
app/src/main/assets/Nature.json
Normal file
BIN
app/src/main/assets/custfont.ttf
Normal file
20702
app/src/main/assets/experimental.json
Normal file
20702
app/src/main/assets/film.json
Normal file
20702
app/src/main/assets/patterns.json
Normal file
20702
app/src/main/assets/street.json
Normal file
20702
app/src/main/assets/travel.json
Normal file
112
app/src/main/java/com/hd/phone/fresh/walls/MyWallpaper.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.hd.phone.fresh.walls;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.Log;
|
||||
|
||||
import com.hd.phone.fresh.walls.json.Category;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.utils.CommonKt;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MyWallpaper extends Application {
|
||||
public static Context mAppContext;
|
||||
|
||||
private static List<Data> natureList;
|
||||
private static List<Data> animalsList;
|
||||
|
||||
private static List<Data> experimentalList;
|
||||
private static List<Data> filmList;
|
||||
private static List<Data> patternsList;
|
||||
private static List<Data> streetList;
|
||||
|
||||
private static List<Data> travelList;
|
||||
public static String TAG = "-------MyApp---------";
|
||||
public static Typeface defaultFont;
|
||||
|
||||
// private String APPId="h673ddf8ae8467";
|
||||
// private String AppKey="a17cd7a62720b00498a8dc5c538c92303";
|
||||
// private String debug_Key="";
|
||||
|
||||
private String animasName = "Animals.json";
|
||||
private String exName = "experimental.json";
|
||||
private String filmName = "film.json";
|
||||
private String natureName = "Nature.json";
|
||||
private String pattName = "patterns.json";
|
||||
private String streetName = "street.json";
|
||||
private String travelName = "travel.json";
|
||||
private static List<Category> data = new ArrayList<>();
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mAppContext = this;
|
||||
defaultFont = Typeface.createFromAsset(getAssets(), "custfont.ttf");
|
||||
DbManager.init(this);
|
||||
String[] names = {animasName,exName,filmName,natureName,pattName,streetName,travelName};
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
for(String name:names){
|
||||
InputStream open = getAssets().open(name);
|
||||
String covertStr = CommonUtils.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
List<Data> data1 = CommonKt.INSTANCE.getData(covertStr);
|
||||
Category category = new Category();
|
||||
String realName = name.substring(0, name.indexOf("."));
|
||||
category.setClassName(realName);
|
||||
List<Data> data2 = data1.subList(0, 200);
|
||||
Collections.shuffle(data2);
|
||||
category.setDataList(data2);
|
||||
data.add(category);
|
||||
|
||||
}
|
||||
}
|
||||
Log.d(MyWallpaper.TAG,"------------data complete");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static List<Category> getData() {
|
||||
// Collections.shuffle(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// private void initTop(){
|
||||
// ATSDK.checkIsEuTraffic(this, new NetTrafficeCallback() {
|
||||
//
|
||||
// @Override
|
||||
// public void onResultCallback(boolean isEU) {
|
||||
// Log.e(TAG, "onResultCallback:" + isEU);
|
||||
// if (isEU && ATSDK.getGDPRDataLevel( MyApp.mAppContext) == ATSDK.UNKNOWN) {
|
||||
// ATSDK.showGdprAuth(MyApp.mAppContext);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onErrorCallback(String errorMsg) {
|
||||
// Log.e(TAG, "onErrorCallback:" + errorMsg);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// ATSDK.init( this, APPId, AppKey);
|
||||
// //测试工具
|
||||
//// ATDebuggerUITest.showDebuggerUI(this,debug_Key);
|
||||
// AdManager.loadAllAd();
|
||||
//
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.hd.phone.fresh.walls.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.MultiTransformation;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
|
||||
public class AdapterFavorite extends RecyclerView.Adapter<MyViewHolder> {
|
||||
|
||||
|
||||
private List<Data> dataInfo = new ArrayList<>();
|
||||
private Context myContext;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public void setInfoWallpaperListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
public AdapterFavorite(Context myCon) {
|
||||
myContext = myCon;
|
||||
}
|
||||
|
||||
public void setDataInfo(List<Data> dataInfo) {
|
||||
this.dataInfo = dataInfo;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(myContext).inflate(R.layout.item_preview, parent, false);
|
||||
return new MyViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
Data info = dataInfo.get(position);
|
||||
ImageView imageView = holder.getImageView();
|
||||
ImageView imFavorite = holder.getImFavorite();
|
||||
String previewUrl400 = info.getPreviewUrl400();
|
||||
String imId = info.getImId();
|
||||
|
||||
MultiTransformation<Bitmap> multiTransformation = new MultiTransformation<>(
|
||||
new CenterCrop(),
|
||||
new RoundedCornersTransformation(CommonUtils.dp2Px(12), 0) // 圆角效果
|
||||
);
|
||||
Glide.with(myContext)
|
||||
.load(previewUrl400)
|
||||
.placeholder(R.mipmap.im_placeholder)
|
||||
.transform(multiTransformation)
|
||||
.into(imageView);
|
||||
|
||||
imFavorite.setSelected(true);
|
||||
imFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
imFavorite.setSelected(false);
|
||||
DbManager.deleteLike(info);
|
||||
int adapterPosition = holder.getAdapterPosition();
|
||||
notifyItemRemoved(adapterPosition);
|
||||
Log.d(MyWallpaper.TAG,"----------notifyItemRemoved-adapterPosition="+adapterPosition);
|
||||
}
|
||||
});
|
||||
holder.getLayout().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (itemClickListener != null) {
|
||||
itemClickListener.onItemClickAction(info);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataInfo.size();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,238 @@
|
||||
package com.hd.phone.fresh.walls.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.MultiTransformation;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.ui.ActivitySet;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
|
||||
public class AdapterPreView extends RecyclerView.Adapter<MyViewHolder> {
|
||||
|
||||
|
||||
private List<Data> dataInfo = new ArrayList<>();
|
||||
|
||||
private ItemClickListener itemClickListener;
|
||||
private WeakReference<Context> weakReference;
|
||||
private boolean idDownload = false;
|
||||
|
||||
public void setInfoWallpaperListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
public AdapterPreView(Context myCon, boolean download) {
|
||||
weakReference = new WeakReference<>(myCon);
|
||||
idDownload = download;
|
||||
}
|
||||
|
||||
public void setDataInfo(List<Data> dataInfo) {
|
||||
this.dataInfo = dataInfo;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
Context context = weakReference.get();
|
||||
if (context != null) {
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.item_preview, parent, false);
|
||||
return new MyViewHolder(itemView);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
Data info = dataInfo.get(position);
|
||||
Log.d(MyWallpaper.TAG, "---position=" + position);
|
||||
ImageView imageView = holder.getImageView();
|
||||
String previewUrl400 = info.getPreviewUrl400();
|
||||
String previewUrl200 = info.getPreviewUrl200();
|
||||
RelativeLayout item = holder.getLayout();
|
||||
String imId = info.getImId();
|
||||
int curheight;
|
||||
|
||||
// if (position <= 1) {
|
||||
// curheight = CommonUtils.dp2Px(200);
|
||||
// } else if (position % 3 == 0) {
|
||||
// curheight = CommonUtils.dp2Px(240);
|
||||
// } else {
|
||||
// curheight = CommonUtils.dp2Px(180);
|
||||
// }
|
||||
// ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
||||
// layoutParams.height = curheight;
|
||||
// imageView.setLayoutParams(layoutParams);
|
||||
|
||||
|
||||
MultiTransformation<Bitmap> multiTransformation = new MultiTransformation<>(
|
||||
new CenterCrop(),
|
||||
new RoundedCornersTransformation(CommonUtils.dp2Px(12), 0) // 圆角效果
|
||||
);
|
||||
RequestOptions options = new RequestOptions()
|
||||
.format(DecodeFormat.PREFER_RGB_565);
|
||||
Context context = weakReference.get();
|
||||
if(context!= null){
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.skipMemoryCache(true)
|
||||
.apply(options)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.load(previewUrl200)
|
||||
.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;
|
||||
}
|
||||
})
|
||||
.placeholder(R.mipmap.im_placeholder)
|
||||
.transform(multiTransformation)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
ImageView imFavorite = holder.getImFavorite();
|
||||
if (idDownload) {
|
||||
imFavorite.setVisibility(View.GONE);
|
||||
} else {
|
||||
imFavorite.setVisibility(View.VISIBLE);
|
||||
boolean b = DbManager.queryIsLike(imId);
|
||||
imFavorite.setSelected(b);
|
||||
imFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean selected = imFavorite.isSelected();
|
||||
imFavorite.setSelected(!selected);
|
||||
|
||||
if (imFavorite.isSelected()) {
|
||||
DbManager.insertOrUpdateLike(info);
|
||||
} else {
|
||||
DbManager.deleteLike(info);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
item.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (itemClickListener != null) {
|
||||
itemClickListener.onItemClickAction(info);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataInfo.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull MyViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
Context context = weakReference.get();
|
||||
if(context!= null){
|
||||
Glide.with(context).clear(holder.getImageView());
|
||||
Log.d(MyWallpaper.TAG, "----------onViewRecycled");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 更新数据集
|
||||
// public void updateList(List<String> newList) {
|
||||
// // 计算差异
|
||||
// DiffUtil.Callback callback = new MyCallback(dataInfo, newList);
|
||||
// DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback);
|
||||
//
|
||||
// // 更新数据集
|
||||
// dataInfo = mNewList;
|
||||
// mNewList = newList;
|
||||
// result.dispatchUpdatesTo(this);
|
||||
// }
|
||||
private static DiffUtil.ItemCallback<Data> diff = new DiffUtil.ItemCallback<Data>() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull Data oldItem, @NonNull Data newItem) {
|
||||
return oldItem.getImId().equals(newItem.getImId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull Data oldItem, @NonNull Data newItem) {
|
||||
return oldItem.getImId().equals(newItem.getImId());
|
||||
}
|
||||
};
|
||||
|
||||
private static class MyCallback extends DiffUtil.Callback {
|
||||
private List<Data> mOldList;
|
||||
private List<Data> mNewList;
|
||||
|
||||
public MyCallback(List<Data> oldList, List<Data> newList) {
|
||||
mOldList = oldList;
|
||||
mNewList = newList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOldListSize() {
|
||||
return mOldList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNewListSize() {
|
||||
return mNewList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
return mOldList.get(oldItemPosition).getImId().equals(mNewList.get(newItemPosition).getImId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
return mOldList.get(oldItemPosition).getImId().equals(mNewList.get(newItemPosition).getImId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.hd.phone.fresh.walls.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
|
||||
public class MyViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
private ImageView imageView;
|
||||
private RelativeLayout layout;
|
||||
private ImageView imFavorite;
|
||||
public MyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView = itemView.findViewById(R.id.wallpaper);
|
||||
layout = itemView.findViewById(R.id.layout);
|
||||
imFavorite = itemView.findViewById(R.id.image_favorite);
|
||||
}
|
||||
|
||||
public ImageView getImFavorite() {
|
||||
return imFavorite;
|
||||
}
|
||||
|
||||
public RelativeLayout getLayout() {
|
||||
return layout;
|
||||
}
|
||||
|
||||
public ImageView getImageView() {
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
229
app/src/main/java/com/hd/phone/fresh/walls/db/DbManager.java
Normal file
@ -0,0 +1,229 @@
|
||||
package com.hd.phone.fresh.walls.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnAddListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnDownloadListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnLikeListener;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.json.Data_;
|
||||
import com.hd.phone.fresh.walls.json.MyObjectBox;
|
||||
import com.hd.phone.fresh.walls.utils.CommonKt;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.objectbox.Box;
|
||||
import io.objectbox.BoxStore;
|
||||
import io.objectbox.android.AndroidScheduler;
|
||||
import io.objectbox.query.Query;
|
||||
import io.objectbox.query.QueryBuilder;
|
||||
import io.objectbox.reactive.DataObserver;
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
import io.objectbox.reactive.DataSubscriptionList;
|
||||
|
||||
public class DbManager {
|
||||
|
||||
private static BoxStore boxStore;
|
||||
|
||||
private static Box<Data> LikeBox;
|
||||
|
||||
|
||||
private static DataSubscription observer;
|
||||
|
||||
private static List<OnAddListener> list = new ArrayList<>();
|
||||
|
||||
public static void addOnAddOrRemoveListener(OnAddListener listener) {
|
||||
list.add(listener);
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
boxStore = MyObjectBox.builder().androidContext(context).build();
|
||||
}
|
||||
|
||||
public static Box<Data> getObjectBoxLike() {
|
||||
if (LikeBox == null) {
|
||||
LikeBox = boxStore.boxFor(Data.class);
|
||||
}
|
||||
|
||||
return LikeBox;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static DataSubscription setLikeDataListener(OnLikeListener listener) {
|
||||
Query<Data> build = getObjectBoxLike().query()
|
||||
.equal(Data_.isLike, true)
|
||||
.build();
|
||||
return build.subscribe(new DataSubscriptionList())
|
||||
.on(AndroidScheduler.mainThread())
|
||||
.observer(new DataObserver<List<Data>>() {
|
||||
@Override
|
||||
public void onData(@NonNull List<Data> data) {
|
||||
Log.d(MyWallpaper.TAG, "------data=" + data.size());
|
||||
listener.onLikeList(data);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static DataSubscription setDownloadListener(OnDownloadListener listener) {
|
||||
Query<Data> build = getObjectBoxLike().query()
|
||||
.equal(Data_.isDownload, true)
|
||||
.build();
|
||||
|
||||
return build.subscribe(new DataSubscriptionList())
|
||||
.on(AndroidScheduler.mainThread())
|
||||
.observer(new DataObserver<List<Data>>() {
|
||||
@Override
|
||||
public void onData(@NonNull List<Data> data) {
|
||||
List<Data> real = new ArrayList<>();
|
||||
Log.d(MyWallpaper.TAG, "-----查询-Download data=" + data.size());
|
||||
for(Data info:data){
|
||||
String saveFilePath = CommonKt.INSTANCE.getSaveFilePath(MyWallpaper.mAppContext, info.getImId());
|
||||
File file = new File(saveFilePath);
|
||||
if(!file.exists()){
|
||||
deleteDownload(info);
|
||||
}else {
|
||||
Log.d(MyWallpaper.TAG, "-----add=" + real.size());
|
||||
real.add(info);
|
||||
}
|
||||
}
|
||||
listener.onDownloadList(real);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void insertOrUpdateLike(Data boxLike) {
|
||||
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
String imId = boxLike.getImId();
|
||||
Data first = objectBoxLike.query()
|
||||
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
Log.d(MyWallpaper.TAG, "-----------添加11 isLike=" + imId);
|
||||
boxLike.setLike(true);
|
||||
objectBoxLike.put(boxLike);
|
||||
for(OnAddListener listener:list){
|
||||
listener.onAdd(boxLike);
|
||||
}
|
||||
} else {
|
||||
if(!first.isLike()){
|
||||
first.setLike(true);
|
||||
objectBoxLike.put(first);
|
||||
for(OnAddListener listener:list){
|
||||
listener.onAdd(first);
|
||||
}
|
||||
Log.d(MyWallpaper.TAG, "-----------已经存在添加22 isLike=" + imId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void insertOrUpdateDownload(Data boxLike) {
|
||||
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
String imId = boxLike.getImId();
|
||||
Data first = objectBoxLike.query()
|
||||
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (first == null) {
|
||||
Log.d(MyWallpaper.TAG, "-----------添加11 Download=" + imId);
|
||||
boxLike.setDownload(true);
|
||||
objectBoxLike.put(boxLike);
|
||||
} else {
|
||||
first.setDownload(true);
|
||||
objectBoxLike.put(first);
|
||||
Log.d(MyWallpaper.TAG, "-----------已经存在添加22 Download=" + imId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void deleteLike(Data likeData) {
|
||||
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
String imId = likeData.getImId();
|
||||
Data boxLike = objectBoxLike.query()
|
||||
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (boxLike != null) {
|
||||
if(boxLike.isDownload()){
|
||||
boxLike.setLike(false);
|
||||
objectBoxLike.put(boxLike);
|
||||
for(OnAddListener listener:list){
|
||||
listener.onRemove(boxLike);
|
||||
}
|
||||
}else {
|
||||
objectBoxLike.remove(boxLike);
|
||||
for(OnAddListener listener:list){
|
||||
listener.onRemove(boxLike);
|
||||
}
|
||||
}
|
||||
Log.d(MyWallpaper.TAG, "--------deleteLike imId=" + imId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static void deleteDownload(Data downloadData) {
|
||||
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
String imId = downloadData.getImId();
|
||||
Data boxLike = objectBoxLike.query()
|
||||
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if (boxLike != null) {
|
||||
if(boxLike.isLike()){
|
||||
boxLike.setDownload(false);
|
||||
objectBoxLike.put(boxLike);
|
||||
}else {
|
||||
objectBoxLike.remove(boxLike);
|
||||
}
|
||||
Log.d(MyWallpaper.TAG, "--------deleteDownload imId=" + imId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static boolean queryIsLike(String imId) {
|
||||
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
Data first = objectBoxLike.query()
|
||||
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
.build()
|
||||
.findFirst();
|
||||
if(first!= null&& first.isLike()){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public static String queryIsDownload(String imId) {
|
||||
// Box<Data> objectBoxLike = getObjectBoxLike();
|
||||
// Data first = objectBoxLike.query()
|
||||
// .equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||
// .build()
|
||||
// .findFirst();
|
||||
// if (first != null) {
|
||||
// return first.getSavePath();
|
||||
// }else {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.hd.phone.fresh.walls.json;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Category {
|
||||
|
||||
private String className;
|
||||
|
||||
private List<Data> dataList;
|
||||
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public List<Data> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public void setDataList(List<Data> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
}
|
||||
149
app/src/main/java/com/hd/phone/fresh/walls/json/Data.java
Normal file
@ -0,0 +1,149 @@
|
||||
package com.hd.phone.fresh.walls.json;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.objectbox.annotation.Entity;
|
||||
import io.objectbox.annotation.Id;
|
||||
|
||||
|
||||
@Entity
|
||||
public class Data implements Serializable {
|
||||
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
private String imId;
|
||||
|
||||
private String description;
|
||||
|
||||
private String fullUrl;
|
||||
|
||||
private String previewUrl1080;
|
||||
private String previewUrl400;
|
||||
private String previewUrl200;
|
||||
|
||||
private String authorName;
|
||||
|
||||
private String authorHeader;
|
||||
|
||||
private String authorHtml;
|
||||
|
||||
private boolean isLike;
|
||||
|
||||
private boolean isDownload;
|
||||
|
||||
|
||||
public boolean isLike() {
|
||||
return isLike;
|
||||
}
|
||||
|
||||
public void setLike(boolean like) {
|
||||
isLike = like;
|
||||
}
|
||||
|
||||
public boolean isDownload() {
|
||||
return isDownload;
|
||||
}
|
||||
|
||||
public void setDownload(boolean download) {
|
||||
isDownload = download;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getImId() {
|
||||
return imId;
|
||||
}
|
||||
|
||||
public void setImId(String imId) {
|
||||
this.imId = imId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getFullUrl() {
|
||||
return fullUrl;
|
||||
}
|
||||
|
||||
public void setFullUrl(String fullUrl) {
|
||||
this.fullUrl = fullUrl;
|
||||
}
|
||||
|
||||
public String getPreviewUrl1080() {
|
||||
return previewUrl1080;
|
||||
}
|
||||
|
||||
public void setPreviewUrl1080(String previewUrl1080) {
|
||||
this.previewUrl1080 = previewUrl1080;
|
||||
}
|
||||
|
||||
public String getPreviewUrl400() {
|
||||
return previewUrl400;
|
||||
}
|
||||
|
||||
public void setPreviewUrl400(String previewUrl400) {
|
||||
this.previewUrl400 = previewUrl400;
|
||||
}
|
||||
|
||||
public String getPreviewUrl200() {
|
||||
return previewUrl200;
|
||||
}
|
||||
|
||||
public void setPreviewUrl200(String previewUrl200) {
|
||||
this.previewUrl200 = previewUrl200;
|
||||
}
|
||||
|
||||
public String getAuthorName() {
|
||||
return authorName;
|
||||
}
|
||||
|
||||
public void setAuthorName(String authorName) {
|
||||
this.authorName = authorName;
|
||||
}
|
||||
|
||||
public String getAuthorHeader() {
|
||||
return authorHeader;
|
||||
}
|
||||
|
||||
public void setAuthorHeader(String authorHeader) {
|
||||
this.authorHeader = authorHeader;
|
||||
}
|
||||
|
||||
public String getAuthorHtml() {
|
||||
return authorHtml;
|
||||
}
|
||||
|
||||
public void setAuthorHtml(String authorHtml) {
|
||||
this.authorHtml = authorHtml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
Data obj1 = (Data) obj;
|
||||
if (obj1 != null) {
|
||||
if (obj1.getImId().equals(imId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.hd.phone.fresh.walls.mylistener;
|
||||
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
public interface ItemClickListener {
|
||||
|
||||
public void onItemClickAction(Data info);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.hd.phone.fresh.walls.mylistener;
|
||||
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
public interface OnAddListener {
|
||||
void onAdd(Data data);
|
||||
void onRemove(Data data);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hd.phone.fresh.walls.mylistener;
|
||||
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OnDownloadListener {
|
||||
void onDownloadList(List<Data> dataList);
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hd.phone.fresh.walls.mylistener;
|
||||
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OnLikeListener {
|
||||
void onLikeList(List<Data> dataList);
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.hd.phone.fresh.walls.mylistener;
|
||||
|
||||
public interface TypeListener {
|
||||
|
||||
void onSelectType(int type);
|
||||
}
|
||||
104
app/src/main/java/com/hd/phone/fresh/walls/ui/ActivityMain.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.databinding.ActivityMainBinding;
|
||||
import com.hd.phone.fresh.walls.databinding.TabCustomViewBinding;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityMain extends AppCompatActivity {
|
||||
|
||||
|
||||
private ActivityMainBinding vb;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
vb = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
CommonUtils.initFull(this,false);
|
||||
setContentView(vb.getRoot());
|
||||
|
||||
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(FragmentHome.newInstance(0));
|
||||
list.add(FragmentLike.newInstance());
|
||||
// list.add(FragmentDownload.newInstance());
|
||||
|
||||
int[] ints = {R.drawable.selector_tab_home, R.drawable.selector_tab_like,R.drawable.selector_tab_download};
|
||||
vb.viewpager2.setAdapter(new FragmentStateAdapter(this) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
});
|
||||
vb.viewpager2.setUserInputEnabled(false);
|
||||
|
||||
for(int i = 0;i<list.size();i++){
|
||||
TabLayout.Tab tab = vb.tab.newTab();
|
||||
TabCustomViewBinding tabVb = TabCustomViewBinding.inflate(getLayoutInflater());
|
||||
tabVb.imageIcon.setImageDrawable(ContextCompat.getDrawable(this,ints[i]));
|
||||
tab.setCustomView(tabVb.getRoot());
|
||||
if(i ==0){
|
||||
tabVb.imageIndicator.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
tabVb.imageIndicator.setVisibility(View.GONE);
|
||||
}
|
||||
vb.tab.addTab(tab);
|
||||
}
|
||||
vb.tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
int position = tab.getPosition();
|
||||
vb.viewpager2.setCurrentItem(position);
|
||||
|
||||
View customView = tab.getCustomView();
|
||||
View imageIndicator = customView.findViewById(R.id.image_indicator);
|
||||
imageIndicator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
View imageIndicator = customView.findViewById(R.id.image_indicator);
|
||||
imageIndicator.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
/**
|
||||
* Total PSS: 144060 KB
|
||||
* 2024-12-08 21:39:03.211 30266-30266 MemoryInfo com.hd.phone.mico.test D Total Private Dirty: 121456 KB
|
||||
* 2024-12-08 21:39:03.211 30266-30266 MemoryInfo com.hd.phone.mico.test D Total Shared Dirty: 22320 KB
|
||||
*/
|
||||
CommonUtils.printUsedMemory(this);
|
||||
}
|
||||
}
|
||||
430
app/src/main/java/com/hd/phone/fresh/walls/ui/ActivitySet.java
Normal file
@ -0,0 +1,430 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
|
||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.databinding.ActivitySetBinding;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.mylistener.TypeListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonKt;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import okhttp3.Call;
|
||||
|
||||
public class ActivitySet extends AppCompatActivity implements TypeListener {
|
||||
|
||||
private WeakReference<ActivitySet> weakReference;
|
||||
private Data data;
|
||||
private WallpaperManager wallpaperManager;
|
||||
|
||||
|
||||
private ActivitySetBinding vb;
|
||||
|
||||
private Drawable fullDrawable;
|
||||
private int permissionCode = 1;
|
||||
private String mSavePath;
|
||||
private String imId;
|
||||
private String fullUrl;
|
||||
|
||||
private DialogSetType dialogSetType;
|
||||
|
||||
private File downloadFile;
|
||||
private Call call;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
vb = ActivitySetBinding.inflate(getLayoutInflater());
|
||||
CommonUtils.initFull(this, true);
|
||||
setContentView(vb.getRoot());
|
||||
weakReference = new WeakReference<>(this);
|
||||
data = (Data) getIntent().getSerializableExtra(CommonUtils.key_info);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
imId = data.getImId();
|
||||
mSavePath = CommonKt.INSTANCE.getSaveFilePath(this, imId);
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
initClick();
|
||||
loadDetail();
|
||||
}
|
||||
|
||||
private void loadDetail() {
|
||||
String previewUrl400 = data.getPreviewUrl400();
|
||||
String previewUrl1080 = data.getPreviewUrl1080();
|
||||
String previewUrl200 = data.getPreviewUrl200();
|
||||
String authorHeader = data.getAuthorHeader();
|
||||
String authorName = data.getAuthorName();
|
||||
String authorHtml = data.getAuthorHtml();
|
||||
fullUrl = data.getFullUrl();
|
||||
|
||||
File file = new File(mSavePath);
|
||||
RequestOptions options = new RequestOptions()
|
||||
.format(DecodeFormat.PREFER_RGB_565);
|
||||
int width = vb.imageviewPreview.getWidth();
|
||||
int height = vb.imageviewPreview.getHeight();
|
||||
|
||||
int[] screenWidthHeight = CommonUtils.getScreenWidthHeight(this);
|
||||
Log.d(MyWallpaper.TAG,"--------width="+screenWidthHeight[0]+"----height="+screenWidthHeight[1]);
|
||||
if (file.exists()) {
|
||||
Glide.with(this)
|
||||
.load(file)
|
||||
.apply(options)
|
||||
.placeholder(R.mipmap.im_placeholder)
|
||||
// .override(screenWidthHeight[0], screenWidthHeight[1])
|
||||
.transition(DrawableTransitionOptions.withCrossFade(500))
|
||||
.into(vb.imageviewPreview);
|
||||
} else {
|
||||
Glide.with(this)
|
||||
.asDrawable()
|
||||
.load(previewUrl1080)
|
||||
.apply(options)
|
||||
.skipMemoryCache(true)
|
||||
// .override(screenWidthHeight[0], screenWidthHeight[1])
|
||||
.placeholder(R.mipmap.im_placeholder)
|
||||
.thumbnail(
|
||||
Glide.with(ActivitySet.this)
|
||||
.asDrawable()
|
||||
.load(previewUrl200)
|
||||
.apply(options)
|
||||
.placeholder(R.mipmap.im_placeholder)
|
||||
// .override(screenWidthHeight[0], screenWidthHeight[1])
|
||||
.centerCrop()
|
||||
)
|
||||
.transition(DrawableTransitionOptions.withCrossFade(500)) // 500ms 淡入效果
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||
Log.d(MyWallpaper.TAG, "-----------onLoadFailed e" + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
|
||||
// fullDrawable = resource;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.centerCrop()
|
||||
.into(vb.imageviewPreview);
|
||||
// doDownload(false, false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Glide.with(this)
|
||||
.load(authorHeader)
|
||||
.transform(new CircleCrop())
|
||||
.into(vb.imageHeader);
|
||||
vb.textName.setText(authorName);
|
||||
vb.textHtml.setText(authorHtml);
|
||||
|
||||
boolean b = DbManager.queryIsLike(imId);
|
||||
vb.imageFavorite.setSelected(b);
|
||||
|
||||
}
|
||||
|
||||
private void initClick() {
|
||||
vb.imageviewBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
vb.buttonSet.setOnClickListener(v -> {
|
||||
if (dialogSetType == null) {
|
||||
dialogSetType = new DialogSetType();
|
||||
dialogSetType.setListener(ActivitySet.this);
|
||||
}
|
||||
if (!dialogSetType.isAdded()) {
|
||||
dialogSetType.show(getSupportFragmentManager(), "");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
vb.imageFavorite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean selected = vb.imageFavorite.isSelected();
|
||||
vb.imageFavorite.setSelected(!selected);
|
||||
boolean selectedNew = vb.imageFavorite.isSelected();
|
||||
if (selectedNew) {
|
||||
DbManager.insertOrUpdateLike(data);
|
||||
} else {
|
||||
DbManager.deleteLike(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
vb.layoutDownload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean permission = CommonKt.INSTANCE.requestPermission(ActivitySet.this, permissionCode);
|
||||
if (!permission) {
|
||||
return;
|
||||
}
|
||||
startSaveToAlbum();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startSaveToAlbum() {
|
||||
showDownloadLoading(true);
|
||||
// File file = new File(mSavePath);
|
||||
// if (file.exists()) {
|
||||
// Log.d(MyWallpaper.TAG, "-----------Download 1");
|
||||
// startSave(file);
|
||||
// return;
|
||||
// }
|
||||
if (downloadFile != null && downloadFile.exists()) {
|
||||
Log.d(MyWallpaper.TAG, "-----------Download 2");
|
||||
startSave(downloadFile);
|
||||
return;
|
||||
}
|
||||
Log.d(MyWallpaper.TAG, "-----------Download 3");
|
||||
doDownload(true, true);
|
||||
|
||||
}
|
||||
|
||||
private void doDownload(boolean showMsg, boolean save) {
|
||||
call = CommonKt.INSTANCE.downloadFile(fullUrl, mSavePath, new Function2<Boolean, InputStream, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Boolean aBoolean, InputStream inputStream) {
|
||||
File file = new File(mSavePath);
|
||||
if (aBoolean && file.exists()) {
|
||||
downloadFile = file;
|
||||
if (save) {
|
||||
startSave(downloadFile);
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ActivitySet activity = weakReference.get();
|
||||
if (activity != null && !activity.isDestroyed()) {
|
||||
Log.d(MyWallpaper.TAG, "-------weakReference !=null");
|
||||
// Glide.with(activity)
|
||||
// .asDrawable()
|
||||
// .load(downloadFile)
|
||||
// .into(vb.imageviewPreview);
|
||||
} else {
|
||||
Log.d(MyWallpaper.TAG, "-------weakReference null");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showDownloadLoading(false);
|
||||
if (showMsg) {
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.download_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showDownloadLoading(boolean show) {
|
||||
if (show) {
|
||||
vb.pbDownload.setVisibility(View.VISIBLE);
|
||||
vb.imageDownload.setVisibility(View.GONE);
|
||||
} else {
|
||||
vb.pbDownload.setVisibility(View.GONE);
|
||||
vb.imageDownload.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSetWallpaperLoading(boolean show) {
|
||||
Log.d(MyWallpaper.TAG, "-----------showSetWallpaperLoading" + show);
|
||||
if (show) {
|
||||
vb.pbSet.setVisibility(View.VISIBLE);
|
||||
vb.buttonSet.setVisibility(View.GONE);
|
||||
} else {
|
||||
vb.pbSet.setVisibility(View.GONE);
|
||||
vb.buttonSet.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == permissionCode && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
startSaveToAlbum();
|
||||
}
|
||||
}
|
||||
|
||||
private void startSave(File file) {
|
||||
DbManager.insertOrUpdateDownload(data);
|
||||
Uri uri = CommonKt.INSTANCE.saveToGallery(ActivitySet.this, file);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showDownloadLoading(false);
|
||||
if (uri == null) {
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
deleteCacheFile();
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Log.d(MyWallpaper.TAG, "--------path=" + file.getAbsolutePath() + "---uri=" + uri);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectType(int type) {
|
||||
Log.d(MyWallpaper.TAG, "--------onSelectType=" + Thread.currentThread().getName());
|
||||
showSetWallpaperLoading(true);
|
||||
if (downloadFile != null) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setWallpaper(downloadFile, type);
|
||||
}
|
||||
}).start();
|
||||
} else if (fullDrawable != null) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
File file = new File(CommonUtils.saveDrawableToFile(fullDrawable, mSavePath));
|
||||
setWallpaper(file, type);
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
call = CommonKt.INSTANCE.downloadFile(fullUrl, mSavePath, new Function2<Boolean, InputStream, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Boolean aBoolean, InputStream inputStream) {
|
||||
Log.d(MyWallpaper.TAG, "--------downloadFile=" + Thread.currentThread().getName());
|
||||
File file = new File(mSavePath);
|
||||
if (aBoolean && file.exists()) {
|
||||
downloadFile = file;
|
||||
setWallpaper(downloadFile, type);
|
||||
} else {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showSetWallpaperLoading(false);
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.set_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void setWallpaper(File file, int type) {
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(file);
|
||||
switch (type) {
|
||||
case DialogSetType.type_home:
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
wallpaperManager.setStream(fileInputStream);
|
||||
} else {
|
||||
wallpaperManager.setStream(
|
||||
fileInputStream,
|
||||
null,
|
||||
true,
|
||||
WallpaperManager.FLAG_SYSTEM
|
||||
);
|
||||
}
|
||||
break;
|
||||
case DialogSetType.type_lock:
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
|
||||
wallpaperManager.setStream(fileInputStream);
|
||||
} else {
|
||||
wallpaperManager.setStream(
|
||||
fileInputStream,
|
||||
null,
|
||||
true,
|
||||
WallpaperManager.FLAG_LOCK
|
||||
);
|
||||
}
|
||||
break;
|
||||
case DialogSetType.type_both:
|
||||
wallpaperManager.setStream(fileInputStream);
|
||||
break;
|
||||
}
|
||||
deleteCacheFile();
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showSetWallpaperLoading(false);
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.set_success), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} catch (Exception exception) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showSetWallpaperLoading(false);
|
||||
Toast.makeText(ActivitySet.this, getString(R.string.set_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteCacheFile() {
|
||||
if (downloadFile != null && downloadFile.exists()) {
|
||||
boolean delete = downloadFile.delete();
|
||||
Log.d(MyWallpaper.TAG, "--------delete=" + delete);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (call != null) {
|
||||
call.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.hd.phone.fresh.walls.databinding.ActivityWelcomeBinding;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
|
||||
public class ActivityWelcome extends AppCompatActivity {
|
||||
private TextView textViewWallpaper;
|
||||
private CountDownTimer countDownTimer;
|
||||
private ActivityWelcomeBinding vb;
|
||||
|
||||
private long totalTime = 1000;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
vb = ActivityWelcomeBinding.inflate(getLayoutInflater());
|
||||
CommonUtils.initFull(this,false);
|
||||
setContentView(vb.getRoot());
|
||||
|
||||
|
||||
countDownTimer = new CountDownTimer(totalTime,100) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime);
|
||||
|
||||
int countdownPercentage = 100 - progressPercentage;
|
||||
|
||||
vb.progressbar.setProgress(countdownPercentage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
vb.progressbar.setProgress(100);
|
||||
Intent intent = new Intent(ActivityWelcome.this, ActivityMain.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
// countDownTimer = AdManager.showWelcomeAd(this, totalTime, new CountAction() {
|
||||
// @Override
|
||||
// public void onCount(long millisUntilFinished) {
|
||||
// int progressPercentage = (int) ((100 * millisUntilFinished) / totalTime);
|
||||
//
|
||||
// int countdownPercentage = 100 - progressPercentage;
|
||||
//
|
||||
// vb.progressbar.setProgress(countdownPercentage);
|
||||
// }
|
||||
// }, new GoMainAction() {
|
||||
// @Override
|
||||
// public void onGo() {
|
||||
// vb.progressbar.setProgress(100);
|
||||
// Intent intent = new Intent(WElActivity.this, HomeActivity.class);
|
||||
// startActivity(intent);
|
||||
// finish();
|
||||
// }
|
||||
// });
|
||||
countDownTimer.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import com.hd.phone.fresh.walls.databinding.DialogTypeBinding;
|
||||
import com.hd.phone.fresh.walls.mylistener.TypeListener;
|
||||
|
||||
public class DialogSetType extends DialogFragment {
|
||||
|
||||
private DialogTypeBinding vb;
|
||||
private TypeListener listener;
|
||||
|
||||
public static final int type_home =0;
|
||||
public static final int type_lock =1;
|
||||
public static final int type_both =2;
|
||||
|
||||
public void setListener(TypeListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
vb = DialogTypeBinding.inflate(getLayoutInflater());
|
||||
|
||||
init();
|
||||
return vb.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void init(){
|
||||
vb.layoutHome.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(listener!= null){
|
||||
listener.onSelectType(type_home);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
vb.layoutLock.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(listener!= null){
|
||||
listener.onSelectType(type_lock);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
vb.layoutBoth.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(listener!= null){
|
||||
listener.onSelectType(type_both);
|
||||
dismiss();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
115
app/src/main/java/com/hd/phone/fresh/walls/ui/FragmentChild.java
Normal file
@ -0,0 +1,115 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.adapter.AdapterPreView;
|
||||
import com.hd.phone.fresh.walls.databinding.FragmentChildBinding;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnAddListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.utils.ItemSpace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class FragmentChild extends Fragment implements ItemClickListener {
|
||||
|
||||
|
||||
private int mIndex;
|
||||
|
||||
|
||||
private List<Data> userList;
|
||||
|
||||
private FragmentChildBinding vb;
|
||||
|
||||
|
||||
public FragmentChild() {
|
||||
|
||||
}
|
||||
|
||||
public static FragmentChild newInstance(int type) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(CommonUtils.key_index, type);
|
||||
FragmentChild fragment = new FragmentChild();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mIndex = getArguments().getInt(CommonUtils.key_index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
vb = FragmentChildBinding.inflate(getLayoutInflater());
|
||||
|
||||
initList();
|
||||
return vb.getRoot();
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
ItemSpace itemSpace = new ItemSpace(10, 10, 0);
|
||||
// StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||
vb.list.addItemDecoration(itemSpace);
|
||||
vb.list.setLayoutManager(gridLayoutManager);
|
||||
AdapterPreView adapterPreView = new AdapterPreView(requireContext(),false);
|
||||
userList = MyWallpaper.getData().get(mIndex).getDataList();
|
||||
Log.d(MyWallpaper.TAG, "----------setDataInfo mIndex="+mIndex);
|
||||
adapterPreView.setDataInfo(userList);
|
||||
adapterPreView.setInfoWallpaperListener(this);
|
||||
vb.list.setAdapter(adapterPreView);
|
||||
|
||||
|
||||
// DbManager.addOnAddOrRemoveListener(new OnAddListener() {
|
||||
// @Override
|
||||
// public void onAdd(Data data) {
|
||||
// int index = userList.indexOf(data);
|
||||
// Log.d(MyWallpaper.TAG, "---mIndex=" + mIndex + "----onAdd index=" + index);
|
||||
// adapterPreView.notifyItemChanged(index);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onRemove(Data data) {
|
||||
// int index = userList.indexOf(data);
|
||||
// adapterPreView.notifyItemChanged(index);
|
||||
// Log.d(MyWallpaper.TAG, "---mIndex=" + mIndex + "----onRemove index=" + index);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Data info) {
|
||||
Intent intent = new Intent(requireContext(), ActivitySet.class);
|
||||
intent.putExtra(CommonUtils.key_info, info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Glide.get(requireContext()).clearMemory();
|
||||
Log.d(MyWallpaper.TAG, "--onDestroy-mIndex=" + mIndex);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.adapter.AdapterFavorite;
|
||||
import com.hd.phone.fresh.walls.adapter.AdapterPreView;
|
||||
import com.hd.phone.fresh.walls.databinding.FragmentLikeBinding;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnDownloadListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnLikeListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonKt;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.utils.ItemSpace;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
|
||||
|
||||
public class FragmentDownload extends Fragment implements ItemClickListener {
|
||||
|
||||
private FragmentLikeBinding vb;
|
||||
private DataSubscription dataSubscription;
|
||||
|
||||
public FragmentDownload() {
|
||||
|
||||
}
|
||||
|
||||
public static FragmentDownload newInstance() {
|
||||
FragmentDownload fragment = new FragmentDownload();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
vb = FragmentLikeBinding.inflate(getLayoutInflater());
|
||||
vb.tvTitle.setText(getString(R.string.no_download_data));
|
||||
initList();
|
||||
return vb.getRoot();
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
// String saveFileDir = CommonKt.INSTANCE.getSaveFileDir(requireContext());
|
||||
// File file = new File(saveFileDir);
|
||||
// for (File listFile : Objects.requireNonNull(file.listFiles())) {
|
||||
// if(listFile.getName().endsWith(".jpg")){
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
AdapterPreView adapterDownload = new AdapterPreView(requireContext(),true);
|
||||
dataSubscription = DbManager.setDownloadListener(new OnDownloadListener() {
|
||||
@Override
|
||||
public void onDownloadList(List<Data> dataList) {
|
||||
Log.d(MyWallpaper.TAG, "------onDownloadList size = " + dataList.size());
|
||||
if(dataList.size()==0){
|
||||
vb.layoutNoData.setVisibility(View.VISIBLE);
|
||||
vb.listRecycler.setVisibility(View.GONE);
|
||||
}else {
|
||||
vb.layoutNoData.setVisibility(View.GONE);
|
||||
vb.listRecycler.setVisibility(View.VISIBLE);
|
||||
adapterDownload.setDataInfo(dataList);
|
||||
}
|
||||
}
|
||||
});
|
||||
ItemSpace itemSpace = new ItemSpace(10, 10, 15);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||
vb.listRecycler.setLayoutManager(gridLayoutManager);
|
||||
vb.listRecycler.addItemDecoration(itemSpace);
|
||||
adapterDownload.setInfoWallpaperListener(this);
|
||||
vb.listRecycler.setAdapter(adapterDownload);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Data info) {
|
||||
Intent intent = new Intent(requireContext(), ActivitySet.class);
|
||||
intent.putExtra(CommonUtils.key_info, info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (dataSubscription != null) {
|
||||
dataSubscription.cancel();
|
||||
}
|
||||
Log.d(MyWallpaper.TAG,"------favoriteFragment-onDestroyView");
|
||||
}
|
||||
}
|
||||
143
app/src/main/java/com/hd/phone/fresh/walls/ui/FragmentHome.java
Normal file
@ -0,0 +1,143 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.databinding.ClassTabViewBinding;
|
||||
import com.hd.phone.fresh.walls.databinding.FragmentMainBinding;
|
||||
import com.hd.phone.fresh.walls.json.Category;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.utils.CustomerTv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class FragmentHome extends Fragment implements ItemClickListener {
|
||||
|
||||
|
||||
private int mWallpaperType;
|
||||
|
||||
|
||||
private List<Data> userList;
|
||||
|
||||
private FragmentMainBinding vb;
|
||||
|
||||
|
||||
public FragmentHome() {
|
||||
|
||||
}
|
||||
|
||||
public static FragmentHome newInstance(int type) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(CommonUtils.key_index, type);
|
||||
FragmentHome fragment = new FragmentHome();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mWallpaperType = getArguments().getInt(CommonUtils.key_index);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
vb = FragmentMainBinding.inflate(getLayoutInflater());
|
||||
|
||||
initTabVp();
|
||||
return vb.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Data info) {
|
||||
Intent intent = new Intent(requireContext(), ActivitySet.class);
|
||||
intent.putExtra(CommonUtils.key_info, info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private void initTabVp() {
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
List<Category> data = new ArrayList<>();
|
||||
while (data.size() < 7) {
|
||||
data = MyWallpaper.getData();
|
||||
}
|
||||
vb.loadingPb.setVisibility(View.GONE);
|
||||
Log.d(MyWallpaper.TAG, "------------data=" + data);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
list.add(FragmentChild.newInstance(i));
|
||||
}
|
||||
|
||||
vb.viewpager2.setOffscreenPageLimit(1);
|
||||
vb.viewpager2.setAdapter(new FragmentStateAdapter(getChildFragmentManager(),getLifecycle()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
});
|
||||
vb.viewpager2.setUserInputEnabled(false);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TabLayout.Tab tab = vb.tabClass.newTab();
|
||||
ClassTabViewBinding tabVb = ClassTabViewBinding.inflate(getLayoutInflater());
|
||||
tabVb.name.setText(data.get(i).getClassName());
|
||||
tab.setCustomView(tabVb.getRoot());
|
||||
tabVb.name.setSelected(i == 0);
|
||||
vb.tabClass.addTab(tab);
|
||||
}
|
||||
vb.tabClass.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
int position = tab.getPosition();
|
||||
vb.viewpager2.setCurrentItem(position);
|
||||
|
||||
View customView = tab.getCustomView();
|
||||
if (customView != null) {
|
||||
CustomerTv tv = customView.findViewById(R.id.name);
|
||||
tv.setSelected(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
View customView = tab.getCustomView();
|
||||
if (customView != null) {
|
||||
CustomerTv tv = customView.findViewById(R.id.name);
|
||||
tv.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.hd.phone.fresh.walls.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
import com.hd.phone.fresh.walls.adapter.AdapterFavorite;
|
||||
import com.hd.phone.fresh.walls.databinding.FragmentLikeBinding;
|
||||
import com.hd.phone.fresh.walls.db.DbManager;
|
||||
import com.hd.phone.fresh.walls.json.Data;
|
||||
import com.hd.phone.fresh.walls.mylistener.ItemClickListener;
|
||||
import com.hd.phone.fresh.walls.mylistener.OnLikeListener;
|
||||
import com.hd.phone.fresh.walls.utils.CommonUtils;
|
||||
import com.hd.phone.fresh.walls.utils.ItemSpace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.objectbox.reactive.DataSubscription;
|
||||
|
||||
|
||||
public class FragmentLike extends Fragment implements ItemClickListener {
|
||||
|
||||
private FragmentLikeBinding vb;
|
||||
private DataSubscription dataSubscription;
|
||||
|
||||
public FragmentLike() {
|
||||
|
||||
}
|
||||
|
||||
public static FragmentLike newInstance() {
|
||||
FragmentLike fragment = new FragmentLike();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
vb = FragmentLikeBinding.inflate(getLayoutInflater());
|
||||
vb.tvTitle.setText(getString(R.string.no_like_data));
|
||||
initList();
|
||||
return vb.getRoot();
|
||||
}
|
||||
|
||||
private void initList() {
|
||||
AdapterFavorite adapterFavorite = new AdapterFavorite(requireContext());
|
||||
dataSubscription = DbManager.setLikeDataListener(new OnLikeListener() {
|
||||
@Override
|
||||
public void onLikeList(List<Data> dataList) {
|
||||
Log.d(MyWallpaper.TAG, "------size = " + dataList.size());
|
||||
if(dataList.size()==0){
|
||||
vb.layoutNoData.setVisibility(View.VISIBLE);
|
||||
vb.listRecycler.setVisibility(View.GONE);
|
||||
}else {
|
||||
vb.layoutNoData.setVisibility(View.GONE);
|
||||
vb.listRecycler.setVisibility(View.VISIBLE);
|
||||
adapterFavorite.setDataInfo(dataList);
|
||||
}
|
||||
}
|
||||
});
|
||||
ItemSpace itemSpace = new ItemSpace(10, 10, 15);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||
vb.listRecycler.setLayoutManager(gridLayoutManager);
|
||||
vb.listRecycler.addItemDecoration(itemSpace);
|
||||
adapterFavorite.setInfoWallpaperListener(this);
|
||||
vb.listRecycler.setAdapter(adapterFavorite);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Data info) {
|
||||
Intent intent = new Intent(requireContext(), ActivitySet.class);
|
||||
intent.putExtra(CommonUtils.key_info, info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (dataSubscription != null) {
|
||||
dataSubscription.cancel();
|
||||
}
|
||||
Log.d(MyWallpaper.TAG,"------favoriteFragment-onDestroyView");
|
||||
}
|
||||
}
|
||||
372
app/src/main/java/com/hd/phone/fresh/walls/utils/CommonKt.kt
Normal file
@ -0,0 +1,372 @@
|
||||
package com.hd.phone.fresh.walls.utils
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.MediaStore
|
||||
import android.util.Log
|
||||
import androidx.core.app.ActivityCompat
|
||||
import com.hd.phone.fresh.walls.MyWallpaper
|
||||
import com.hd.phone.fresh.walls.json.Data
|
||||
import okhttp3.Call
|
||||
import okhttp3.Callback
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.BufferedReader
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.InputStreamReader
|
||||
import java.io.OutputStream
|
||||
import java.io.StringWriter
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
object CommonKt {
|
||||
|
||||
|
||||
fun getJsonString(input: InputStream): String {
|
||||
val stringWriter = StringWriter()
|
||||
val charArray = CharArray(input.available())
|
||||
var l = 0;
|
||||
val bufReader = BufferedReader(InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
while (bufReader.read(charArray).also {
|
||||
l = it
|
||||
} != -1) {
|
||||
stringWriter.write(charArray, 0, l)
|
||||
}
|
||||
return stringWriter.toString()
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun getData(jsonStr: String): MutableList<Data> {
|
||||
val jsonArray = JSONArray(jsonStr)
|
||||
var data = mutableListOf<Data>()
|
||||
|
||||
var get:JSONObject
|
||||
var text_description:String
|
||||
|
||||
var links:JSONObject
|
||||
var download:String
|
||||
|
||||
var urls:JSONObject
|
||||
var regular:String
|
||||
var small:String
|
||||
var thumb:String
|
||||
|
||||
|
||||
var users:JSONObject
|
||||
var name:String
|
||||
var header_large:String
|
||||
var user_html:String
|
||||
val host = "https://unsplash.com/photos/"
|
||||
|
||||
var bean:Data
|
||||
var indexOf:Int
|
||||
var substring:String
|
||||
|
||||
|
||||
for (i in 0 until jsonArray.length()) {
|
||||
get = jsonArray.getJSONObject(i)
|
||||
text_description = get.getString("alt_description")
|
||||
links = get.getJSONObject("links")
|
||||
download = links.getString("download")
|
||||
// val downloadLocation = links.getString("download_location")
|
||||
// val html = links.getString("html")
|
||||
|
||||
|
||||
urls = get.getJSONObject("urls")
|
||||
// val full = urls.getString("full")
|
||||
// val raw = urls.getString("raw")
|
||||
regular = urls.getString("regular")
|
||||
small = urls.getString("small")
|
||||
thumb = urls.getString("thumb")
|
||||
|
||||
|
||||
users = get.getJSONObject("user")
|
||||
// val portfolio_url = users.getString("portfolio_url")
|
||||
name = users.getString("name")
|
||||
header_large = users.getString("header_large")
|
||||
// val header_medium = users.getString("header_medium")
|
||||
// val header_small = users.getString("header_small")
|
||||
user_html = users.getString("authorHtml")
|
||||
|
||||
|
||||
indexOf = download.indexOf("/download")
|
||||
substring = download.substring(host.length, indexOf)
|
||||
// Log.d(MyApp.TAG, "i=$i----------substring=$substring")
|
||||
|
||||
bean = Data().apply {
|
||||
imId = substring
|
||||
description = text_description
|
||||
fullUrl = download
|
||||
previewUrl1080 = regular
|
||||
previewUrl400 = small
|
||||
previewUrl200 = thumb
|
||||
authorName = name
|
||||
authorHeader = header_large
|
||||
authorHtml = user_html
|
||||
}
|
||||
|
||||
data.add(bean)
|
||||
}
|
||||
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
fun downloadFile(
|
||||
url: String,
|
||||
savePath: String,
|
||||
result: (Boolean, input: InputStream?) -> Unit
|
||||
): Call {
|
||||
var client = OkHttpClient()
|
||||
var request = Request.Builder().url(url).build()
|
||||
var call = client.newCall(request)
|
||||
call.enqueue(object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
result.invoke(false, null)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call, response: Response) {
|
||||
response.body?.run {
|
||||
val byteStream = byteStream()
|
||||
val writeFile = writeFile(byteStream, savePath)
|
||||
result.invoke(writeFile, byteStream)
|
||||
} ?: run {
|
||||
result.invoke(false, null)
|
||||
}
|
||||
}
|
||||
})
|
||||
return call
|
||||
}
|
||||
|
||||
fun writeFile(input: InputStream, filePath: String): Boolean {
|
||||
try {
|
||||
val byte = ByteArray(4096)
|
||||
val output = ByteArrayOutputStream()
|
||||
var l: Int
|
||||
while (input.read(byte).also { l = it } != -1) {
|
||||
output.write(byte, 0, l)
|
||||
}
|
||||
val fileDe = File(filePath)
|
||||
if (!fileDe.exists()) {
|
||||
fileDe.createNewFile()
|
||||
}
|
||||
val fileOutputStream = FileOutputStream(filePath)
|
||||
fileOutputStream.write(output.toByteArray())
|
||||
output.close()
|
||||
fileOutputStream.close()
|
||||
return true
|
||||
} catch (ex: Exception) {
|
||||
Log.d("-----------", "---------ex=" + ex.message)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun saveImageQ(imagePath: String, context: Context): Boolean {
|
||||
return try {
|
||||
val contentResolver = context.contentResolver
|
||||
val contentValues =
|
||||
getImageContentValues(File(imagePath))
|
||||
val localUri = contentResolver.insert(
|
||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
contentValues
|
||||
)
|
||||
// 拷贝到指定uri,如果没有这步操作,android11不会在相册显示
|
||||
val out = context.contentResolver.openOutputStream(localUri!!)
|
||||
copyFile(imagePath, out)
|
||||
|
||||
contentValues.clear();
|
||||
contentValues.put(MediaStore.MediaColumns.IS_PENDING, 0);
|
||||
contentValues.putNull(MediaStore.MediaColumns.DATE_EXPIRES);
|
||||
contentResolver.update(localUri, contentValues, null, null);
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun getImageContentValues(paramFile: File): ContentValues {
|
||||
val time = System.currentTimeMillis()
|
||||
val localContentValues = ContentValues()
|
||||
localContentValues.put(MediaStore.Images.Media.TITLE, paramFile.name)
|
||||
localContentValues.put(MediaStore.Images.Media.DISPLAY_NAME, paramFile.name)
|
||||
localContentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
localContentValues.put(MediaStore.Images.Media.RELATIVE_PATH, getSavePath())
|
||||
// localContentValues.put(MediaStore.Images.Media.DATE_MODIFIED, time / 1000)
|
||||
// localContentValues.put(MediaStore.Images.Media.DATE_ADDED, time / 1000)
|
||||
return localContentValues
|
||||
}
|
||||
|
||||
private fun getSavePath(): String {
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun saveImage(imagePath: String, context: Context): Boolean {
|
||||
return try {
|
||||
val path = getSavePath() + File.separator + File(imagePath).name
|
||||
val newFile = File(path)
|
||||
if (!newFile!!.parentFile.exists()) {
|
||||
newFile!!.parentFile.mkdirs()
|
||||
}
|
||||
val out = newFile.outputStream()
|
||||
copyFile(imagePath, out)
|
||||
|
||||
val uri = Uri.fromFile(newFile)
|
||||
context.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri))
|
||||
out.close()
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyFile(oldPath: String, out: OutputStream?): Boolean {
|
||||
try {
|
||||
var bytesum = 0
|
||||
var byteread = 0
|
||||
val oldFile = File(oldPath)
|
||||
if (oldFile.exists()) {
|
||||
// 读入原文件
|
||||
val inStream: InputStream = FileInputStream(oldPath)
|
||||
val buffer = ByteArray(1444)
|
||||
while (inStream.read(buffer).also { byteread = it } != -1) {
|
||||
bytesum += byteread //字节数 文件大小
|
||||
println(bytesum)
|
||||
out!!.write(buffer, 0, byteread)
|
||||
}
|
||||
inStream.close()
|
||||
out!!.close()
|
||||
return true
|
||||
} else {
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
fun saveToGallery(context: Context, photoFile: File): Uri? {
|
||||
val displayName = "${System.currentTimeMillis()}.jpg"
|
||||
val contentValues = ContentValues().apply {
|
||||
put(MediaStore.Images.Media.DISPLAY_NAME, displayName)
|
||||
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
put(MediaStore.Images.Media.IS_PENDING, 1)
|
||||
}
|
||||
}
|
||||
|
||||
val contentResolver = context.contentResolver
|
||||
val collectionUri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
|
||||
} else {
|
||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
||||
}
|
||||
|
||||
val imageUri = contentResolver.insert(collectionUri, contentValues)
|
||||
|
||||
imageUri?.let { uri ->
|
||||
try {
|
||||
contentResolver.openOutputStream(uri)?.use { outputStream ->
|
||||
val inputStream = FileInputStream(photoFile)
|
||||
inputStream.copyTo(outputStream)
|
||||
inputStream.close()
|
||||
outputStream.close()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
contentValues.clear()
|
||||
contentValues.put(MediaStore.Images.Media.IS_PENDING, 0)
|
||||
contentResolver.update(uri, contentValues, null, null)
|
||||
} else {
|
||||
|
||||
}
|
||||
return uri
|
||||
} catch (e: IOException) {
|
||||
Log.d(MyWallpaper.TAG, "-----------------e=${e.printStackTrace()}")
|
||||
return null
|
||||
}
|
||||
} ?: run {
|
||||
Log.d(MyWallpaper.TAG, "----------------false")
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun saveFreshAppImageToGallery(context: Context, bitmap: Bitmap) {
|
||||
val bitmap = bitmap
|
||||
val displayName = "${System.currentTimeMillis()}.jpg"
|
||||
|
||||
val values = ContentValues().apply {
|
||||
put(MediaStore.Images.Media.DISPLAY_NAME, displayName)
|
||||
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
put(MediaStore.Images.Media.DATE_ADDED, System.currentTimeMillis() / 1000)
|
||||
}
|
||||
|
||||
val contentResolver = context.contentResolver
|
||||
val collection =
|
||||
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
|
||||
val item = contentResolver.insert(collection, values)
|
||||
|
||||
item?.let { uri ->
|
||||
try {
|
||||
val outputStream = contentResolver.openOutputStream(uri)
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream!!)
|
||||
outputStream.close()
|
||||
|
||||
Log.d(MyWallpaper.TAG, "------------------Save successfully!")
|
||||
val mediaScanIntent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
|
||||
mediaScanIntent.data = uri
|
||||
context.sendBroadcast(mediaScanIntent)
|
||||
} catch (e: Exception) {
|
||||
Log.d(MyWallpaper.TAG, "------------------Save Failed!")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun requestPermission(context: Activity, requestCode: Int): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
return true
|
||||
}
|
||||
return if (context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(
|
||||
context,
|
||||
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||
requestCode
|
||||
)
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
fun getSaveFilePath(context: Context, imId: String): String {
|
||||
return "${context.cacheDir}/${imId}.jpg"
|
||||
}
|
||||
|
||||
fun getSaveFileDir(context: Context): String {
|
||||
return "${context.cacheDir}"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package com.hd.phone.fresh.walls.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Debug;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class CommonUtils {
|
||||
public static final String key_info = "key_info";
|
||||
|
||||
public static final String key_index = "key_index";
|
||||
|
||||
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 = MyWallpaper.mAppContext.getResources().getDisplayMetrics().density;
|
||||
return (int) (dp * scale + 0.5f);
|
||||
}
|
||||
|
||||
public static void initFull(Activity activity, boolean light) {
|
||||
Window window = activity.getWindow();
|
||||
View decorView = window.getDecorView();
|
||||
View rootView = decorView.getRootView();
|
||||
if (light) {
|
||||
// window.setStatusBarColor(ContextCompat.getColor(activity, R.color.white));
|
||||
//
|
||||
} else {
|
||||
// window.setStatusBarColor(ContextCompat.getColor(activity, R.color.black));
|
||||
// decorView.setSystemUiVisibility(0);
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// mView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
// rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Bitmap getBitmap(Drawable drawable) {
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
return ((BitmapDrawable) drawable).getBitmap();
|
||||
}
|
||||
|
||||
// 创建一个空白的 Bitmap
|
||||
Bitmap bitmap = Bitmap.createBitmap(
|
||||
drawable.getIntrinsicWidth(),
|
||||
drawable.getIntrinsicHeight(),
|
||||
Bitmap.Config.ARGB_8888);
|
||||
|
||||
// 在 Canvas 上绘制 Drawable
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawable.draw(canvas);
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
public static String saveDrawableToFile( Drawable drawable,String saveFilePath) {
|
||||
// 将 Drawable 转换为 Bitmap
|
||||
Bitmap bitmap = getBitmap(drawable);
|
||||
|
||||
|
||||
// 创建要保存的文件
|
||||
File file = new File(saveFilePath);
|
||||
FileOutputStream fos = null;
|
||||
|
||||
try {
|
||||
fos = new FileOutputStream(file);
|
||||
|
||||
// 将 Bitmap 写入文件 (使用 PNG 格式,可改为 JPEG)
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
try {
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
public static void printUsedMemory(Context context) {
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
Debug.MemoryInfo[] memoryInfoArray = activityManager.getProcessMemoryInfo(new int[]{android.os.Process.myPid()});
|
||||
for (Debug.MemoryInfo memoryInfo : memoryInfoArray) {
|
||||
int totalPss = memoryInfo.getTotalPss();
|
||||
int totalPrivateDirty = memoryInfo.getTotalPrivateDirty();
|
||||
int totalSharedDirty = memoryInfo.getTotalSharedDirty();
|
||||
|
||||
Log.d("MemoryInfo", "Total PSS: " + totalPss + " KB");
|
||||
Log.d("MemoryInfo", "Total Private Dirty: " + totalPrivateDirty + " KB");
|
||||
Log.d("MemoryInfo", "Total Shared Dirty: " + totalSharedDirty + " KB");
|
||||
}
|
||||
}
|
||||
|
||||
// public static void zoomImage(File file){
|
||||
// BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
// options.inSampleSize = 4; // 将图片缩小到原尺寸的 1/4
|
||||
// Bitmap bitmap = BitmapFactory.decodeFile(filePath, options);
|
||||
// }
|
||||
public static Bitmap scaleDrawable(Drawable drawable, int width, int height) {
|
||||
if (drawable == null) return null;
|
||||
|
||||
Bitmap bitmap = Bitmap.createBitmap(
|
||||
drawable.getIntrinsicWidth(),
|
||||
drawable.getIntrinsicHeight(),
|
||||
Bitmap.Config.ARGB_8888
|
||||
);
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawable.draw(canvas);
|
||||
|
||||
return Bitmap.createScaledBitmap(bitmap, width, height, true);
|
||||
}
|
||||
public static int[] getScreenWidthHeight(Context context) {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
int width = metrics.widthPixels;
|
||||
int height = metrics.heightPixels;
|
||||
return new int[]{width, height};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.hd.phone.fresh.walls.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.hd.phone.fresh.walls.MyWallpaper;
|
||||
import com.hd.phone.fresh.walls.R;
|
||||
|
||||
|
||||
public class CustomerTv extends androidx.appcompat.widget.AppCompatTextView {
|
||||
|
||||
|
||||
public CustomerTv(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initAttrs(context,attrs);
|
||||
}
|
||||
|
||||
|
||||
private void initAttrs(Context context, AttributeSet attrs){
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CustomeTv);
|
||||
boolean aBoolean = typedArray.getBoolean(R.styleable.CustomeTv_apply_font,false);
|
||||
if(aBoolean){
|
||||
setTypeface(MyWallpaper.defaultFont);
|
||||
}
|
||||
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.hd.phone.fresh.walls.utils;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class ItemSpace extends RecyclerView.ItemDecoration {
|
||||
private int ex_space = 0;
|
||||
private int v_space = 0;
|
||||
private int h_space = 0;
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
|
||||
int position = parent.getChildAdapterPosition(view);
|
||||
int spanSize = 1;
|
||||
int spanIndex = 0;
|
||||
int spanCount = 1;
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager1 = (GridLayoutManager) layoutManager;
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount = layoutManager1.getSpanCount();
|
||||
spanSize = layoutManager1.getSpanSizeLookup().getSpanSize(position);
|
||||
spanIndex = layoutParams.getSpanIndex();
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (spanSize == spanCount) {
|
||||
outRect.left = v_space + ex_space;
|
||||
outRect.right = v_space + ex_space;
|
||||
outRect.bottom = h_space;
|
||||
} else {
|
||||
int itemAllSpacing = (v_space * (spanCount + 1) + ex_space * 2) / spanCount;
|
||||
int left = v_space * (spanIndex + 1) - itemAllSpacing * spanIndex + ex_space;
|
||||
int right = itemAllSpacing - left;
|
||||
outRect.left = left;
|
||||
outRect.right = right;
|
||||
outRect.bottom = h_space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ItemSpace(int v_space, int h_space, int ex_space) {
|
||||
this.ex_space = ex_space;
|
||||
this.h_space = h_space;
|
||||
this.v_space = v_space;
|
||||
|
||||
}
|
||||
}
|
||||
BIN
app/src/main/logo-playstore.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/author_bg.xml
Normal 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">
|
||||
<solid android:color="@color/white" />
|
||||
<corners android:radius="16dp"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/class_gray_bg.xml
Normal 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="12dp" />
|
||||
<solid android:color="@color/sub_color" />
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/im_back.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M154.5,469.3H981.3a42.7,42.7 0,1 1,0 85.3H154.5l300.7,266.9a42.7,42.7 0,1 1,-57.1 63.4l-384,-341.3a42.7,42.7 0,0 1,0 -63.4l384,-341.3a42.7,42.7 0,1 1,57.1 63.4L154.5,469.3z"
|
||||
android:fillColor="#2c2c2c"/>
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/im_both.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M747.2,283.2L54.5,283.2v692.7h692.7v-692.7zM656.8,373.6v512h-512v-512h512z"
|
||||
android:fillColor="@color/black"/>
|
||||
<path
|
||||
android:pathData="M993.3,12.4v692.7h-287.2v-90.4h196.8v-512h-512v224.4h-90.4V12.4z"
|
||||
android:fillColor="@color/black"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/im_download.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M878.6,337.2a57.8,57.8 0,0 0,-81.7 0L574.6,559.5V173a57.8,57.8 0,0 0,-115.6 0v386.5L236.8,337.2a57.8,57.8 0,0 0,-81.7 0,57.8 57.8,0 0,0 0,81.8l318.7,318.7a57.6,57.6 0,0 0,40.9 16.9c0.7,0 1.5,-0.1 2.2,-0.1 0.7,0 1.5,0.1 2.2,0.1a57.6,57.6 0,0 0,40.9 -16.9L878.6,419a57.8,57.8 0,0 0,0 -81.8zM861,908.4H165.4a57.8,57.8 0,0 1,0 -115.6h695.6a57.8,57.8 0,0 1,0 115.6z"
|
||||
android:fillColor="@color/black"/>
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/im_empty.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M271.9,728.1v-412.2c0,-30.7 18.9,-53.8 39.9,-53.8h412.2c21,0 39.9,23.6 39.9,54.3v220.2c0,2 0.5,4.1 1,5.6l14.8,-5.6v-220.2c0,-38.9 -25.1,-70.1 -56.3,-70.1h-412.2c-31.2,0 -56.3,31.2 -56.3,70.1v418.3l16.9,-6.7zM271.9,728.1v-412.2c0,-30.7 18.9,-53.8 39.9,-53.8h412.2c21,0 39.9,23.6 39.9,54.3v220.2c0,2 0.5,4.1 1,5.6l14.8,-5.6v-220.2c0,-38.9 -25.1,-70.1 -56.3,-70.1h-412.2c-31.2,0 -56.3,31.2 -56.3,70.1v418.3l16.9,-6.7zM958.5,800.8c-21.5,-16.9 -45.6,-29.7 -71.7,-38.4 -4.1,-1 -8.7,1.5 -9.7,5.6 -1,4.1 1,8.2 4.6,9.7 24.1,8.2 46.6,20.5 67.1,35.8 3.6,2.6 8.7,1.5 11.3,-2 2,-3.1 1.5,-7.7 -1.5,-10.8zM517.6,817.2c-37.9,0 -75.3,10.2 -108,30.2 -45.6,-61.4 -117.2,-97.3 -194,-97.3 -54.3,0 -107.5,18.4 -150,52.2 -3.1,3.1 -3.6,8.2 -0.5,11.3 2.6,3.1 7.2,3.6 10.2,1 39.9,-31.7 89.1,-48.6 140.3,-48.6 74.8,0 143.4,36.4 185.3,96.8 2.6,3.6 7.2,4.6 11.3,2 31.2,-21 68.1,-31.7 105.5,-31.7 35.8,0 69.6,9.7 99.8,27.6 3.6,2 8.2,1 10.8,-2 13.3,-17.9 29.2,-34.3 47.1,-47.6 3.6,-3.1 4.1,-8.2 1,-11.3 -2.6,-3.1 -7.2,-3.6 -10.8,-1.5 -17.4,12.8 -32.8,28.2 -46.1,45.1 -31.7,-16.9 -66.6,-26.1 -101.9,-26.1zM855.6,846.8c-41,-27.6 -96.3,-16.9 -123.9,23.6l-3.1,4.6c-2,3.6 -1,8.7 3.1,11.3 3.6,2 8.7,1 11.3,-3.1 8.2,-14.3 21.5,-25.1 36.9,-31.2 22.5,-8.7 47.6,-5.6 67.6,7.7 3.6,2.6 8.7,1.5 11.3,-2 1.5,-3.1 0.5,-8.2 -3.1,-10.8zM185.3,248.8c2,1.5 2,4.6 0.5,6.1m-45.1,205.3l-18.9,21c-1,1 -2.6,1 -3.6,0 -1,-1 -1,-2.6 0,-3.6l18.9,-21c1,-1 2.6,-1 3.6,0 1,1 1,2.6 0,3.6zM165.4,460.3l-18.9,21c-1,1 -2.6,1 -3.6,0 -1,-1 -1,-2.6 0,-3.6l18.9,-21c1,-1 2.6,-1 3.6,0 0.5,1 1,2.6 0,3.6zM813.1,146.4l-38.4,43c-2,2.6 -6.1,2.6 -8.2,0.5 -2.6,-2 -2.6,-6.1 -0.5,-8.2l38.4,-43c2,-2.6 6.1,-2.6 8.2,-0.5 2.6,2 2.6,5.6 0.5,8.2zM863.7,146.4l-38.4,43c-2,2.6 -6.1,2.6 -8.2,0.5 -2.6,-2 -2.6,-6.1 -0.5,-8.2l38.4,-43c2,-2.6 6.1,-2.6 8.2,-0.5 2.6,2 3.1,5.6 0.5,8.2z"
|
||||
android:fillColor="@color/sub_title_color"/>
|
||||
<path
|
||||
android:pathData="M390.1,451.6c-17.9,0.5 -32.8,-13.8 -33.3,-31.2 -0.5,-17.9 13.8,-32.8 31.2,-33.3h1.5c17.9,0.5 31.7,15.4 31.2,33.3 0.5,16.9 -13.3,30.7 -30.7,31.2zM382.5,419.3c6.1,0 10.8,-4.6 10.8,-10.8 0,-6.1 -4.6,-10.8 -10.8,-10.8 -6.1,0 -10.8,4.6 -10.8,10.8 0,6.1 4.6,10.8 10.8,10.8zM656.4,451.6c-17.9,0.5 -32.8,-13.8 -33.3,-31.2 -0.5,-17.9 13.8,-32.8 31.2,-33.3h1.5c17.9,0.5 31.7,15.4 31.2,33.3 0.5,16.9 -13.3,30.7 -30.7,31.2zM648.2,419.3c6.1,0 10.8,-4.6 10.8,-10.8 0,-6.1 -4.6,-10.8 -10.8,-10.8s-10.8,4.6 -10.8,10.8c0,6.1 5.1,10.8 10.8,10.8zM596,515.1c-2,0 -4.1,-1 -5.6,-2.6 -11.8,-12.3 -23.6,-17.9 -35.3,-17.4 -11.3,0.5 -21,7.7 -26.1,14.3 -2.6,3.6 -7.7,4.1 -11.3,1.5 -0.5,-0.5 -1,-0.5 -1,-1 -14.3,-16.4 -26.6,-15.9 -36.4,-13.8 -8.2,2 -16.4,6.7 -24.6,14.3 -3.1,3.1 -8.2,2.6 -11.3,-0.5 -3.1,-3.1 -2.6,-8.2 0.5,-11.3 10.2,-9.2 21,-15.4 31.7,-17.9 17.4,-4.6 32.8,-0.5 46.6,12.3 6.7,-6.1 17.4,-12.8 31.7,-13.8 16.4,-1 32.3,6.7 47.6,22.5 3.1,3.1 3.1,8.2 0,11.3 -2.6,1 -4.6,2 -6.7,2zM765.4,798.2c-64.5,0 -116.7,-52.2 -116.7,-116.7 0,-64.5 52.2,-116.7 116.7,-116.7 64.5,0 116.7,52.2 116.7,116.7 0,64.5 -52.2,116.7 -116.7,116.7zM707.6,666.6c-8.7,0 -16.4,7.2 -15.9,16.4 0,8.7 7.2,15.9 15.9,15.9h118.3c8.7,0 16.4,-7.2 15.9,-16.4 0,-8.7 -7.2,-15.9 -15.9,-15.9h-118.3z"
|
||||
android:fillColor="@color/sub_title_color"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/im_home.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M776.7,1010.1h-479.9c-28.3,0 -51.3,-23 -51.3,-51.3v-891.1c0,-28.3 23,-51.3 51.3,-51.3h479.9c28.3,0 51.3,23 51.3,51.3v891.1c0,28.3 -23,51.3 -51.3,51.3v0zM536.6,958.8c19.1,0 34.2,-15.4 34.2,-34.2s-15.4,-34.2 -34.2,-34.2 -34.2,15.4 -34.2,34.2 15.4,34.2 34.2,34.2v0zM776.7,119h-479.9v719.7h479.6v-719.7h0.3z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/im_lock.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M426.9,683l170.8,0c25.6,0 42.7,-17.1 42.7,-42.7L640.3,512.3c0,-25.6 -17.1,-42.7 -42.7,-42.7l0,-42.7c0,-47 -38.4,-85.4 -85.4,-85.4s-85.4,38.4 -85.4,85.4l0,42.7c-25.6,0 -42.7,17.1 -42.7,42.7l0,128.1C384.2,666 401.3,683 426.9,683zM461,426.9c0,-29.9 21.3,-51.2 51.2,-51.2s51.2,21.3 51.2,51.2l0,42.7 -102.5,0L461,426.9 461,426.9zM725.7,42.7 L298.8,42.7c-47,0 -85.4,38.4 -85.4,85.4l0,768.4c0,47 38.4,85.4 85.4,85.4l426.9,0c47,0 85.4,-38.4 85.4,-85.4L811.1,128.1C811.1,81.1 772.7,42.7 725.7,42.7zM725.7,811.1 L298.8,811.1 298.8,213.4l426.9,0L725.7,811.1z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/like_false.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M667.8,117.3C832.9,117.3 938.7,249.7 938.7,427.9c0,138.3 -125.1,290.5 -371.6,461.6a96.8,96.8 0,0 1,-110.2 0C210.4,718.4 85.3,566.1 85.3,427.9 85.3,249.7 191.1,117.3 356.2,117.3c59.6,0 100.1,20.8 155.8,68.1C567.7,138.2 608.2,117.3 667.8,117.3zM667.8,180.5c-41.4,0 -70.3,15.2 -117,55 -2.2,1.8 -14.4,12.4 -17.9,15.4a32.3,32.3 0,0 1,-41.8 0c-3.5,-3 -15.8,-13.5 -17.9,-15.4 -46.7,-39.9 -75.5,-55 -117,-55C230.2,180.5 149.3,281.3 149.3,426.7 149.3,537.6 262.9,675.2 493.6,834.8a32.4,32.4 0,0 0,36.7 0C761.1,675.3 874.7,537.6 874.7,426.7c0,-145.4 -80.9,-246.2 -206.9,-246.2z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/like_false_black.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M704,128C833.6,128 938.7,234.7 938.7,384c0,298.7 -320,469.3 -426.7,533.3C405.3,853.3 85.3,682.7 85.3,384c0,-149.3 106.7,-256 234.7,-256C399.4,128 469.3,170.7 512,213.3c42.7,-42.7 112.6,-85.3 192,-85.3zM551.9,793.8a1141.4,1141.4 0,0 0,103.3 -72.6C782.3,620.1 853.3,509.6 853.3,384c0,-100.7 -65.6,-170.7 -149.3,-170.7 -45.9,0 -95.6,24.3 -131.7,60.3L512,334l-60.3,-60.3C415.6,237.7 365.9,213.3 320,213.3 237.2,213.3 170.7,284 170.7,384c0,125.6 71.1,236.1 198.2,337.2 31.8,25.3 65.7,48.9 103.3,72.5 12.8,8.1 25.4,15.8 39.9,24.4 14.5,-8.6 27.1,-16.3 39.9,-24.4z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/like_true.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M667.8,117.3C832.9,117.3 938.7,249.7 938.7,427.9c0,138.3 -125.1,290.5 -371.6,461.6a96.8,96.8 0,0 1,-110.2 0C210.4,718.4 85.3,566.1 85.3,427.9 85.3,249.7 191.1,117.3 356.2,117.3c59.6,0 100.1,20.8 155.8,68.1C567.7,138.2 608.2,117.3 667.8,117.3z"
|
||||
android:fillColor="@color/favorite_true"/>
|
||||
</vector>
|
||||
19
app/src/main/res/drawable/loading_pb.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromDegrees="0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:toDegrees="1080.0">
|
||||
<shape
|
||||
android:innerRadiusRatio="3"
|
||||
android:shape="ring"
|
||||
android:thicknessRatio="10"
|
||||
android:useLevel="false">
|
||||
<gradient
|
||||
android:centerColor="@color/color_7d67ec"
|
||||
android:centerY="0.50"
|
||||
android:endColor="@color/color_0e0d5d"
|
||||
android:startColor="@color/color_7d67ec"
|
||||
android:type="sweep" />
|
||||
</shape>
|
||||
</rotate>
|
||||
74
app/src/main/res/drawable/logo_background.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/main_gradient_bg.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="12dp"/>
|
||||
<gradient android:angle="45"
|
||||
android:startColor="@color/color_60e9cd"
|
||||
android:centerColor="@color/color_7d67ec"
|
||||
android:endColor="@color/color_0e0d5d"/>
|
||||
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/selector_class_tab.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/main_gradient_bg" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/class_gray_bg" />
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_favorite.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/like_true" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/like_false_black" />
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_like.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/like_true" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/like_false" />
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_tab_download.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/tab_download_slected" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/tab_download" />
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_tab_home.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/tab_home_selected" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/tab_home" />
|
||||
|
||||
</selector>
|
||||
6
app/src/main/res/drawable/selector_tab_like.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/tab_favorite_selected" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/tab_favorite_noramal" />
|
||||
|
||||
</selector>
|
||||
9
app/src/main/res/drawable/tab_anmials.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/black"
|
||||
android:pathData="M633.9,409.7c-74.9,-27.9 -152.4,-30.1 -230.4,-6.9 -51.7,11.1 -104.4,39 -151.9,80.7l-3.7,2.1 -2.1,3.2a471.7,471.7 0,0 0,-83.8 101.8c-59.1,94.9 -81.7,203 -60.6,289 13.2,53.8 42.7,95.4 84.4,120.2 27.4,16.3 59.1,24.3 92.3,24.3 34.8,0 71.7,-8.4 108.6,-25.8 15.3,-7.4 30.1,-15.3 43.8,-24.8 59.6,-24.8 118.6,-11.1 158.2,5.3 38.5,24.3 79.6,39.5 118.6,43.8 43.2,5.3 84.4,-2.6 118.1,-22.7 41.7,-24.8 71.2,-66.4 84.4,-120.2 21.1,-86 -1.6,-194 -60.6,-289 -54.8,-89.1 -133.4,-154.5 -215.1,-180.9zM220.3,465.1c22.1,-28.7 34.3,-67.2 34.3,-107.2s-12.2,-78.1 -34.3,-107.2c-24,-31 -57.8,-48.4 -92.6,-48.4 -35.3,0 -68.6,17.9 -92.6,48.9 -22.1,28.7 -34.3,66.8 -34.3,106.7s12.2,78.5 34.3,107.2c24,31 57.4,48.9 92.6,48.9 34.8,0 68.6,-17.9 92.6,-48.9zM658.9,312.2c34.8,0 68.7,-17.9 92.6,-48.9 22.1,-28.7 34.3,-67.2 34.3,-107.2s-12.2,-78.5 -34.3,-107.2C727.6,17.9 694.2,0 658.9,0s-68.6,17.9 -92.6,48.9c-22.1,28.7 -34.3,67.2 -34.3,107.2s12.2,78.1 34.3,107.2c23.5,31 57.4,48.9 92.6,48.9zM364.8,312.2c35.3,0 68.6,-17.9 92.6,-48.9 22.1,-28.7 34.3,-67.2 34.3,-107.2s-12.2,-78.5 -34.3,-107.2C433.5,17.9 399.6,0.4 364.8,0.4s-68.7,17.4 -92.6,48.4c-22.1,28.7 -34.3,67.2 -34.3,107.2s12.2,78.1 34.3,107.2c24,31.1 57.4,48.9 92.6,48.9zM988.9,250.7c-24,-31 -57.8,-48.4 -92.6,-48.4 -35.3,0 -68.7,17.9 -92.6,48.9 -22.1,28.7 -34.3,66.8 -34.3,106.7s12.2,78.5 34.3,107.2c24,31 57.4,48.9 92.6,48.9 34.8,0 68.6,-17.9 92.6,-48.9 22.1,-28.7 34.3,-67.2 34.3,-107.2s-12.2,-78.1 -34.3,-107.2z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_download.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,0a512,512 0,1 1,0 1024A512,512 0,0 1,512 0zM511.4,256a47.2,47.2 0,0 0,-47.6 46.6L463.8,608.6l-62.5,-61.2a48.4,48.4 0,0 0,-67.4 0,46.1 46.1,0 0,0 0,66l143.9,141.1a47.7,47.7 0,0 0,21.8 12.2l1.6,0.4 0.8,0.1 1.3,0.2 1.2,0.3 1,0.1 0.7,0.1h0.6c0.3,0 0.6,0 0.9,0.1l1.4,0.1h2.9a48.2,48.2 0,0 0,34.3 -13.6l143.9,-141.1a46.3,46.3 0,0 0,0 -66.1,48.4 48.4,0 0,0 -67.4,0l-63.8,62.5L558.9,302.6A47.2,47.2 0,0 0,511.4 256z"
|
||||
android:fillColor="@color/sub_color"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_download_slected.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M512,0a512,512 0,1 1,0 1024A512,512 0,0 1,512 0zM511.4,256a47.2,47.2 0,0 0,-47.6 46.6L463.8,608.6l-62.5,-61.2a48.4,48.4 0,0 0,-67.4 0,46.1 46.1,0 0,0 0,66l143.9,141.1a47.7,47.7 0,0 0,21.8 12.2l1.6,0.4 0.8,0.1 1.3,0.2 1.2,0.3 1,0.1 0.7,0.1h0.6c0.3,0 0.6,0 0.9,0.1l1.4,0.1h2.9a48.2,48.2 0,0 0,34.3 -13.6l143.9,-141.1a46.3,46.3 0,0 0,0 -66.1,48.4 48.4,0 0,0 -67.4,0l-63.8,62.5L558.9,302.6A47.2,47.2 0,0 0,511.4 256z"
|
||||
android:fillColor="@color/color_0e0d5d"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_favorite_noramal.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M667.8,117.3C832.9,117.3 938.7,249.7 938.7,427.9c0,138.3 -125.1,290.5 -371.6,461.6a96.8,96.8 0,0 1,-110.2 0C210.4,718.4 85.3,566.1 85.3,427.9 85.3,249.7 191.1,117.3 356.2,117.3c59.6,0 100.1,20.8 155.8,68.1C567.7,138.2 608.2,117.3 667.8,117.3z"
|
||||
android:fillColor="@color/sub_color"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_favorite_selected.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M667.8,117.3C832.9,117.3 938.7,249.7 938.7,427.9c0,138.3 -125.1,290.5 -371.6,461.6a96.8,96.8 0,0 1,-110.2 0C210.4,718.4 85.3,566.1 85.3,427.9 85.3,249.7 191.1,117.3 356.2,117.3c59.6,0 100.1,20.8 155.8,68.1C567.7,138.2 608.2,117.3 667.8,117.3z"
|
||||
android:fillColor="@color/color_0e0d5d"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_home.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M555.5,118l312.9,224.6A117.3,117.3 0,0 1,917.3 437.9V800c0,64.8 -52.5,117.3 -117.3,117.3H640V746.7c0,-70.7 -57.3,-128 -128,-128s-128,57.3 -128,128v170.7H224c-64.8,0 -117.3,-52.5 -117.3,-117.3V437.9a117.3,117.3 0,0 1,48.9 -95.3l312.9,-224.6a74.7,74.7 0,0 1,87.1 0z"
|
||||
android:fillColor="@color/sub_color"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/tab_home_selected.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M555.5,118l312.9,224.6A117.3,117.3 0,0 1,917.3 437.9V800c0,64.8 -52.5,117.3 -117.3,117.3H640V746.7c0,-70.7 -57.3,-128 -128,-128s-128,57.3 -128,128v170.7H224c-64.8,0 -117.3,-52.5 -117.3,-117.3V437.9a117.3,117.3 0,0 1,48.9 -95.3l312.9,-224.6a74.7,74.7 0,0 1,87.1 0z"
|
||||
android:fillColor="@color/color_0e0d5d"/>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/tab_indicator.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/color_0e0d5d"/>
|
||||
<size android:height="5dp" android:width="5dp"/>
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/tab_nature.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="64dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="@color/black"
|
||||
android:pathData="M993.3,793.6q11.3,21.5 10.8,40.4t-11.3,32.8 -30.2,22 -45.1,8.2l-395.3,0 -263.2,0 -138.2,0q-27.6,0 -45.6,-10.2t-26.1,-26.1 -7.2,-35.8 11.3,-40.4q14.3,-27.6 31.2,-59.4t34.3,-64.5l34.8,-65.5q17.4,-32.8 33.8,-62.5 37.9,-70.7 76.8,-141.3l130,255 256,-475.1q68.6,120.8 132.1,236.5 27.6,49.2 56.3,101.9t56.8,103.4 53.2,97.3 44.5,83.5z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/wel_gradient_bg.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient android:angle="45"
|
||||
android:startColor="@color/color_60e9cd"
|
||||
android:centerColor="@color/color_7d67ec"
|
||||
android:endColor="@color/color_0e0d5d"/>
|
||||
|
||||
</shape>
|
||||
27
app/src/main/res/drawable/wel_pb.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="@color/sub_color" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="10dp" />
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="@color/color_0e0d5d"
|
||||
android:centerColor="@color/color_7d67ec"
|
||||
android:startColor="@color/color_60e9cd" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
39
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/home_background"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dp"
|
||||
tools:context=".ui.ActivityMain">
|
||||
|
||||
<com.hd.phone.fresh.walls.utils.CustomerTv
|
||||
android:id="@+id/textview_wallpaper"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/color_0e0d5d"
|
||||
android:textSize="19sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewpager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/tab"
|
||||
android:layout_below="@id/textview_wallpaper" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:tabBackground="@color/white"
|
||||
app:tabIndicator="@null"
|
||||
app:tabIndicatorHeight="0dp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
180
app/src/main/res/layout/activity_set.xml
Normal file
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.ActivitySet">
|
||||
|
||||
<!-- <HorizontalScrollView-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent">-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<!-- </HorizontalScrollView>-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_back"
|
||||
android:layout_width="55dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="30dp"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/im_back" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/color_main"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="@drawable/author_bg"
|
||||
android:padding="12dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_author"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/layout_set"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_header"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_toEndOf="@id/image_header"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.hd.phone.fresh.walls.utils.CustomerTv
|
||||
android:id="@+id/text_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
app:apply_font="true"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_html"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/sub_title_color"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="@id/layout_download"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_author">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/button_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/color_7d67ec"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:src="@mipmap/set_wallpaper"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_set"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/button_set"
|
||||
android:layout_alignBottom="@id/button_set"
|
||||
android:indeterminateDrawable="@drawable/loading_pb"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_download"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/layout_author"
|
||||
app:layout_constraintRight_toLeftOf="@id/image_favorite"
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_author">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_download"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/im_download" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_download"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/black"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_favorite"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:src="@drawable/selector_favorite"
|
||||
app:layout_constraintLeft_toRightOf="@id/layout_download"
|
||||
app:layout_constraintRight_toRightOf="@id/layout_author"
|
||||
app:layout_constraintTop_toTopOf="@id/layout_download" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_below="@id/imageview_back"
|
||||
android:background="@color/view_color"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent">
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminateDrawable="@drawable/loading_pb" />
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
47
app/src/main/res/layout/activity_welcome.xml
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/wel_gradient_bg"
|
||||
tools:context=".ui.ActivityWelcome">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_logo"
|
||||
android:layout_width="94dp"
|
||||
android:layout_height="94dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="260dp"
|
||||
android:src="@mipmap/logo_foreground" />
|
||||
|
||||
<com.hd.phone.fresh.walls.utils.CustomerTv
|
||||
android:id="@+id/textview_appname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/imageview_logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="19dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="33dp"
|
||||
android:layout_marginEnd="33dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:max="100"
|
||||
android:progress="10"
|
||||
android:progressDrawable="@drawable/wel_pb" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
21
app/src/main/res/layout/class_tab_view.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.hd.phone.fresh.walls.utils.CustomerTv
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/selector_class_tab"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
app:apply_font="true" />
|
||||
|
||||
</LinearLayout>
|
||||
83
app/src/main/res/layout/dialog_type.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:background="@drawable/author_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:gravity="center"
|
||||
android:id="@+id/layout_home"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/im_home" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/home"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="21dp"
|
||||
android:text="@string/type_home"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:gravity="center"
|
||||
android:id="@+id/layout_lock"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/im_lock" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lock"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:text="@string/type_lock"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:gravity="center"
|
||||
android:id="@+id/layout_both"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/im_both" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/both"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:text="@string/type_both"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
15
app/src/main/res/layout/fragment_child.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.FragmentHome">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
37
app/src/main/res/layout/fragment_like.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/list_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:id="@+id/layout_no_data"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/im_empty" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:gravity="center"
|
||||
android:id="@+id/tv_title"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/no_like_data"
|
||||
android:textColor="@color/sub_title_color"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
36
app/src/main/res/layout/fragment_main.xml
Normal 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.FragmentHome">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_class"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
app:tabBackground="@color/transparent"
|
||||
app:tabIndicator="@null"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabPaddingEnd="0dp"
|
||||
app:tabPaddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:background="@color/transparent"
|
||||
app:tabMode="scrollable" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewpager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/tab_class" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_pb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateDrawable="@drawable/loading_pb" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
23
app/src/main/res/layout/item_preview.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_favorite"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignBottom="@id/wallpaper"
|
||||
android:padding="13dp"
|
||||
android:src="@drawable/selector_like" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
21
app/src/main/res/layout/tab_custom_view.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_icon"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_indicator"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:src="@drawable/tab_indicator" />
|
||||
|
||||
</LinearLayout>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/logo.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/logo_background"/>
|
||||
<foreground android:drawable="@mipmap/logo_foreground"/>
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/logo_round.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/logo_background"/>
|
||||
<foreground android:drawable="@mipmap/logo_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/logo.webp
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-hdpi/logo_round.webp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-mdpi/logo.webp
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/logo_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xhdpi/logo.webp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/mipmap-xhdpi/logo_round.webp
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/logo.webp
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/logo_round.webp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/im_placeholder.png
Normal file
|
After Width: | Height: | Size: 506 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo.webp
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/logo_round.webp
Normal file
|
After Width: | Height: | Size: 20 KiB |