V1.0(1)
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
BIN
app/PhotoWallpaper.jks
Normal file
64
app/build.gradle.kts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import java.util.Date
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
id("io.objectbox")
|
||||||
|
}
|
||||||
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
|
android {
|
||||||
|
namespace = "com.newapp.paperwall"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.newapp.paperwall"
|
||||||
|
minSdk = 24
|
||||||
|
targetSdk = 35
|
||||||
|
versionCode = 2
|
||||||
|
versionName = "1.1"
|
||||||
|
setProperty(
|
||||||
|
"archivesBaseName",
|
||||||
|
"Photo Wallpaper_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
|
)
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = true
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.appcompat)
|
||||||
|
implementation(libs.androidx.fragment.ktx)
|
||||||
|
implementation(libs.androidx.viewpager2)
|
||||||
|
implementation(libs.material)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
implementation(libs.glide)
|
||||||
|
annotationProcessor(libs.compiler)
|
||||||
|
implementation(libs.objectbox.android)
|
||||||
|
annotationProcessor(libs.objectbox.processor)
|
||||||
|
implementation(libs.okhttp)
|
||||||
|
}
|
||||||
92
app/objectbox-models/default.json
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
"_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": "1:473534968661854659",
|
||||||
|
"lastPropertyId": "13:2758783041590214628",
|
||||||
|
"name": "Data",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "1:8456440925235345467",
|
||||||
|
"name": "id",
|
||||||
|
"type": 6,
|
||||||
|
"flags": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2:3853253176314558448",
|
||||||
|
"name": "categoryName",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "3:8514301063930589668",
|
||||||
|
"name": "imId",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "4:7889975261281064274",
|
||||||
|
"name": "description",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5:8488704057249354926",
|
||||||
|
"name": "fullUrl",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "6:4092527141419432230",
|
||||||
|
"name": "previewUrl1080",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "7:3674656561950545322",
|
||||||
|
"name": "previewUrl400",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "8:8178810497709680612",
|
||||||
|
"name": "previewUrl200",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "9:5363050702337268543",
|
||||||
|
"name": "authorName",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "10:2247221557154814124",
|
||||||
|
"name": "authorHeader",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "11:4843180988851382577",
|
||||||
|
"name": "authorHtml",
|
||||||
|
"type": 9
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "12:8063623000305599548",
|
||||||
|
"name": "isLike",
|
||||||
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "13:2758783041590214628",
|
||||||
|
"name": "isDownload",
|
||||||
|
"type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"relations": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lastEntityId": "1:473534968661854659",
|
||||||
|
"lastIndexId": "0:0",
|
||||||
|
"lastRelationId": "0:0",
|
||||||
|
"lastSequenceId": "0:0",
|
||||||
|
"modelVersion": 5,
|
||||||
|
"modelVersionParserMinimum": 5,
|
||||||
|
"retiredEntityUids": [],
|
||||||
|
"retiredIndexUids": [],
|
||||||
|
"retiredPropertyUids": [],
|
||||||
|
"retiredRelationUids": [],
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 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
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.newapp.paperwall
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("com.newapp.paperwall", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
45
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
|
android:maxSdkVersion="32" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name=".BaseApp"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_logo"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_logo_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.WelWallpaper"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".uiview.StartActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.WelWallpaper">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".uiview.CategoryListActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".uiview.MainActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".uiview.DetailActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
<activity
|
||||||
|
android:name=".uiview.SearchActivity"
|
||||||
|
android:exported="false" />
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
20703
app/src/main/assets/Animals.json
Normal file
20703
app/src/main/assets/Experimental.json
Normal file
20703
app/src/main/assets/Featured.json
Normal file
20703
app/src/main/assets/Film.json
Normal file
20702
app/src/main/assets/Nature.json
Normal file
20702
app/src/main/assets/Patterns.json
Normal file
20679
app/src/main/assets/Street.json
Normal file
20702
app/src/main/assets/Travel.json
Normal file
BIN
app/src/main/assets/custfont.ttf
Normal file
BIN
app/src/main/ic_logo-playstore.png
Normal file
|
After Width: | Height: | Size: 304 KiB |
109
app/src/main/java/com/newapp/paperwall/BaseApp.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package com.newapp.paperwall;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
import com.newapp.paperwall.tools.JsonData;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class BaseApp extends Application {
|
||||||
|
public static Context mAppContext;
|
||||||
|
|
||||||
|
public static String TAG = "-------MyApp---------";
|
||||||
|
public static Typeface regularFont;
|
||||||
|
|
||||||
|
|
||||||
|
private String animaLs = "Animals.json";
|
||||||
|
private String experiment = "Experimental.json";
|
||||||
|
private String film = "Film.json";
|
||||||
|
private String nature = "Nature.json";
|
||||||
|
private String patterns = "Patterns.json";
|
||||||
|
private String street = "Street.json";
|
||||||
|
private String travel = "Travel.json";
|
||||||
|
private String wallpaper = "Featured.json";
|
||||||
|
private ExecutorService executor;
|
||||||
|
private static List<String> CategoryNames = new ArrayList<>();
|
||||||
|
private int i = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
mAppContext = this;
|
||||||
|
regularFont = Typeface.createFromAsset(getAssets(), "custfont.ttf");
|
||||||
|
Log.d("YYYYYYY","init before");
|
||||||
|
DbManager.init(this);
|
||||||
|
executor = Executors.newFixedThreadPool(8);
|
||||||
|
String[] names = {wallpaper, animaLs, experiment, film, nature, patterns, street, travel};
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (String name : names) {
|
||||||
|
InputStream open = getAssets().open(name);
|
||||||
|
String covertStr = UiUtils.getCovertStr(open);
|
||||||
|
Log.d("YYYYYY",covertStr);
|
||||||
|
if (!covertStr.isEmpty()) {
|
||||||
|
String realName = name.substring(0, name.indexOf("."));
|
||||||
|
CategoryNames.add(realName);
|
||||||
|
executor.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
i++;
|
||||||
|
Log.d(TAG, "------------111");
|
||||||
|
JsonData.INSTANCE.getData(covertStr, realName);
|
||||||
|
// if (i == 8) {
|
||||||
|
// executor.shutdown();
|
||||||
|
// Log.d(MyWallpaper.TAG, "------------data complete");
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getCategoryNames() {
|
||||||
|
return CategoryNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
123
app/src/main/java/com/newapp/paperwall/adapter/HomeAdapter.java
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
package com.newapp.paperwall.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.RenderEffect;
|
||||||
|
import android.graphics.Shader;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.load.DataSource;
|
||||||
|
import com.bumptech.glide.load.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.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.bumptech.glide.request.RequestListener;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.databinding.ItemHomeBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.OnItemClickListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.HomeParentHolder> {
|
||||||
|
private List<String> data = new ArrayList<>();
|
||||||
|
private Context mContext;
|
||||||
|
private OnItemClickListener listener;
|
||||||
|
private MultiTransformation<Bitmap> multiTransformation = new MultiTransformation<>(
|
||||||
|
new CenterCrop(),
|
||||||
|
new RoundedCorners(UiUtils.dp2Px(20)) // 圆角效果
|
||||||
|
);
|
||||||
|
|
||||||
|
public void setData(List<String> data) {
|
||||||
|
this.data = data;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfoWallpaperListener(OnItemClickListener onItemClickListener) {
|
||||||
|
this.listener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public HomeParentHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
ItemHomeBinding inflate = ItemHomeBinding.inflate(LayoutInflater.from(mContext), parent, false);
|
||||||
|
return new HomeParentHolder(inflate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull HomeParentHolder holder, int position) {
|
||||||
|
String name = data.get(position);
|
||||||
|
List<Data> data1 = DbManager.queryHome(name);
|
||||||
|
String previewUrl400 = data1.get(0).getPreviewUrl1080();
|
||||||
|
|
||||||
|
holder.itemBing.tvClassName.setText(name);
|
||||||
|
if(position==getItemCount()-1){
|
||||||
|
holder.itemBing.bottomView.setVisibility(View.VISIBLE);
|
||||||
|
}else{
|
||||||
|
holder.itemBing.bottomView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
RenderEffect blurEffect = RenderEffect.createBlurEffect(60, 60, Shader.TileMode.CLAMP);
|
||||||
|
holder.itemBing.llBlur.setRenderEffect(blurEffect);
|
||||||
|
}
|
||||||
|
Glide.with(mContext)
|
||||||
|
.asDrawable()
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.load(previewUrl400)
|
||||||
|
// .centerCrop()
|
||||||
|
.listener(new RequestListener<Drawable>() {
|
||||||
|
@Override
|
||||||
|
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
|
||||||
|
Log.d(BaseApp.TAG, "------------e="+e.getMessage()+"---previewUrl400="+previewUrl400);
|
||||||
|
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.img_placeholder)
|
||||||
|
// .transform(multiTransformation)
|
||||||
|
.into(holder.itemBing.preview);
|
||||||
|
|
||||||
|
// initChild(holder,data1);
|
||||||
|
holder.itemBing.preview.setOnClickListener(v -> listener.onClickMore(name));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return data.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
static class HomeParentHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
private ItemHomeBinding itemBing;
|
||||||
|
|
||||||
|
public HomeParentHolder(@NonNull ItemHomeBinding itemView) {
|
||||||
|
super(itemView.getRoot());
|
||||||
|
itemBing = itemView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,252 @@
|
|||||||
|
package com.newapp.paperwall.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
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.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.OnItemClickListener;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class ThreeLinesAdapter extends RecyclerView.Adapter<ThreeLinesAdapter.MyViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
private List<Data> dataInfo = new ArrayList<>();
|
||||||
|
|
||||||
|
private OnItemClickListener onItemClickListener;
|
||||||
|
private WeakReference<Context> weakReference;
|
||||||
|
private int itemHeight;
|
||||||
|
|
||||||
|
|
||||||
|
public void setInfoWallpaperListener(OnItemClickListener onItemClickListener) {
|
||||||
|
this.onItemClickListener = onItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThreeLinesAdapter(Context myCon, int itemHeight) {
|
||||||
|
weakReference = new WeakReference<>(myCon);
|
||||||
|
this.itemHeight = itemHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
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_like, parent, false);
|
||||||
|
ImageView imageView = itemView.findViewById(R.id.wallpaper);
|
||||||
|
ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
||||||
|
layoutParams.height = itemHeight;
|
||||||
|
imageView.setLayoutParams(layoutParams);
|
||||||
|
return new MyViewHolder(itemView);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||||
|
Data info = dataInfo.get(position);
|
||||||
|
ImageView imageView = holder.getImageView();
|
||||||
|
String previewUrl400 = info.getPreviewUrl400();
|
||||||
|
String previewUrl200 = info.getPreviewUrl200();
|
||||||
|
RelativeLayout item = holder.getLayout();
|
||||||
|
String imId = info.getImId();
|
||||||
|
int curheight;
|
||||||
|
|
||||||
|
|
||||||
|
MultiTransformation<Bitmap> multiTransformation = new MultiTransformation<>(
|
||||||
|
new CenterCrop()
|
||||||
|
// new RoundedCorners(CommonUtils.dp2Px(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(previewUrl400)
|
||||||
|
.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.img_placeholder)
|
||||||
|
.transform(multiTransformation)
|
||||||
|
.into(imageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageView imFavorite = holder.imFavorite;
|
||||||
|
// imFavorite.setSelected(info.isLike());
|
||||||
|
|
||||||
|
// 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 (onItemClickListener != null) {
|
||||||
|
onItemClickListener.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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
package com.newapp.paperwall.adapter;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
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.engine.DiskCacheStrategy;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.CollectListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WallpaperAdapter extends RecyclerView.Adapter<WallpaperAdapter.ViewHolder> {
|
||||||
|
|
||||||
|
private List<Data> wallPapers;
|
||||||
|
private Context myContext;
|
||||||
|
private CollectListener listener;
|
||||||
|
|
||||||
|
public WallpaperAdapter(Context myCon,List<Data> wallPapers) {
|
||||||
|
this.myContext=myCon;
|
||||||
|
this.wallPapers=wallPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListener(CollectListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
|
public void setDataInfo(List<Data> dataInfo) {
|
||||||
|
this.wallPapers = dataInfo;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
|
.inflate(R.layout.item_wallpaper, parent, false);
|
||||||
|
return new ViewHolder(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||||
|
Data wallpaper = wallPapers.get(position);
|
||||||
|
MultiTransformation<Bitmap> multiTransformation = new MultiTransformation<>(
|
||||||
|
new CenterCrop(),
|
||||||
|
new RoundedCorners(UiUtils.dp2Px(12)) // 圆角效果
|
||||||
|
);
|
||||||
|
Glide.with(myContext)
|
||||||
|
.load(wallpaper.getPreviewUrl1080())
|
||||||
|
.placeholder(R.mipmap.img_placeholder)
|
||||||
|
.transform(multiTransformation)
|
||||||
|
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||||
|
.into(holder.imageView);
|
||||||
|
holder.rlSet.setOnClickListener(v->{
|
||||||
|
listener.onSetClick(wallpaper,position);
|
||||||
|
});
|
||||||
|
holder.imageView.setClipToOutline(true);
|
||||||
|
holder.rlDown.setOnClickListener(v->{
|
||||||
|
listener.onDownloadClick(wallpaper,position);
|
||||||
|
});
|
||||||
|
holder.imgCollect.setSelected(true);
|
||||||
|
holder.imgCollect.setOnClickListener(v->{
|
||||||
|
if(position>=0&&position< wallPapers.size()){
|
||||||
|
boolean selected = holder.imgCollect.isSelected();
|
||||||
|
holder.imgCollect.setSelected(!selected);
|
||||||
|
boolean selectedNew = holder.imgCollect.isSelected();
|
||||||
|
wallpaper.setLike(selectedNew);
|
||||||
|
DbManager.updateLike(wallpaper);
|
||||||
|
listener.onRemoveClick(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.tvName.setText(wallpaper.getDescription());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return wallPapers.size();
|
||||||
|
}
|
||||||
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
ImageView imageView;
|
||||||
|
RelativeLayout rlSet;
|
||||||
|
RelativeLayout rlDown;
|
||||||
|
ImageView imgCollect;
|
||||||
|
TextView tvName;
|
||||||
|
ImageView imgSet;
|
||||||
|
|
||||||
|
public ViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
imageView = view.findViewById(R.id.wallpaper);
|
||||||
|
rlSet = view.findViewById(R.id.rlSet);
|
||||||
|
imgSet = view.findViewById(R.id.imgSet);
|
||||||
|
rlDown = view.findViewById(R.id.rlDown);
|
||||||
|
imgCollect = view.findViewById(R.id.imgCollect);
|
||||||
|
tvName = view.findViewById(R.id.tvName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
159
app/src/main/java/com/newapp/paperwall/javabean/Data.java
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
package com.newapp.paperwall.javabean;
|
||||||
|
|
||||||
|
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 categoryName;
|
||||||
|
|
||||||
|
|
||||||
|
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 getCategoryName() {
|
||||||
|
return categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryName(String categoryName) {
|
||||||
|
this.categoryName = categoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.newapp.paperwall.listener;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
|
||||||
|
public interface ChangeCollectListener {
|
||||||
|
void onAdd(Data data);
|
||||||
|
void onRemove(Data data);
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.newapp.paperwall.listener;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
|
||||||
|
public interface CollectListener {
|
||||||
|
void onSetClick(Data data,int position);
|
||||||
|
void onDownloadClick(Data data,int position);
|
||||||
|
void onRemoveClick(int position);
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.newapp.paperwall.listener;
|
||||||
|
|
||||||
|
public interface DialogListener {
|
||||||
|
|
||||||
|
void onSelectType(int type);
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.newapp.paperwall.listener;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LikeListListener {
|
||||||
|
void onLikeList(List<Data> dataList);
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.newapp.paperwall.listener;
|
||||||
|
|
||||||
|
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
|
||||||
|
public interface OnItemClickListener {
|
||||||
|
|
||||||
|
void onItemClickAction(Data info);
|
||||||
|
|
||||||
|
default void onClickMore(String name){}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.newapp.paperwall.tools;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
|
||||||
|
|
||||||
|
public class CustTxtView extends androidx.appcompat.widget.AppCompatTextView {
|
||||||
|
|
||||||
|
|
||||||
|
public CustTxtView(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(BaseApp.regularFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedArray.recycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
161
app/src/main/java/com/newapp/paperwall/tools/DbManager.java
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
package com.newapp.paperwall.tools;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.javabean.Data_;
|
||||||
|
import com.newapp.paperwall.javabean.MyObjectBox;
|
||||||
|
import com.newapp.paperwall.listener.LikeListListener;
|
||||||
|
import com.newapp.paperwall.listener.ChangeCollectListener;
|
||||||
|
|
||||||
|
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 List<ChangeCollectListener> list = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
public static void init(Context context) {
|
||||||
|
boxStore = MyObjectBox.builder().androidContext(context).build();
|
||||||
|
Log.d("YYYYYYY","init success");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Box<Data> getObjectBoxLike() {
|
||||||
|
if (LikeBox == null) {
|
||||||
|
LikeBox = boxStore.boxFor(Data.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
return LikeBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addData(Data data) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
String imId = data.getImId();
|
||||||
|
Data first = objectBoxLike.query()
|
||||||
|
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||||
|
.build()
|
||||||
|
.findFirst();
|
||||||
|
if (first == null) {
|
||||||
|
Log.d(BaseApp.TAG, "-----------addData " + imId);
|
||||||
|
objectBoxLike.put(data);
|
||||||
|
}else {
|
||||||
|
Log.d(BaseApp.TAG, "-----------忽略添加 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataSubscription setLikeDataListener(LikeListListener 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(BaseApp.TAG, "------data=" + data.size());
|
||||||
|
listener.onLikeList(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void updateLike(Data boxLike) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
String imId = boxLike.getImId();
|
||||||
|
|
||||||
|
objectBoxLike.put(boxLike);
|
||||||
|
for (ChangeCollectListener listener : list) {
|
||||||
|
listener.onAdd(boxLike);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void insertOrUpdateDownload(Data boxLike) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
String imId = boxLike.getImId();
|
||||||
|
Log.d("YYYYYYY","imId is "+imId);
|
||||||
|
Data first = objectBoxLike.query()
|
||||||
|
.equal(Data_.imId, imId, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||||
|
.build()
|
||||||
|
.findFirst();
|
||||||
|
if (first == null) {
|
||||||
|
Log.d(BaseApp.TAG, "-----------添加11 Download=" + imId);
|
||||||
|
boxLike.setDownload(true);
|
||||||
|
objectBoxLike.put(boxLike);
|
||||||
|
} else {
|
||||||
|
first.setDownload(true);
|
||||||
|
objectBoxLike.put(first);
|
||||||
|
Log.d(BaseApp.TAG, "-----------已经存在添加22 Download=" + imId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static List<Data> search(String name) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
List<Data> data = objectBoxLike.query()
|
||||||
|
.contains(Data_.description, name, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||||
|
.build()
|
||||||
|
.find();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
public static List<Data> queryHome(String name) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
List<Data> data = objectBoxLike.query()
|
||||||
|
.equal(Data_.categoryName, name, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||||
|
.build()
|
||||||
|
.find(10, 1);
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static List<Data> queryCategoryAll(String name) {
|
||||||
|
Box<Data> objectBoxLike = getObjectBoxLike();
|
||||||
|
List<Data> data = objectBoxLike.query()
|
||||||
|
.equal(Data_.categoryName, name, QueryBuilder.StringOrder.CASE_SENSITIVE)
|
||||||
|
.build()
|
||||||
|
.find(0, 200);
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
56
app/src/main/java/com/newapp/paperwall/tools/ItemSpace.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package com.newapp.paperwall.tools;
|
||||||
|
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
public class 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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
233
app/src/main/java/com/newapp/paperwall/tools/JsonData.kt
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
package com.newapp.paperwall.tools
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ContentValues
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
|
import android.provider.MediaStore
|
||||||
|
import android.util.Log
|
||||||
|
import androidx.core.app.ActivityCompat
|
||||||
|
import com.newapp.paperwall.BaseApp
|
||||||
|
import com.newapp.paperwall.javabean.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.ByteArrayOutputStream
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
|
object JsonData {
|
||||||
|
|
||||||
|
|
||||||
|
fun getData(jsonStr: String, category: 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 300) {
|
||||||
|
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
|
||||||
|
categoryName = category
|
||||||
|
description = text_description
|
||||||
|
fullUrl = download
|
||||||
|
previewUrl1080 = regular
|
||||||
|
previewUrl400 = small
|
||||||
|
previewUrl200 = thumb
|
||||||
|
authorName = name
|
||||||
|
authorHeader = header_large
|
||||||
|
authorHtml = user_html
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DbManager.addData(bean)
|
||||||
|
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) {
|
||||||
|
Log.d("YYYYYYY","erroris$e")
|
||||||
|
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 {
|
||||||
|
Log.d("YYYYYYY","write error")
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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(BaseApp.TAG, "-----------------e=${e.printStackTrace()}")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
} ?: run {
|
||||||
|
Log.d(BaseApp.TAG, "----------------false")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
144
app/src/main/java/com/newapp/paperwall/tools/UiUtils.java
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
package com.newapp.paperwall.tools;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
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.newapp.paperwall.BaseApp;
|
||||||
|
|
||||||
|
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 UiUtils {
|
||||||
|
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 = BaseApp.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) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||||
|
}
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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 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,65 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
|
||||||
|
import com.newapp.paperwall.adapter.ThreeLinesAdapter;
|
||||||
|
import com.newapp.paperwall.databinding.ActivityCategoryListBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.OnItemClickListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
import com.newapp.paperwall.tools.ItemSpace;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CategoryListActivity extends AppCompatActivity implements OnItemClickListener {
|
||||||
|
private ActivityCategoryListBinding vb;
|
||||||
|
|
||||||
|
private String categoryName;
|
||||||
|
public static final String key_index = "index";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityCategoryListBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
UiUtils.initFull(this, true);
|
||||||
|
categoryName = getIntent().getStringExtra(key_index);
|
||||||
|
vb.name.setText(categoryName);
|
||||||
|
initList();
|
||||||
|
vb.imageviewBack.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initList() {
|
||||||
|
List<Data> data = DbManager.queryCategoryAll(categoryName);
|
||||||
|
ItemSpace itemSpace = new ItemSpace(10, 10, 0);
|
||||||
|
// StaggeredGridLayoutManager gridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
|
||||||
|
vb.list.addItemDecoration(itemSpace);
|
||||||
|
vb.list.setLayoutManager(gridLayoutManager);
|
||||||
|
int height = UiUtils.dp2Px(240);
|
||||||
|
ThreeLinesAdapter threeLinesAdapter = new ThreeLinesAdapter(this, height);
|
||||||
|
threeLinesAdapter.setDataInfo(data);
|
||||||
|
threeLinesAdapter.setInfoWallpaperListener(this);
|
||||||
|
vb.list.setAdapter(threeLinesAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickAction(Data info) {
|
||||||
|
Intent intent = new Intent(this, DetailActivity.class);
|
||||||
|
intent.putExtra(UiUtils.key_info, info);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,348 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
import android.app.WallpaperManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.adapter.WallpaperAdapter;
|
||||||
|
import com.newapp.paperwall.databinding.FragCollectBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.CollectListener;
|
||||||
|
import com.newapp.paperwall.listener.DialogListener;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
import com.newapp.paperwall.tools.JsonData;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import io.objectbox.reactive.DataSubscription;
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function2;
|
||||||
|
import okhttp3.Call;
|
||||||
|
|
||||||
|
|
||||||
|
public class CollectFragment extends Fragment implements CollectListener, DialogListener {
|
||||||
|
|
||||||
|
private FragCollectBinding vb;
|
||||||
|
private DataSubscription dataSubscription;
|
||||||
|
private WallpaperAdapter wallpaperAdapter;
|
||||||
|
private List<Data> wallPapers = new ArrayList<>();
|
||||||
|
private int permissionCode = 1;
|
||||||
|
private SettingDialog dialogType;
|
||||||
|
private Map<String, File> downloadedFilesMap = new HashMap<>();
|
||||||
|
private Call call;
|
||||||
|
private WeakReference<FragmentActivity> weakReference;
|
||||||
|
private Data thisData;
|
||||||
|
private Data thisDownData;
|
||||||
|
private String mSavePath;
|
||||||
|
private String fullUrl;
|
||||||
|
private String fullDownUrl;
|
||||||
|
private WallpaperManager wallpaperManager;
|
||||||
|
private boolean isDownloading = false;
|
||||||
|
|
||||||
|
public CollectFragment() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CollectFragment newInstance() {
|
||||||
|
CollectFragment fragment = new CollectFragment();
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
setTransform();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
vb = FragCollectBinding.inflate(getLayoutInflater());
|
||||||
|
vb.tvNoData.setText(getString(R.string.no_like_data));
|
||||||
|
initList();
|
||||||
|
wallpaperManager = WallpaperManager.getInstance(requireActivity());
|
||||||
|
return vb.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initList() {
|
||||||
|
wallpaperAdapter = new WallpaperAdapter(requireContext(), new ArrayList<>());
|
||||||
|
dataSubscription = DbManager.setLikeDataListener(dataList -> {
|
||||||
|
Log.d(BaseApp.TAG, "------size = " + dataList.size());
|
||||||
|
if (dataList.isEmpty()) {
|
||||||
|
vb.layoutNoData.setVisibility(View.VISIBLE);
|
||||||
|
vb.llCollect.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
vb.layoutNoData.setVisibility(View.GONE);
|
||||||
|
vb.llCollect.setVisibility(View.VISIBLE);
|
||||||
|
wallpaperAdapter.setDataInfo(dataList);
|
||||||
|
wallpaperAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wallpaperAdapter.setListener(this);
|
||||||
|
vb.viewPager2.setAdapter(wallpaperAdapter);
|
||||||
|
vb.viewPager2.setOffscreenPageLimit(1);
|
||||||
|
setTransform();
|
||||||
|
// 设置初始页面为中间位置
|
||||||
|
vb.viewPager2.setCurrentItem(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置页面变换器,用于实现中间大左右小的效果
|
||||||
|
private void setTransform() {
|
||||||
|
vb.viewPager2.setPageTransformer((page, position) -> {
|
||||||
|
if (page.getWidth() == 0) return;
|
||||||
|
|
||||||
|
float scaleFactor = 0.8f;
|
||||||
|
float translateX = page.getWidth() * -position * (1 - scaleFactor);
|
||||||
|
|
||||||
|
page.post(() -> {
|
||||||
|
if (position < -1) {
|
||||||
|
page.setScaleX(scaleFactor);
|
||||||
|
page.setScaleY(scaleFactor);
|
||||||
|
page.setTranslationX(translateX);
|
||||||
|
} else if (position <= 1) {
|
||||||
|
float scale = 1 - Math.abs(position) * (1 - scaleFactor);
|
||||||
|
page.setScaleX(scale);
|
||||||
|
page.setScaleY(scale);
|
||||||
|
page.setTranslationX(translateX);
|
||||||
|
} else {
|
||||||
|
page.setScaleX(scaleFactor);
|
||||||
|
page.setScaleY(scaleFactor);
|
||||||
|
page.setTranslationX(translateX);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onItemClickAction(Data info) {
|
||||||
|
// Intent intent = new Intent(requireContext(), DetailActivity.class);
|
||||||
|
// intent.putExtra(CommonUtils.key_info, info);
|
||||||
|
// startActivity(intent);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
isDownloading = false;
|
||||||
|
deleteCacheFiles();
|
||||||
|
if (dataSubscription != null) {
|
||||||
|
dataSubscription.cancel();
|
||||||
|
}
|
||||||
|
if (call != null) {
|
||||||
|
call.cancel();
|
||||||
|
}
|
||||||
|
Log.d(BaseApp.TAG, "------favoriteFragment-onDestroyView");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSetClick(Data data, int position) {
|
||||||
|
thisData = data;
|
||||||
|
fullUrl = thisData.getFullUrl();
|
||||||
|
mSavePath = JsonData.INSTANCE.getSaveFilePath(requireActivity(), data.getImId());
|
||||||
|
if (dialogType == null) {
|
||||||
|
dialogType = new SettingDialog();
|
||||||
|
dialogType.setListener(CollectFragment.this);
|
||||||
|
}
|
||||||
|
if (!dialogType.isAdded()) {
|
||||||
|
dialogType.show(getChildFragmentManager(), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDownloadClick(Data data, int position) {
|
||||||
|
boolean permission = JsonData.INSTANCE.requestPermission(requireActivity(), permissionCode);
|
||||||
|
if (isDownloading) {
|
||||||
|
Toast.makeText(requireActivity(), "正在下载中,请稍候...", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!permission) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isDownloading = true;
|
||||||
|
thisDownData = data;
|
||||||
|
Log.d("YYYYYYY", "position is " + position);
|
||||||
|
Log.d("YYYYYYY", "wallpapper is " + thisDownData.getDescription());
|
||||||
|
weakReference = new WeakReference<>(requireActivity());
|
||||||
|
mSavePath = JsonData.INSTANCE.getSaveFilePath(requireActivity(), data.getImId());
|
||||||
|
Log.d("YYYYYYY", "fullDownUrl is " + thisDownData.getFullUrl());
|
||||||
|
fullDownUrl = data.getFullUrl();
|
||||||
|
startSaveToAlbum();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoveClick(int position) {
|
||||||
|
vb.viewPager2.setCurrentItem(Math.max(0, vb.viewPager2.getCurrentItem() - 1), true);
|
||||||
|
setTransform();
|
||||||
|
vb.viewPager2.requestLayout();
|
||||||
|
wallpaperAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelectType(int type) {
|
||||||
|
vb.searchPb.setVisibility(View.VISIBLE);
|
||||||
|
// 从 Map 中获取当前图片对应的已下载文件
|
||||||
|
File downloadedFile = downloadedFilesMap.get(thisData.getImId());
|
||||||
|
|
||||||
|
if (downloadedFile != null && downloadedFile.exists()) {
|
||||||
|
new Thread(() -> {
|
||||||
|
setWallpaper(downloadedFile, type);
|
||||||
|
}).start();
|
||||||
|
} else {
|
||||||
|
// 如果未下载,则重新下载
|
||||||
|
call = JsonData.INSTANCE.downloadFile(fullUrl, mSavePath, (aBoolean, inputStream) -> {
|
||||||
|
if (aBoolean) {
|
||||||
|
File file = new File(mSavePath);
|
||||||
|
if (file.exists()) {
|
||||||
|
// 下载成功后存入 Map
|
||||||
|
downloadedFilesMap.put(thisData.getImId(), file);
|
||||||
|
setWallpaper(file, type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(requireActivity(), 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 SettingDialog.type_home:
|
||||||
|
wallpaperManager.setStream(
|
||||||
|
fileInputStream,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
WallpaperManager.FLAG_SYSTEM
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case SettingDialog.type_lock:
|
||||||
|
wallpaperManager.setStream(
|
||||||
|
fileInputStream,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
WallpaperManager.FLAG_LOCK
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case SettingDialog.type_both:
|
||||||
|
wallpaperManager.setStream(fileInputStream);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
deleteCacheFiles();
|
||||||
|
requireActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
Toast.makeText(requireActivity(), getString(R.string.set_success), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception exception) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
Toast.makeText(requireActivity(), getString(R.string.set_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteCacheFiles() {
|
||||||
|
for (File file : downloadedFilesMap.values()) {
|
||||||
|
if (file != null && file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
downloadedFilesMap.clear(); // 清空 Map
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSaveToAlbum() {
|
||||||
|
vb.searchPb.setVisibility(View.VISIBLE);
|
||||||
|
// 从 Map 中获取当前图片的已下载文件
|
||||||
|
File downloadedFile = downloadedFilesMap.get(thisDownData.getImId());
|
||||||
|
Log.d("YYYYYY", "download" + downloadedFile);
|
||||||
|
if (downloadedFile != null && downloadedFile.exists()) {
|
||||||
|
startSave(downloadedFile);
|
||||||
|
} else {
|
||||||
|
doDownload(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSave(File file) {
|
||||||
|
DbManager.insertOrUpdateDownload(thisDownData);
|
||||||
|
Uri uri = JsonData.INSTANCE.saveToGallery(requireActivity(), file);
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
if (uri == null) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(requireActivity(), getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// deleteCacheFile();
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(requireActivity(), getString(R.string.save_success), Toast.LENGTH_SHORT).show();
|
||||||
|
requestTransform();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Log.d(BaseApp.TAG, "--------path=" + file.getAbsolutePath() + "---uri=" + uri);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
private void requestTransform() {
|
||||||
|
vb.viewPager2.post(() -> {
|
||||||
|
int currentItem = vb.viewPager2.getCurrentItem();
|
||||||
|
vb.viewPager2.setCurrentItem(currentItem, false); // 无动画跳转当前页
|
||||||
|
setTransform(); // 重新应用变换
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doDownload(boolean showMsg, boolean save) {
|
||||||
|
call = JsonData.INSTANCE.downloadFile(fullDownUrl, mSavePath, (aBoolean, inputStream) -> {
|
||||||
|
isDownloading = false;
|
||||||
|
if (aBoolean) {
|
||||||
|
File file = new File(mSavePath);
|
||||||
|
if (file.exists()) {
|
||||||
|
// 存入 Map
|
||||||
|
downloadedFilesMap.put(thisDownData.getImId(), file);
|
||||||
|
if (save) {
|
||||||
|
startSave(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
Toast.makeText(requireActivity(), getString(R.string.download_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
requestTransform();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,413 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.WallpaperManager;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
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.drawable.DrawableTransitionOptions;
|
||||||
|
import com.bumptech.glide.request.RequestListener;
|
||||||
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
|
import com.bumptech.glide.request.target.Target;
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.databinding.ActivityDetailBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.DialogListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
import com.newapp.paperwall.tools.JsonData;
|
||||||
|
|
||||||
|
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 DetailActivity extends AppCompatActivity implements DialogListener {
|
||||||
|
|
||||||
|
private WeakReference<DetailActivity> weakReference;
|
||||||
|
private Data data;
|
||||||
|
private WallpaperManager wallpaperManager;
|
||||||
|
|
||||||
|
|
||||||
|
private ActivityDetailBinding vb;
|
||||||
|
|
||||||
|
|
||||||
|
private int permissionCode = 1;
|
||||||
|
private String mSavePath;
|
||||||
|
private String imId;
|
||||||
|
private String fullUrl;
|
||||||
|
|
||||||
|
private SettingDialog dialogType;
|
||||||
|
|
||||||
|
private File downloadFile;
|
||||||
|
private Call call;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityDetailBinding.inflate(getLayoutInflater());
|
||||||
|
UiUtils.initFull(this, true);
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
weakReference = new WeakReference<>(this);
|
||||||
|
data = (Data) getIntent().getSerializableExtra(UiUtils.key_info);
|
||||||
|
if (data == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
imId = data.getImId();
|
||||||
|
mSavePath = JsonData.INSTANCE.getSaveFilePath(this, imId);
|
||||||
|
wallpaperManager = WallpaperManager.getInstance(this);
|
||||||
|
initClick();
|
||||||
|
loadDetail();
|
||||||
|
vb.tvContent.setText(data.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
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[] screenWidthHeight = UiUtils.getScreenWidthHeight(this);
|
||||||
|
Log.d(BaseApp.TAG, "--------width=" + screenWidthHeight[0] + "----height=" + screenWidthHeight[1]);
|
||||||
|
if (file.exists()) {
|
||||||
|
Glide.with(this)
|
||||||
|
.load(file)
|
||||||
|
.apply(options)
|
||||||
|
.placeholder(R.mipmap.img_placeholder)
|
||||||
|
// .override(screenWidthHeight[0], screenWidthHeight[1])
|
||||||
|
.transition(DrawableTransitionOptions.withCrossFade(500))
|
||||||
|
.into(vb.imageviewPreview);
|
||||||
|
} else {
|
||||||
|
Glide.with(this)
|
||||||
|
.asDrawable()
|
||||||
|
.load(previewUrl1080)
|
||||||
|
.apply(options)
|
||||||
|
.skipMemoryCache(true)
|
||||||
|
|
||||||
|
.placeholder(R.mipmap.img_placeholder)
|
||||||
|
.thumbnail(
|
||||||
|
Glide.with(DetailActivity.this)
|
||||||
|
.asDrawable()
|
||||||
|
.load(previewUrl400)
|
||||||
|
.apply(options)
|
||||||
|
.placeholder(R.mipmap.img_placeholder)
|
||||||
|
.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(BaseApp.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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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.layoutSet.setOnClickListener(v -> {
|
||||||
|
if (dialogType == null) {
|
||||||
|
dialogType = new SettingDialog();
|
||||||
|
dialogType.setListener(DetailActivity.this);
|
||||||
|
}
|
||||||
|
if (!dialogType.isAdded()) {
|
||||||
|
dialogType.show(getSupportFragmentManager(), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
vb.imageFavorite.setOnClickListener(v -> {
|
||||||
|
boolean selected = vb.imageFavorite.isSelected();
|
||||||
|
vb.imageFavorite.setSelected(!selected);
|
||||||
|
boolean selectedNew = vb.imageFavorite.isSelected();
|
||||||
|
data.setLike(selectedNew);
|
||||||
|
DbManager.updateLike(data);
|
||||||
|
|
||||||
|
});
|
||||||
|
vb.layoutDownload.setOnClickListener(v -> {
|
||||||
|
boolean permission = JsonData.INSTANCE.requestPermission(DetailActivity.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(BaseApp.TAG, "-----------Download 2");
|
||||||
|
startSave(downloadFile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.d(BaseApp.TAG, "-----------Download 3");
|
||||||
|
doDownload(true, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doDownload(boolean showMsg, boolean save) {
|
||||||
|
call = JsonData.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() {
|
||||||
|
DetailActivity activity = weakReference.get();
|
||||||
|
if (activity != null && !activity.isDestroyed()) {
|
||||||
|
Log.d(BaseApp.TAG, "-------weakReference !=null");
|
||||||
|
// Glide.with(activity)
|
||||||
|
// .asDrawable()
|
||||||
|
// .load(downloadFile)
|
||||||
|
// .into(vb.imageviewPreview);
|
||||||
|
} else {
|
||||||
|
Log.d(BaseApp.TAG, "-------weakReference null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showDownloadLoading(false);
|
||||||
|
if (showMsg) {
|
||||||
|
Toast.makeText(DetailActivity.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(BaseApp.TAG, "-----------showSetWallpaperLoading" + show);
|
||||||
|
if (show) {
|
||||||
|
vb.pbSet.setVisibility(View.VISIBLE);
|
||||||
|
vb.txApply.setVisibility(View.GONE);
|
||||||
|
vb.buttonSet.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
vb.pbSet.setVisibility(View.GONE);
|
||||||
|
vb.txApply.setVisibility(View.VISIBLE);
|
||||||
|
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 = JsonData.INSTANCE.saveToGallery(DetailActivity.this, file);
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showDownloadLoading(false);
|
||||||
|
if (uri == null) {
|
||||||
|
Toast.makeText(DetailActivity.this, getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
// deleteCacheFile();
|
||||||
|
Toast.makeText(DetailActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
Log.d(BaseApp.TAG, "--------path=" + file.getAbsolutePath() + "---uri=" + uri);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelectType(int type) {
|
||||||
|
|
||||||
|
showSetWallpaperLoading(true);
|
||||||
|
if (downloadFile != null && downloadFile.exists()) {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.d(BaseApp.TAG, "--------downloadFile=" + downloadFile.exists());
|
||||||
|
setWallpaper(downloadFile, type);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
// else if (fullDrawable != null) {
|
||||||
|
// new Thread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// File file = new File(CommonHelper.saveDrawableToFile(fullDrawable, mSavePath));
|
||||||
|
// setWallpaper(file, type);
|
||||||
|
// }
|
||||||
|
// }).start();
|
||||||
|
// }
|
||||||
|
else {
|
||||||
|
call = JsonData.INSTANCE.downloadFile(fullUrl, mSavePath, new Function2<Boolean, InputStream, Unit>() {
|
||||||
|
@Override
|
||||||
|
public Unit invoke(Boolean aBoolean, InputStream inputStream) {
|
||||||
|
Log.d(BaseApp.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(DetailActivity.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 SettingDialog.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 SettingDialog.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 SettingDialog.type_both:
|
||||||
|
wallpaperManager.setStream(fileInputStream);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
deleteCacheFile();
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showSetWallpaperLoading(false);
|
||||||
|
Toast.makeText(DetailActivity.this, getString(R.string.set_success), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception exception) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
showSetWallpaperLoading(false);
|
||||||
|
Toast.makeText(DetailActivity.this, getString(R.string.set_fail), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteCacheFile() {
|
||||||
|
if (downloadFile != null && downloadFile.exists()) {
|
||||||
|
boolean delete = downloadFile.delete();
|
||||||
|
Log.d(BaseApp.TAG, "--------delete=" + delete);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (call != null) {
|
||||||
|
call.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.adapter.HomeAdapter;
|
||||||
|
import com.newapp.paperwall.databinding.FragHomeBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.OnItemClickListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.ItemSpace;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class HomeFragment extends Fragment implements OnItemClickListener {
|
||||||
|
private FragHomeBinding vb;
|
||||||
|
public HomeFragment() {
|
||||||
|
}
|
||||||
|
public static HomeFragment newInstance(int type) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putInt(UiUtils.key_index, type);
|
||||||
|
HomeFragment fragment = new HomeFragment();
|
||||||
|
fragment.setArguments(bundle);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
vb = FragHomeBinding.inflate(getLayoutInflater());
|
||||||
|
initTabVp();
|
||||||
|
return vb.getRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void initTabVp() {
|
||||||
|
|
||||||
|
List<String> data = new ArrayList<>();
|
||||||
|
while (data.size() < 8) {
|
||||||
|
data = BaseApp.getCategoryNames();
|
||||||
|
}
|
||||||
|
vb.loadingPb.setVisibility(View.GONE);
|
||||||
|
initList(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initList(List<String> data) {
|
||||||
|
HomeAdapter homeAdapter = new HomeAdapter();
|
||||||
|
homeAdapter.setData(data);
|
||||||
|
homeAdapter.setInfoWallpaperListener(this);
|
||||||
|
ItemSpace itemSpace = new ItemSpace(10, 10, 0);
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||||
|
// vb.rvClass.addItemDecoration(itemSpace);
|
||||||
|
vb.rvClass.setLayoutManager(gridLayoutManager);
|
||||||
|
vb.rvClass.setAdapter(homeAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickAction(Data info) {
|
||||||
|
Intent intent = new Intent(requireContext(), DetailActivity.class);
|
||||||
|
intent.putExtra(UiUtils.key_info, info);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClickMore(String name) {
|
||||||
|
Intent intent = new Intent(requireContext(), CategoryListActivity.class);
|
||||||
|
intent.putExtra(CategoryListActivity.key_index, name);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
105
app/src/main/java/com/newapp/paperwall/uiview/MainActivity.java
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
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.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.databinding.ActivityMainBinding;
|
||||||
|
import com.newapp.paperwall.databinding.ItemTabBinding;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
|
private ActivityMainBinding vb;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
|
UiUtils.initFull(this, true);
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
|
||||||
|
|
||||||
|
List<Fragment> list = new ArrayList<>();
|
||||||
|
list.add(HomeFragment.newInstance(0));
|
||||||
|
// list.add(FindFragment.newInstance());
|
||||||
|
list.add(CollectFragment.newInstance());
|
||||||
|
|
||||||
|
int[] ints = {R.drawable.selector_home, R.drawable.selector_like};
|
||||||
|
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();
|
||||||
|
ItemTabBinding tabVb = ItemTabBinding.inflate(getLayoutInflater());
|
||||||
|
tabVb.imgIcon.setImageDrawable(ContextCompat.getDrawable(this, ints[i]));
|
||||||
|
tab.setCustomView(tabVb.getRoot());
|
||||||
|
if (i == 0) {
|
||||||
|
tabVb.tvBottom.setText(R.string.category);
|
||||||
|
tabVb.tvBottom.setTextColor(Color.parseColor("#ff617b"));
|
||||||
|
} else {
|
||||||
|
tabVb.tvBottom.setText(R.string.collect);
|
||||||
|
tabVb.tvBottom.setTextColor(Color.parseColor("#808080"));
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
assert customView != null;
|
||||||
|
TextView imageIndicator = customView.findViewById(R.id.tvBottom);
|
||||||
|
imageIndicator.setTextColor(Color.parseColor("#ff617b"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(TabLayout.Tab tab) {
|
||||||
|
View customView = tab.getCustomView();
|
||||||
|
assert customView != null;
|
||||||
|
TextView imageIndicator = customView.findViewById(R.id.tvBottom);
|
||||||
|
imageIndicator.setTextColor(Color.parseColor("#808080"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(TabLayout.Tab tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
initSearchClick();
|
||||||
|
}
|
||||||
|
private void initSearchClick(){
|
||||||
|
vb.toSearch.setOnClickListener(v -> {
|
||||||
|
Intent intent = new Intent(MainActivity.this, SearchActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.BaseApp;
|
||||||
|
import com.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.adapter.ThreeLinesAdapter;
|
||||||
|
import com.newapp.paperwall.databinding.ActivityFindBinding;
|
||||||
|
import com.newapp.paperwall.javabean.Data;
|
||||||
|
import com.newapp.paperwall.listener.OnItemClickListener;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
import com.newapp.paperwall.tools.DbManager;
|
||||||
|
import com.newapp.paperwall.tools.ItemSpace;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SearchActivity extends AppCompatActivity implements OnItemClickListener {
|
||||||
|
|
||||||
|
private ThreeLinesAdapter adapterWallapper;
|
||||||
|
private ActivityFindBinding vb;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityFindBinding.inflate(getLayoutInflater());
|
||||||
|
UiUtils.initFull(this, true);
|
||||||
|
setContentView(vb.getRoot());
|
||||||
|
initList();
|
||||||
|
setBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.d("YYYYYYY", "onResume is start");
|
||||||
|
startSearch(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initList() {
|
||||||
|
int height = UiUtils.dp2Px(240);
|
||||||
|
adapterWallapper = new ThreeLinesAdapter(this, height);
|
||||||
|
adapterWallapper.setInfoWallpaperListener(this);
|
||||||
|
ItemSpace recyclerItemSpace = new ItemSpace(10, 10, 15);
|
||||||
|
GridLayoutManager gridLayoutManager = new GridLayoutManager(SearchActivity.this, 3);
|
||||||
|
vb.resultRecycler.setLayoutManager(gridLayoutManager);
|
||||||
|
vb.resultRecycler.addItemDecoration(recyclerItemSpace);
|
||||||
|
vb.resultRecycler.setAdapter(adapterWallapper);
|
||||||
|
|
||||||
|
|
||||||
|
vb.et.setOnEditorActionListener((v, actionId, event) -> {
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
|
||||||
|
startSearch(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
vb.et.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
String inputText = s.toString().trim();
|
||||||
|
vb.btnSearch.setSelected(!inputText.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vb.btnSearch.setOnClickListener(v -> startSearch(true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeKeyboard() {
|
||||||
|
InputMethodManager imm = (InputMethodManager) SearchActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(vb.et.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSearch(boolean afterClick) {
|
||||||
|
closeKeyboard();
|
||||||
|
if (afterClick) {
|
||||||
|
vb.searchPb.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
String string = vb.et.getText().toString();
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
List<Data> search = DbManager.search(string);
|
||||||
|
if (!search.isEmpty()) {
|
||||||
|
showEmpty(false);
|
||||||
|
adapterWallapper.setDataInfo(search);
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
showEmpty(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d(BaseApp.TAG, "--------------size=" + search.size());
|
||||||
|
for (Data data : search) {
|
||||||
|
Log.d(BaseApp.TAG, "--------------data=" + data.getDescription());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (afterClick) {
|
||||||
|
vb.searchPb.setVisibility(View.GONE);
|
||||||
|
Toast.makeText(SearchActivity.this, getString(R.string.please_enter), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEmpty(boolean showEmpty) {
|
||||||
|
if (showEmpty) {
|
||||||
|
vb.emptyLayout.setVisibility(View.VISIBLE);
|
||||||
|
vb.resultRecycler.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
vb.emptyLayout.setVisibility(View.GONE);
|
||||||
|
vb.resultRecycler.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setBack() {
|
||||||
|
vb.imgBack.setOnClickListener(v -> {
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClickAction(Data info) {
|
||||||
|
Intent intent = new Intent(SearchActivity.this, DetailActivity.class);
|
||||||
|
intent.putExtra(UiUtils.key_info, info);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
109
app/src/main/java/com/newapp/paperwall/uiview/SettingDialog.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
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.newapp.paperwall.R;
|
||||||
|
import com.newapp.paperwall.databinding.DialogSettingBinding;
|
||||||
|
import com.newapp.paperwall.listener.DialogListener;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class SettingDialog extends DialogFragment {
|
||||||
|
|
||||||
|
private DialogSettingBinding vb;
|
||||||
|
private DialogListener 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(DialogListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
vb = DialogSettingBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
init();
|
||||||
|
return vb.getRoot();
|
||||||
|
}
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
|
||||||
|
// 设置自定义样式
|
||||||
|
Objects.requireNonNull(dialog.getWindow()).requestFeature(android.view.Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.getWindow().setWindowAnimations(R.style.BottomSheetDialogStyle);
|
||||||
|
|
||||||
|
// 调整对话框布局参数,使其从底部弹起
|
||||||
|
dialog.getWindow().setLayout(
|
||||||
|
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
dialog.getWindow().setGravity(android.view.Gravity.BOTTOM);
|
||||||
|
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
package com.newapp.paperwall.uiview;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.newapp.paperwall.databinding.ActivityStartBinding;
|
||||||
|
import com.newapp.paperwall.tools.UiUtils;
|
||||||
|
|
||||||
|
public class StartActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private CountDownTimer countDownTimer;
|
||||||
|
private ActivityStartBinding vb;
|
||||||
|
|
||||||
|
private long totalTime = 1600;
|
||||||
|
|
||||||
|
@SuppressLint("MissingInflatedId")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
vb = ActivityStartBinding.inflate(getLayoutInflater());
|
||||||
|
UiUtils.initFull(this,true);
|
||||||
|
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(StartActivity.this, MainActivity.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
app/src/main/res/anim/slide_down.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<translate
|
||||||
|
android:fromYDelta="0%"
|
||||||
|
android:toYDelta="100%"
|
||||||
|
android:duration="300"/>
|
||||||
|
</set>
|
||||||
7
app/src/main/res/anim/slide_up.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<translate
|
||||||
|
android:fromYDelta="100%"
|
||||||
|
android:toYDelta="0%"
|
||||||
|
android:duration="300"/>
|
||||||
|
</set>
|
||||||
7
app/src/main/res/drawable/bottom_dialog.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="#ffffff" />
|
||||||
|
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
8
app/src/main/res/drawable/bottom_tab.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#99FFFFFF"
|
||||||
|
android:endColor="#FFFFFFFF"
|
||||||
|
android:angle="270"
|
||||||
|
android:type="linear" />
|
||||||
|
</shape>
|
||||||
10
app/src/main/res/drawable/btn_apply.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">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#FFC0CB"
|
||||||
|
android:endColor="#ffffff"
|
||||||
|
android:angle="0"
|
||||||
|
android:type="linear" />
|
||||||
|
<corners android:radius="25dp"/>
|
||||||
|
</shape>
|
||||||
9
app/src/main/res/drawable/ic_back_white.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="@color/white"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_collect_red.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="#C03B3B"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_collect_stoke_white.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/ic_collect_white.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="@color/white"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/ic_double_rec.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/ic_down_local.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/white"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/ic_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="#C9C7C7"/>
|
||||||
|
<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="#C9C7C7"/>
|
||||||
|
</vector>
|
||||||
17
app/src/main/res/drawable/ic_empty_result.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="256dp"
|
||||||
|
android:height="256dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M219.8,71c-12.3,0 -21.8,-9.6 -21.8,-21.8S208.9,27.3 219.8,27.3c12.3,0 21.8,9.6 21.8,21.8 0,12.3 -9.6,21.8 -21.8,21.8zM219.8,34.1c-8.2,0 -15,6.8 -15,15s6.8,15 15,15c8.2,0 15,-6.8 15,-15 0,-8.2 -6.8,-15 -15,-15z"
|
||||||
|
android:strokeAlpha="0.3"
|
||||||
|
android:fillColor="#C9C7C7"
|
||||||
|
android:fillAlpha="0.3"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M935.3,1009L112,1009c-4.1,0 -6.8,2.7 -6.8,6.8s2.7,6.8 6.8,6.8h823.3c4.1,0 6.8,-2.7 6.8,-6.8s-2.7,-6.8 -6.8,-6.8zM84.7,1009h-54.6c-4.1,0 -6.8,2.7 -6.8,6.8s2.7,6.8 6.8,6.8h54.6c4.1,0 6.8,-2.7 6.8,-6.8s-4.1,-6.8 -6.8,-6.8zM994,1009h-27.3c-4.1,0 -6.8,2.7 -6.8,6.8s2.7,6.8 6.8,6.8h27.3c4.1,0 6.8,-2.7 6.8,-6.8s-2.7,-6.8 -6.8,-6.8zM244.4,428.7c4.1,0 6.8,-2.7 6.8,-6.8L251.2,210.3h400v109.2L764.6,319.5l4.1,4.1v379.6c0,4.1 2.7,6.8 6.8,6.8s6.8,-2.7 6.8,-6.8L782.3,318.1l-8.2,-8.2c0,-1.4 -2.7,-4.1 -4.1,-4.1l-107.9,-107.9 -1.4,-1.4h-423.3v225.3c0,4.1 2.7,6.8 6.8,6.8zM663.6,305.8v-86l86,86h-86zM244.4,518.8c4.1,0 6.8,-2.7 6.8,-6.8v-64.2c0,-4.1 -2.7,-6.8 -6.8,-6.8s-6.8,2.7 -6.8,6.8v64.2c0,4.1 2.7,6.8 6.8,6.8zM244.4,558.4c4.1,0 6.8,-2.7 6.8,-6.8L251.2,532.5c0,-4.1 -2.7,-6.8 -6.8,-6.8s-6.8,2.7 -6.8,6.8v19.1c0,4.1 2.7,6.8 6.8,6.8zM782.3,740c0,-4.1 -2.7,-6.8 -6.8,-6.8s-6.8,2.7 -6.8,6.8v84.7L251.2,824.7L251.2,570.7c0,-4.1 -2.7,-6.8 -6.8,-6.8s-6.8,2.7 -6.8,6.8v267.6h544.8v-98.3z"
|
||||||
|
android:fillColor="#C9C7C7"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M460.1,434.2c-4.1,-1.4 -6.8,1.4 -8.2,5.5 -2.7,15 -12.3,27.3 -24.6,32.8 -24.6,9.6 -58.7,-8.2 -58.7,-9.6 -2.7,-1.4 -6.8,-1.4 -9.6,2.7 -1.4,2.7 -1.4,6.8 2.7,9.6 15,8.2 31.4,13.7 49.2,13.7 6.8,0 15,-1.4 21.8,-4.1 17.7,-8.2 30,-23.2 32.8,-42.3 0,-4.1 -1.4,-8.2 -5.5,-8.2zM584.4,490.2c5.5,2.7 10.9,2.7 17.7,2.7 16.4,-1.4 31.4,-6.8 45.1,-16.4 2.7,-2.7 4.1,-6.8 1.4,-9.6 -2.7,-2.7 -5.5,-4.1 -9.6,-1.4 -19.1,12.3 -35.5,16.4 -49.2,10.9 -21.8,-8.2 -31.4,-39.6 -31.4,-39.6 -1.4,-4.1 -5.5,-5.5 -8.2,-4.1 -4.1,1.4 -5.5,4.1 -4.1,8.2 0,2.7 9.6,38.2 38.2,49.2zM462.8,617.1c1.4,-1.4 36.9,-34.1 81.9,4.1 1.4,1.4 2.7,1.4 4.1,1.4 4.1,0 6.8,-2.7 6.8,-6.8 0,-2.7 -1.4,-4.1 -2.7,-5.5 -56,-45.1 -99.7,-2.7 -101,-2.7 -2.7,2.7 -2.7,6.8 0,9.6s8.2,2.7 10.9,0zM909.3,148.8c12.3,0 21.8,-9.6 21.8,-21.8s-9.6,-21.8 -21.8,-21.8c-12.3,0 -21.8,9.6 -21.8,21.8 1.4,12.3 10.9,21.8 21.8,21.8zM909.3,113.3c8.2,0 15,6.8 15,15s-6.8,15 -15,15c-8.2,0 -15,-6.8 -15,-15 1.4,-8.2 8.2,-15 15,-15zM73.7,296.3l13.7,8.2 -6.8,13.7c-1.4,2.7 0,5.5 2.7,6.8 2.7,1.4 5.5,0 6.8,-2.7l5.5,-12.3 12.3,8.2c1.4,0 1.4,1.4 2.7,1.4 2.7,0 5.5,-2.7 5.5,-5.5 0,-1.4 -1.4,-4.1 -2.7,-4.1l-13.7,-8.2 6.8,-13.7c1.4,-2.7 0,-5.5 -2.7,-6.8 -2.7,-1.4 -5.5,0 -6.8,2.7l-6.8,12.3 -10.9,-9.6c-2.7,-1.4 -5.5,-1.4 -6.8,1.4 -2.7,2.7 -1.4,6.8 1.4,8.2zM957.1,475.1l-19.1,-10.9 8.2,-20.5c1.4,-4.1 0,-6.8 -4.1,-9.6s-6.8,0 -9.6,4.1l-8.2,19.1 -17.7,-9.6c-2.7,-1.4 -6.8,0 -9.6,2.7 -1.4,2.7 0,6.8 2.7,9.6l19.1,10.9 -8.2,20.5c-1.4,4.1 0,6.8 4.1,9.6s6.8,0 9.6,-4.1l8.2,-19.1 17.7,9.6c2.7,1.4 6.8,0 9.6,-2.7s0,-8.2 -2.7,-9.6z"
|
||||||
|
android:fillColor="#C9C7C7"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/ic_find_black.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="256dp"
|
||||||
|
android:height="256dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M222.1,580.4a356.2,356.2 0,0 0,34.1 152.9,357.6 357.6,0 0,0 477.7,-477.7A357.6,357.6 0,0 0,222.1 580.4z"
|
||||||
|
android:fillColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1009,936.6l-276.1,-276.1a409.5,409.5 0,1 0,-72.3 72.3l276.1,276.1a51.2,51.2 0,0 0,72.3 -72.3zM409.8,716.9a307.1,307.1 0,1 1,307.1 -307.1,307.1 307.1,0 0,1 -307.1,307.1z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/ic_find_gray.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="256dp"
|
||||||
|
android:height="256dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M222.1,580.4a356.2,356.2 0,0 0,34.1 152.9,357.6 357.6,0 0,0 477.7,-477.7A357.6,357.6 0,0 0,222.1 580.4z"
|
||||||
|
android:fillColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1009,936.6l-276.1,-276.1a409.5,409.5 0,1 0,-72.3 72.3l276.1,276.1a51.2,51.2 0,0 0,72.3 -72.3zM409.8,716.9a307.1,307.1 0,1 1,307.1 -307.1,307.1 307.1,0 0,1 -307.1,307.1z"
|
||||||
|
android:fillColor="#DCDCDC"/>
|
||||||
|
</vector>
|
||||||
12
app/src/main/res/drawable/ic_find_red.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="256dp"
|
||||||
|
android:height="256dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:pathData="M1009,936.6l-276.1,-276.1a409.5,409.5 0,1 0,-72.3 72.3l276.1,276.1a51.2,51.2 0,0 0,72.3 -72.3zM409.8,716.9a307.1,307.1 0,1 1,307.1 -307.1,307.1 307.1,0 0,1 -307.1,307.1z"
|
||||||
|
android:fillColor="#D3D3D3"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1009,936.6l-276.1,-276.1a409.5,409.5 0,1 0,-72.3 72.3l276.1,276.1a51.2,51.2 0,0 0,72.3 -72.3zM409.8,716.9a307.1,307.1 0,1 1,307.1 -307.1,307.1 307.1,0 0,1 -307.1,307.1z"
|
||||||
|
android:fillColor="#CD5C5C"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/ic_lock_phone.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="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>
|
||||||
74
app/src/main/res/drawable/ic_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>
|
||||||
9
app/src/main/res/drawable/ic_phone.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="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>
|
||||||
12
app/src/main/res/drawable/ic_wallpaper.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="256dp"
|
||||||
|
android:height="256dp"
|
||||||
|
android:viewportWidth="1024"
|
||||||
|
android:viewportHeight="1024">
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/white"
|
||||||
|
android:pathData="M261.9,492.9c20.6,11.9 46,11.9 66.6,0 20.6,-11.9 33.3,-33.9 33.3,-57.6 0,-36.8 -29.8,-66.5 -66.6,-66.5s-66.5,29.8 -66.5,66.5c0,23.8 12.7,45.7 33.2,57.6z"/>
|
||||||
|
<path
|
||||||
|
android:fillColor="@color/white"
|
||||||
|
android:pathData="M804,153.4L221.4,153.4c-78.3,0 -142,63.7 -142,142v436.9c0,78.3 63.7,142 142,142L804,874.3c78.3,0 142,-63.7 142,-142L946,295.4c-0.1,-78.3 -63.7,-142 -142,-142zM144.9,295.4c0,-42.2 34.3,-76.5 76.4,-76.5L804,218.9c42.1,0 76.4,34.3 76.4,76.5v331.1l-95.3,-86.2 -13.6,-9.7c-71.9,-46.1 -164.2,-45.1 -233.9,1.3l-385,232.6c-4.7,-9.9 -7.7,-20.6 -7.7,-32.2L144.9,295.4zM804,808.8L221.4,808.8c-4.1,0 -7.6,-1.7 -11.4,-2.3l362.8,-219.2c49.5,-32.9 113.6,-33.4 162.8,-1.9l143.7,128.5 1.2,-1.3v19.8c-0.1,42.1 -34.4,76.4 -76.5,76.4z"/>
|
||||||
|
</vector>
|
||||||
6
app/src/main/res/drawable/list_back_oval.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
<solid android:color="#33808080"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
7
app/src/main/res/drawable/search_et_stoke.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="#2bC0C0C0" />
|
||||||
|
<corners android:radius="25dp"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
6
app/src/main/res/drawable/selector_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_select" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/tab_home_gray" />
|
||||||
|
|
||||||
|
</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/tab_like_select" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/tab_like_gray" />
|
||||||
|
|
||||||
|
</selector>
|
||||||
6
app/src/main/res/drawable/selector_like_white.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/ic_collect_red" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/ic_collect_stoke_white" />
|
||||||
|
|
||||||
|
</selector>
|
||||||
6
app/src/main/res/drawable/selector_likewhite.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/ic_collect_red" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/ic_collect_white" />
|
||||||
|
|
||||||
|
</selector>
|
||||||
6
app/src/main/res/drawable/selector_search.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/ic_find_red" android:state_selected="true" />
|
||||||
|
<item android:drawable="@drawable/ic_find_gray" />
|
||||||
|
|
||||||
|
</selector>
|
||||||
9
app/src/main/res/drawable/tab_home_gray.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="#808080"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/tab_home_select.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="#ff617b"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/tab_like_gray.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="#808080"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/tab_like_select.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="#ff617b"/>
|
||||||
|
</vector>
|
||||||
8
app/src/main/res/drawable/top_tab.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<gradient
|
||||||
|
android:startColor="#FFFFFFFF"
|
||||||
|
android:endColor="#99FFFFFF"
|
||||||
|
android:angle="270"
|
||||||
|
android:type="linear" />
|
||||||
|
</shape>
|
||||||
27
app/src/main/res/drawable/welcome_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="#ff617b" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:id="@android:id/progress">
|
||||||
|
<clip>
|
||||||
|
<shape>
|
||||||
|
<corners android:radius="10dp" />
|
||||||
|
<gradient
|
||||||
|
android:angle="0"
|
||||||
|
android:endColor="@color/white"
|
||||||
|
android:centerColor="@color/white"
|
||||||
|
android:startColor="@color/white" />
|
||||||
|
</shape>
|
||||||
|
</clip>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
44
app/src/main/res/layout/activity_category_list.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?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=".uiview.CategoryListActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageview_back"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@drawable/ic_back_white"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:tint="@color/black" />
|
||||||
|
|
||||||
|
<com.newapp.paperwall.tools.CustTxtView
|
||||||
|
android:id="@+id/name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignTop="@id/imageview_back"
|
||||||
|
android:layout_alignBottom="@id/imageview_back"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="#ff617b"
|
||||||
|
android:textSize="17sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:apply_font="true" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_below="@id/imageview_back" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
141
app/src/main/res/layout/activity_detail.xml
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/black"
|
||||||
|
tools:context=".uiview.DetailActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageview_preview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageview_back"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@drawable/ic_back_white"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_favorite"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:background="@drawable/list_back_oval"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:src="@drawable/selector_likewhite" />
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/layout_download"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:background="@drawable/list_back_oval">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image_download"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@drawable/ic_down_local" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/pb_download"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateTint="@color/white"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.newapp.paperwall.tools.CustTxtView
|
||||||
|
android:id="@+id/tv_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minHeight="40dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:apply_font="true"
|
||||||
|
android:layout_marginBottom="130dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/layout_set"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/btn_apply"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_content"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/button_set"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:src="@drawable/ic_wallpaper"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txApply"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/apply"
|
||||||
|
android:textColor="#CD5C5C"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginVertical="10dp"
|
||||||
|
android:layout_marginStart="38dp"
|
||||||
|
android:layout_marginEnd="20dp"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/pb_set"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateTint="@color/white"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
94
app/src/main/res/layout/activity_find.xml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?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:paddingTop="40dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/llTop"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgBack"
|
||||||
|
android:layout_width="55dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:src="@drawable/ic_back_white"
|
||||||
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="15dp"
|
||||||
|
app:tint="@color/black" />
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/et_parent"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/search_et_stoke">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:hint="@string/start_search"
|
||||||
|
android:imeOptions="actionSearch"
|
||||||
|
android:inputType="text"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="40dp"
|
||||||
|
android:textColorHint="#D3D3D3"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_search"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
android:src="@drawable/selector_search" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/result_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@id/llTop"
|
||||||
|
android:layout_marginTop="7dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/empty_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:src="@drawable/ic_empty_result" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/no_search_result"
|
||||||
|
android:textColor="#000000" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/search_pb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateTint="#FFB6C1"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
58
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?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="#ffffff"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="42dp"
|
||||||
|
tools:context="com.newapp.paperwall.uiview.MainActivity">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/tvTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<com.newapp.paperwall.tools.CustTxtView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="#ff617b"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:textSize="19sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:apply_font="true" />
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/toSearch"
|
||||||
|
android:layout_width="34dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:contentDescription="@string/collect"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:src="@drawable/ic_find_black"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/viewpager2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@id/tvTitle"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tab"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="65dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
app:tabIndicator="@null"
|
||||||
|
android:background="@drawable/bottom_tab"
|
||||||
|
app:tabIndicatorHeight="0dp" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
47
app/src/main/res/layout/activity_start.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="@color/white"
|
||||||
|
tools:context=".uiview.StartActivity">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||||
|
android:id="@+id/imageview_logo"
|
||||||
|
android:layout_width="94dp"
|
||||||
|
android:layout_height="94dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="260dp"
|
||||||
|
android:src="@mipmap/ic_logo"
|
||||||
|
app:roundPercent="0.2" />
|
||||||
|
|
||||||
|
<com.newapp.paperwall.tools.CustTxtView
|
||||||
|
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="#ff617b"
|
||||||
|
android:textSize="22sp"
|
||||||
|
app:apply_font="true" />
|
||||||
|
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressbar"
|
||||||
|
style="?android:attr/progressBarStyleSmall"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="140dp"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="80"
|
||||||
|
android:indeterminateTint="#FFB6C1"
|
||||||
|
android:progressDrawable="@drawable/welcome_pb" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
91
app/src/main/res/layout/dialog_setting.xml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?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:background="@drawable/bottom_dialog"
|
||||||
|
android:paddingVertical="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_home"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="54dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_phone" />
|
||||||
|
|
||||||
|
<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="#ff617b"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:background=" #F5F5F5" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_lock"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="54dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_lock_phone" />
|
||||||
|
|
||||||
|
<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="#ff617b"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:background=" #F5F5F5" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_both"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="54dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_double_rec" />
|
||||||
|
|
||||||
|
<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="#ff617b"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
69
app/src/main/res/layout/frag_collect.xml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/llCollect"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:id="@+id/tvTitle"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:background="@drawable/top_tab"-->
|
||||||
|
<!-- android:layout_height="wrap_content">-->
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginStart="20dp"-->
|
||||||
|
<!-- android:paddingTop="15dp"-->
|
||||||
|
<!-- android:paddingBottom="10dp"-->
|
||||||
|
<!-- android:text="@string/collect"-->
|
||||||
|
<!-- android:textColor="#808080"-->
|
||||||
|
<!-- android:textSize="16sp"-->
|
||||||
|
<!-- android:textStyle="bold" />-->
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
android:id="@+id/viewPager2"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginHorizontal="10dp"
|
||||||
|
android:layout_marginBottom="55dp"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/layout_no_data"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/ic_empty" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvNoData"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:lineSpacingExtra="4dp"
|
||||||
|
android:text="@string/no_like_data"
|
||||||
|
android:textColor="#000000"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/searchPb"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminateTint="#FEA7F5"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</RelativeLayout>
|
||||||
58
app/src/main/res/layout/frag_home.xml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?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="com.newapp.paperwall.uiview.MainActivity">
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:id="@+id/tvTitle"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:background="@drawable/top_tab"-->
|
||||||
|
<!-- android:layout_height="wrap_content">-->
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:layout_marginStart="20dp"-->
|
||||||
|
<!-- android:paddingTop="15dp"-->
|
||||||
|
<!-- android:paddingBottom="10dp"-->
|
||||||
|
<!-- android:text="@string/category"-->
|
||||||
|
<!-- android:textColor="#808080"-->
|
||||||
|
<!-- android:textSize="16sp"-->
|
||||||
|
<!-- android:textStyle="bold" />-->
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rvClass"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:layout_marginTop="10dp" />
|
||||||
|
|
||||||
|
<!-- <com.google.android.material.tabs.TabLayout-->
|
||||||
|
<!-- android:id="@+id/tab_class"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="60dp"-->
|
||||||
|
<!-- android:background="@color/transparent"-->
|
||||||
|
<!-- android:paddingEnd="10dp"-->
|
||||||
|
<!-- app:tabBackground="@color/transparent"-->
|
||||||
|
<!-- app:tabIndicator="@null"-->
|
||||||
|
<!-- app:tabIndicatorHeight="0dp"-->
|
||||||
|
<!-- app:tabMode="scrollable"-->
|
||||||
|
<!-- app:tabPaddingEnd="0dp"-->
|
||||||
|
<!-- app:tabPaddingStart="10dp" />-->
|
||||||
|
|
||||||
|
<!-- <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:indeterminateTint="@color/white" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
83
app/src/main/res/layout/item_home.xml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?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="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<View
|
||||||
|
android:id="@+id/topView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="260dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
app:cardCornerRadius="20dp"
|
||||||
|
app:cardElevation="0dp">
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/preview"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent">
|
||||||
|
<View
|
||||||
|
android:id="@+id/llBlur"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#bf696969"
|
||||||
|
/>
|
||||||
|
<com.newapp.paperwall.tools.CustTxtView
|
||||||
|
android:id="@+id/tv_class_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="start"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_marginVertical="10dp"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp"
|
||||||
|
app:apply_font="true"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:text=">>"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <androidx.recyclerview.widget.RecyclerView-->
|
||||||
|
<!-- android:id="@+id/child_recycler"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- app:layout_constraintTop_toBottomOf="@id/tv_class_name" />-->
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
<View
|
||||||
|
android:id="@+id/bottomView"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_class_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="65dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
23
app/src/main/res/layout/item_like.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="240dp" />
|
||||||
|
|
||||||
|
<!-- <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_white" />-->
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
23
app/src/main/res/layout/item_list.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="100dp" />
|
||||||
|
|
||||||
|
<!-- <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>
|
||||||
23
app/src/main/res/layout/item_tab.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?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/imgIcon"
|
||||||
|
android:layout_width="25dp"
|
||||||
|
android:layout_height="25dp"
|
||||||
|
android:src="@drawable/ic_find_black"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvBottom"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textColor="#ff617b"
|
||||||
|
android:text="@string/search"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
101
app/src/main/res/layout/item_wallpaper.xml
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvName"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:textColor="#808080"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_marginHorizontal="40dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="paperName"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/wallpaper"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="20dp"
|
||||||
|
android:paddingHorizontal="10dp"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:layout_below="@id/tvName"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:paddingHorizontal="60dp"
|
||||||
|
>
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rlSet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/list_back_oval">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgSet"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@drawable/ic_wallpaper" />
|
||||||
|
|
||||||
|
<!-- <ProgressBar-->
|
||||||
|
<!-- android:id="@+id/pbSet"-->
|
||||||
|
<!-- android:layout_width="46dp"-->
|
||||||
|
<!-- android:layout_height="46dp"-->
|
||||||
|
<!-- android:layout_centerInParent="true"-->
|
||||||
|
<!-- android:indeterminateTint="@color/white"-->
|
||||||
|
<!-- android:padding="13dp"-->
|
||||||
|
<!-- android:visibility="gone" />-->
|
||||||
|
</RelativeLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rlDown"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/list_back_oval">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgDown"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:src="@drawable/ic_down_local" />
|
||||||
|
|
||||||
|
<!-- <ProgressBar-->
|
||||||
|
<!-- android:id="@+id/pbDown"-->
|
||||||
|
<!-- android:layout_width="46dp"-->
|
||||||
|
<!-- android:layout_height="46dp"-->
|
||||||
|
<!-- android:layout_centerInParent="true"-->
|
||||||
|
<!-- android:indeterminateTint="@color/white"-->
|
||||||
|
<!-- android:padding="13dp"-->
|
||||||
|
<!-- android:visibility="gone" />-->
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgCollect"
|
||||||
|
android:layout_width="46dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:background="@drawable/list_back_oval"
|
||||||
|
android:padding="13dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:src="@drawable/selector_likewhite" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_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/ic_logo_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_logo_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_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/ic_logo_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_logo_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_logo.webp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_logo_round.webp
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_logo.webp
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_logo_round.webp
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_logo.webp
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_logo_round.webp
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_logo.webp
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_logo_foreground.webp
Normal file
|
After Width: | Height: | Size: 37 KiB |