V1.0.2(3) MAX集成(Liftoff Monetize(vungle)、Mintegral、Pangle、Unity Ads)
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
|
||||
80
app/build.gradle.kts
Normal file
@ -0,0 +1,80 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("applovin-quality-service")
|
||||
}
|
||||
applovin{
|
||||
apiKey = "QSHbR4fRiQsQS35GZQfoxKJ9qpWcpR3DgvLcRdgJaN3OWFBLouEs6hfZqh0FpC5thnqdRfMvZGFfDc5Vekvicw"
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.example.wallpapermagazine"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
//com.wallpaper.magazine
|
||||
applicationId = "com.wallpaper.magazine"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 3
|
||||
versionName = "1.0.2"
|
||||
setProperty(
|
||||
"archivesBaseName",
|
||||
"Wallpaper Magazine_V" + versionName + "(${versionCode})_$timestamp"
|
||||
)
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions{
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.appcompat)
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(libs.filament.android)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
||||
implementation ("com.google.code.gson:gson:2.10.1")
|
||||
implementation ("androidx.room:room-runtime:2.4.0")
|
||||
annotationProcessor ("androidx.room:room-compiler:2.4.0")
|
||||
|
||||
//----------------firebase
|
||||
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
|
||||
implementation("com.google.firebase:firebase-crashlytics")
|
||||
implementation("com.google.firebase:firebase-analytics")
|
||||
|
||||
implementation("com.applovin:applovin-sdk:+")
|
||||
implementation("com.applovin.mediation:vungle-adapter:+")
|
||||
implementation("com.applovin.mediation:mintegral-adapter:+")
|
||||
implementation("com.applovin.mediation:bytedance-adapter:+")
|
||||
implementation("com.applovin.mediation:unityads-adapter:+")
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "531313760053",
|
||||
"project_id": "wallpaper-magazine-hd-wallart",
|
||||
"storage_bucket": "wallpaper-magazine-hd-wallart.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:531313760053:android:ae42b8b67d7c64708ede7c",
|
||||
"android_client_info": {
|
||||
"package_name": "com.wallpaper.magazine"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyCNfjDNk1WZM7Tt6thJGMn05NUCBOXDagk"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
40
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-keepclassmembers class com.example.wallpapermagazine.WallPaperSelect {
|
||||
public static final java.lang.String aaa;
|
||||
public static final int vvvaa;
|
||||
}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
|
||||
-keep class com.example.wallpapermagazine.LoveDAO.AppDatabase { *; }
|
||||
-keep class com.example.wallpapermagazine.json.Info { *; }
|
||||
-keepclassmembers class com.example.wallpapermagazine.json.Info_data { *; }
|
||||
|
||||
|
||||
-keep class com.google.gson.** { *; }
|
||||
-keepattributes Signature
|
||||
-keep class com.google.gson.reflect.TypeToken { *; }
|
||||
-keep class * extends com.google.gson.reflect.TypeToken
|
||||
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations
|
||||
@ -0,0 +1,26 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.example.wallpapermagazine", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
57
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?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" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"
|
||||
tools:ignore="SelectedPhotoAccess" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"
|
||||
tools:ignore="SelectedPhotoAccess" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".WallPaperSelect"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@drawable/long_icon"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.WallpaperMagazine"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ViewActivity2"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ViewActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".CataItemActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".LogInActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
app/src/main/assets/ZYLAA Smile at you.ttf
Normal file
12208
app/src/main/assets/wallpaper.json
Normal file
@ -0,0 +1,104 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.wallpapermagazine.action.InfoListWallPaperListener;
|
||||
import com.example.wallpapermagazine.action.InfoWallPaperListener;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.max.MaxManager;
|
||||
import com.example.wallpapermagazine.max.onActionListener;
|
||||
import com.example.wallpapermagazine.max.onAdStatusListener;
|
||||
import com.example.wallpapermagazine.recylcle.CataItemAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CataItemActivity extends AppCompatActivity implements InfoListWallPaperListener{
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private ImageView imageView;
|
||||
private TextView textView;
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.fragment_cata_item);
|
||||
inint();
|
||||
int position=getIntent().getIntExtra("position",2);
|
||||
recyclerView=findViewById(R.id.recycler_cata_item);
|
||||
textView=findViewById(R.id.cataitemname);
|
||||
imageView=findViewById(R.id.back);
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showMax(new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
textView.setText(WallPaperSelect.getCataName().get(position).getName());
|
||||
setRecyclerviewWallpaper(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
showMax(new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setRecyclerviewWallpaper(int position) {
|
||||
|
||||
Recycle_view recycle_View = new Recycle_view(10, 10, 15);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 3);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
recyclerView.addItemDecoration(recycle_View);
|
||||
CataItemAdapter cataItemAdapter = new CataItemAdapter(WallPaperSelect.getCataName(),position ,this);
|
||||
cataItemAdapter.setInfoWallPaperListener((InfoListWallPaperListener) this);
|
||||
recyclerView.setAdapter(cataItemAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void inint() {
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
findViewById(R.id.recycler_cata_item).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
}
|
||||
private void showMax(onActionListener listener) {
|
||||
MaxManager.ShowAd(CataItemActivity.this, new onAdStatusListener() {
|
||||
@Override
|
||||
public void onAdStatus(int type) {
|
||||
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||
if (listener != null)
|
||||
listener.onAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(int nameop, int recop) {
|
||||
Intent intent = new Intent(getBaseContext(), ViewActivity.class);
|
||||
intent.putExtra("naop",nameop);
|
||||
intent.putExtra("dataop",recop);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.example.wallpapermagazine
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Shader
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
|
||||
class CustomProgressBar(context: Context, attrs: AttributeSet?) : View(context, attrs) {
|
||||
private var progress = 0f // 当前进度
|
||||
private val maxProgress = 100f // 最大进度
|
||||
private val progressBarHeight = 20f // 进度条高度
|
||||
private val cornerRadius = 10f // 圆角半径
|
||||
private val backgroundColor = Color.parseColor("#26FFFFFF")
|
||||
private val startColor = Color.parseColor("#FF9ce8ff") // 起始颜色
|
||||
private val middleColor = Color.parseColor("#FFa4c4fb") // 中间颜色
|
||||
private val endColor = Color.parseColor("#FFbfa4ee") // 结束颜色
|
||||
private val paint = Paint()
|
||||
private val paintTow = Paint()
|
||||
|
||||
init {
|
||||
paint.style = Paint.Style.FILL
|
||||
paint.isAntiAlias = true
|
||||
paintTow.style = Paint.Style.FILL
|
||||
paintTow.isAntiAlias = true
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
// 绘制底色矩形
|
||||
paint.shader = null // 重置着色器
|
||||
paint.color = backgroundColor
|
||||
val backgroundRect = RectF(0f, (height / 2 - progressBarHeight / 2), width.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(backgroundRect, cornerRadius, cornerRadius, paint)
|
||||
|
||||
|
||||
// 计算进度条的宽度
|
||||
val progressBarWidth = (width * progress / maxProgress)
|
||||
|
||||
// 创建颜色渐变对象
|
||||
val gradient = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(startColor, middleColor, endColor), null, Shader.TileMode.CLAMP)
|
||||
paintTow.shader = gradient
|
||||
|
||||
// 绘制带圆角的进度条矩形
|
||||
val rect = RectF(0f, (height / 2 - progressBarHeight / 2), progressBarWidth.toFloat(), (height / 2 + progressBarHeight / 2))
|
||||
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paintTow)
|
||||
}
|
||||
|
||||
fun getProgress():Float{
|
||||
return progress
|
||||
}
|
||||
|
||||
// 设置进度
|
||||
fun setProgress(progress: Float) {
|
||||
this.progress = progress
|
||||
invalidate() // 请求重绘
|
||||
}
|
||||
}
|
||||
254
app/src/main/java/com/example/wallpapermagazine/DealData.kt
Normal file
@ -0,0 +1,254 @@
|
||||
package com.example.wallpapermagazine
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.MediaStore
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
|
||||
import okhttp3.Call
|
||||
import okhttp3.Callback
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.json.JSONArray
|
||||
import java.io.BufferedReader
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.io.InputStreamReader
|
||||
import java.io.OutputStream
|
||||
import java.io.StringWriter
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
object DealData {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fun downloadFile(
|
||||
url: String,
|
||||
savePath: String,
|
||||
result: (Boolean, input: InputStream?) -> Unit
|
||||
) {
|
||||
var client = OkHttpClient()
|
||||
var request = Request.Builder().url(url).build()
|
||||
var call = client.newCall(request)
|
||||
call.enqueue(object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
result.invoke(false, null)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call, response: Response) {
|
||||
response.body?.run {
|
||||
val byteStream = byteStream()
|
||||
val writeFile = writeFile(byteStream, savePath)
|
||||
result.invoke(writeFile, byteStream)
|
||||
} ?: run {
|
||||
result.invoke(false, null)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun writeFile(input: InputStream, filePath: String): Boolean {
|
||||
try {
|
||||
val byte = ByteArray(4096)
|
||||
val output = ByteArrayOutputStream()
|
||||
var l: Int
|
||||
while (input.read(byte).also { l = it } != -1) {
|
||||
output.write(byte, 0, l)
|
||||
}
|
||||
val fileDe = File(filePath)
|
||||
if (!fileDe.exists()) {
|
||||
fileDe.createNewFile()
|
||||
}
|
||||
val fileOutputStream = FileOutputStream(filePath)
|
||||
fileOutputStream.write(output.toByteArray())
|
||||
output.close()
|
||||
fileOutputStream.close()
|
||||
return true
|
||||
} catch (ex: Exception) {
|
||||
Log.d("-----------", "---------ex=" + ex.message)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun saveImageQ(imagePath: String, context: Context): Boolean {
|
||||
return try {
|
||||
val contentResolver = context.contentResolver
|
||||
val contentValues =
|
||||
getImageContentValues(File(imagePath))
|
||||
val localUri = contentResolver.insert(
|
||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
contentValues
|
||||
)
|
||||
// 拷贝到指定uri,如果没有这步操作,android11不会在相册显示
|
||||
val out = context.contentResolver.openOutputStream(localUri!!)
|
||||
copyFile(imagePath, out)
|
||||
|
||||
contentValues.clear();
|
||||
contentValues.put(MediaStore.MediaColumns.IS_PENDING, 0);
|
||||
contentValues.putNull(MediaStore.MediaColumns.DATE_EXPIRES);
|
||||
contentResolver.update(localUri, contentValues, null, null);
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun getImageContentValues(paramFile: File): ContentValues {
|
||||
val time = System.currentTimeMillis()
|
||||
val localContentValues = ContentValues()
|
||||
localContentValues.put(MediaStore.Images.Media.TITLE, paramFile.name)
|
||||
localContentValues.put(MediaStore.Images.Media.DISPLAY_NAME, paramFile.name)
|
||||
localContentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
localContentValues.put(MediaStore.Images.Media.RELATIVE_PATH, getSavePath())
|
||||
// localContentValues.put(MediaStore.Images.Media.DATE_MODIFIED, time / 1000)
|
||||
// localContentValues.put(MediaStore.Images.Media.DATE_ADDED, time / 1000)
|
||||
return localContentValues
|
||||
}
|
||||
|
||||
private fun getSavePath(): String {
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun saveImage(imagePath: String, context: Context): Boolean {
|
||||
return try {
|
||||
val path = getSavePath() + File.separator + File(imagePath).name
|
||||
val newFile = File(path)
|
||||
if (!newFile!!.parentFile.exists()) {
|
||||
newFile!!.parentFile.mkdirs()
|
||||
}
|
||||
val out = newFile.outputStream()
|
||||
copyFile(imagePath, out)
|
||||
|
||||
val uri = Uri.fromFile(newFile)
|
||||
context.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri))
|
||||
out.close()
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyFile(oldPath: String, out: OutputStream?): Boolean {
|
||||
try {
|
||||
var bytesum = 0
|
||||
var byteread = 0
|
||||
val oldFile = File(oldPath)
|
||||
if (oldFile.exists()) {
|
||||
// 读入原文件
|
||||
val inStream: InputStream = FileInputStream(oldPath)
|
||||
val buffer = ByteArray(1444)
|
||||
while (inStream.read(buffer).also { byteread = it } != -1) {
|
||||
bytesum += byteread //字节数 文件大小
|
||||
println(bytesum)
|
||||
out!!.write(buffer, 0, byteread)
|
||||
}
|
||||
inStream.close()
|
||||
out!!.close()
|
||||
return true
|
||||
} else {
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
fun saveToGallery(context: Context, inputStream: InputStream): Uri? {
|
||||
val displayName = "${System.currentTimeMillis()}.jpg"
|
||||
|
||||
Log.d(WallPaperSelect.TAG, "----------------displayName=${displayName}")
|
||||
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(WallPaperSelect.TAG, "-----------------e=${e.printStackTrace()}")
|
||||
return null
|
||||
}
|
||||
} ?: run {
|
||||
Log.d(WallPaperSelect.TAG, "----------------false")
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun saveFreshAppImageToGallery(context: Context, bitmap: Bitmap) {
|
||||
val bitmap = bitmap
|
||||
val displayName = "${System.currentTimeMillis()}.jpg"
|
||||
|
||||
val values = ContentValues().apply {
|
||||
put(MediaStore.Images.Media.DISPLAY_NAME, displayName)
|
||||
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
put(MediaStore.Images.Media.DATE_ADDED, System.currentTimeMillis() / 1000)
|
||||
}
|
||||
|
||||
val contentResolver = context.contentResolver
|
||||
val collection =
|
||||
MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
|
||||
val item = contentResolver.insert(collection, values)
|
||||
|
||||
item?.let { uri ->
|
||||
try {
|
||||
val outputStream = contentResolver.openOutputStream(uri)
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream!!)
|
||||
outputStream.close()
|
||||
|
||||
Log.d(WallPaperSelect.TAG, "------------------Save successfully!")
|
||||
val mediaScanIntent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
|
||||
mediaScanIntent.data = uri
|
||||
context.sendBroadcast(mediaScanIntent)
|
||||
} catch (e: Exception) {
|
||||
Log.d(WallPaperSelect.TAG, "------------------Save Failed!")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.wallpapermagazine.max.MaxManager;
|
||||
import com.example.wallpapermagazine.max.WelComManager;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function0;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
|
||||
public class LogInActivity extends AppCompatActivity {
|
||||
|
||||
private CountDownTimer countDownTimer;
|
||||
|
||||
private long time = 10000;
|
||||
private CustomProgressBar progressBar;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.login_lay);
|
||||
progressBar = findViewById(R.id.pb);
|
||||
inint();
|
||||
|
||||
countDownTimer = WelComManager.initTimer(LogInActivity.this, time, new Function1<Long, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(Long aLong) {
|
||||
long number = time - aLong;
|
||||
Double s = calculatePercentage(number, time);
|
||||
Log.d(WallPaperSelect.TAG, "--------------l=" + s);
|
||||
progressBar.setProgress(s.floatValue());
|
||||
return null;
|
||||
}
|
||||
}, new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
progressBar.setProgress(100);
|
||||
Intent intent = new Intent(LogInActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private Double calculatePercentage(long number, long total) {
|
||||
if (total == 0) {
|
||||
return 0.00; // 防止除以0错误
|
||||
}
|
||||
return ((double) number / total) * 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (countDownTimer != null) {
|
||||
countDownTimer.cancel();
|
||||
countDownTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void inint() {
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
findViewById(R.id.main).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.example.wallpapermagazine.LoveDAO;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImageDao;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
|
||||
@Database(entities = {FavoriteImage.class}, version =WallPaperSelect.vvvaa, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
public abstract FavoriteImageDao favoriteImageDao();
|
||||
|
||||
private static volatile AppDatabase INSTANCE;
|
||||
|
||||
public static AppDatabase getDatabase(final Context context) {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (AppDatabase.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
|
||||
AppDatabase.class, WallPaperSelect.aaa)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.example.wallpapermagazine.LoveDAO;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity(tableName = "favorite_images")
|
||||
public class FavoriteImage implements Serializable {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public long id;
|
||||
|
||||
@ColumnInfo(name = "image_url")
|
||||
public String imageUrl;
|
||||
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.example.wallpapermagazine.LoveDAO;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface FavoriteImageDao {
|
||||
@Insert
|
||||
void insert(FavoriteImage favoriteImage);
|
||||
|
||||
|
||||
@Query("SELECT * FROM favorite_images")
|
||||
List<FavoriteImage> getAllFavoriteImages();
|
||||
|
||||
@Query("SELECT * FROM favorite_images where image_url =:url")
|
||||
FavoriteImage getImageUrl(String url);
|
||||
|
||||
@Query("SELECT * FROM favorite_images WHERE image_url = :name LIMIT 1")
|
||||
LiveData<FavoriteImage> getDataByname(String name);
|
||||
|
||||
|
||||
@Update
|
||||
void updateUser(FavoriteImage favoriteImage);
|
||||
|
||||
|
||||
@Delete
|
||||
void deleteUser(FavoriteImage favoriteImage);
|
||||
}
|
||||
@ -0,0 +1,217 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.example.wallpapermagazine.adapter.adapter.MyFragmentAdapter;
|
||||
import com.example.wallpapermagazine.fragment.FragmentCate;
|
||||
import com.example.wallpapermagazine.fragment.FragmentHome;
|
||||
import com.example.wallpapermagazine.fragment.FragmentLike;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private BottomNavigationView bt_view;
|
||||
private ViewPager viewPager;
|
||||
private List<Fragment> mfragmentList;
|
||||
private static final int STORAGE_PERMISSION_CODE = 1;
|
||||
|
||||
private NavigationView navigationView;
|
||||
|
||||
private AlertDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.acitvity_home);
|
||||
viewPager = findViewById(R.id.view_page_dis);
|
||||
bt_view = findViewById(R.id.bt_view);
|
||||
navigationView = findViewById(R.id.cata_navigation_view);
|
||||
inData();
|
||||
inint();
|
||||
initDrawer();
|
||||
checkStoragePermission();
|
||||
MyFragmentAdapter myFragmentAdapter = new MyFragmentAdapter(getSupportFragmentManager(), mfragmentList);
|
||||
viewPager.setAdapter(myFragmentAdapter);
|
||||
bt_view.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.view_home) {
|
||||
viewPager.setCurrentItem(0);
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.view_cate) {
|
||||
viewPager.setCurrentItem(1);
|
||||
inData();
|
||||
return true;
|
||||
}
|
||||
{
|
||||
viewPager.setCurrentItem(2);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
onPagerSelected(position);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onPagerSelected(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
bt_view.setSelectedItemId(R.id.view_home);
|
||||
break;
|
||||
case 1:
|
||||
bt_view.setSelectedItemId(R.id.view_cate);
|
||||
break;
|
||||
case 2:
|
||||
bt_view.setSelectedItemId(R.id.view_like);
|
||||
}
|
||||
}
|
||||
|
||||
private void inData() {
|
||||
mfragmentList = new ArrayList<>();
|
||||
FragmentHome fragment1 = new FragmentHome();
|
||||
FragmentCate fragment2 = new FragmentCate();
|
||||
FragmentLike fragment3 = new FragmentLike();
|
||||
mfragmentList.add(fragment1);
|
||||
mfragmentList.add(fragment2);
|
||||
mfragmentList.add(fragment3);
|
||||
}
|
||||
|
||||
private void initDrawer() {
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@SuppressLint("QueryPermissionsNeeded")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.menu_about) {
|
||||
showDialog();
|
||||
} else if (item.getItemId() == R.id.menu_face) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
String packName = getPackageName();
|
||||
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + packName));
|
||||
if (intent.resolveActivity(MainActivity.this.getPackageManager()) != null) {
|
||||
startActivity(intent);
|
||||
} else {
|
||||
// 如果没有应用可以处理,使用浏览器打开
|
||||
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + packName));
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
@SuppressLint("InflateParams")
|
||||
View dialogView = inflater.inflate(R.layout.alterdialog, null);
|
||||
builder.setCustomTitle(dialogView);
|
||||
builder.setMessage("The current version is 1.0.1")
|
||||
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void inint() {
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
findViewById(R.id.dlt_main).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
}
|
||||
|
||||
private void checkStoragePermission() {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
// 权限未被授予,申请权限
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
STORAGE_PERMISSION_CODE);
|
||||
}
|
||||
} else {
|
||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(this,
|
||||
new String[]{android.Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO, android.Manifest.permission.READ_MEDIA_AUDIO},
|
||||
STORAGE_PERMISSION_CODE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == STORAGE_PERMISSION_CODE) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// 权限被授予
|
||||
Toast.makeText(this, "Storage permission successful", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
// 权限被拒绝
|
||||
Toast.makeText(this, "Storage permission denied", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (dialog != null) {
|
||||
dialog.dismiss();
|
||||
dialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ReadFile {
|
||||
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 = WallPaperSelect.context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dp * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class Recycle_view extends RecyclerView.ItemDecoration {
|
||||
|
||||
private int h_Item;
|
||||
private int v_Item;
|
||||
private int e_Item;
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
|
||||
int spanSise=1;
|
||||
int posation=parent.getChildAdapterPosition(view);
|
||||
int spanIndex=0;
|
||||
int spanCount=1;
|
||||
//确定recycleview内部布局
|
||||
RecyclerView.LayoutManager layoutManager=parent.getLayoutManager();
|
||||
|
||||
if (layoutManager instanceof GridLayoutManager){
|
||||
GridLayoutManager layoutManager1=(GridLayoutManager) layoutManager;
|
||||
GridLayoutManager.LayoutParams layoutParams=(GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount=layoutManager1.getSpanCount();
|
||||
spanSise=layoutManager1.getSpanSizeLookup().getSpanSize(posation);
|
||||
spanIndex= layoutParams.getSpanIndex();
|
||||
|
||||
}
|
||||
//设置网格间是间距
|
||||
|
||||
int itemAllSpacing = (v_Item * (spanCount + 1) + e_Item * 2) / spanCount;
|
||||
int left = v_Item * (spanIndex + 1) - itemAllSpacing * spanIndex + e_Item;
|
||||
int right = itemAllSpacing - left;
|
||||
outRect.left = left;
|
||||
outRect.right = right;
|
||||
outRect.bottom = h_Item;
|
||||
|
||||
}
|
||||
public Recycle_view(int v_Item, int h_Item, int e_Item){
|
||||
this.e_Item=e_Item;
|
||||
this.h_Item=h_Item;
|
||||
this.v_Item=v_Item;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.example.wallpapermagazine;
|
||||
public class StaticValue {
|
||||
|
||||
public static final String key_info = "key_info";
|
||||
|
||||
public static final String key_source = "key_source";
|
||||
|
||||
}
|
||||
@ -0,0 +1,312 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.example.wallpapermagazine.LoveDAO.AppDatabase;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImageDao;
|
||||
import com.example.wallpapermagazine.action.DownloadListener;
|
||||
import com.example.wallpapermagazine.donwload.ImageDownloadTask;
|
||||
import com.example.wallpapermagazine.fragment.PreviewFragment2;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.max.MaxManager;
|
||||
import com.example.wallpapermagazine.max.onActionListener;
|
||||
import com.example.wallpapermagazine.max.onAdStatusListener;
|
||||
import com.example.wallpapermagazine.recylcle.FavoriteImageAdapter;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ViewActivity extends AppCompatActivity {
|
||||
private FrameLayout frameLayoutBack;
|
||||
private ViewPager viewPagerPreview;
|
||||
private List<Info> info;
|
||||
private FavoriteImageAdapter adapter;
|
||||
private AppDatabase appDatabase;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private FloatingActionButton fab_download, fab_like, fab_share;
|
||||
private String selectPreImg;
|
||||
private TextView textViewLoading;
|
||||
private FavoriteImageDao favoriteImageDao;
|
||||
private int nameop;
|
||||
private int recop;
|
||||
private static final int STORAGE_PERMISSION_CODE = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.view_layout);
|
||||
MaxManager.onLoadAd();
|
||||
inint();
|
||||
nameop = getIntent().getIntExtra("naop", 2);
|
||||
recop = getIntent().getIntExtra("dataop", 16);
|
||||
info = WallPaperSelect.getCataName().get(nameop).getDatas();
|
||||
appDatabase = AppDatabase.getDatabase(this);
|
||||
selectPreImg = info.get(recop).getOriginal();
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
frameLayoutBack = findViewById(R.id.back);
|
||||
viewPagerPreview = findViewById(R.id.viewpager_preview);
|
||||
textViewLoading = findViewById(R.id.textview_loading);
|
||||
fab_download = findViewById(R.id.fbt_download);
|
||||
fab_like = findViewById(R.id.fbt_love);
|
||||
fab_share = findViewById(R.id.fbt_show);
|
||||
initViewPaper();
|
||||
frameLayoutBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.set_wallpaper).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showMax(new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
textViewLoading.setVisibility(View.VISIBLE);
|
||||
if (selectPreImg != null) {
|
||||
loadPreview(selectPreImg);
|
||||
} else {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
Toast.makeText(ViewActivity.this, "Sorry setting failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
fab_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selectPreImg != null) {
|
||||
textViewLoading.setVisibility(View.VISIBLE);
|
||||
ImageDownloadTask downloadTask = new ImageDownloadTask(getBaseContext(), new DownloadListener() {
|
||||
@Override
|
||||
public void downloadResult(boolean isSuccess) {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
if (isSuccess) {
|
||||
Toast.makeText(ViewActivity.this, "Image downloaded successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(ViewActivity.this, "Failed to download image", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
downloadTask.execute(selectPreImg);
|
||||
}
|
||||
}
|
||||
});
|
||||
FavoriteImage favoriteImage = new FavoriteImage();
|
||||
favoriteImage.imageUrl = selectPreImg;
|
||||
favoriteImageDao = appDatabase.favoriteImageDao();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
public void run() {
|
||||
FavoriteImage favoriteImage3 = favoriteImageDao.getImageUrl(selectPreImg);
|
||||
if (favoriteImage3 != null) {
|
||||
fab_like.setForeground(getDrawable(R.drawable.select_like));
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
fab_like.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FavoriteImage favoriteImage1 = favoriteImageDao.getImageUrl(selectPreImg);
|
||||
if (favoriteImage1 == null) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
public void run() {
|
||||
fab_like.setForeground(getDrawable(R.drawable.select_like));
|
||||
Toast.makeText(ViewActivity.this, "Added successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
favoriteImage1 = new FavoriteImage();
|
||||
favoriteImage1.imageUrl = selectPreImg;
|
||||
new InsertImageTask().execute(favoriteImage1);
|
||||
} else {
|
||||
//delete
|
||||
FavoriteImage favoriteImage2 = favoriteImage1;
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
favoriteImageDao.deleteUser(favoriteImage2);
|
||||
}
|
||||
}).start();
|
||||
fab_like.setForeground(getDrawable(R.drawable.love));
|
||||
Toast.makeText(ViewActivity.this, "Cancel successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
fab_share.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain"); // 设置分享内容的类型为图片
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, selectPreImg); // 可以添加URL文本
|
||||
startActivity(Intent.createChooser(shareIntent, "Share pictures"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class InsertImageTask extends AsyncTask<FavoriteImage, Void, Void> {
|
||||
@Override
|
||||
protected Void doInBackground(FavoriteImage... favoriteImages) {
|
||||
appDatabase.favoriteImageDao().insert(favoriteImages[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void initViewPaper() {
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
List<Info> infoList = WallPaperSelect.getCataName().get(nameop).getDatas();
|
||||
for (int i = recop; i <= recop + 6; i++) {
|
||||
Info myInfo = infoList.get(i);
|
||||
list.add(PreviewFragment2.newInstance(myInfo.getOriginal()));
|
||||
}
|
||||
viewPagerPreview.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
});
|
||||
viewPagerPreview.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FavoriteImage selelctUrl = favoriteImageDao.getImageUrl(infoList.get(position).getOriginal());
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint({"UseCompatLoadingForDrawables"})
|
||||
@Override
|
||||
public void run() {
|
||||
if (selelctUrl != null) {
|
||||
fab_like.setForeground(getDrawable(R.drawable.select_like));
|
||||
} else {
|
||||
Drawable drawable = getDrawable(R.drawable.love);
|
||||
fab_like.setForeground(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
selectPreImg = infoList.get(position).getOriginal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadPreview(String preURl) {
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(preURl)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
setPhoneWallpaper(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPhoneWallpaper(Bitmap bitmap) {
|
||||
try {
|
||||
|
||||
wallpaperManager.setBitmap(bitmap);
|
||||
finish();
|
||||
Toast.makeText(this, "Setting wallpaper successfully", Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException ioException) {
|
||||
Toast.makeText(this, "Setting failed, ", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void inint() {
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
findViewById(R.id.viewpager_preview).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
}
|
||||
|
||||
private void showMax(onActionListener listener) {
|
||||
MaxManager.ShowAd(ViewActivity.this, new onAdStatusListener() {
|
||||
@Override
|
||||
public void onAdStatus(int type) {
|
||||
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||
if (listener != null)
|
||||
listener.onAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,271 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.example.wallpapermagazine.LoveDAO.AppDatabase;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImageDao;
|
||||
import com.example.wallpapermagazine.action.DownloadListener;
|
||||
import com.example.wallpapermagazine.donwload.ImageDownloadTask;
|
||||
import com.example.wallpapermagazine.fragment.FragmentLike;
|
||||
import com.example.wallpapermagazine.fragment.PreviewFragment;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.max.MaxManager;
|
||||
import com.example.wallpapermagazine.max.onActionListener;
|
||||
import com.example.wallpapermagazine.max.onAdStatusListener;
|
||||
import com.example.wallpapermagazine.recylcle.FavoriteImageAdapter;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ViewActivity2 extends AppCompatActivity {
|
||||
private ImageView frameLayoutBack;
|
||||
private ViewPager viewPagerPreview;
|
||||
private FavoriteImage favoriteImage;
|
||||
private FavoriteImageAdapter adapter;
|
||||
private AppDatabase appDatabase;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private FloatingActionButton fab_download, fab_like, fab_share;
|
||||
private String lovePreImg;
|
||||
private TextView textViewLoading;
|
||||
private FavoriteImageDao favoriteImageDao;
|
||||
private int recop;
|
||||
private static final int STORAGE_PERMISSION_CODE = 1;
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.viewlayout2);
|
||||
MaxManager.onLoadAd();
|
||||
inint();
|
||||
favoriteImage = new FavoriteImage();
|
||||
appDatabase = AppDatabase.getDatabase(this);
|
||||
favoriteImageDao = appDatabase.favoriteImageDao();
|
||||
favoriteImage = (FavoriteImage) getIntent().getSerializableExtra("imageUrl");
|
||||
recop = getIntent().getIntExtra("recop", 0);
|
||||
lovePreImg = favoriteImage.getImageUrl();
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
frameLayoutBack = findViewById(R.id.imageview_back2);
|
||||
viewPagerPreview = findViewById(R.id.viewpager_preview);
|
||||
textViewLoading = findViewById(R.id.textview_loading2);
|
||||
fab_download = findViewById(R.id.fbt_download2);
|
||||
fab_share = findViewById(R.id.fbt_show2);
|
||||
fab_like = findViewById(R.id.fbt_love2);
|
||||
initViewPaper();
|
||||
frameLayoutBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.set_wallpaper).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
showMax(new onActionListener() {
|
||||
@Override
|
||||
public void onAction() {
|
||||
textViewLoading.setVisibility(View.VISIBLE);
|
||||
if (lovePreImg != null) {
|
||||
loadPreview(lovePreImg);
|
||||
} else {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
Toast.makeText(ViewActivity2.this, "Sorry setting failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
fab_share.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
fab_share.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain"); // 设置分享内容的类型为图片
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, lovePreImg); // 可以添加URL文本
|
||||
startActivity(Intent.createChooser(shareIntent, "Share pictures"));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fab_download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (lovePreImg != null) {
|
||||
textViewLoading.setVisibility(View.VISIBLE);
|
||||
String imageUrl = lovePreImg;
|
||||
ImageDownloadTask downloadTask = new ImageDownloadTask(getBaseContext(), new DownloadListener() {
|
||||
@Override
|
||||
public void downloadResult(boolean isSuccess) {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
if (isSuccess) {
|
||||
Toast.makeText(ViewActivity2.this, "Image downloaded successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(ViewActivity2.this, "Failed to download image", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
downloadTask.execute(imageUrl);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
favoriteImage.imageUrl = lovePreImg;
|
||||
fab_like.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
FavoriteImage selelctUrl = favoriteImageDao.getImageUrl(lovePreImg);
|
||||
if (selelctUrl != null) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
public void run() {
|
||||
fab_like.setForeground(getDrawable(R.drawable.love));
|
||||
Toast.makeText(ViewActivity2.this, "Cancel successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
new Thread(() -> favoriteImageDao.deleteUser(selelctUrl)).start();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void initViewPaper() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
List<FavoriteImage> alldatas;
|
||||
alldatas = favoriteImageDao.getAllFavoriteImages();
|
||||
for (int i = recop; i <= alldatas.size() - 1; i++) {
|
||||
FavoriteImage favoriteImage1 = alldatas.get(i);
|
||||
list.add(PreviewFragment.newInstance(favoriteImage1.imageUrl));
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
viewPagerPreview.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
viewPagerPreview.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
lovePreImg = favoriteImage.getImageUrl();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadPreview(String preURl) {
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(preURl)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
setPhoneWallpaper(resource);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPhoneWallpaper(Bitmap bitmap) {
|
||||
try {
|
||||
wallpaperManager.setBitmap(bitmap);
|
||||
finish();
|
||||
Toast.makeText(this, "Setting wallpaper successfully", Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException ioException) {
|
||||
Toast.makeText(this, "Setting failed, please wait...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void showMax(onActionListener listener) {
|
||||
MaxManager.ShowAd(ViewActivity2.this, new onAdStatusListener() {
|
||||
@Override
|
||||
public void onAdStatus(int type) {
|
||||
if (type == MaxManager.type_show_close || type == MaxManager.type_show_fail || type == MaxManager.type_no_cache) {
|
||||
if (listener != null)
|
||||
listener.onAction();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void inint() {
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
findViewById(R.id.viewpager_preview).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.example.wallpapermagazine;
|
||||
|
||||
import static androidx.core.content.ContentProviderCompat.requireContext;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.applovin.sdk.AppLovinMediationProvider;
|
||||
import com.applovin.sdk.AppLovinSdk;
|
||||
import com.applovin.sdk.AppLovinSdkConfiguration;
|
||||
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.json.Info_data;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class WallPaperSelect extends Application {
|
||||
private static final List<Info> userList = new ArrayList<>();
|
||||
private static List<Info_data> cataname = new ArrayList<>();
|
||||
public static Context context;
|
||||
public static final String aaa = "app_database";
|
||||
public static final int vvvaa = 1;
|
||||
public static String TAG = "=============";
|
||||
|
||||
public static boolean initSDkOK = false;
|
||||
public static String initAction = "ACTION_INIT";
|
||||
|
||||
private String SDK_KEY = "B16JDnq2XTvLHqPBl7HpoKPpP15v1VLRuFdB8wtkJXGdiJHxXSbizUSrFaaz4t5rmRXbHbTcqO1o6tm779ymUf";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getBaseContext();
|
||||
initMAxSDk();
|
||||
try {
|
||||
InputStream open = getAssets().open("wallpaper.json");
|
||||
String covertStr = ReadFile.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<Info_data>>() {
|
||||
}.getType();
|
||||
List<Info_data> names = gson.fromJson(covertStr, type);
|
||||
for (Info_data Name : names) {
|
||||
cataname.add(Name);
|
||||
for (Info info : Name.getDatas()) {
|
||||
userList.add(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Info_data> getCataName() {
|
||||
return cataname;
|
||||
}
|
||||
|
||||
public static List<Info> getUserList() {
|
||||
Collections.shuffle(userList);
|
||||
return userList;
|
||||
}
|
||||
|
||||
private void initMAxSDk() {
|
||||
|
||||
AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder(SDK_KEY, this)
|
||||
.setMediationProvider(AppLovinMediationProvider.MAX)
|
||||
.build();
|
||||
// Initialize the SDK with the configuration
|
||||
AppLovinSdk.getInstance(this).initialize(initConfig, new AppLovinSdk.SdkInitializationListener() {
|
||||
@Override
|
||||
public void onSdkInitialized(AppLovinSdkConfiguration appLovinSdkConfiguration) {
|
||||
initSDkOK = true;
|
||||
LocalBroadcastManager.getInstance(WallPaperSelect.this).sendBroadcast(new Intent(initAction));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.example.wallpapermagazine.action;
|
||||
|
||||
public interface DownloadListener {
|
||||
|
||||
void downloadResult(boolean isSuccess);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.example.wallpapermagazine.action;
|
||||
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
|
||||
public interface FavoriteLimage {
|
||||
public void onItemClickAction(FavoriteImage favoriteImage, int recop);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.example.wallpapermagazine.action;
|
||||
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface InfoListWallPaperListener {
|
||||
|
||||
public void onItemClickAction(int nameop,int recop);
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.example.wallpapermagazine.action;
|
||||
|
||||
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
|
||||
public interface InfoWallPaperListener {
|
||||
|
||||
public void onItemClickAction(Info info);
|
||||
}
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package com.example.wallpapermagazine.action;
|
||||
|
||||
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
|
||||
public interface Like {
|
||||
|
||||
public void onItemClickAction(FavoriteImage favoriteImage);
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.example.wallpapermagazine.adapter.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
public class FragmentLikeAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private Fragment fragment;
|
||||
public FragmentLikeAdapter(@NonNull FragmentManager fm,Fragment f) {
|
||||
super(fm);
|
||||
this.fragment=f;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.example.wallpapermagazine.adapter.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyFragmentAdapter extends FragmentStatePagerAdapter {
|
||||
private final List<Fragment> mfragmentList;
|
||||
|
||||
public MyFragmentAdapter(FragmentManager fm, List<Fragment> fragmentList) {
|
||||
super(fm);
|
||||
this.mfragmentList = fragmentList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mfragmentList == null ? null : mfragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mfragmentList.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.example.wallpapermagazine.adapter.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.fragment.PreviewFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
||||
private List<FavoriteImage> names; // 存储数据列表
|
||||
private List<PreviewFragment> fragmentList; // 存储 Fragment 列表
|
||||
|
||||
public MyPagerAdapter(FragmentManager fm, List<FavoriteImage> dataList) {
|
||||
super(fm);
|
||||
this.names = dataList;
|
||||
fragmentList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
PreviewFragment fragment = PreviewFragment.newInstance(names.get(position).getImageUrl());
|
||||
fragmentList.add(fragment);
|
||||
return fragment;
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragmentList.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.example.wallpapermagazine.adapter.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.ReadFile;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
import com.example.wallpapermagazine.json.Info_data;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MycataAdapter extends BaseAdapter {
|
||||
private final Context context;
|
||||
private final List<Info_data> img_list;
|
||||
|
||||
public MycataAdapter(Context context, List<Info_data> img_list) {
|
||||
this.context = context;
|
||||
this.img_list = img_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return img_list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.listview_lay, parent, false);
|
||||
}
|
||||
|
||||
TextView textView = convertView.findViewById(R.id.item_text);
|
||||
ImageView imageView = convertView.findViewById(R.id.item_img);
|
||||
textView.setText(WallPaperSelect.getCataName().get(position).getName());
|
||||
Info_data info = img_list.get(position);
|
||||
while (info.getDatas().get(position).getBanner()==null){
|
||||
Collections.shuffle(info.getDatas());
|
||||
}
|
||||
Glide.with(convertView)
|
||||
.load(info.getDatas().get(position).getBanner())
|
||||
.transform(new RoundedCorners(20))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
|
||||
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.example.wallpapermagazine.donwload;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.wallpapermagazine.DealData;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
import com.example.wallpapermagazine.action.DownloadListener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
public class ImageDownloadTask extends AsyncTask<String, Void, Boolean> {
|
||||
private Context context;
|
||||
private DownloadListener downloadListener;
|
||||
|
||||
public ImageDownloadTask(Context context, DownloadListener listener) {
|
||||
this.context = context;
|
||||
downloadListener = listener;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(String... params) {
|
||||
String imageUrl = params[0];
|
||||
HttpURLConnection connection = null;
|
||||
try {
|
||||
URL url = new URL(imageUrl);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.connect();
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
|
||||
Uri uri1 = DealData.INSTANCE.saveToGallery(WallPaperSelect.context, inputStream);
|
||||
|
||||
|
||||
if(uri1 == null){
|
||||
return false;
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
// ContentValues values = new ContentValues();
|
||||
// values.put(MediaStore.Images.Media.DISPLAY_NAME, "downloaded_image_" + System.currentTimeMillis() + ".jpg");
|
||||
// values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
|
||||
// values.put(MediaStore.Images.Media.RELATIVE_PATH, Environment.DIRECTORY_PICTURES);
|
||||
// Uri uri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||
// if (uri != null) {
|
||||
// try (OutputStream outputStream = context.getContentResolver().openOutputStream(uri)) {
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
// outputStream.write(buffer, 0, bytesRead);
|
||||
// }
|
||||
// Log.e("ImageDownloadTask", " true uri =" + uri.getPath());
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// File directory = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "download");
|
||||
// if (!directory.exists()) {
|
||||
// directory.mkdirs();
|
||||
// }
|
||||
// File outputFile = new File(directory, "downloaded_image_" + System.currentTimeMillis() + ".jpg");
|
||||
// try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
// fileOutputStream.write(buffer, 0, bytesRead);
|
||||
// }
|
||||
// Log.e("ImageDownloadTask", " true outputFile =" + outputFile.getAbsolutePath());
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
Log.e("ImageDownloadTask", "Server returned HTTP " + responseCode + " " + connection.getResponseMessage());
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ImageDownloadTask", "Error downloading image", e);
|
||||
return false;
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result) {
|
||||
Log.e("ImageDownloadTask", "============" + result);
|
||||
if (downloadListener != null) {
|
||||
downloadListener.downloadResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.example.wallpapermagazine.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
import com.example.wallpapermagazine.adapter.adapter.MycataAdapter;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.json.Info_data;
|
||||
import com.example.wallpapermagazine.CataItemActivity;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FragmentCate extends Fragment {
|
||||
private ListView listView;
|
||||
private DrawerLayout drawerLayout;
|
||||
private ImageView imageView;
|
||||
private NavigationView navigationView;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.layout_cate, container, false);
|
||||
listView = view.findViewById(R.id.list_catagray);
|
||||
imageView = view.findViewById(R.id.cate_more);
|
||||
|
||||
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
drawerLayout = requireActivity().findViewById(R.id.dlt_main);
|
||||
drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
});
|
||||
MycataAdapter adapter = new MycataAdapter(getActivity(), WallPaperSelect.getCataName());
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Intent intent = new Intent(getActivity(), CataItemActivity.class);
|
||||
intent.putExtra("position", position);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
package com.example.wallpapermagazine.fragment;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.ReadFile;
|
||||
import com.example.wallpapermagazine.Recycle_view;
|
||||
import com.example.wallpapermagazine.ViewActivity;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
import com.example.wallpapermagazine.action.InfoListWallPaperListener;
|
||||
import com.example.wallpapermagazine.recylcle.RecommonedAdapter;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
public class FragmentHome extends Fragment implements InfoListWallPaperListener {
|
||||
private TextView textView1, textView2, textView3, textView4;
|
||||
private ImageView imageView1, imageView2, imageView3, imageView_trop;
|
||||
private DrawerLayout mdrawerLayout;
|
||||
private ImageView imageView;
|
||||
private Context mContext;
|
||||
private DrawerLayout drawerLayout;
|
||||
private RecyclerView recyclerView;
|
||||
private NavigationView navigationView;
|
||||
private int opp;
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
this.mContext = context;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.fragment_home, container, false);
|
||||
recyclerView = view.findViewById(R.id.recycler_view_home);
|
||||
imageView = view.findViewById(R.id.home_more);
|
||||
navigationView = requireActivity().findViewById(R.id.cata_navigation_view);
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.menu_about) {
|
||||
showDialog();
|
||||
} else if (item.getItemId() == R.id.menu_face) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
String packName=requireContext().getPackageName();
|
||||
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+packName));
|
||||
startActivity(intent);
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://sites.google.com/view/originality-prank"));
|
||||
startActivity(intent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
drawerLayout = requireActivity().findViewById(R.id.dlt_main);
|
||||
drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
});
|
||||
findByIf(view);
|
||||
textView1.setText(WallPaperSelect.getCataName().get(5).getName());
|
||||
textView2.setText(WallPaperSelect.getCataName().get(7).getName());
|
||||
textView3.setText(WallPaperSelect.getCataName().get(10).getName());
|
||||
textView4.setText(WallPaperSelect.getCataName().get(15).getName());
|
||||
setHimg(imageView1, 5);
|
||||
setHimg(imageView2, 7);
|
||||
setHimg(imageView3, 10);
|
||||
setVimg(imageView_trop, 15);
|
||||
setRecyclerviewWallpaper(12);
|
||||
imageView1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("naop", 5);
|
||||
intent.putExtra("dataop", opp);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
imageView2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("naop", 7);
|
||||
intent.putExtra("dataop", opp);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
imageView3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("naop", 10);
|
||||
intent.putExtra("dataop", opp);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
imageView_trop.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("naop", 15);
|
||||
intent.putExtra("dataop", opp);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void setRecyclerviewWallpaper(int rand) {
|
||||
|
||||
Recycle_view recycle_View = new Recycle_view(10, 10, 15);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 1);
|
||||
gridLayoutManager.setOrientation(RecyclerView.HORIZONTAL);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
recyclerView.addItemDecoration(recycle_View);
|
||||
RecommonedAdapter recommonedAdapter = new RecommonedAdapter(WallPaperSelect.getCataName(), getContext(), rand);
|
||||
recommonedAdapter.setInfoWallPaperListener((InfoListWallPaperListener) this);
|
||||
recyclerView.setAdapter(recommonedAdapter);
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View dialogView = inflater.inflate(R.layout.alterdialog, null);
|
||||
builder.setCustomTitle(dialogView);
|
||||
builder.setMessage("The current version is 1.0")
|
||||
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
private void findByIf(@NonNull View view) {
|
||||
imageView1 = view.findViewById(R.id.img_big);
|
||||
imageView2 = view.findViewById(R.id.img_nature);
|
||||
imageView3 = view.findViewById(R.id.img_super);
|
||||
imageView_trop = view.findViewById(R.id.img_Trop);
|
||||
textView1 = view.findViewById(R.id.tv_big);
|
||||
textView2 = view.findViewById(R.id.tv_nature);
|
||||
textView3 = view.findViewById(R.id.tv_suoer);
|
||||
textView4 = view.findViewById(R.id.tv_Trop);
|
||||
}
|
||||
private int getDataOp(int data) {
|
||||
int a;
|
||||
a = data;
|
||||
return a;
|
||||
}
|
||||
|
||||
private void setHimg(ImageView imageView, int rand) {
|
||||
Random random = new Random();
|
||||
int randomnum = random.nextInt(124);
|
||||
while (WallPaperSelect.getCataName().get(rand).getDatas().get(randomnum).getBanner() == null) {
|
||||
randomnum = randomnum + 1;
|
||||
opp = getDataOp(randomnum);
|
||||
}
|
||||
Glide.with(mContext)
|
||||
.load(WallPaperSelect.getCataName().get(rand).getDatas().get(randomnum).getBanner())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
private void setVimg(ImageView imageView, int rand) {
|
||||
Random random = new Random();
|
||||
int randomnum = random.nextInt(124);
|
||||
while (WallPaperSelect.getCataName().get(rand).getDatas().get(randomnum).getPreviewThumb() == null) {
|
||||
randomnum = randomnum + 1;
|
||||
opp = getDataOp(randomnum);
|
||||
}
|
||||
Glide.with(mContext)
|
||||
.load(WallPaperSelect.getCataName().get(rand).getDatas().get(randomnum).getPreviewThumb())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(int nameop, int recop) {
|
||||
Intent intent = new Intent(getActivity(), ViewActivity.class);
|
||||
intent.putExtra("naop", nameop);
|
||||
intent.putExtra("dataop", recop);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
package com.example.wallpapermagazine.fragment;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.example.wallpapermagazine.LoveDAO.AppDatabase;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.Recycle_view;
|
||||
import com.example.wallpapermagazine.ViewActivity2;
|
||||
import com.example.wallpapermagazine.action.FavoriteLimage;
|
||||
import com.example.wallpapermagazine.recylcle.FavoriteImageAdapter;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FragmentLike extends Fragment implements FavoriteLimage {
|
||||
private FavoriteImageAdapter adapter;
|
||||
private List<FavoriteImage> favoriteImages = new ArrayList<>();
|
||||
private AppDatabase appDatabase;
|
||||
private RecyclerView recyclerView;
|
||||
private DrawerLayout drawerLayout;
|
||||
private ImageView imageView;
|
||||
private NavigationView navigationView;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_like, container, false);
|
||||
appDatabase = AppDatabase.getDatabase(requireContext());
|
||||
recyclerView = view.findViewById(R.id.recyl_like);
|
||||
imageView = view.findViewById(R.id.like_more);
|
||||
navigationView = requireActivity().findViewById(R.id.cata_navigation_view);
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.menu_about) {
|
||||
showDialog();
|
||||
} else if (item.getItemId() == R.id.menu_face) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
String packName=requireContext().getPackageName();
|
||||
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+packName));
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://sites.google.com/view/originality-prank"));
|
||||
startActivity(intent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
imageView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
drawerLayout = requireActivity().findViewById(R.id.dlt_main);
|
||||
drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
});
|
||||
setRecyclerviewWallpaper();
|
||||
loadFavoriteImages();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private void setRecyclerviewWallpaper() {
|
||||
Recycle_view recycle_View = new Recycle_view(10, 10, 15);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 3);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
recyclerView.addItemDecoration(recycle_View);
|
||||
adapter = new FavoriteImageAdapter(getActivity(), favoriteImages);
|
||||
adapter.setInfoWallPaperListener((FavoriteLimage) this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
private void showDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View dialogView = inflater.inflate(R.layout.alterdialog, null);
|
||||
builder.setCustomTitle(dialogView);
|
||||
builder.setMessage("The current version is 1.0")
|
||||
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
|
||||
// 创建并显示对话框
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void loadFavoriteImages() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<FavoriteImage> allFavoriteImages = appDatabase.favoriteImageDao().getAllFavoriteImages();
|
||||
requireActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
favoriteImages.clear();
|
||||
favoriteImages.addAll(allFavoriteImages);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@Override
|
||||
public void onItemClickAction(FavoriteImage favoriteImage, int recop) {
|
||||
Intent intent = new Intent(requireActivity(), ViewActivity2.class);
|
||||
intent.putExtra("recop", recop);
|
||||
intent.putExtra("imageUrl", favoriteImage);
|
||||
startActivity(intent);
|
||||
}
|
||||
public class LoadFavoriteImagesTask extends AsyncTask<Void, Void, List<FavoriteImage>> {
|
||||
@Override
|
||||
protected List<FavoriteImage> doInBackground(Void... voids) {
|
||||
return appDatabase.favoriteImageDao().getAllFavoriteImages();
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
protected void onPostExecute(List<FavoriteImage> images) {
|
||||
favoriteImages.clear();
|
||||
favoriteImages.addAll(images);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
loadFavoriteImages();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.example.wallpapermagazine.fragment;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.StaticValue;
|
||||
|
||||
public class PreviewFragment extends Fragment {
|
||||
private String source_url;
|
||||
private ImageView imageViewPreview;
|
||||
private ProgressBar progressBar;
|
||||
public PreviewFragment() {
|
||||
|
||||
}
|
||||
public static PreviewFragment newInstance(String param1) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(StaticValue.key_source, param1);
|
||||
PreviewFragment fragment = new PreviewFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
source_url = getArguments().getString(StaticValue.key_source);
|
||||
}
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View fragmentview = inflater.inflate(R.layout.fragment_img, container, false);
|
||||
imageViewPreview = fragmentview.findViewById(R.id.imageview_preview);
|
||||
progressBar = fragmentview.findViewById(R.id.progressbar);
|
||||
Glide.with(requireContext())
|
||||
.asBitmap()
|
||||
.load(source_url)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
imageViewPreview.setImageBitmap(resource);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
}
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
return fragmentview;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.example.wallpapermagazine.fragment;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.StaticValue;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
public class PreviewFragment2 extends Fragment {
|
||||
private String source_url;
|
||||
private ImageView imageViewPreview;
|
||||
private ProgressBar progressBar;
|
||||
private FloatingActionButton floatingActionButton;
|
||||
public PreviewFragment2() {
|
||||
|
||||
}
|
||||
public static PreviewFragment2 newInstance(String param1) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(StaticValue.key_source, param1);
|
||||
PreviewFragment2 fragment2 = new PreviewFragment2();
|
||||
fragment2.setArguments(bundle);
|
||||
return fragment2;
|
||||
}
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
source_url = getArguments().getString(StaticValue.key_source);
|
||||
}
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View fragmentview = inflater.inflate(R.layout.fragment_img, container, false);
|
||||
imageViewPreview = fragmentview.findViewById(R.id.imageview_preview);
|
||||
progressBar = fragmentview.findViewById(R.id.progressbar);
|
||||
floatingActionButton = getActivity().findViewById(R.id.fbt_love);
|
||||
Glide.with(requireContext())
|
||||
.asBitmap()
|
||||
.load(source_url)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
imageViewPreview.setImageBitmap(resource);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
return fragmentview;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.example.wallpapermagazine.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Info implements Serializable {
|
||||
|
||||
|
||||
private String banner;
|
||||
private String original;
|
||||
private String previewThumb;
|
||||
private String source;
|
||||
|
||||
|
||||
public String getBanner() {
|
||||
return banner;
|
||||
}
|
||||
|
||||
public String getOriginal() {
|
||||
return original;
|
||||
}
|
||||
|
||||
public String getPreviewThumb() {
|
||||
return previewThumb;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.example.wallpapermagazine.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class Info_data implements Serializable {
|
||||
private String name;
|
||||
private List<Info> data;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Info> getDatas() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.example.wallpapermagazine.max;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
|
||||
public interface MaxListener {
|
||||
void onFail(MaxAd ad);
|
||||
|
||||
void onShowSuccess(MaxAd ad);
|
||||
|
||||
void onHidden();
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
package com.example.wallpapermagazine.max;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.applovin.mediation.MaxAd;
|
||||
import com.applovin.mediation.MaxAdListener;
|
||||
import com.applovin.mediation.MaxError;
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd;
|
||||
import com.example.wallpapermagazine.WallPaperSelect;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MaxManager {
|
||||
/**
|
||||
* 858b17df7371e4cd
|
||||
* 858b17df7371e4cd
|
||||
* 9bc40a5042b29b1e
|
||||
*/
|
||||
private static final String one_AD = "858b17df7371e4cd";
|
||||
private static final String two_Ad = "858b17df7371e4cd";
|
||||
private static final String three_ad = "9bc40a5042b29b1e";
|
||||
|
||||
|
||||
public static final int type_no_cache = 0;
|
||||
public static final int type_has_cache = 1;
|
||||
public static final int type_show_success = 2;
|
||||
public static final int type_show_close = 3;
|
||||
public static final int type_show_fail = 4;
|
||||
|
||||
private static List<MaxInterstitialAd> adList = new ArrayList<>();
|
||||
|
||||
public static MaxInterstitialAd getAd(List<MaxInterstitialAd> list) {
|
||||
Collections.shuffle(list);
|
||||
for (MaxInterstitialAd ad : list) {
|
||||
if (ad.isReady()) {
|
||||
return ad;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<MaxInterstitialAd> onLoadAd() {
|
||||
if (adList.isEmpty()) {
|
||||
MaxInterstitialAd AdT = new MaxInterstitialAd(two_Ad, WallPaperSelect.context);
|
||||
MaxInterstitialAd AdOne = new MaxInterstitialAd(one_AD, WallPaperSelect.context);
|
||||
MaxInterstitialAd AdThree = new MaxInterstitialAd(three_ad, WallPaperSelect.context);
|
||||
adList.add(AdOne);
|
||||
adList.add(AdT);
|
||||
adList.add(AdThree);
|
||||
}
|
||||
|
||||
for (MaxInterstitialAd ad : adList) {
|
||||
if (!ad.isReady()) {
|
||||
setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.loadAd();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return adList;
|
||||
}
|
||||
|
||||
public static void setMyListener(MaxInterstitialAd ad, MaxListener maxListener) {
|
||||
ad.setListener(new MaxAdListener() {
|
||||
@Override
|
||||
public void onAdLoaded(@NonNull MaxAd maxAd) {
|
||||
Log.d(WallPaperSelect.TAG, "-------onAdLoaded-----maxAd="+maxAd.getAdUnitId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayed(@NonNull MaxAd maxAd) {
|
||||
Log.d(WallPaperSelect.TAG, "-------onAdDisplayed-----maxAd="+maxAd.getAdUnitId());
|
||||
maxListener.onShowSuccess(maxAd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdHidden(@NonNull MaxAd maxAd) {
|
||||
Log.d(WallPaperSelect.TAG, "-------onAdHidden-----maxAd="+maxAd.getAdUnitId());
|
||||
maxListener.onHidden();
|
||||
setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
|
||||
}
|
||||
});
|
||||
ad.loadAd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClicked(@NonNull MaxAd maxAd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLoadFailed(@NonNull String s, @NonNull MaxError maxError) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
|
||||
maxListener.onFail(maxAd);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void ShowAd(Activity activity, onAdStatusListener listener) {
|
||||
MaxInterstitialAd ad = MaxManager.getAd(adList);
|
||||
if (ad == null) {
|
||||
listener.onAdStatus(type_no_cache);
|
||||
} else {
|
||||
listener.onAdStatus(type_has_cache);
|
||||
MaxManager.setMyListener(ad, new MaxListener() {
|
||||
@Override
|
||||
public void onFail(MaxAd ad) {
|
||||
listener.onAdStatus(type_show_fail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowSuccess(MaxAd ad) {
|
||||
listener.onAdStatus(type_show_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidden() {
|
||||
listener.onAdStatus(type_show_close);
|
||||
}
|
||||
});
|
||||
ad.showAd(activity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.example.wallpapermagazine.max
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.CountDownTimer
|
||||
import android.util.Log
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.applovin.mediation.ads.MaxInterstitialAd
|
||||
import com.example.wallpapermagazine.WallPaperSelect
|
||||
|
||||
|
||||
object WelComManager {
|
||||
|
||||
private lateinit var timer: CountDownTimer
|
||||
|
||||
private var need_Show = true
|
||||
|
||||
private lateinit var lists: List<MaxInterstitialAd>
|
||||
|
||||
@JvmStatic
|
||||
fun initTimer(
|
||||
activity: Activity,
|
||||
countTime: Long,
|
||||
timAction: (time: Long) -> Unit,
|
||||
goMainAction: () -> Unit
|
||||
): CountDownTimer {
|
||||
need_Show = true
|
||||
timer = object : CountDownTimer(countTime, 100) {
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
timAction.invoke(millisUntilFinished)
|
||||
if (need_Show) {
|
||||
MaxManager.ShowAd(activity) {
|
||||
Log.d(WallPaperSelect.TAG, "--onTick----------it=$it")
|
||||
if (it == MaxManager.type_has_cache) {
|
||||
need_Show = false
|
||||
}
|
||||
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail) {
|
||||
Log.d(WallPaperSelect.TAG, "--onTick---------enter")
|
||||
goMainAction.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
if (need_Show) {
|
||||
MaxManager.ShowAd(activity) {
|
||||
if (it == MaxManager.type_show_close || it == MaxManager.type_show_fail || it == MaxManager.type_no_cache) {
|
||||
Log.d(WallPaperSelect.TAG, "--onFinish---------enter")
|
||||
goMainAction.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
startAd(activity)
|
||||
return timer
|
||||
}
|
||||
|
||||
private fun startAd(activity: Activity) {
|
||||
if (!WallPaperSelect.initSDkOK) {
|
||||
LocalBroadcastManager.getInstance(activity)
|
||||
.registerReceiver(object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(WallPaperSelect.TAG, "------------1sucess")
|
||||
}
|
||||
}, IntentFilter(WallPaperSelect.initAction))
|
||||
} else {
|
||||
lists = MaxManager.onLoadAd()
|
||||
timer.start()
|
||||
Log.d(WallPaperSelect.TAG, "------------2sucess")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.example.wallpapermagazine.max;
|
||||
|
||||
public interface onActionListener {
|
||||
|
||||
void onAction();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
package com.example.wallpapermagazine.max;
|
||||
|
||||
public interface onAdStatusListener {
|
||||
|
||||
void onAdStatus(int type);
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.action.InfoListWallPaperListener;
|
||||
import com.example.wallpapermagazine.action.InfoWallPaperListener;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.json.Info_data;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
public class CataItemAdapter extends RecyclerView.Adapter<CataItemHolder> {
|
||||
|
||||
private final List<Info_data> datainfo;
|
||||
private final Context mycontext;
|
||||
private final int op;
|
||||
private InfoListWallPaperListener infoWallPaperListener;
|
||||
|
||||
public void setInfoWallPaperListener(InfoListWallPaperListener infoWallPaperListener) {
|
||||
this.infoWallPaperListener = infoWallPaperListener;
|
||||
}
|
||||
|
||||
public CataItemAdapter(List<Info_data> infoList, int position, Context myCon) {
|
||||
this.datainfo = infoList;
|
||||
this.op = position;
|
||||
this.mycontext = myCon;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CataItemHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemview = LayoutInflater.from(mycontext).inflate(R.layout.item_recly2, parent, false);
|
||||
return new CataItemHolder(itemview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CataItemHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
ImageView imageView = holder.getImageView();
|
||||
String name = datainfo.get(op).getName();
|
||||
List<Info> infos;
|
||||
for (int i = 0; i < datainfo.size(); i++) {
|
||||
if (Objects.equals(name, datainfo.get(i).getName())) {
|
||||
infos = datainfo.get(i).getDatas();
|
||||
for (int j = 0; j <= i; j++) {
|
||||
Glide.with(mycontext)
|
||||
.load(infos.get(position).getPreviewThumb())
|
||||
.transform(new RoundedCorners(20))
|
||||
.placeholder(R.drawable.fail)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
holder.getLayoutItem().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (infoWallPaperListener != null) {
|
||||
infoWallPaperListener.onItemClickAction(op, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datainfo.get(op).getDatas().size()-6;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.wallpapermagazine.R;
|
||||
|
||||
public class CataItemHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView imageView_item;
|
||||
private LinearLayout layout_item;
|
||||
public CataItemHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView_item=itemView.findViewById(R.id.img_cata_item_recyle2);
|
||||
layout_item=itemView.findViewById(R.id.cata_item_lay2);
|
||||
}
|
||||
public LinearLayout getLayoutItem(){
|
||||
return layout_item;
|
||||
}
|
||||
public ImageView getImageView(){
|
||||
return imageView_item;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.example.wallpapermagazine.LoveDAO.FavoriteImage;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.ReadFile;
|
||||
import com.example.wallpapermagazine.action.FavoriteLimage;
|
||||
import com.example.wallpapermagazine.action.InfoListWallPaperListener;
|
||||
import com.example.wallpapermagazine.action.InfoWallPaperListener;
|
||||
import com.example.wallpapermagazine.action.Like;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FavoriteImageAdapter extends RecyclerView.Adapter<ImageViewHolder> {
|
||||
|
||||
private final Context context;
|
||||
private List<Info> datainfo;
|
||||
private final List<FavoriteImage> favoriteImages;
|
||||
private FavoriteLimage infoListWallPaperListener;
|
||||
|
||||
public void setInfoWallPaperListener(FavoriteLimage infoListWallPaperListener){
|
||||
this.infoListWallPaperListener= infoListWallPaperListener;
|
||||
}
|
||||
public FavoriteImageAdapter(Context context, List<FavoriteImage> favoriteImages) {
|
||||
this.context = context;
|
||||
this.favoriteImages = favoriteImages;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.cata_item_recyle, parent, false);
|
||||
return new ImageViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ImageViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
FavoriteImage favoriteImage = favoriteImages.get(position);
|
||||
ImageView imageView=holder.getImageView();
|
||||
Glide.with(context)
|
||||
.load(favoriteImage.imageUrl)
|
||||
.transform(new RoundedCorners(20))
|
||||
.placeholder(R.drawable.fail)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
holder.getLayoutItem().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(infoListWallPaperListener != null) {
|
||||
infoListWallPaperListener.onItemClickAction(favoriteImage,position);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return favoriteImages.size();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.wallpapermagazine.R;
|
||||
|
||||
public class ImageViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView imageView_item;
|
||||
private LinearLayout layout_item;
|
||||
public ImageViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView_item=itemView.findViewById(R.id.img_cata_item_recyle);
|
||||
layout_item=itemView.findViewById(R.id.cata_item_lay);
|
||||
|
||||
}
|
||||
public LinearLayout getLayoutItem(){
|
||||
return layout_item;
|
||||
}
|
||||
public ImageView getImageView(){
|
||||
return imageView_item;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.example.wallpapermagazine.R;
|
||||
import com.example.wallpapermagazine.ReadFile;
|
||||
import com.example.wallpapermagazine.action.InfoListWallPaperListener;
|
||||
import com.example.wallpapermagazine.action.InfoWallPaperListener;
|
||||
import com.example.wallpapermagazine.json.Info;
|
||||
import com.example.wallpapermagazine.json.Info_data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class RecommonedAdapter extends RecyclerView.Adapter<RecommonedHolder> {
|
||||
|
||||
private List<Info_data> datainfo;
|
||||
private Context mycontext;
|
||||
private final int op;
|
||||
private InfoListWallPaperListener infoWallPaperListener;
|
||||
|
||||
public void setInfoWallPaperListener(InfoListWallPaperListener infoWallPaperListener) {
|
||||
this.infoWallPaperListener = infoWallPaperListener;
|
||||
}
|
||||
|
||||
public RecommonedAdapter(List<Info_data> infoList, Context myCon, int op) {
|
||||
datainfo = infoList;
|
||||
this.op = op;
|
||||
mycontext = myCon;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecommonedHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemview = LayoutInflater.from(mycontext).inflate(R.layout.item_recycle, parent, false);
|
||||
return new RecommonedHolder(itemview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecommonedHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
ImageView imageView = holder.getImageView();
|
||||
String name = datainfo.get(op).getName();
|
||||
List<Info> infos;
|
||||
for (int i = 0; i < datainfo.size(); i++) {
|
||||
if (Objects.equals(name, datainfo.get(i).getName())) {
|
||||
infos = datainfo.get(i).getDatas();
|
||||
for (int j = 0; j <= i; j++) {
|
||||
Glide.with(mycontext)
|
||||
.load(infos.get(position).getPreviewThumb())
|
||||
.transform(new RoundedCorners(20))
|
||||
.placeholder(R.drawable.fail)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(imageView);
|
||||
holder.getLayoutItem().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (infoWallPaperListener != null) {
|
||||
infoWallPaperListener.onItemClickAction(op, position);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datainfo.get(op).getDatas().size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.example.wallpapermagazine.recylcle;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.wallpapermagazine.R;
|
||||
|
||||
public class RecommonedHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ImageView imageView_item;
|
||||
private LinearLayout layout_item;
|
||||
public RecommonedHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView_item=itemView.findViewById(R.id.img_item);
|
||||
layout_item=itemView.findViewById(R.id.item_layout);
|
||||
}
|
||||
public LinearLayout getLayoutItem(){
|
||||
return layout_item;
|
||||
}
|
||||
public ImageView getImageView(){
|
||||
return imageView_item;
|
||||
}
|
||||
}
|
||||
5
app/src/main/res/color/tab.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/white" android:state_checked="true"/>
|
||||
<item android:color="@color/nabt_color" android:state_checked="false"/>
|
||||
</selector>
|
||||
BIN
app/src/main/res/drawable/about.png
Normal file
|
After Width: | Height: | Size: 415 B |
12
app/src/main/res/drawable/back.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="M444.5,300.9a42.7,42.7 0,1 0,-60.4 -60.4l-241.3,241.4a42.5,42.5 0,0 0,0 60.4l241.3,241.3a42.7,42.7 0,1 0,60.4 -60.3l-211.2,-211.2 211.2,-211.2z"
|
||||
android:fillColor="@color/white"/>
|
||||
<path
|
||||
android:pathData="M170.7,512a42.7,42.7 0,0 1,42.7 -42.7h640a42.7,42.7 0,1 1,0 85.3H213.3a42.7,42.7 0,0 1,-42.7 -42.7z"
|
||||
android:fillColor="@color/white"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/bank_icon.png
Normal file
|
After Width: | Height: | Size: 195 B |
6
app/src/main/res/drawable/bg.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="@color/white33" />
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/download.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M5,18.404H19V20.004H5V18.404ZM12.778,10.404H18.222L12,16.804L5.778,10.404H11.222V4.004H12.778V10.404Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/fab_sharp.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">
|
||||
|
||||
<!-- 设置背景颜色 -->
|
||||
<solid android:color="@color/green" />
|
||||
|
||||
<!-- 设置圆角半径 -->
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/facebook.png
Normal file
|
After Width: | Height: | Size: 386 B |
BIN
app/src/main/res/drawable/fail.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
23
app/src/main/res/drawable/fail_h.xml
Normal file
18
app/src/main/res/drawable/fencisng.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M4,12.165C4,12.977 4.323,13.756 4.897,14.33C5.472,14.905 6.251,15.227 7.063,15.227C7.875,15.227 8.654,14.905 9.228,14.33C9.803,13.756 10.125,12.977 10.125,12.165C10.125,11.353 9.803,10.574 9.228,10C8.654,9.425 7.875,9.103 7.063,9.103C6.251,9.103 5.472,9.425 4.897,10C4.323,10.574 4,11.353 4,12.165Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M13.668,18.29C13.668,18.922 13.919,19.528 14.366,19.976C14.813,20.423 15.42,20.674 16.052,20.674C16.684,20.674 17.291,20.423 17.738,19.976C18.185,19.528 18.436,18.922 18.436,18.29C18.436,17.657 18.185,17.051 17.738,16.604C17.291,16.156 16.684,15.905 16.052,15.905C15.42,15.905 14.813,16.156 14.366,16.604C13.919,17.051 13.668,17.657 13.668,18.29Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M15.231,5.717C15.231,6.35 15.483,6.956 15.93,7.403C16.377,7.85 16.983,8.102 17.616,8.102C18.248,8.102 18.855,7.85 19.302,7.403C19.749,6.956 20,6.35 20,5.717C20,5.085 19.749,4.479 19.302,4.031C18.855,3.584 18.248,3.333 17.616,3.333C16.983,3.333 16.377,3.584 15.93,4.031C15.483,4.479 15.231,5.085 15.231,5.717Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M8.112,14.421L8.793,13.242L15.374,17.041L14.693,18.221L8.112,14.421ZM8.298,10.437L15.719,6.153L16.4,7.333L8.979,11.618L8.298,10.437Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/h_fail.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,2.28C17.368,2.28 21.72,6.632 21.72,12C21.72,17.368 17.368,21.72 12,21.72C6.632,21.72 2.28,17.368 2.28,12C2.28,6.632 6.632,2.28 12,2.28ZM15.398,7.358L10.455,9.138C10.152,9.247 9.877,9.422 9.649,9.649C9.421,9.877 9.247,10.152 9.138,10.455L7.358,15.398C7.295,15.572 7.284,15.76 7.324,15.94C7.364,16.12 7.455,16.285 7.585,16.415C7.716,16.546 7.88,16.636 8.061,16.677C8.241,16.717 8.428,16.705 8.602,16.642L13.545,14.863C13.848,14.753 14.123,14.579 14.351,14.351C14.579,14.123 14.753,13.848 14.862,13.545L16.642,8.602C16.705,8.429 16.716,8.241 16.676,8.061C16.636,7.881 16.545,7.716 16.415,7.585C16.284,7.455 16.119,7.364 15.939,7.324C15.759,7.284 15.572,7.296 15.398,7.358ZM12,13.215C12.322,13.215 12.631,13.087 12.859,12.859C13.087,12.632 13.215,12.323 13.215,12C13.215,11.678 13.087,11.369 12.859,11.141C12.631,10.913 12.322,10.785 12,10.785C11.678,10.785 11.369,10.913 11.141,11.141C10.913,11.369 10.785,11.678 10.785,12C10.785,12.323 10.913,12.632 11.141,12.859C11.369,13.087 11.678,13.215 12,13.215Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_cata.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M20.809,8.512L18.149,11.172C17.414,11.908 16.223,11.908 15.488,11.172L12.826,8.512C12.092,7.776 12.092,6.586 12.826,5.851L15.488,3.19C16.223,2.456 17.413,2.456 18.149,3.19L20.809,5.851C21.544,6.586 21.544,7.776 20.809,8.512ZM14.192,12.958H18.393C19.554,12.958 20.494,13.898 20.494,15.058V19.259C20.494,20.42 19.554,21.36 18.393,21.36H14.192C13.031,21.36 12.091,20.42 12.091,19.259V15.058C12.092,13.898 13.033,12.958 14.192,12.958ZM8.941,21.358H4.741C3.58,21.358 2.64,20.418 2.64,19.258V15.057C2.64,13.898 3.58,12.958 4.741,12.958H8.942C10.101,12.958 11.043,13.898 11.043,15.058V19.259C11.041,20.418 10.101,21.358 8.941,21.358ZM8.941,11.907H4.741C3.58,11.907 2.64,10.967 2.64,9.807V5.606C2.64,4.446 3.58,3.506 4.741,3.506H8.942C10.101,3.506 11.043,4.446 11.043,5.606V9.807C11.041,10.967 10.101,11.907 8.941,11.907Z"
|
||||
android:fillColor="#808D95"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/image_icon.png
Normal file
|
After Width: | Height: | Size: 194 KiB |
BIN
app/src/main/res/drawable/long_icon.png
Normal file
|
After Width: | Height: | Size: 388 KiB |
9
app/src/main/res/drawable/love.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M16.761,3.72C15.785,3.72 13.578,4.185 12.5,6.618C11.422,4.185 9.266,3.72 8.239,3.72C5.262,3.72 3.26,6.048 3.26,8.636C3.26,14.898 12.5,20.28 12.5,20.28C12.5,20.28 21.74,14.898 21.74,8.636C21.74,6.048 19.738,3.72 16.761,3.72Z"
|
||||
android:fillColor="#808D95"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/more.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M3,4C3,3.448 3.448,3 4,3H20C20.552,3 21,3.448 21,4C21,4.552 20.552,5 20,5H4C3.448,5 3,4.552 3,4ZM3,19C3,18.448 3.448,18 4,18H20C20.552,18 21,18.448 21,19C21,19.552 20.552,20 20,20H4C3.448,20 3,19.552 3,19ZM11,14C11,13.448 11.448,13 12,13H20C20.552,13 21,13.448 21,14C21,14.552 20.552,15 20,15H12C11.448,15 11,14.552 11,14ZM11,9C11,8.448 11.448,8 12,8H20C20.552,8 21,8.448 21,9C21,9.552 20.552,10 20,10H12C11.448,10 11,9.552 11,9ZM7.933,12.3C8.467,11.9 8.467,11.1 7.933,10.7L4.6,8.2C3.941,7.706 3,8.176 3,9V14C3,14.824 3.941,15.294 4.6,14.8L7.933,12.3Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/pv.png
Normal file
|
After Width: | Height: | Size: 290 B |
6
app/src/main/res/drawable/rounded_corner_borde.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/transparent"/> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="15dp"/> <!-- 设置圆角的半径 -->
|
||||
|
||||
<stroke android:width="5dp" android:color="@color/th"/> <!-- 设置边框的宽度和颜色 -->
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/select_like.png
Normal file
|
After Width: | Height: | Size: 424 B |
10
app/src/main/res/drawable/set_button.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:angle="0"
|
||||
android:endColor="@color/end_color"
|
||||
android:startColor="@color/start_color" />
|
||||
|
||||
|
||||
</shape>
|
||||
21
app/src/main/res/drawable/setwallpaper.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="343dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="343"
|
||||
android:viewportHeight="48">
|
||||
<path
|
||||
android:pathData="M16,0L327,0A16,16 0,0 1,343 16L343,32A16,16 0,0 1,327 48L16,48A16,16 0,0 1,0 32L0,16A16,16 0,0 1,16 0z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:startX="0"
|
||||
android:startY="24"
|
||||
android:endX="343"
|
||||
android:endY="24"
|
||||
android:type="linear">
|
||||
<item android:offset="0" android:color="#FF25DD87"/>
|
||||
<item android:offset="1" android:color="#FF2DD5C4"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</vector>
|
||||
7
app/src/main/res/drawable/text_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="10dp"/>
|
||||
<solid android:color="@color/white33" />
|
||||
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/title.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
45
app/src/main/res/layout/acitvity_home.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/dlt_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/th"
|
||||
tools:openDrawer="start"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_page_dis"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bt_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:itemActiveIndicatorStyle="@null"
|
||||
app:itemBackground="@color/wallpaper"
|
||||
app:itemIconTint="@color/tab"
|
||||
app:itemTextColor="@color/tab"
|
||||
app:labelVisibilityMode="labeled"
|
||||
app:menu="@menu/bt_menu" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/cata_navigation_view"
|
||||
android:background="@color/gray"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/nac_view_lay"
|
||||
app:menu="@menu/view_nav"
|
||||
app:itemTextColor="@color/white"
|
||||
app:itemIconTint="@color/white"
|
||||
app:itemBackground="@color/gray" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
15
app/src/main/res/layout/alterdialog.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about"
|
||||
android:textSize="20sp"
|
||||
android:textAlignment="center" /> <!-- 使文本居中 -->
|
||||
</LinearLayout>
|
||||
19
app/src/main/res/layout/cata_item_recyle.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/cata_item_lay"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_cata_item_recyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="210dp"
|
||||
android:scaleType="fitXY"/>
|
||||
|
||||
</LinearLayout>
|
||||
37
app/src/main/res/layout/fragment_cata_item.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?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:background="@color/wallpaper"
|
||||
android:paddingTop="30dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:contentDescription="@string/more_back"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cataitemname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/favorites"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_cata_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
60
app/src/main/res/layout/fragment_cata_item_indata.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/dar_cata_item"
|
||||
android:layout_width="393dp"
|
||||
android:layout_height="851dp"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/th"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dp">
|
||||
|
||||
<Toolbar
|
||||
android:id="@+id/cata_item_tool"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cate_item_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/more" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_show_cataname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</Toolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_cata_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/cata_item_navigation_view"
|
||||
android:layout_width="270dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/nac_view_lay"
|
||||
app:menu="@menu/view_nav" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
203
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/wallpaper">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingEnd="20dp"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/more" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/recommend"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="169dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/recommend"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frameLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="45dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_big"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="153dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/long_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_big"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp"
|
||||
android:layout_below="@+id/frameLayout"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_lay"
|
||||
android:layout_width="231.33dp"
|
||||
android:layout_height="101.5dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="161dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_nature"
|
||||
android:layout_width="231.33dp"
|
||||
android:layout_height="101.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/long_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="231.33dp"
|
||||
android:layout_height="101.5dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="161dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_super"
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="101dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/long_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_suoer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frameLayout2"
|
||||
android:layout_width="111.67dp"
|
||||
android:layout_height="211dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="226dp">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_Trop"
|
||||
android:layout_width="192dp"
|
||||
android:layout_height="211dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/long_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_Trop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/relativeLayout"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/recommend"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="216dp"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
24
app/src/main/res/layout/fragment_img.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".PreviewFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="#ff0000 " />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
38
app/src/main/res/layout/fragment_like.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dar_like"
|
||||
android:background="@color/wallpaper"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/like_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/more_back"
|
||||
android:src="@drawable/more" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/favorites"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyl_like"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
15
app/src/main/res/layout/item_recly2.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/cata_item_lay2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_cata_item_recyle2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="210dp"
|
||||
android:scaleType="fitXY"/>
|
||||
|
||||
</LinearLayout>
|
||||
14
app/src/main/res/layout/item_recycle.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_item"
|
||||
android:layout_width="127dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
</LinearLayout>
|
||||
41
app/src/main/res/layout/layout_cate.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?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:background="@color/wallpaper"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="30dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cate_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/more_back"
|
||||
android:src="@drawable/more" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/catalog"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list_catagray"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
26
app/src/main/res/layout/listview_lay.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="230dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="21dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="31dp"
|
||||
android:layout_marginTop="202dp"
|
||||
android:text="NAAAA"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="25sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
33
app/src/main/res/layout/login_lay.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/wel_bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/welcome"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="35sp" />
|
||||
|
||||
|
||||
<com.example.wallpapermagazine.CustomProgressBar
|
||||
android:id="@+id/pb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tv"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginTop="130dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:layout_marginBottom="70dp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
25
app/src/main/res/layout/nac_view_lay.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingTop="30dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:src="@drawable/title"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="144dp"
|
||||
android:layout_height="49dp"
|
||||
android:paddingStart="15dp"
|
||||
android:text="@string/wallpaper_magazine"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
</LinearLayout>
|
||||
128
app/src/main/res/layout/view_layout.xml
Normal file
@ -0,0 +1,128 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/wallpaper"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/back"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/bg">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_back"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/viewpageback"
|
||||
android:src="@drawable/bank_icon" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/set_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="48dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/set_button"
|
||||
android:gravity="center"
|
||||
android:text="@string/set_wallpaper"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="30dp"
|
||||
android:backgroundTint="@color/th"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/set_wallpaper"
|
||||
android:visibility="gone"
|
||||
app:fabSize="auto"
|
||||
app:layout_anchorGravity="bottom|end" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_download"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/download"
|
||||
android:foreground="@drawable/download"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_love"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/love"
|
||||
android:foreground="@drawable/love"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_show"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/share"
|
||||
android:foreground="@drawable/fencisng"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/text_bg"
|
||||
android:padding="17dp"
|
||||
android:text="@string/download"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
120
app/src/main/res/layout/viewlayout2.xml
Normal file
@ -0,0 +1,120 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/th"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/imageview_back2"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/viewpageback"
|
||||
android:foreground="@drawable/bank_icon" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/set_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="48dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/set_button"
|
||||
android:gravity="center"
|
||||
android:text="@string/set_wallpaper"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab_setting2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_margin="30dp"
|
||||
android:backgroundTint="@color/th"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/set_wallpaper"
|
||||
android:visibility="gone"
|
||||
app:fabSize="auto"
|
||||
app:layout_anchorGravity="bottom|end" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_download2"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/download"
|
||||
android:foreground="@drawable/download"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_love2"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/love"
|
||||
android:foreground="@drawable/select_like"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:tint="@color/red" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fbt_show2"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="130dp"
|
||||
android:backgroundTint="@color/white33"
|
||||
android:contentDescription="@string/share"
|
||||
android:foreground="@drawable/fencisng"
|
||||
app:layout_anchorGravity="bottom|end"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Material3.Button"
|
||||
app:tint="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_loading2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/text_bg"
|
||||
android:padding="17dp"
|
||||
android:visibility="gone"
|
||||
android:text="@string/download"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
18
app/src/main/res/menu/bt_menu.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/view_home"
|
||||
android:icon="@drawable/icon"
|
||||
android:title="@string/discover_icon" />
|
||||
<item
|
||||
android:id="@+id/view_cate"
|
||||
android:icon="@drawable/icon_cata"
|
||||
android:title="@string/catalog" />
|
||||
|
||||
<item
|
||||
android:id="@+id/view_like"
|
||||
android:icon="@drawable/love"
|
||||
android:title="@string/favorites" />
|
||||
|
||||
</menu>
|
||||
13
app/src/main/res/menu/view_nav.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/menu_about"
|
||||
android:icon="@drawable/about"
|
||||
android:title="@string/about"/>
|
||||
<item
|
||||
android:id="@+id/menu_face"
|
||||
android:icon="@drawable/facebook"
|
||||
android:title="@string/feedback"/>
|
||||
</group>
|
||||
</menu>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |