V1.0.1(2)
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
|
||||
BIN
WallpapersGallery.jks
Normal file
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
67
app/build.gradle.kts
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
id("org.jetbrains.kotlin.android")
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.app.wallpaper"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.wallpapers.gallery"
|
||||
minSdk = 23
|
||||
targetSdk = 34
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
defaultConfig {
|
||||
setProperty("archivesBaseName", "Wallpapers Gallery_V" + versionName + "(${versionCode})_$timestamp")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
dataBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.appcompat)
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
implementation(libs.navigation.fragment)
|
||||
implementation(libs.navigation.ui)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
implementation("androidx.room:room-runtime:2.4.0")
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
kapt("androidx.room:room-compiler:2.5.0")
|
||||
}
|
||||
38
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
# 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.app.wallpaper.getdata.SetData {
|
||||
public static final java.lang.String abc;
|
||||
public static final int vs;
|
||||
}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
|
||||
-keep class com.app.wallpaper.mydao.AppDatabase { *; }
|
||||
-keep class com.app.wallpaper.getdata.GetWalls { *; }
|
||||
-keepclassmembers class com.app.wallpaper.getdata.Urldata { *; }
|
||||
-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.app.wallpaper;
|
||||
|
||||
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.app.wallpaper", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
45
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_MEDIA_IMAGES"
|
||||
tools:ignore="SelectedPhotoAccess" />
|
||||
|
||||
<application
|
||||
android:name=".getdata.SetData"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@drawable/app_icon"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Base.Theme.Wallpaper"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".myact.MainActivity"
|
||||
android:exported="false"/>
|
||||
<activity
|
||||
android:name=".myact.ViewActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".myact.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>
|
||||
2199
app/src/main/assets/test_new.json
Normal file
@ -0,0 +1,65 @@
|
||||
package com.app.wallpaper.donwload;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.getdata.SetData;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
public class ImageDownloadTask extends AsyncTask<String, Void, Boolean> {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private Context context;
|
||||
private Activity activity;
|
||||
public ImageDownloadTask(Context context, Activity activity) {
|
||||
this.context = context;
|
||||
this.activity = activity;
|
||||
}
|
||||
@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 uri = a.saveToGallery(SetData.getContext(), inputStream);
|
||||
if(uri == null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
Log.e("ImageDownloadTask", "Server returned HTTP " + responseCode + " " + connection.getResponseMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("ImageDownloadTask", "Error downloading image", e);
|
||||
} finally {
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result) {
|
||||
if(activity != null&& !activity.isFinishing() && !activity.isDestroyed()){
|
||||
activity.findViewById(R.id.progressbar1).setVisibility(View.GONE);
|
||||
if (result) {
|
||||
|
||||
Toast.makeText(context, "Image downloaded successfully", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(context, "Failed to download image", Toast.LENGTH_SHORT).show();
|
||||
}}
|
||||
}
|
||||
}
|
||||
64
app/src/main/java/com/app/wallpaper/donwload/a.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.app.wallpaper.donwload;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class a {
|
||||
public static Uri saveToGallery(Context context, InputStream inputStream) {
|
||||
String displayName = System.currentTimeMillis()+".jpg";
|
||||
ContentValues contentValues = new ContentValues();
|
||||
Log.d("-----------------", "saveToGallery: "+displayName);
|
||||
contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, displayName);
|
||||
contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
contentValues.put(MediaStore.Images.Media.IS_PENDING, 1);
|
||||
}
|
||||
|
||||
Uri collectionUri;
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
collectionUri = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY);
|
||||
} else {
|
||||
collectionUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
Uri imageUri = contentResolver.insert(collectionUri, contentValues);
|
||||
if (imageUri == null) {
|
||||
return null;
|
||||
}
|
||||
// InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
int byteLength = 0;
|
||||
byte[] bytes = new byte[4096];
|
||||
outputStream = contentResolver.openOutputStream(imageUri);
|
||||
// inputStream = new FileInputStream(photoFile);
|
||||
while ((byteLength = inputStream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, byteLength);
|
||||
}
|
||||
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(imageUri, contentValues, null, null);
|
||||
}
|
||||
return imageUri;
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
app/src/main/java/com/app/wallpaper/getdata/GetWalls.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.app.wallpaper.getdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class GetWalls implements Serializable {
|
||||
private String name;
|
||||
private List<Urldata> list;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<Urldata> getList() {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
36
app/src/main/java/com/app/wallpaper/getdata/ReadFile.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.app.wallpaper.getdata;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
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 = SetData.context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dp * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
71
app/src/main/java/com/app/wallpaper/getdata/SetData.java
Normal file
@ -0,0 +1,71 @@
|
||||
package com.app.wallpaper.getdata;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
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 SetData extends Application {
|
||||
|
||||
private static final List<GetWalls> AllWalls=new ArrayList<>();
|
||||
private static final List<Urldata> dataUrls=new ArrayList<>();
|
||||
static Context context;
|
||||
public static final String abc="app_database";
|
||||
public static final int vs=1;
|
||||
|
||||
|
||||
public static Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
context = getBaseContext();
|
||||
try {
|
||||
InputStream open = getAssets().open("test_new.json");
|
||||
String covertStr = ReadFile.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<GetWalls>>() {
|
||||
}.getType();
|
||||
List<GetWalls> catas=gson.fromJson(covertStr,type);
|
||||
for (GetWalls categories:catas){
|
||||
AllWalls.add(categories);
|
||||
for (Urldata urldata:categories.getList()){
|
||||
dataUrls.add(urldata);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<Urldata> getDataUrls() {
|
||||
return dataUrls;
|
||||
}
|
||||
|
||||
public static List<GetWalls> getCataDatas() {
|
||||
return AllWalls;
|
||||
}
|
||||
}
|
||||
16
app/src/main/java/com/app/wallpaper/getdata/Urldata.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.app.wallpaper.getdata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Urldata implements Serializable {
|
||||
private String sourceUrl;
|
||||
private String preUrl;
|
||||
|
||||
public String getSourceUrl() {
|
||||
return sourceUrl;
|
||||
}
|
||||
|
||||
public String getPreUrl() {
|
||||
return preUrl;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.app.wallpaper.myOnitem;
|
||||
|
||||
import com.app.wallpaper.mydao.MyEntity;
|
||||
|
||||
public interface OnFavority {
|
||||
public void OnitemClick(MyEntity myEntity,int Id);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.app.wallpaper.myOnitem;
|
||||
|
||||
public interface OnItemHome {
|
||||
public void OnitemClick(int position);
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
package com.app.wallpaper.myOnitem;
|
||||
|
||||
public interface OnLoaditem {
|
||||
public void OnitemClick(int cataId,int position);
|
||||
}
|
||||
59
app/src/main/java/com/app/wallpaper/myact/LoginActivity.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.app.wallpaper.myact;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.app.wallpaper.databinding.ActivityLogin2Binding;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
private ActivityLogin2Binding binding;
|
||||
private Handler handler = new Handler();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityLogin2Binding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
EdgeToEdge.enable(this);
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 使用 ValueAnimator 创建进度条动画
|
||||
ValueAnimator animation = ValueAnimator.ofInt(0, binding.progressBar.getMax());
|
||||
animation.setDuration(2500); // 动画时长
|
||||
animation.setInterpolator(new DecelerateInterpolator()); // 减速插值器
|
||||
animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
binding.progressBar.setProgress((int) animation.getAnimatedValue());
|
||||
}
|
||||
});
|
||||
animation.start();
|
||||
// 动画结束后跳转到新页面
|
||||
animation.addListener(new android.animation.Animator.AnimatorListener() {
|
||||
@Override
|
||||
public void onAnimationStart(android.animation.Animator animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(android.animation.Animator animation) {
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish(); // 可选:结束当前 Activity
|
||||
}
|
||||
@Override
|
||||
public void onAnimationCancel(android.animation.Animator animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(android.animation.Animator animation) {}
|
||||
});
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
}
|
||||
80
app/src/main/java/com/app/wallpaper/myact/MainActivity.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.app.wallpaper.myact;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.view.MenuItem;
|
||||
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.ActivityMainBinding;
|
||||
import com.app.wallpaper.myada.MainFragmentAddapter;
|
||||
import com.app.wallpaper.myfra.HomeFragment;
|
||||
import com.app.wallpaper.myfra.MyfavFragment;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private ActivityMainBinding binding;
|
||||
private final List<Fragment> mfragmentList = new ArrayList<>();
|
||||
private static final int STORAGE_PERMISSION_CODE = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
binding.getRoot();
|
||||
setContentView(binding.getRoot());
|
||||
checkPermission(this, STORAGE_PERMISSION_CODE);
|
||||
mfragmentList.add(new HomeFragment());
|
||||
mfragmentList.add(new MyfavFragment());
|
||||
MainFragmentAddapter myFragmentAdapter = new MainFragmentAddapter(MainActivity.this, mfragmentList);
|
||||
binding.viewPager.setAdapter(myFragmentAdapter);
|
||||
new TabLayoutMediator(binding.tabLayout, binding.viewPager, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
if (position == 0) {
|
||||
tab.setIcon(R.drawable.ic_home);
|
||||
} else {
|
||||
tab.setIcon(R.drawable.frame_3_);
|
||||
}
|
||||
}
|
||||
}).attach();
|
||||
}
|
||||
|
||||
private boolean checkPermission(Activity mActivity, int requestCode) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
return true;
|
||||
} else {
|
||||
if (mActivity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(
|
||||
mActivity,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
requestCode
|
||||
);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
272
app/src/main/java/com/app/wallpaper/myact/ViewActivity.java
Normal file
@ -0,0 +1,272 @@
|
||||
package com.app.wallpaper.myact;
|
||||
|
||||
import static androidx.databinding.adapters.ViewBindingAdapter.setPadding;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.ActivityViewBinding;
|
||||
import com.app.wallpaper.donwload.ImageDownloadTask;
|
||||
import com.app.wallpaper.getdata.SetData;
|
||||
import com.app.wallpaper.mydao.AppDatabase;
|
||||
import com.app.wallpaper.mydao.InterfaceDao;
|
||||
import com.app.wallpaper.mydao.MyEntity;
|
||||
import com.app.wallpaper.myfra.ViewFragment;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class ViewActivity extends AppCompatActivity {
|
||||
private ActivityViewBinding binding;
|
||||
private int position, cataId, Id,position1;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private String sourUrl;
|
||||
private InterfaceDao interfaceDao;
|
||||
private AppDatabase appDatabase;
|
||||
private MyEntity myEntitys = new MyEntity();
|
||||
private ImageDownloadTask downloadTask;
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
binding = ActivityViewBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
intenttData();
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
appDatabase = AppDatabase.getDatabase(this);
|
||||
if (cataId != 0) {
|
||||
sourUrl = SetData.getCataDatas().get(cataId).getList().get(position).getSourceUrl();
|
||||
} else {
|
||||
sourUrl = SetData.getDataUrls().get(position).getSourceUrl();
|
||||
}
|
||||
showView();
|
||||
interfaceDao = appDatabase.interfaceDao();
|
||||
initJudge();
|
||||
binding.back.setOnClickListener(view -> finish());
|
||||
setButtonLisenner();
|
||||
}
|
||||
|
||||
private void intenttData() {
|
||||
position1 = getIntent().getIntExtra("position1", 0);
|
||||
if (position1 != 0) {
|
||||
position = position1;
|
||||
}else {
|
||||
position = getIntent().getIntExtra("position", 0);
|
||||
}
|
||||
cataId = getIntent().getIntExtra("cataId", 0);
|
||||
Id = getIntent().getIntExtra("Id", -100);
|
||||
myEntitys = (MyEntity) getIntent().getSerializableExtra("imageUrl");
|
||||
}
|
||||
|
||||
private void initJudge() {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
if (myEntitys != null) {
|
||||
MyEntity myEntity = interfaceDao.getImageSou(myEntitys.imageSou);
|
||||
if (myEntity != null) {
|
||||
binding.likeImg.setBackgroundResource(R.drawable.likede_ic);
|
||||
}
|
||||
} else {
|
||||
MyEntity myEntity = interfaceDao.getImageSou(sourUrl);
|
||||
if (myEntity != null) {
|
||||
binding.likeImg.setBackgroundResource(R.drawable.likede_ic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
private void setButtonLisenner() {
|
||||
binding.donwload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (sourUrl != null) {
|
||||
downloadTask = new ImageDownloadTask(getBaseContext(), ViewActivity.this);
|
||||
downloadTask.execute(sourUrl);
|
||||
binding.progressbar1.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Toast.makeText(ViewActivity.this, "Failed to download image...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
binding.apply.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
loadPreview(sourUrl);
|
||||
binding.progressbar1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
binding.like.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myEntitys == null) {
|
||||
MyEntity myEntity1 = interfaceDao.getImageSou(sourUrl);
|
||||
if (myEntity1 == null) {
|
||||
if (cataId==0) {
|
||||
MyEntity myEntity = new MyEntity();
|
||||
myEntity.setImagePre(SetData.getDataUrls().get(position).getPreUrl());
|
||||
myEntity.setImageSou(sourUrl);
|
||||
new InsertImageTask().execute(myEntity);
|
||||
}else {
|
||||
MyEntity myEntity = new MyEntity();
|
||||
myEntity.setImagePre(SetData.getCataDatas().get(cataId).getList().get(position).getPreUrl());
|
||||
myEntity.setImageSou(sourUrl);
|
||||
new InsertImageTask().execute(myEntity);
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
binding.likeImg.setBackgroundResource(R.drawable.likede_ic);
|
||||
Toast.makeText(ViewActivity.this, "Added successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
interfaceDao.deleteUser(myEntity1);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
binding.likeImg.setBackgroundResource(R.drawable.like);
|
||||
Toast.makeText(ViewActivity.this, "Cancel successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else
|
||||
{
|
||||
MyEntity myEntity2 = myEntitys;
|
||||
interfaceDao.deleteUser(myEntity2);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
binding.likeImg.setBackgroundResource(R.drawable.like);
|
||||
Toast.makeText(ViewActivity.this, "Cancel successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
binding.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, sourUrl); // 可以添加URL文本
|
||||
startActivity(Intent.createChooser(shareIntent, "Share pictures"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private class InsertImageTask extends AsyncTask<MyEntity, Void, Void> {
|
||||
@Override
|
||||
protected Void doInBackground(MyEntity... myEntities) {
|
||||
appDatabase.interfaceDao().insert(myEntities[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
|
||||
}
|
||||
}
|
||||
private void showView() {
|
||||
ViewFragment viewFragment;
|
||||
if (myEntitys == null) {
|
||||
if (cataId == 0) {
|
||||
viewFragment = ViewFragment.newInstance(SetData
|
||||
.getDataUrls().get(position).getSourceUrl());
|
||||
} else {
|
||||
viewFragment = ViewFragment.newInstance(SetData.
|
||||
getCataDatas().get(cataId).getList().
|
||||
get(position).getSourceUrl());
|
||||
}
|
||||
} else {
|
||||
viewFragment = ViewFragment.newInstance(myEntitys.getImageUrl2());
|
||||
}
|
||||
binding.viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return viewFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
binding.progressbar1.setVisibility(View.VISIBLE);
|
||||
setPhoneWallpaper(resource);
|
||||
}
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
binding.progressbar1.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setPhoneWallpaper(Bitmap bitmap) {
|
||||
try {
|
||||
wallpaperManager.setBitmap(bitmap);
|
||||
finish();
|
||||
Toast.makeText(this, "Setting wallpaper successfully", Toast.LENGTH_SHORT).show();
|
||||
binding.progressbar1.setVisibility(View.GONE);
|
||||
} catch (IOException ioException) {
|
||||
Toast.makeText(this, "Setting failed, ", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (downloadTask != null && !downloadTask.isCancelled()) {
|
||||
downloadTask.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
136
app/src/main/java/com/app/wallpaper/myada/LoadDataAdapter.java
Normal file
@ -0,0 +1,136 @@
|
||||
package com.app.wallpaper.myada;
|
||||
|
||||
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.app.wallpaper.R;
|
||||
import com.app.wallpaper.getdata.GetWalls;
|
||||
import com.app.wallpaper.getdata.ReadFile;
|
||||
import com.app.wallpaper.getdata.Urldata;
|
||||
import com.app.wallpaper.myOnitem.OnItemHome;
|
||||
import com.app.wallpaper.myOnitem.OnLoaditem;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LoadDataAdapter extends RecyclerView.Adapter<LoadDataAdapter.LoadDataHolder> {
|
||||
private static int VIEW_TYPE_1 = 0;
|
||||
private static final int VIEW_TYPE_2 = 1;
|
||||
private List<GetWalls> datas = new ArrayList<>();
|
||||
private final int posi;
|
||||
private final Context context;
|
||||
private List<Urldata> urldata = new ArrayList<>();
|
||||
private OnItemHome onItemHome;
|
||||
private OnLoaditem onLoaditem;
|
||||
|
||||
|
||||
public LoadDataAdapter(List<GetWalls> datas, Context context, int position, List<Urldata> urldata) {
|
||||
this.datas = datas;
|
||||
this.context = context;
|
||||
this.posi = position;
|
||||
this.urldata = urldata;
|
||||
}
|
||||
|
||||
public void setInfoWallPaperListener(OnItemHome onItemHome, OnLoaditem onLoaditem) {
|
||||
this.onItemHome = onItemHome;
|
||||
this.onLoaditem = onLoaditem;
|
||||
}
|
||||
|
||||
public static class LoadDataHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView img_one;
|
||||
|
||||
public LoadDataHolder(@NonNull View itemView, int viewType) {
|
||||
super(itemView);
|
||||
if (viewType == VIEW_TYPE_1) {
|
||||
img_one = itemView.findViewById(R.id.img_one);
|
||||
} else {
|
||||
img_one = itemView.findViewById(R.id.img_two);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LoadDataHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
if (viewType == VIEW_TYPE_1) {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rec_item_layout, parent, false);
|
||||
} else {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rec_item_layout2, parent, false);
|
||||
}
|
||||
return new LoadDataHolder(view, viewType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LoadDataHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
if (posi == 0) {
|
||||
Glide.with(context)
|
||||
.load(urldata.get(position).getPreUrl())
|
||||
.placeholder(R.drawable.place)
|
||||
.centerCrop()
|
||||
.into(holder.img_one);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onItemHome != null) {
|
||||
onItemHome.OnitemClick(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Glide.with(context)
|
||||
.load(datas.get(posi - 1).getList().get(position).getPreUrl())
|
||||
.centerCrop()
|
||||
.placeholder(R.drawable.place)
|
||||
.into(holder.img_one);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onLoaditem != null) {
|
||||
onLoaditem.OnitemClick(posi - 1, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
int row = position / 2;
|
||||
if (row % 2 != 0) {
|
||||
if (position % 2 == 0) {
|
||||
return VIEW_TYPE_1; // 偶数位置
|
||||
} else {
|
||||
return VIEW_TYPE_2; // 奇数位置
|
||||
}
|
||||
} else {
|
||||
if (position % 2 == 0) {
|
||||
return VIEW_TYPE_2; // 偶数位置
|
||||
} else {
|
||||
return VIEW_TYPE_1; // 奇数位置
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (posi == 0) {
|
||||
return urldata.size();
|
||||
} else {
|
||||
return datas.get(posi - 1).getList().size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.app.wallpaper.myada;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
|
||||
public class LoadDataHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView img_one;
|
||||
private ImageView img_two;
|
||||
private FrameLayout frame_layout;
|
||||
private FrameLayout frame_layout2;
|
||||
public LoadDataHolder(@NonNull View itemView,int viewType) {
|
||||
super(itemView);
|
||||
|
||||
if (viewType==com.app.wallpaper.R.layout.rec_item_layout) {
|
||||
img_one = itemView.findViewById(R.id.img_one);
|
||||
frame_layout=itemView.findViewById(R.id.frame_layout);
|
||||
}else {
|
||||
img_two = itemView.findViewById(R.id.img_two);
|
||||
frame_layout2=itemView.findViewById(R.id.frame_layout2);
|
||||
}
|
||||
}
|
||||
|
||||
public ImageView getImg_one() {
|
||||
return img_one;
|
||||
}
|
||||
|
||||
public ImageView getImg_two() {
|
||||
return img_two;
|
||||
}
|
||||
|
||||
public FrameLayout getFrame_layout() {
|
||||
return frame_layout;
|
||||
}
|
||||
public FrameLayout getFrame_layout2() {
|
||||
return frame_layout2;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.app.wallpaper.myada;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainFragmentAddapter extends FragmentStateAdapter {
|
||||
private final List<Fragment> mfragmentList;
|
||||
|
||||
public MainFragmentAddapter(@NonNull FragmentActivity fragmentActivity, List<Fragment> fragmentList) {
|
||||
super(fragmentActivity);
|
||||
this.mfragmentList = fragmentList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
return mfragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mfragmentList.size();
|
||||
}
|
||||
}
|
||||
101
app/src/main/java/com/app/wallpaper/myada/MyfavorityAdapter.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.app.wallpaper.myada;
|
||||
|
||||
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.app.wallpaper.R;
|
||||
import com.app.wallpaper.getdata.ReadFile;
|
||||
|
||||
import com.app.wallpaper.myOnitem.OnFavority;
|
||||
|
||||
import com.app.wallpaper.mydao.MyEntity;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyfavorityAdapter extends RecyclerView.Adapter<MyfavorityAdapter.LoadDataHolder> {
|
||||
private static int VIEW_TYPE_1 = 0;
|
||||
private static final int VIEW_TYPE_2 = 1;
|
||||
private final Context context;
|
||||
private OnFavority onFavority;
|
||||
private final List<MyEntity> datas;
|
||||
public MyfavorityAdapter(Context context, List<MyEntity> datas) {
|
||||
this.context = context;
|
||||
this.datas = datas;
|
||||
}
|
||||
public void setInfoWallPaperListener(OnFavority onFavority) {
|
||||
this.onFavority = onFavority;
|
||||
}
|
||||
|
||||
public static class LoadDataHolder extends RecyclerView.ViewHolder {
|
||||
public ImageView img_one;
|
||||
public LoadDataHolder(@NonNull View itemView, int viewType) {
|
||||
super(itemView);
|
||||
if (viewType == VIEW_TYPE_1) {
|
||||
img_one = itemView.findViewById(R.id.img_one);
|
||||
} else {
|
||||
img_one = itemView.findViewById(R.id.img_two);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public LoadDataHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view;
|
||||
if (viewType == VIEW_TYPE_1) {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rec_item_layout, parent, false);
|
||||
} else {
|
||||
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.rec_item_layout2, parent, false);
|
||||
}
|
||||
return new LoadDataHolder(view, viewType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull LoadDataHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
Glide.with(context)
|
||||
.load(datas.get(position).getImageUrl1())
|
||||
.centerCrop()
|
||||
.placeholder(R.drawable.ic_fail)
|
||||
.into(holder.img_one);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onFavority != null) {
|
||||
onFavority.OnitemClick(datas.get(position),position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
int row = position / 2;
|
||||
if (row % 2 != 0) {
|
||||
if (position % 2 == 0) {
|
||||
return VIEW_TYPE_1; // 偶数位置
|
||||
} else {
|
||||
return VIEW_TYPE_2; // 奇数位置
|
||||
}
|
||||
} else {
|
||||
if (position % 2 == 0) {
|
||||
return VIEW_TYPE_2; // 偶数位置
|
||||
} else {
|
||||
return VIEW_TYPE_1; // 奇数位置
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return datas.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.app.wallpaper.myada;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import com.app.wallpaper.getdata.GetWalls;
|
||||
import com.app.wallpaper.myfra.LoadDataFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class TabPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<Fragment> fragmentList=new ArrayList<>();
|
||||
private List<GetWalls> datas=new ArrayList<>();
|
||||
public TabPagerAdapter(@NonNull FragmentManager fm
|
||||
, List<Fragment> fragmentList
|
||||
,List<GetWalls> datas) {
|
||||
super(fm);
|
||||
this.fragmentList=fragmentList;
|
||||
this.datas=datas;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
|
||||
if (position==0){
|
||||
return LoadDataFragment.newInstance(position);
|
||||
}else {
|
||||
|
||||
return LoadDataFragment.newInstance(position);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragmentList.size()+1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
if (position==0){
|
||||
return "All";
|
||||
}else {
|
||||
return datas==null?null:datas.get(position-1).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
27
app/src/main/java/com/app/wallpaper/mydao/AppDatabase.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.app.wallpaper.mydao;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {MyEntity.class}, version = 1, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
public abstract InterfaceDao interfaceDao();
|
||||
|
||||
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, "app_database")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
26
app/src/main/java/com/app/wallpaper/mydao/InterfaceDao.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.app.wallpaper.mydao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface InterfaceDao {
|
||||
@Insert
|
||||
void insert(MyEntity myEntity);
|
||||
|
||||
@Query("SELECT * FROM table_image_url")
|
||||
List<MyEntity> getAllImages();
|
||||
|
||||
@Query("SELECT * FROM table_image_url where imagePre =:url")
|
||||
MyEntity getImagePre(String url);
|
||||
|
||||
@Query("SELECT * FROM table_image_url where imageSou =:url")
|
||||
MyEntity getImageSou(String url);
|
||||
|
||||
@Delete
|
||||
void deleteUser(MyEntity favoriteImage);
|
||||
}
|
||||
47
app/src/main/java/com/app/wallpaper/mydao/MyEntity.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.app.wallpaper.mydao;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity(tableName = "table_image_url")
|
||||
public class MyEntity implements Serializable {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
public String imagePre;
|
||||
public String imageSou;
|
||||
|
||||
public MyEntity(String imageUrl1, String imageUrl2) {
|
||||
this.imagePre = imageUrl1;
|
||||
this.imageSou = imageUrl2;
|
||||
}
|
||||
public MyEntity(){
|
||||
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setImagePre(String imageUrl1) {
|
||||
this.imagePre = imageUrl1;
|
||||
}
|
||||
|
||||
public void setImageSou(String imageUrl2) {
|
||||
this.imageSou = imageUrl2;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String getImageUrl1() {
|
||||
return imagePre;
|
||||
}
|
||||
|
||||
public String getImageUrl2() {
|
||||
return imageSou;
|
||||
}
|
||||
}
|
||||
136
app/src/main/java/com/app/wallpaper/myfra/HomeFragment.java
Normal file
@ -0,0 +1,136 @@
|
||||
package com.app.wallpaper.myfra;
|
||||
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.FragmentHomeBinding;
|
||||
import com.app.wallpaper.getdata.GetWalls;
|
||||
import com.app.wallpaper.getdata.ReadFile;
|
||||
import com.app.wallpaper.getdata.SetData;
|
||||
import com.app.wallpaper.getdata.Urldata;
|
||||
import com.app.wallpaper.myOnitem.OnItemHome;
|
||||
import com.app.wallpaper.myact.ViewActivity;
|
||||
import com.app.wallpaper.myada.TabPagerAdapter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class HomeFragment extends Fragment implements OnItemHome {
|
||||
private FragmentHomeBinding binding;
|
||||
private DrawerLayout drawerLayout;
|
||||
private final List<Fragment> mfragmentList = new ArrayList<>();
|
||||
private List<GetWalls> datas = new ArrayList<>();
|
||||
private int position;
|
||||
private Random random;
|
||||
private List<Urldata> urldata = new ArrayList<>();
|
||||
private NavigationView navigationView;
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentHomeBinding.inflate(getLayoutInflater());
|
||||
binding.tablay.setupWithViewPager(binding.viewPagerTab);
|
||||
urldata = SetData.getDataUrls();
|
||||
drawerLayout = requireActivity().findViewById(R.id.drawer_layout);
|
||||
navigationView = requireActivity().findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.about) {
|
||||
showDialog();
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
random = new Random();
|
||||
position = random.nextInt(SetData.getDataUrls().size() - 1);
|
||||
defautIma();
|
||||
setFra();
|
||||
binding.viewPagerTab.setAdapter(new TabPagerAdapter(getChildFragmentManager(), mfragmentList, datas));
|
||||
binding.homeSetting.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
});
|
||||
binding.img.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("position1", position);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
});
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
private void defautIma() {
|
||||
Glide.with(this)
|
||||
.load(urldata.get(position).getSourceUrl())
|
||||
.centerCrop()
|
||||
.placeholder(R.drawable.place)
|
||||
.into(binding.img);
|
||||
}
|
||||
|
||||
private void setFra() {
|
||||
for (int i = 0; i < SetData.getCataDatas().size(); i++) {
|
||||
mfragmentList.add(new LoadDataFragment());
|
||||
}
|
||||
datas = SetData.getCataDatas();
|
||||
|
||||
}
|
||||
|
||||
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.0")
|
||||
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnitemClick(int position) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("position", position);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package com.app.wallpaper.myfra;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.FragmentContentBinding;
|
||||
import com.app.wallpaper.getdata.GetWalls;
|
||||
import com.app.wallpaper.getdata.SetData;
|
||||
import com.app.wallpaper.myOnitem.OnItemHome;
|
||||
import com.app.wallpaper.myOnitem.OnLoaditem;
|
||||
import com.app.wallpaper.myact.ViewActivity;
|
||||
import com.app.wallpaper.myada.LoadDataAdapter;
|
||||
import com.app.wallpaper.utils.MyItemDecoration;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class LoadDataFragment extends Fragment implements OnItemHome, OnLoaditem {
|
||||
private FragmentContentBinding binding;
|
||||
private static final String ARG_CONTENT = "content";
|
||||
private List<GetWalls> urldata;
|
||||
private int position;
|
||||
|
||||
public static LoadDataFragment newInstance( int position) {
|
||||
LoadDataFragment fragment = new LoadDataFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("position", position);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
// urldata = (List<GetWalls>) getArguments().getSerializable(ARG_CONTENT);
|
||||
position = getArguments().getInt("position");
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {// 替换为你的 Fragment 布局文件
|
||||
binding = FragmentContentBinding.inflate(getLayoutInflater());
|
||||
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
|
||||
binding.contentRe.setLayoutManager(staggeredGridLayoutManager);
|
||||
LoadDataAdapter loadDataAdapter = new LoadDataAdapter(SetData.getCataDatas(), getContext(), position, SetData.getDataUrls());
|
||||
binding.contentRe.addItemDecoration(new MyItemDecoration(SetData.getContext(), 20, 20, 15));
|
||||
loadDataAdapter.setInfoWallPaperListener((OnItemHome) this, (OnLoaditem) this);
|
||||
binding.contentRe.setAdapter(loadDataAdapter);
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnitemClick(int position) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("position", position);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void OnitemClick(int cataId, int position) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("cataId", cataId);
|
||||
intent.putExtra("position", position);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
158
app/src/main/java/com/app/wallpaper/myfra/MyfavFragment.java
Normal file
@ -0,0 +1,158 @@
|
||||
package com.app.wallpaper.myfra;
|
||||
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.FragmentMyfav2Binding;
|
||||
import com.app.wallpaper.getdata.SetData;
|
||||
import com.app.wallpaper.myOnitem.OnFavority;
|
||||
import com.app.wallpaper.myOnitem.OnItemHome;
|
||||
import com.app.wallpaper.myOnitem.OnLoaditem;
|
||||
import com.app.wallpaper.myact.ViewActivity;
|
||||
import com.app.wallpaper.myada.LoadDataAdapter;
|
||||
import com.app.wallpaper.myada.MyfavorityAdapter;
|
||||
import com.app.wallpaper.mydao.AppDatabase;
|
||||
import com.app.wallpaper.mydao.MyEntity;
|
||||
import com.app.wallpaper.utils.MyItemDecoration;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyfavFragment extends Fragment implements OnFavority {
|
||||
|
||||
private FragmentMyfav2Binding binding;
|
||||
private AppDatabase appDatabase;
|
||||
private List<MyEntity> datas = new ArrayList<>();
|
||||
private MyfavorityAdapter myfavorityAdapter;
|
||||
private DrawerLayout drawerLayout;
|
||||
private NavigationView navigationView;;
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public MyfavFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static MyfavFragment newInstance(String param1, String param2) {
|
||||
MyfavFragment fragment = new MyfavFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding = FragmentMyfav2Binding.inflate(getLayoutInflater());
|
||||
appDatabase = AppDatabase.getDatabase(requireContext());
|
||||
navigationView = requireActivity().findViewById(R.id.nav_view);
|
||||
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.about) {
|
||||
showDialog();
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
binding.myfraSetting.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
drawerLayout= getActivity().findViewById(R.id.drawer_layout);
|
||||
drawerLayout.openDrawer(GravityCompat.START);
|
||||
}
|
||||
});
|
||||
setRecyclerview();
|
||||
loadFavoriteImages();
|
||||
return binding.getRoot();
|
||||
}
|
||||
private void loadFavoriteImages() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<MyEntity> allFavoriteImages = appDatabase.interfaceDao().getAllImages();
|
||||
requireActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
if (allFavoriteImages.isEmpty()){
|
||||
binding.layout.setVisibility(View.VISIBLE);;
|
||||
}else {
|
||||
binding.layout.setVisibility(View.GONE);
|
||||
}
|
||||
datas.clear();
|
||||
datas.addAll(allFavoriteImages);
|
||||
myfavorityAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void setRecyclerview() {
|
||||
StaggeredGridLayoutManager staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
|
||||
binding.myfra.setLayoutManager(staggeredGridLayoutManager);
|
||||
myfavorityAdapter = new MyfavorityAdapter(getContext(), datas);
|
||||
myfavorityAdapter.setInfoWallPaperListener((OnFavority) this);
|
||||
binding.myfra.addItemDecoration(new MyItemDecoration(SetData.getContext(),20,20,15));
|
||||
binding.myfra.setAdapter(myfavorityAdapter);
|
||||
}
|
||||
@Override
|
||||
public void OnitemClick(MyEntity myEntity,int Id) {
|
||||
Intent intent = new Intent(getContext(), ViewActivity.class);
|
||||
intent.putExtra("imageUrl",myEntity);
|
||||
intent.putExtra("Id", Id);
|
||||
startActivity(intent);
|
||||
}
|
||||
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.0")
|
||||
.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
loadFavoriteImages();
|
||||
}
|
||||
}
|
||||
75
app/src/main/java/com/app/wallpaper/myfra/ViewFragment.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.app.wallpaper.myfra;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
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 com.app.wallpaper.R;
|
||||
import com.app.wallpaper.databinding.FragmentViewBinding;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
public class ViewFragment extends Fragment {
|
||||
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private FragmentViewBinding binding;
|
||||
private String mParam1;
|
||||
|
||||
public ViewFragment() {
|
||||
}
|
||||
|
||||
public static ViewFragment newInstance(String param1) {
|
||||
ViewFragment fragment = new ViewFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
binding= FragmentViewBinding.inflate(getLayoutInflater());
|
||||
Glide.with(requireContext())
|
||||
.asBitmap()
|
||||
.load(mParam1)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
binding.imageviewPreview.setImageBitmap(resource);
|
||||
binding.progressbar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
binding.progressbar.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package com.app.wallpaper.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Rect
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
|
||||
class MyItemDecoration(
|
||||
private var context: Context,
|
||||
private var v: Int,
|
||||
private var h: Int,
|
||||
private var ex: Int
|
||||
) :
|
||||
RecyclerView.ItemDecoration() {
|
||||
// item占满一行时,该item是否需要左右间距
|
||||
var mVerticalSpacing = true
|
||||
|
||||
var mHorizontalSpaci = true
|
||||
|
||||
init {
|
||||
|
||||
v = dpToPx(v, context)
|
||||
h = dpToPx(h, context)
|
||||
ex = dpToPx(ex, context)
|
||||
}
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
|
||||
val position = parent.getChildAdapterPosition(view)
|
||||
var spanCount = 1
|
||||
var spanSize = 1
|
||||
var spanIndex = 0
|
||||
|
||||
|
||||
parent.layoutManager?.run {
|
||||
if (this is StaggeredGridLayoutManager) {
|
||||
spanCount = this.spanCount
|
||||
(view.layoutParams as StaggeredGridLayoutManager.LayoutParams)?.run {
|
||||
if (isFullSpan) spanSize = spanCount
|
||||
spanIndex = this.spanIndex
|
||||
}
|
||||
} else if (this is GridLayoutManager) {
|
||||
spanCount = this.spanCount
|
||||
spanSize = this.spanSizeLookup.getSpanSize(position)
|
||||
spanIndex = (view.layoutParams as GridLayoutManager.LayoutParams).spanIndex
|
||||
} else if (this is LinearLayoutManager) {
|
||||
outRect.left = v
|
||||
outRect.right = v
|
||||
outRect.bottom = h
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (spanSize == spanCount) {
|
||||
outRect.left =
|
||||
if (mVerticalSpacing) v + ex else 0
|
||||
outRect.right =
|
||||
if (mVerticalSpacing) v + ex else 0
|
||||
outRect.bottom = if (mHorizontalSpaci) h else 0
|
||||
} else {
|
||||
val itemAllSpacing = (v * (spanCount + 1) + ex * 2) / spanCount
|
||||
val left = v * (spanIndex + 1) - itemAllSpacing * spanIndex + ex
|
||||
val right = itemAllSpacing - left
|
||||
outRect.left = left
|
||||
outRect.right = right
|
||||
outRect.bottom = h
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun dpToPx(dp: Int, context: Context): Int {
|
||||
val density = context.resources.displayMetrics.density
|
||||
return (dp * density).toInt()
|
||||
}
|
||||
|
||||
}
|
||||
5
app/src/main/new.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="">
|
||||
<item android:state_selected="true" android:drawable="@color/black" />
|
||||
<item android:drawable="@color/black" />
|
||||
</selector>
|
||||
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/black" android:state_selected="true"/>
|
||||
<item android:color="#80F5F5F5" android:state_selected="false"/>
|
||||
</selector>
|
||||
5
app/src/main/res/color/tab_text_color.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_selected="true" />
|
||||
<item android:color="@color/black" android:state_selected="false" />
|
||||
</selector>
|
||||
BIN
app/src/main/res/drawable/aaa.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
app/src/main/res/drawable/about.png
Normal file
|
After Width: | Height: | Size: 426 B |
BIN
app/src/main/res/drawable/app_icon.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
BIN
app/src/main/res/drawable/apply.png
Normal file
|
After Width: | Height: | Size: 371 B |
BIN
app/src/main/res/drawable/back.png
Normal file
|
After Width: | Height: | Size: 274 B |
4
app/src/main/res/drawable/back_ic_boder.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#4DFFFFFF" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="4dp"/> <!-- 设置圆角的半径 -->
|
||||
</shape>
|
||||
17
app/src/main/res/drawable/custom_progress_bar.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="#80FFFFFF" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="5dp" />
|
||||
<solid android:color="@color/pinkk" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
BIN
app/src/main/res/drawable/donwload.png
Normal file
|
After Width: | Height: | Size: 264 B |
BIN
app/src/main/res/drawable/faceback.png
Normal file
|
After Width: | Height: | Size: 636 B |
BIN
app/src/main/res/drawable/fav_ic.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable/favorites.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
9
app/src/main/res/drawable/frame_3_.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="M21.633,6.647C21.319,5.919 20.866,5.26 20.299,4.706C19.732,4.151 19.064,3.709 18.33,3.405C17.57,3.09 16.754,2.928 15.931,2.93C14.775,2.93 13.648,3.246 12.668,3.844C12.434,3.987 12.211,4.144 12,4.315C11.789,4.144 11.566,3.987 11.332,3.844C10.352,3.246 9.225,2.93 8.07,2.93C7.238,2.93 6.431,3.089 5.67,3.405C4.934,3.71 4.27,4.148 3.701,4.706C3.134,5.26 2.681,5.919 2.367,6.647C2.041,7.404 1.875,8.208 1.875,9.035C1.875,9.816 2.034,10.629 2.351,11.456C2.616,12.148 2.995,12.865 3.48,13.589C4.249,14.735 5.306,15.931 6.619,17.142C8.794,19.151 10.948,20.538 11.039,20.594L11.594,20.951C11.841,21.108 12.157,21.108 12.403,20.951L12.959,20.594C13.05,20.536 15.202,19.151 17.379,17.142C18.691,15.931 19.748,14.735 20.517,13.589C21.002,12.865 21.384,12.148 21.647,11.456C21.963,10.629 22.123,9.816 22.123,9.035C22.125,8.208 21.959,7.404 21.633,6.647Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/head_ic.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
5
app/src/main/res/drawable/ic_boder.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#4DFFFFFF" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="8dp"/> <!-- 设置圆角的半径 -->
|
||||
<stroke android:width="6dp" android:color="#00000000"/> <!-- 设置边框的宽度和颜色 -->
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/ic_fail.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable/ic_fail2.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
12
app/src/main/res/drawable/ic_fav.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<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="M21.633,6.647C21.319,5.919 20.866,5.26 20.299,4.706C19.732,4.151 19.064,3.709 18.33,3.405C17.57,3.09 16.754,2.928 15.931,2.93C14.775,2.93 13.648,3.246 12.668,3.844C12.434,3.987 12.211,4.144 12,4.315C11.789,4.144 11.566,3.987 11.332,3.844C10.352,3.246 9.225,2.93 8.07,2.93C7.238,2.93 6.431,3.089 5.67,3.405C4.934,3.71 4.27,4.148 3.701,4.706C3.134,5.26 2.681,5.919 2.367,6.647C2.041,7.404 1.875,8.208 1.875,9.035C1.875,9.816 2.034,10.629 2.351,11.456C2.616,12.148 2.995,12.865 3.48,13.589C4.249,14.735 5.306,15.931 6.619,17.142C8.794,19.151 10.948,20.538 11.039,20.594L11.594,20.951C11.841,21.108 12.157,21.108 12.403,20.951L12.959,20.594C13.05,20.536 15.202,19.151 17.379,17.142C18.691,15.931 19.748,14.735 20.517,13.589C21.002,12.865 21.384,12.148 21.647,11.456C21.963,10.629 22.123,9.816 22.123,9.035C22.125,8.208 21.959,7.404 21.633,6.647ZM12,19.097C12,19.097 3.656,13.751 3.656,9.035C3.656,6.647 5.632,4.711 8.07,4.711C9.783,4.711 11.269,5.667 12,7.064C12.731,5.667 14.217,4.711 15.931,4.711C18.368,4.711 20.344,6.647 20.344,9.035C20.344,13.751 12,19.097 12,19.097Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M21.633,6.647C21.319,5.919 20.866,5.26 20.299,4.706C19.732,4.151 19.064,3.709 18.33,3.405C17.57,3.09 16.754,2.928 15.931,2.93C14.775,2.93 13.648,3.246 12.668,3.844C12.434,3.987 12.211,4.144 12,4.315C11.789,4.144 11.566,3.987 11.332,3.844C10.352,3.246 9.225,2.93 8.07,2.93C7.238,2.93 6.431,3.089 5.67,3.405C4.934,3.71 4.27,4.148 3.701,4.706C3.134,5.26 2.681,5.919 2.367,6.647C2.041,7.404 1.875,8.208 1.875,9.035C1.875,9.816 2.034,10.629 2.351,11.456C2.616,12.148 2.995,12.865 3.48,13.589C4.249,14.735 5.306,15.931 6.619,17.142C8.794,19.151 10.948,20.538 11.039,20.594L11.594,20.951C11.841,21.108 12.157,21.108 12.403,20.951L12.959,20.594C13.05,20.536 15.202,19.151 17.379,17.142C18.691,15.931 19.748,14.735 20.517,13.589C21.002,12.865 21.384,12.148 21.647,11.456C21.963,10.629 22.123,9.816 22.123,9.035C22.125,8.208 21.959,7.404 21.633,6.647ZM12,19.097C12,19.097 3.656,13.751 3.656,9.035C3.656,6.647 5.632,4.711 8.07,4.711C9.783,4.711 11.269,5.667 12,7.064C12.731,5.667 14.217,4.711 15.931,4.711C18.368,4.711 20.344,6.647 20.344,9.035C20.344,13.751 12,19.097 12,19.097Z"
|
||||
android:fillColor="#CECECE"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_home.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="M22.184,11.835L12.53,2.188C12.46,2.119 12.378,2.064 12.287,2.026C12.196,1.988 12.098,1.969 12,1.969C11.902,1.969 11.804,1.988 11.713,2.026C11.622,2.064 11.54,2.119 11.47,2.188L1.816,11.835C1.535,12.117 1.376,12.499 1.376,12.897C1.376,13.724 2.048,14.397 2.876,14.397H3.893V21.281C3.893,21.695 4.228,22.031 4.643,22.031H9.45C10.03,22.031 10.5,21.56 10.5,20.981V18.093C10.5,17.368 11.088,16.781 11.813,16.781C12.537,16.781 13.125,17.368 13.125,18.093V20.981C13.125,21.56 13.595,22.031 14.175,22.031H19.357C19.772,22.031 20.107,21.695 20.107,21.281V14.397H21.124C21.523,14.397 21.905,14.24 22.186,13.956C22.77,13.37 22.77,12.421 22.184,11.835Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/ic_home_with_border.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item><shape android:shape="oval">
|
||||
<solid android:color="@color/white"/>
|
||||
<size
|
||||
android:width="40dp"
|
||||
android:height="40dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
BIN
app/src/main/res/drawable/ic_homefra.png
Normal file
|
After Width: | Height: | Size: 174 B |
BIN
app/src/main/res/drawable/ic_homrfra.png
Normal file
|
After Width: | Height: | Size: 263 B |
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>
|
||||
BIN
app/src/main/res/drawable/img_fail.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable/like.png
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
app/src/main/res/drawable/likede_ic.png
Normal file
|
After Width: | Height: | Size: 474 B |
BIN
app/src/main/res/drawable/login_ic.png
Normal file
|
After Width: | Height: | Size: 3.6 MiB |
5
app/src/main/res/drawable/nav_back.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#4DFFFFFF" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="42dp"/> <!-- 设置圆角的半径 -->
|
||||
<stroke android:width="1dp" android:color="#00000000"/>
|
||||
</shape>
|
||||
17
app/src/main/res/drawable/navback.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="202dp"
|
||||
android:height="68dp"
|
||||
android:viewportWidth="202"
|
||||
android:viewportHeight="68"
|
||||
>
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M34 0H168C186.778 0 202 15.2223 202 34C202 52.7777 186.778 68 168 68H34C15.2223 68 0 52.7777 0 34C0 15.2223 15.2223 0 34 0Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M0 0V68H202V0"
|
||||
android:fillColor="#66FFFFFF"
|
||||
/>
|
||||
</group>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/pavc.png
Normal file
|
After Width: | Height: | Size: 546 B |
BIN
app/src/main/res/drawable/place.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
5
app/src/main/res/drawable/rounded_corner_background.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/white" />
|
||||
<corners android:radius="32dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/rounded_corner_borde.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/black" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="12dp"/> <!-- 设置圆角的半径 -->
|
||||
<stroke android:width="1dp" android:color="#00000000"/>
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/rounded_corner_borde2.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#EBEFF4" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="12dp"/> <!-- 设置圆角的半径 -->
|
||||
<stroke android:width="1dp" android:color="#00000000"/>
|
||||
</shape>
|
||||
6
app/src/main/res/drawable/rounded_corner_borde3.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/tab" /> <!-- 你可以设置边框内的颜色 -->
|
||||
<corners android:radius="44dp"/> <!-- 设置圆角的半径 -->
|
||||
<stroke android:width="1dp" android:color="#00000000"/>
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/share.png
Normal file
|
After Width: | Height: | Size: 381 B |
5
app/src/main/res/drawable/tab_back.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:drawable="@drawable/rounded_corner_borde" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/rounded_corner_borde2" android:state_selected="false"/>
|
||||
</selector>
|
||||
BIN
app/src/main/res/drawable/wallpapers.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
33
app/src/main/res/layout/activity_login.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".myact.LoginActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_login" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="16dp"
|
||||
app:srcCompat="@android:drawable/ic_dialog_email" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
30
app/src/main/res/layout/activity_login2.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?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/back">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100.25dp"
|
||||
android:src="@mipmap/ic_log"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_height="57.32dp"/>
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:progressDrawable="@drawable/custom_progress_bar"
|
||||
android:scrollbarSize="6dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="181dp" />
|
||||
</RelativeLayout>
|
||||
50
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?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/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
tools:context=".myact.MainActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
style="@style/MyTabLayout"
|
||||
android:layout_width="202dp"
|
||||
android:layout_height="68dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="47dp"
|
||||
android:background="@drawable/nav_back"
|
||||
android:elevation="0dp"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabIconTint="@color/tab"
|
||||
app:tabMode="fixed" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="275dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start|bottom"
|
||||
android:background="#E6FFFFFF"
|
||||
app:headerLayout="@layout/head"
|
||||
app:itemBackground="@color/white"
|
||||
app:itemHorizontalPadding="20dp"
|
||||
app:itemVerticalPadding="10.5dp"
|
||||
app:menu="@menu/nav_menu" />
|
||||
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
209
app/src/main/res/layout/activity_view.xml
Normal file
@ -0,0 +1,209 @@
|
||||
<?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/view_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar1"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:scrollbarSize="5dp"
|
||||
android:indeterminateTint="@color/white"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/back"
|
||||
android:layout_width="31dp"
|
||||
android:layout_height="31dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="68dp"
|
||||
android:background="@drawable/back_ic_boder">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_img"
|
||||
android:layout_width="23dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="23dp"
|
||||
android:src="@drawable/back" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="4">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/donwload"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/ic_boder"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView1"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="NotSibling">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/donwload_img"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/donwload" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/save"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.509"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/donwload" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/apply"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/ic_boder"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView2"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="NotSibling">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/apply_img"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/apply" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/aplly"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.509"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/apply" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/like"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/ic_boder"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView3"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="NotSibling">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/like_img"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/like" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/like"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.509"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/like" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/share"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@drawable/ic_boder"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView4"
|
||||
app:layout_constraintDimensionRatio="1:1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="NotSibling">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/share_img"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/share" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/share"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.509"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/share" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
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/content_login.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_content_login"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
13
app/src/main/res/layout/fragment_content.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/content_re"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
35
app/src/main/res/layout/fragment_first.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".FirstFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_first"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/next"
|
||||
app:layout_constraintBottom_toTopOf="@id/textview_first"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_first"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/lorem_ipsum"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_first" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
70
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".myfra.HomeFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_setting"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_homrfra" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home"
|
||||
android:layout_width="127dp"
|
||||
android:layout_height="29dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="45dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/wallpapers" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/home"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
app:cardCornerRadius="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="130dp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tablay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="32dp"
|
||||
android:layout_below="@+id/card_view"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:background="#00000000"
|
||||
android:scrollbarSize="32dp"
|
||||
app:tabBackground="@drawable/tab_back"
|
||||
app:tabGravity="center"
|
||||
app:tabMode="scrollable"
|
||||
app:tabSelectedTextColor="@color/tab_text_color"
|
||||
app:tabUnboundedRipple="false" />
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/view_pager_tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/tablay"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="20dp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
23
app/src/main/res/layout/fragment_img.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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">
|
||||
|
||||
<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>
|
||||
60
app/src/main/res/layout/fragment_myfav2.xml
Normal file
@ -0,0 +1,60 @@
|
||||
<?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=".myfra.MyfavFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/myfra_setting"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_homrfra" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home"
|
||||
android:layout_width="139dp"
|
||||
android:layout_height="29dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="45dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/favorites" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/home"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/fav_ic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="80dp"
|
||||
android:src="@drawable/fav_ic" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/no_favorite_wallpapers_have_been_added_yet"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/myfra"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/layout"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
35
app/src/main/res/layout/fragment_second.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".SecondFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_second"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/previous"
|
||||
app:layout_constraintBottom_toTopOf="@id/textview_second"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_second"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/lorem_ipsum"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_second" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
23
app/src/main/res/layout/fragment_view.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?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">
|
||||
|
||||
<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>
|
||||
17
app/src/main/res/layout/head.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/head_ic" />
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
16
app/src/main/res/layout/rec_item_layout.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="32dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_one"
|
||||
android:src="@drawable/place"
|
||||
android:scaleType="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
17
app/src/main/res/layout/rec_item_layout2.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/frame_layout2"
|
||||
android:layout_width="match_parent"
|
||||
app:cardCornerRadius="32dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_two"
|
||||
android:layout_width="match_parent"
|
||||
android:src="@drawable/place"
|
||||
android:scaleType="center"
|
||||
app:layout_constraintDimensionRatio="H,1:1"
|
||||
android:layout_height="150dp" />
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
15
app/src/main/res/menu/bt_menu.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/view_home"
|
||||
android:icon="@drawable/ic_home"
|
||||
android:title="@string/todo" />
|
||||
<item
|
||||
android:id="@+id/view_cate"
|
||||
android:icon="@drawable/frame_3_"
|
||||
android:title="@string/todo" />
|
||||
|
||||
|
||||
</menu>
|
||||
15
app/src/main/res/menu/nav_menu.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:icon="@drawable/about"
|
||||
android:title="@string/about" />
|
||||
<item
|
||||
android:id="@+id/feedback"
|
||||
android:icon="@drawable/faceback"
|
||||
android:title="@string/feedback" />
|
||||
|
||||
|
||||
</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 |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |