V1.0.0(1)
15
.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
BIN
app/WallpapersHaven.jks
Normal file
58
app/build.gradle.kts
Normal file
@ -0,0 +1,58 @@
|
||||
import java.util.Date
|
||||
import java.text.SimpleDateFormat
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
id ("org.jetbrains.kotlin.android")
|
||||
kotlin("kapt")
|
||||
}
|
||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||
android {
|
||||
namespace = "com.lh.wallpaper2"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.app.wallpapershaven"
|
||||
minSdk = 23
|
||||
//noinspection OldTargetApi
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
setProperty("archivesBaseName", "WallpapersHaven_V" + versionName + "(${versionCode})_$timestamp")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//noinspection UseTomlInstead
|
||||
kapt( "androidx.room:room-compiler:2.6.1")
|
||||
implementation("androidx.room:room-ktx:2.6.1")
|
||||
androidTestImplementation("androidx.room:room-testing:2.6.1")
|
||||
//noinspection GradleDependency
|
||||
implementation("androidx.viewpager2:viewpager2:1.0.0")
|
||||
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
implementation(libs.appcompat)
|
||||
implementation(libs.material)
|
||||
implementation(libs.activity)
|
||||
implementation(libs.constraintlayout)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
}
|
||||
39
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# 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.lh.wallpaper2.Wallpaper {
|
||||
public static final java.lang.String dadgsfgsf;
|
||||
public static final int aadasdasd;
|
||||
}
|
||||
|
||||
-keepclassmembers class * {
|
||||
@androidx.room.Query <methods>;
|
||||
}
|
||||
-keep class com.lh.wallpaper2.entity.AppDatabase { *; }
|
||||
-keep class com.lh.wallpaper2.json.Info { *; }
|
||||
-keepclassmembers class com.lh.wallpaper2.json.Url { *; }
|
||||
-keep class com.lh.wallpaper2.db.Favorite { *; }
|
||||
|
||||
-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.lh.wallpaper2;
|
||||
|
||||
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.lh.wallpaper2", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
57
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<!--
|
||||
<!– 访问网络权限–>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!– 访问sd卡需要添加的权限–>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
-->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32"
|
||||
tools:ignore="ScopedStorage" />
|
||||
|
||||
<application
|
||||
android:name=".Wallpaper"
|
||||
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="@drawable/app_icon"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Wallpaper2"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".PrivacyActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".DetailsActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ViewActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".InitialActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
2251
app/src/main/assets/pink_wallpaper.json
Normal file
86
app/src/main/assets/privacy.html
Normal file
@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Privacy Policy</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
h1, h2 {
|
||||
color: #333;
|
||||
}
|
||||
h2 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
p {
|
||||
margin: 10px 0;
|
||||
}
|
||||
ul {
|
||||
margin: 10px 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Privacy Policy</h1>
|
||||
<p><strong>Date:</strong> August 8, 2024</p>
|
||||
|
||||
<p>We provide this Privacy Policy to help you understand how we collect, use, and disclose information, including what you may provide to us or that we obtain from our products and services. We treat your privacy very seriously. Your privacy is important to us.</p>
|
||||
|
||||
<h2>Information Collection and Use</h2>
|
||||
<p>For a better experience, while using our Service, we may require you to provide us with certain personally identifiable information, such as users' name, address, location, pictures, etc. The information that we request will be retained on your device and is not collected or retained by us in any way and used as described in this privacy policy.</p>
|
||||
<p>The app does use third-party services that may collect information used to identify you.</p>
|
||||
<p>Please refer to the privacy policy of the third-party service provider used by the application:</p>
|
||||
<ul>
|
||||
<li>Google Play Services</li>
|
||||
<li>Google Analytics for Firebase</li>
|
||||
<li>Firebase Crashlytics</li>
|
||||
<li>Unity</li>
|
||||
<li>AppLovin</li>
|
||||
<li>Pangle</li>
|
||||
<li>Mintegral</li>
|
||||
<li>Bigo</li>
|
||||
<li>Ironsource</li>
|
||||
<li>Vungle</li>
|
||||
</ul>
|
||||
|
||||
<h2>Log Data</h2>
|
||||
<p>We want to inform you that whenever you use our Service, in case of an error in the app, we collect data and information (through third-party products) on your phone called Log Data. This Log Data may include information such as your device Internet Protocol (“IP”) address, device name, operating system version, the configuration of the app when utilizing our Service, the time and date of your use of the Service, and other statistics.</p>
|
||||
|
||||
<h2>Cookies</h2>
|
||||
<p>Cookies are files with a small amount of data that are commonly used as anonymous unique identifiers. These are sent to your browser from the websites that you visit and are stored on your device's internal memory.</p>
|
||||
<p>This Service does not use these “cookies” explicitly. However, the app may use third-party code and libraries that use “cookies” to collect information and improve their services. You have the option to either accept or refuse these cookies and know when a cookie is being sent to your device. If you choose to refuse our cookies, you may not be able to use some portions of this Service.</p>
|
||||
|
||||
<h2>Service Providers</h2>
|
||||
<p>We may employ third-party companies and individuals due to the following reasons:</p>
|
||||
<ul>
|
||||
<li>To facilitate our Service</li>
|
||||
<li>To provide the Service on our behalf</li>
|
||||
<li>To perform Service-related services</li>
|
||||
<li>To assist us in analyzing how our Service is used</li>
|
||||
</ul>
|
||||
<p>We want to inform users of this Service that these third parties have access to their Personal Information. The reason is to perform the tasks assigned to them on our behalf. However, they are obligated not to disclose or use the information for any other purpose.</p>
|
||||
|
||||
<h2>Security</h2>
|
||||
<p>We value your trust in providing us your Personal Information, thus we are striving to use commercially acceptable means of protecting it. But remember that no method of transmission over the internet, or method of electronic storage is 100% secure and reliable, and we cannot guarantee its absolute security.</p>
|
||||
|
||||
<h2>Links to Other Sites</h2>
|
||||
<p>This Service may contain links to other sites. If you click on a third-party link, you will be directed to that site. Note that these external sites are not operated by us. Therefore, we strongly advise you to review the Privacy Policy of these websites. We have no control over and assume no responsibility for the content, privacy policies, or practices of any third-party sites or services.</p>
|
||||
|
||||
<h2>Children’s Privacy</h2>
|
||||
<p>These Services do not address anyone under the age of 13. We do not knowingly collect personally identifiable information from children under 13 years of age. In the case we discover that a child under 13 has provided us with personal information, we will immediately delete this from our servers. If you are a parent or guardian and you are aware that your child has provided us with personal information, please contact us so that we will be able to take the necessary actions.</p>
|
||||
|
||||
<h2>Changes to This Privacy Policy</h2>
|
||||
<p>We may update our Privacy Policy from time to time. Thus, you are advised to review this page periodically for any changes. We will notify you of any changes by posting the new Privacy Policy on this page.</p>
|
||||
|
||||
<h2>Privacy Questions</h2>
|
||||
<p>We may update the Privacy Policy from time to time. When we change the policy in a material way, a notice will be posted on our website along with the updated Privacy Policy.</p>
|
||||
<p>If you have any questions or concerns about our Privacy Policy or data processing, please contact us: <a href="mailto:SantoshAtmorgiXh@gmail.com">SantoshAtmorgiXh@gmail.com</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
67
app/src/main/java/com/lh/wallpaper2/DetailsActivity.java
Normal file
@ -0,0 +1,67 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lh.wallpaper2.action.InfoWallpaperListener;
|
||||
import com.lh.wallpaper2.action.UrlWallpaperListener;
|
||||
import com.lh.wallpaper2.adapter.DetailsAdapter;
|
||||
import com.lh.wallpaper2.file.MyItemSpace;
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DetailsActivity extends AppCompatActivity implements UrlWallpaperListener {
|
||||
private TextView textView;
|
||||
private Info info;
|
||||
private RecyclerView recyclerView;
|
||||
private ImageView imageView;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_details);
|
||||
textView = findViewById(R.id.details_text);
|
||||
recyclerView = findViewById(R.id.details_recyclerView);
|
||||
info = (Info) getIntent().getSerializableExtra(StaticValue.key_info);
|
||||
Log.d("99999999999", "onCreate: " + info.getList().size());
|
||||
if (info != null) {
|
||||
textView.setText(info.getName());
|
||||
Log.d("99999999999", "onCreate: " + info.getName());
|
||||
}
|
||||
setRecyclerView();
|
||||
imageView = findViewById(R.id.imageview_back);
|
||||
imageView.setOnClickListener(v -> finish());
|
||||
}
|
||||
|
||||
|
||||
private void setRecyclerView() {
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(this, 2);
|
||||
DetailsAdapter detailsAdapter = new DetailsAdapter(info.getList(), this);
|
||||
detailsAdapter.setUrlWallpaperListener(this);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
recyclerView.setAdapter(detailsAdapter);
|
||||
MyItemSpace myItemSpace = new MyItemSpace(30, 50, 40);
|
||||
recyclerView.addItemDecoration(myItemSpace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(ArrayList<Url> dataInfo, int position) {
|
||||
|
||||
startActivity(new Intent(this, ViewActivity.class).putExtra(StaticValue.key_picture, dataInfo).putExtra(StaticValue.key_position,position));
|
||||
}
|
||||
}
|
||||
59
app/src/main/java/com/lh/wallpaper2/InitialActivity.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public class InitialActivity extends AppCompatActivity {
|
||||
private ProgressBar progressBar;
|
||||
// private int progressStatus = 0;
|
||||
private CountDownTimer countDownTimer;
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
private int progressStatus = 0;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_initial);
|
||||
progressBar = findViewById(R.id.progressBar);
|
||||
// 更新进度
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (progressStatus < 100) {
|
||||
progressStatus += 1;
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.setProgress(progressStatus);
|
||||
}
|
||||
});
|
||||
try {
|
||||
Thread.sleep(30); // 延时 300 毫秒
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(InitialActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
113
app/src/main/java/com/lh/wallpaper2/MainActivity.java
Normal file
@ -0,0 +1,113 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
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.fragment.app.Fragment;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.navigation.NavigationBarView;
|
||||
import com.lh.wallpaper2.fragment.FavoriteFragment;
|
||||
import com.lh.wallpaper2.fragment.HomeFragment;
|
||||
import com.lh.wallpaper2.fragment.SettingFragment;
|
||||
import com.lh.wallpaper2.adapter.MyFragmentStateAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private BottomNavigationView navigationView;
|
||||
private ViewPager viewPager;
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
EdgeToEdge.enable(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
navigationView = findViewById(R.id.bottomNavigation);
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
fragments.add(new HomeFragment());
|
||||
fragments.add(new FavoriteFragment());
|
||||
fragments.add(new SettingFragment());
|
||||
//若跳转多个界面添加多个fragment
|
||||
MyFragmentStateAdapter adapter = new MyFragmentStateAdapter(getSupportFragmentManager(), fragments);
|
||||
viewPager.setAdapter(adapter);
|
||||
navigationView.setSelectedItemId(R.id.navigation_home);
|
||||
// getNavigationBarHeight(this);
|
||||
navigationView.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.navigation_home) {
|
||||
viewPager.setCurrentItem(0);
|
||||
} if (item.getItemId() == R.id.navigation_favorite){
|
||||
viewPager.setCurrentItem(1);
|
||||
} if (item.getItemId() == R.id.navigation_setting) {
|
||||
viewPager.setCurrentItem(2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
navigationView.setSelectedItemId(R.id.navigation_home);
|
||||
break;
|
||||
case 1:
|
||||
navigationView.setSelectedItemId(R.id.navigation_favorite);
|
||||
break;
|
||||
case 2:
|
||||
navigationView.setSelectedItemId(R.id.navigation_setting);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
});
|
||||
checkPermission(this,1);
|
||||
}
|
||||
private boolean checkPermission(Activity mActivity, int requestCode) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
return true;
|
||||
} else {
|
||||
if (mActivity.checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(
|
||||
mActivity,
|
||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
requestCode
|
||||
);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*public int getNavigationBarHeight(Context context) {
|
||||
Resources resources = context.getResources();
|
||||
int resourceId = resources.getIdentifier("bottomNavigation", "dimen", "android");
|
||||
if (resourceId > 0) {
|
||||
return resources.getDimensionPixelSize(resourceId);
|
||||
}
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
}
|
||||
26
app/src/main/java/com/lh/wallpaper2/PrivacyActivity.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.lh.wallpaper2.databinding.ActivityPrivacyBinding;
|
||||
|
||||
|
||||
public class PrivacyActivity extends AppCompatActivity {
|
||||
private WebView webView;
|
||||
private ImageView imageView;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_privacy);
|
||||
webView=findViewById(R.id.webview);
|
||||
imageView=findViewById(R.id.back);
|
||||
imageView.setOnClickListener(view -> finish());
|
||||
webView.loadUrl("file:///android_asset/privacy.html");
|
||||
}
|
||||
}
|
||||
9
app/src/main/java/com/lh/wallpaper2/StaticValue.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
public class StaticValue {
|
||||
public static final String key_info = "key_info";
|
||||
public static final String key_source = "key_source";
|
||||
public static final String key_picture = "key_source";
|
||||
public static final String key_position = "key_position";
|
||||
|
||||
}
|
||||
259
app/src/main/java/com/lh/wallpaper2/ViewActivity.java
Normal file
@ -0,0 +1,259 @@
|
||||
package com.lh.wallpaper2;
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.WallpaperManager;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.lh.wallpaper2.dao.TaskDao;
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
import com.lh.wallpaper2.download.ImageDownloadTask;
|
||||
import com.lh.wallpaper2.entity.AppDatabase;
|
||||
import com.lh.wallpaper2.fragment.PreviewFragment;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class ViewActivity extends AppCompatActivity {
|
||||
private ArrayList<Url> url;
|
||||
private int position;
|
||||
private ViewPager viewPagerPreview;
|
||||
private String selectPreImg;
|
||||
private ImageView BackimageView;
|
||||
private CardView cardView;
|
||||
private FrameLayout share;
|
||||
private FrameLayout download;
|
||||
private ImageView collect;
|
||||
private TextView textViewLoading;
|
||||
private WallpaperManager wallpaperManager;
|
||||
private TaskDao dao;
|
||||
private Favorite favorite;
|
||||
private Favorite info;
|
||||
private Url homeInfo;
|
||||
private String topInfo;
|
||||
private ImageDownloadTask downloadTask;
|
||||
private ProgressBar process;
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EdgeToEdge.enable(this);
|
||||
setContentView(R.layout.activity_view);
|
||||
wallpaperManager = WallpaperManager.getInstance(this);
|
||||
viewPagerPreview = findViewById(R.id.viewpager_preview);
|
||||
BackimageView = findViewById(R.id.imageview_back);
|
||||
cardView = findViewById(R.id.cardView);
|
||||
share = findViewById(R.id.share);
|
||||
download = findViewById(R.id.download);
|
||||
collect = findViewById(R.id.collection);
|
||||
textViewLoading = findViewById(R.id.textview_loading);
|
||||
process=findViewById(R.id.progressbar);
|
||||
//初始化db
|
||||
initDb();
|
||||
topInfo=(String) getIntent().getSerializableExtra("top_info");
|
||||
info = (Favorite) getIntent().getSerializableExtra("info");
|
||||
url = (ArrayList<Url>) getIntent().getSerializableExtra(StaticValue.key_picture);
|
||||
homeInfo = (Url) getIntent().getSerializableExtra("home_info");
|
||||
position = getIntent().getIntExtra(StaticValue.key_position, 0);
|
||||
//判断数据源
|
||||
if (info != null) {
|
||||
selectPreImg = info.getPicture();
|
||||
judge();
|
||||
} else if (homeInfo != null) {
|
||||
selectPreImg = homeInfo.getSourceUrl();
|
||||
judge();
|
||||
} else if (topInfo != null) {
|
||||
selectPreImg = topInfo;
|
||||
judge();
|
||||
}
|
||||
else {
|
||||
selectPreImg = url.get(position).getSourceUrl();
|
||||
judge();
|
||||
}
|
||||
|
||||
//初始化壁纸
|
||||
initViewPagerPreview();
|
||||
BackimageView.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
|
||||
download.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
process.setVisibility(View.VISIBLE);
|
||||
if (selectPreImg != null) {
|
||||
downloadTask = new ImageDownloadTask(getBaseContext(), ViewActivity.this);
|
||||
downloadTask.execute(selectPreImg);
|
||||
|
||||
} else {
|
||||
Toast.makeText(ViewActivity.this, "Failed to download image...", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cardView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
textViewLoading.setVisibility(View.VISIBLE);
|
||||
if (selectPreImg != null) {
|
||||
loadPreview(selectPreImg);
|
||||
} else {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
Toast.makeText(ViewActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
share.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_TEXT, selectPreImg);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
collect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (dao.getTaskByUrl(selectPreImg) == null) {
|
||||
Log.d("qqqqqqqqqq", "run: ");
|
||||
favorite = new Favorite();
|
||||
favorite.setPicture(selectPreImg);
|
||||
dao.insertTask(favorite);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
Drawable drawable = getResources().getDrawable(R.drawable.like_icon);
|
||||
collect.setForeground(drawable);
|
||||
Toast.makeText(ViewActivity.this, "Added successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dao.deleteTaskByUrl(selectPreImg);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
Drawable drawable = getResources().getDrawable(R.drawable.dislike);
|
||||
collect.setForeground(drawable);
|
||||
Toast.makeText(ViewActivity.this, "Cancel successfully", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
private void initDb() {
|
||||
//初始化db
|
||||
AppDatabase db = AppDatabase.getDatabase(this);
|
||||
dao = db.taskDao();
|
||||
}
|
||||
|
||||
private void judge() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d("2323232", "run: " + selectPreImg);
|
||||
if (dao.getTaskByUrl(selectPreImg) != null) {
|
||||
Log.d("2323232", "run: "+dao.getTaskByUrl(selectPreImg));
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@SuppressLint("UseCompatLoadingForDrawables") Drawable drawable = getResources().getDrawable(R.drawable.like_icon);
|
||||
collect.setForeground(drawable);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void loadPreview(String selectPreImg) {
|
||||
Glide.with(this)
|
||||
.asBitmap()
|
||||
.load(selectPreImg)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
setPhoneWallpaper(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPhoneWallpaper(Bitmap bitmap) {
|
||||
try {
|
||||
wallpaperManager.setBitmap(bitmap);
|
||||
//finish();
|
||||
Toast.makeText(this, getString(R.string.set_wallpaper_success), Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException ioException) {
|
||||
Toast.makeText(this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
textViewLoading.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void initViewPagerPreview() {
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(PreviewFragment.newInstance(selectPreImg));
|
||||
viewPagerPreview.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return list.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
});
|
||||
viewPagerPreview.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
selectPreImg = url.get(position).getSourceUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
50
app/src/main/java/com/lh/wallpaper2/Wallpaper.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.lh.wallpaper2;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.lh.wallpaper2.file.ReadFile;
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Wallpaper extends Application {
|
||||
public static Context mAppContext;
|
||||
private static List<Info> userList = new ArrayList<Info>();
|
||||
private List<Url> urlList = new ArrayList<Url>();
|
||||
public static final String dadgsfgsf = "app_database";
|
||||
public static final int aadasdasd = 1;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mAppContext = this;
|
||||
try {
|
||||
InputStream open = getAssets().open("pink_wallpaper.json");
|
||||
String covertStr = ReadFile.getCovertStr(open);
|
||||
if (!covertStr.isEmpty()) {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<Info>>(){
|
||||
}.getType();
|
||||
userList = gson.fromJson(covertStr,type);
|
||||
for (Info info:userList) {
|
||||
for (Url url:info.getList()){
|
||||
urlList.add(url);
|
||||
}
|
||||
}
|
||||
Log.d("22222222222222", "onCreate: "+urlList.size());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public static List<Info> getUserList() {
|
||||
Log.d("------------","-------------userList="+userList);
|
||||
return userList;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.lh.wallpaper2.action;
|
||||
|
||||
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
|
||||
public interface FavoriteWallpaperListener {
|
||||
|
||||
void onItemClickAction(Favorite info);
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.lh.wallpaper2.action;
|
||||
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
|
||||
public interface InfoWallpaperListener {
|
||||
|
||||
public void onItemClickAction(Info info);
|
||||
|
||||
public void onHomeInfoClickAction(Url homeInfo);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.lh.wallpaper2.action;
|
||||
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface UrlWallpaperListener {
|
||||
|
||||
public void onItemClickAction(ArrayList<Url> dataInfo, int position);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.lh.wallpaper2.adapter;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.action.InfoWallpaperListener;
|
||||
import com.lh.wallpaper2.action.UrlWallpaperListener;
|
||||
import com.lh.wallpaper2.file.ReadFile;
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
import com.lh.wallpaper2.recycleView.DetailsWallpaperVH;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class DetailsAdapter extends RecyclerView.Adapter<DetailsWallpaperVH> {
|
||||
private ArrayList<Url> dataInfo;
|
||||
private Context myContext;
|
||||
private UrlWallpaperListener urlWallpaperListener;
|
||||
@NonNull
|
||||
@Override
|
||||
public DetailsWallpaperVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(myContext).inflate(R.layout.details_vh, parent, false);
|
||||
return new DetailsWallpaperVH(itemView);
|
||||
}
|
||||
|
||||
public DetailsAdapter(ArrayList<Url> dataInfo, Context myContext) {
|
||||
this.dataInfo = dataInfo;
|
||||
this.myContext = myContext;
|
||||
}
|
||||
public void setUrlWallpaperListener(UrlWallpaperListener urlWallpaperListener) {
|
||||
this.urlWallpaperListener = urlWallpaperListener;
|
||||
}
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DetailsWallpaperVH holder, @SuppressLint("RecyclerView") int position) {
|
||||
Url info = dataInfo.get(position);
|
||||
Log.d("2323232323232", "onBindViewHolder: "+dataInfo.get(1).getPreUrl());
|
||||
Log.d("99999999999", "onBindViewHolder: "+dataInfo.get(position));
|
||||
ImageView imageView = holder.getImageView();
|
||||
Glide.with(myContext)
|
||||
.load(info.getPreUrl())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.into(imageView);
|
||||
holder.getItemRoot().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (urlWallpaperListener != null) {
|
||||
urlWallpaperListener.onItemClickAction(dataInfo, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataInfo.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.lh.wallpaper2.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.action.FavoriteWallpaperListener;
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
import com.lh.wallpaper2.file.ReadFile;
|
||||
import com.lh.wallpaper2.recycleView.DetailsWallpaperVH;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FavoriteWallpaperAdapter extends RecyclerView.Adapter<DetailsWallpaperVH> {
|
||||
private List<Favorite> dataInfo ;
|
||||
private Context myContext;
|
||||
private FavoriteWallpaperListener infoWallpaperListener;
|
||||
|
||||
public void setInfoWallpaperListener(FavoriteWallpaperListener infoWallpaperListener) {
|
||||
this.infoWallpaperListener = infoWallpaperListener;
|
||||
}
|
||||
public FavoriteWallpaperAdapter(List<Favorite> infoList, Context myCon) {
|
||||
dataInfo = infoList;
|
||||
myContext = myCon;
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public DetailsWallpaperVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(myContext).inflate(R.layout.details_vh, parent, false);
|
||||
return new DetailsWallpaperVH(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DetailsWallpaperVH holder, int position) {
|
||||
Favorite info = dataInfo.get(position);
|
||||
ImageView imageView = holder.getImageView();
|
||||
Glide.with(myContext)
|
||||
.load(info.getPicture())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.into(imageView);
|
||||
holder.getItemRoot().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (infoWallpaperListener != null) {
|
||||
infoWallpaperListener.onItemClickAction(info);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataInfo.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.lh.wallpaper2.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.action.InfoWallpaperListener;
|
||||
import com.lh.wallpaper2.file.ReadFile;
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
import com.lh.wallpaper2.recycleView.InfoWallpaperVH;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InfoWallpaperAdapter extends RecyclerView.Adapter<InfoWallpaperVH> {
|
||||
private List<Info> dataInfo;
|
||||
private Context myContext;
|
||||
private InfoWallpaperListener infoWallpaperListener;
|
||||
|
||||
public void setInfoWallpaperListener(InfoWallpaperListener infoWallpaperListener) {
|
||||
this.infoWallpaperListener = infoWallpaperListener;
|
||||
}
|
||||
public InfoWallpaperAdapter(List<Info> infoList, Context myCon) {
|
||||
dataInfo = infoList;
|
||||
myContext = myCon;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public InfoWallpaperVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(myContext).inflate(R.layout.home_wallpaper_adapter_list, parent, false);
|
||||
return new InfoWallpaperVH(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull InfoWallpaperVH holder, int position) {
|
||||
Info info = dataInfo.get(position);
|
||||
holder.getText().setText(info.getName());
|
||||
ImageView leftImage = holder.getLeftImage();
|
||||
ImageView rightImage = holder.getRightImage();
|
||||
Url homeLeftUrl = info.getList().get(0);
|
||||
Url homeRightUrl = info.getList().get(1);
|
||||
|
||||
|
||||
Glide.with(myContext)
|
||||
.load(info.getList().get(0).getPreUrl())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.apply(RequestOptions.bitmapTransform(new RoundedCorners(ReadFile.dp2Px(7))))
|
||||
.skipMemoryCache(true)
|
||||
.placeholder(R.drawable.preview)
|
||||
.into(leftImage);
|
||||
Glide.with(myContext)
|
||||
.load(info.getList().get(1).getPreUrl())
|
||||
.transform(new RoundedCorners(ReadFile.dp2Px(7)))
|
||||
.skipMemoryCache(true)
|
||||
.placeholder(R.drawable.preview)
|
||||
.into(rightImage);
|
||||
|
||||
RelativeLayout seeAll = holder.getSeeAll();
|
||||
leftImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
infoWallpaperListener.onHomeInfoClickAction(homeLeftUrl);
|
||||
}
|
||||
});
|
||||
rightImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
infoWallpaperListener.onHomeInfoClickAction(homeRightUrl);
|
||||
}
|
||||
});
|
||||
|
||||
seeAll.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
infoWallpaperListener.onItemClickAction(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataInfo.size();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.lh.wallpaper2.adapter;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyFragmentStateAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private final List<Fragment> mFragments;
|
||||
|
||||
public MyFragmentStateAdapter(@NonNull FragmentManager fragmentManager, List<Fragment> fragments) {
|
||||
super(fragmentManager);
|
||||
mFragments = fragments;
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
}
|
||||
21
app/src/main/java/com/lh/wallpaper2/dao/TaskDao.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.lh.wallpaper2.dao;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface TaskDao {
|
||||
@Query("SELECT * FROM collection")
|
||||
List<Favorite> getAllTasks();
|
||||
@Query("SELECT * FROM collection WHERE picture = :picture")
|
||||
Favorite getTaskByUrl(String picture);
|
||||
@Query("DELETE FROM collection WHERE picture = :picture")
|
||||
void deleteTaskByUrl(String picture);
|
||||
@Insert
|
||||
void insertTask(Favorite task);
|
||||
@Update
|
||||
void updateTask(Favorite task);
|
||||
}
|
||||
26
app/src/main/java/com/lh/wallpaper2/db/Favorite.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.lh.wallpaper2.db;
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Entity(tableName = "collection")
|
||||
public class Favorite implements Serializable {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public int id;
|
||||
@ColumnInfo(name = "picture")
|
||||
public String picture;
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getPicture() {
|
||||
return picture;
|
||||
}
|
||||
public void setPicture(String picture) {
|
||||
this.picture = picture;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.lh.wallpaper2.download;
|
||||
|
||||
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.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.ViewActivity;
|
||||
|
||||
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 = Save.saveToGallery(context, 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.progressbar).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();
|
||||
}}
|
||||
}
|
||||
}
|
||||
62
app/src/main/java/com/lh/wallpaper2/download/Save.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.lh.wallpaper2.download;
|
||||
|
||||
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 java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class Save {
|
||||
public static Uri saveToGallery(Context context, InputStream photoFile) {
|
||||
String displayName = System.currentTimeMillis()+".jpg";
|
||||
ContentValues contentValues = new ContentValues();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
int byteLength = 0;
|
||||
byte[] bytes = new byte[4096];
|
||||
outputStream = contentResolver.openOutputStream(imageUri);
|
||||
while ((byteLength = photoFile.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, byteLength);
|
||||
}
|
||||
photoFile.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
app/src/main/java/com/lh/wallpaper2/entity/AppDatabase.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.lh.wallpaper2.entity;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
import com.lh.wallpaper2.dao.TaskDao;
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
|
||||
@Database(entities = {Favorite.class}, version = 1)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
public abstract TaskDao taskDao();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
54
app/src/main/java/com/lh/wallpaper2/file/MyItemSpace.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.lh.wallpaper2.file;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class MyItemSpace extends RecyclerView.ItemDecoration {
|
||||
private int ex_space = 0;
|
||||
private int v_space = 0;
|
||||
private int h_space = 0;
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
|
||||
int position = parent.getChildAdapterPosition(view);
|
||||
int spanSize = 1;
|
||||
int spanIndex = 0;
|
||||
int spanCount = 1;
|
||||
|
||||
RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
|
||||
|
||||
if (layoutManager instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager1 = (GridLayoutManager) layoutManager;
|
||||
GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
spanCount = layoutManager1.getSpanCount();
|
||||
spanSize = layoutManager1.getSpanSizeLookup().getSpanSize(position);
|
||||
spanIndex = layoutParams.getSpanIndex();
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (spanSize == spanCount) {
|
||||
outRect.left = v_space + ex_space;
|
||||
outRect.right = v_space + ex_space;
|
||||
outRect.bottom = h_space;
|
||||
} else {
|
||||
int itemAllSpacing = (v_space * (spanCount + 1) + ex_space * 2) / spanCount;
|
||||
int left = v_space * (spanIndex + 1) - itemAllSpacing * spanIndex + ex_space;
|
||||
int right = itemAllSpacing - left;
|
||||
outRect.left = left;
|
||||
outRect.right = right;
|
||||
outRect.bottom = h_space;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MyItemSpace(int v_space, int h_space, int ex_space) {
|
||||
this.ex_space = ex_space;
|
||||
this.h_space = h_space;
|
||||
this.v_space = v_space;
|
||||
|
||||
}
|
||||
}
|
||||
35
app/src/main/java/com/lh/wallpaper2/file/ReadFile.java
Normal file
@ -0,0 +1,35 @@
|
||||
package com.lh.wallpaper2.file;
|
||||
import com.lh.wallpaper2.Wallpaper;
|
||||
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 = Wallpaper.mAppContext.getResources().getDisplayMetrics().density;
|
||||
return (int) (dp * scale + 0.5f);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.lh.wallpaper2.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.ViewActivity;
|
||||
import com.lh.wallpaper2.action.FavoriteWallpaperListener;
|
||||
import com.lh.wallpaper2.adapter.FavoriteWallpaperAdapter;
|
||||
import com.lh.wallpaper2.dao.TaskDao;
|
||||
import com.lh.wallpaper2.db.Favorite;
|
||||
import com.lh.wallpaper2.entity.AppDatabase;
|
||||
import com.lh.wallpaper2.file.MyItemSpace;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class FavoriteFragment extends Fragment implements FavoriteWallpaperListener {
|
||||
private RecyclerView recyclerviewWallpaper;
|
||||
private TaskDao dao;
|
||||
private List<Favorite> favoriteList= new ArrayList<>();
|
||||
private AppDatabase db;
|
||||
private FavoriteWallpaperAdapter favoriteWallpaperAdapter;
|
||||
private ImageView likeBackground;
|
||||
private RelativeLayout likeText;
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Log.d("mmmmmmmmmmmmmmmmmm", "onCreateView: ");
|
||||
View view = inflater.inflate(R.layout.fragment_favorite, container, false);
|
||||
recyclerviewWallpaper = view.findViewById(R.id.like_recyclerview);
|
||||
|
||||
likeBackground = view.findViewById(R.id.like_background);
|
||||
likeText = view.findViewById(R.id.like_text);
|
||||
|
||||
db = AppDatabase.getDatabase(requireContext());
|
||||
dao = db.taskDao();
|
||||
setRecyclerviewWallpaper();
|
||||
loadFavoriteImages();
|
||||
return view;
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private void loadFavoriteImages() {
|
||||
new Thread(new Runnable() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void run() {
|
||||
List<Favorite> favorites = db.taskDao().getAllTasks();
|
||||
requireActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (favorites.isEmpty()){
|
||||
likeBackground.setVisibility(View.VISIBLE);
|
||||
likeText.setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
likeBackground.setVisibility(View.GONE);
|
||||
likeText.setVisibility(View.GONE);
|
||||
}
|
||||
favoriteList.clear();
|
||||
favoriteList.addAll(favorites);
|
||||
favoriteWallpaperAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
private void setRecyclerviewWallpaper() {
|
||||
favoriteWallpaperAdapter = new FavoriteWallpaperAdapter(favoriteList, requireContext());
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2);
|
||||
recyclerviewWallpaper.setLayoutManager(gridLayoutManager);
|
||||
favoriteWallpaperAdapter.setInfoWallpaperListener(this);
|
||||
MyItemSpace myItemSpace = new MyItemSpace(30, 50, 40);
|
||||
recyclerviewWallpaper.addItemDecoration(myItemSpace);
|
||||
recyclerviewWallpaper.setAdapter(favoriteWallpaperAdapter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Favorite info) {
|
||||
Intent intent = new Intent(requireContext(), ViewActivity.class);
|
||||
intent.putExtra("info", info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
loadFavoriteImages();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.lh.wallpaper2.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.lh.wallpaper2.DetailsActivity;
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.StaticValue;
|
||||
import com.lh.wallpaper2.ViewActivity;
|
||||
import com.lh.wallpaper2.Wallpaper;
|
||||
import com.lh.wallpaper2.action.InfoWallpaperListener;
|
||||
import com.lh.wallpaper2.adapter.InfoWallpaperAdapter;
|
||||
import com.lh.wallpaper2.json.Info;
|
||||
import com.lh.wallpaper2.json.Url;
|
||||
|
||||
public class HomeFragment extends Fragment implements InfoWallpaperListener {
|
||||
private RecyclerView recyclerView;
|
||||
private Info info;
|
||||
private RelativeLayout relativeLayout;
|
||||
private ImageView imageView;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
recyclerView = view.findViewById(R.id.home_recyclerView);
|
||||
relativeLayout = view.findViewById(R.id.top_info);
|
||||
info=Wallpaper.getUserList().get(14);
|
||||
String topInfo = info.getList().get(0).getSourceUrl();
|
||||
setRecyclerView();
|
||||
imageView=view.findViewById(R.id.top_image);
|
||||
Glide.with(requireContext()).load(topInfo).into(imageView);
|
||||
relativeLayout.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(requireContext(), ViewActivity.class);
|
||||
intent.putExtra("top_info",topInfo);
|
||||
startActivity(intent);
|
||||
});
|
||||
return view;
|
||||
}
|
||||
private void setRecyclerView(){
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 1);
|
||||
InfoWallpaperAdapter infoWallpaperAdapter = new InfoWallpaperAdapter(Wallpaper.getUserList(), requireContext());
|
||||
infoWallpaperAdapter.setInfoWallpaperListener(this);
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
recyclerView.setAdapter(infoWallpaperAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClickAction(Info info) {
|
||||
Intent intent = new Intent(requireContext(), DetailsActivity.class);
|
||||
intent.putExtra(StaticValue.key_info,info);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHomeInfoClickAction(Url info) {
|
||||
Intent intent = new Intent(requireContext(), ViewActivity.class);
|
||||
intent.putExtra("home_info",info);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.lh.wallpaper2.fragment;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.lh.wallpaper2.R;
|
||||
import com.lh.wallpaper2.StaticValue;
|
||||
|
||||
|
||||
public class PreviewFragment extends Fragment {
|
||||
|
||||
|
||||
private String source_url;
|
||||
|
||||
private ImageView imageViewPreview;
|
||||
|
||||
private ImageView preview;
|
||||
|
||||
public PreviewFragment() {
|
||||
|
||||
}
|
||||
|
||||
public static PreviewFragment newInstance(String param1) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(StaticValue.key_source, param1);
|
||||
PreviewFragment fragment = new PreviewFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
source_url = getArguments().getString(StaticValue.key_source);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View fragmentView = inflater.inflate(R.layout.fragment_preview, container, false);
|
||||
imageViewPreview = fragmentView.findViewById(R.id.imageview_preview);
|
||||
preview = fragmentView.findViewById(R.id.preview);
|
||||
|
||||
Glide.with(requireContext())
|
||||
.asBitmap()
|
||||
.load(source_url)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
imageViewPreview.setImageBitmap(resource);
|
||||
preview.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
}
|
||||
});
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.lh.wallpaper2.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.lh.wallpaper2.PrivacyActivity;
|
||||
import com.lh.wallpaper2.R;
|
||||
|
||||
public class SettingFragment extends Fragment {
|
||||
private RelativeLayout about;
|
||||
private RelativeLayout feedBack;
|
||||
private RelativeLayout privacy;
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View view = inflater.inflate(R.layout.fragment_setting, container, false);
|
||||
about = view.findViewById(R.id.about);
|
||||
feedBack=view.findViewById(R.id.feedback);
|
||||
privacy=view.findViewById(R.id.Privacy);
|
||||
|
||||
privacy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(requireContext(), PrivacyActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
about.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
feedBack.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@SuppressLint("IntentWithNullActionLaunch")
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+requireContext().getPackageName()));
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
public void onBackPressed(){
|
||||
//声明对象
|
||||
final AlertDialog dialog;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
|
||||
builder.setTitle("About");
|
||||
|
||||
builder.setMessage("The current version is "+getVersion());
|
||||
//添加确定按钮
|
||||
builder.setPositiveButton("CONFIRM", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss(); //关闭对话框
|
||||
}
|
||||
});
|
||||
dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
public String getVersion(){
|
||||
try {
|
||||
PackageInfo packageInfo =requireContext().getPackageManager().getPackageInfo(requireContext().getPackageName(), 0);
|
||||
return packageInfo.versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.lh.wallpaper2.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.lh.wallpaper2.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link TopicFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class TopicFragment extends Fragment {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public TopicFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment TopicFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static TopicFragment newInstance(String param1, String param2) {
|
||||
TopicFragment fragment = new TopicFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_topic, container, false);
|
||||
}
|
||||
}
|
||||
26
app/src/main/java/com/lh/wallpaper2/json/Info.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.lh.wallpaper2.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Info implements Serializable {
|
||||
private String name;
|
||||
private ArrayList<Url> list;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ArrayList<Url> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(ArrayList<Url> list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
25
app/src/main/java/com/lh/wallpaper2/json/Url.java
Normal file
@ -0,0 +1,25 @@
|
||||
package com.lh.wallpaper2.json;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Url implements Serializable {
|
||||
|
||||
private String sourceUrl;
|
||||
private String preUrl;
|
||||
|
||||
public String getPreUrl() {
|
||||
return preUrl;
|
||||
}
|
||||
|
||||
public void setPreUrl(String preUrl) {
|
||||
this.preUrl = preUrl;
|
||||
}
|
||||
|
||||
public String getSourceUrl() {
|
||||
return sourceUrl;
|
||||
}
|
||||
|
||||
public void setSourceUrl(String sourceUrl) {
|
||||
this.sourceUrl = sourceUrl;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.lh.wallpaper2.recycleView;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lh.wallpaper2.R;
|
||||
|
||||
public class DetailsWallpaperVH extends RecyclerView.ViewHolder{
|
||||
private ImageView imageView;
|
||||
private LinearLayout itemRoot;
|
||||
private ImageView collection;
|
||||
|
||||
public DetailsWallpaperVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
imageView = itemView.findViewById(R.id.imageView_wallpaper);
|
||||
itemRoot = itemView.findViewById(R.id.item_root);
|
||||
}
|
||||
public LinearLayout getItemRoot() {
|
||||
return itemRoot;
|
||||
}
|
||||
public ImageView getImageView() {
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.lh.wallpaper2.recycleView;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.lh.wallpaper2.R;
|
||||
|
||||
public class InfoWallpaperVH extends RecyclerView.ViewHolder {
|
||||
private TextView text;
|
||||
private RelativeLayout seeAll;
|
||||
private ImageView leftImage;
|
||||
private ImageView rightImage;
|
||||
private LinearLayout itemRoot;
|
||||
|
||||
public InfoWallpaperVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
leftImage = itemView.findViewById(R.id.vh_left_image);
|
||||
rightImage = itemView.findViewById(R.id.vh_right_image);
|
||||
itemRoot = itemView.findViewById(R.id.item_root);
|
||||
text = itemView.findViewById(R.id.vh_text);
|
||||
seeAll = itemView.findViewById(R.id.vh_see_all);
|
||||
}
|
||||
|
||||
public TextView getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public RelativeLayout getSeeAll() {
|
||||
return seeAll;
|
||||
}
|
||||
|
||||
public ImageView getLeftImage() {
|
||||
return leftImage;
|
||||
}
|
||||
|
||||
public ImageView getRightImage() {
|
||||
return rightImage;
|
||||
}
|
||||
|
||||
public LinearLayout getItemRoot() {
|
||||
return itemRoot;
|
||||
}
|
||||
}
|
||||
5
app/src/main/res/color/bottom_nav_colors.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/nav_selected_color" android:state_checked="true" />
|
||||
<item android:color="@color/nav_selected_color" android:state_checked="false" />
|
||||
</selector>
|
||||
BIN
app/src/main/res/drawable/app_icon.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
8
app/src/main/res/drawable/back_circle.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/color_trans"/>
|
||||
|
||||
|
||||
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/background.png
Normal file
|
After Width: | Height: | Size: 196 KiB |
9
app/src/main/res/drawable/dislike.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M16.873,4.004C14.966,4.004 13.309,4.989 12.5,6.422C11.691,4.989 10.034,4.004 8.127,4.004C5.231,4.004 3.5,6.525 3.5,8.962C3.5,14.734 11.879,19.722 12.235,19.932C12.317,19.98 12.408,20.004 12.5,20.004C12.592,20.004 12.683,19.98 12.765,19.932C13.121,19.722 21.5,14.734 21.5,8.962C21.5,6.525 19.769,4.004 16.873,4.004Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
14
app/src/main/res/drawable/dislike_icon.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M20.994,5.111C18.175,1.021 12.626,3.434 12.626,7.588C12.626,3.434 7.076,1.021 4.257,5.111C1.342,9.339 4.215,16.746 12.626,21C21.036,16.746 23.909,9.339 20.994,5.111Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#E22F60"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/down_load.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M5,18.404H19V20.004H5V18.404ZM12.778,10.404H18.222L12,16.804L5.778,10.404H11.222V4.004H12.778V10.404Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/home_icon.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="23dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="23"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M1.211,7L10.953,1.154C11.112,1.059 11.31,1.059 11.468,1.154L21.211,7"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M3.211,6L3.211,19"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19.211,6L19.211,19"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M15.651,12.5C15.651,14.176 13.663,15.535 11.211,15.535C8.758,15.535 6.77,14.176 6.77,12.5"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/home_top.jpeg
Normal file
|
After Width: | Height: | Size: 261 KiB |
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/initial_page_logo.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
app/src/main/res/drawable/like_background.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
9
app/src/main/res/drawable/like_icon.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M16.873,4.004C14.966,4.004 13.309,4.989 12.5,6.422C11.691,4.989 10.034,4.004 8.127,4.004C5.231,4.004 3.5,6.525 3.5,8.962C3.5,14.734 11.879,19.722 12.235,19.932C12.317,19.98 12.408,20.004 12.5,20.004C12.592,20.004 12.683,19.98 12.765,19.932C13.121,19.722 21.5,14.734 21.5,8.962C21.5,6.525 19.769,4.004 16.873,4.004Z"
|
||||
android:fillColor="#FF223D"/>
|
||||
</vector>
|
||||
BIN
app/src/main/res/drawable/preview.png
Normal file
|
After Width: | Height: | Size: 837 B |
20
app/src/main/res/drawable/progress_style_h_scene.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!--设置progress背景颜色-->
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="8dp"/>
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
<!--设置progress进度条颜色-->
|
||||
<item android:id="@android:id/progress">
|
||||
<clip android:clipOrientation="horizontal">
|
||||
<shape>
|
||||
<corners android:radius="8dp"/>
|
||||
<solid android:color="#F68FAB" />
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
||||
6
app/src/main/res/drawable/round_button.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/black_trans"/><!--内部-->
|
||||
<size android:width="80dp" android:height="80dp"/>
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/rounded_corners.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="#FFFFFFFF" />
|
||||
<corners android:radius="50dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/rounded_corners_privacy.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/lucency"/>
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/setting_enter.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="13dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="13"
|
||||
android:viewportHeight="12">
|
||||
<path
|
||||
android:pathData="M4,1.5L9.001,6.001L4,10.502"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="1.2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#9B9B9B"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
16
app/src/main/res/drawable/setting_icon.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="23dp"
|
||||
android:height="22dp"
|
||||
android:viewportWidth="23"
|
||||
android:viewportHeight="22">
|
||||
<path
|
||||
android:pathData="M13.54,2.269C13.54,1.568 12.972,1 12.271,1H10.81C10.108,1 9.54,1.568 9.54,2.269C9.54,2.847 9.144,3.343 8.605,3.555C8.52,3.589 8.435,3.625 8.352,3.661C7.821,3.891 7.19,3.821 6.78,3.412C6.542,3.174 6.219,3.041 5.883,3.041C5.547,3.041 5.224,3.174 4.986,3.412L3.952,4.446C3.714,4.684 3.581,5.007 3.581,5.343C3.581,5.679 3.714,6.002 3.952,6.24C4.362,6.65 4.432,7.28 4.2,7.812C4.164,7.896 4.129,7.98 4.095,8.065C3.883,8.604 3.387,9 2.809,9C2.108,9 1.54,9.568 1.54,10.269V11.731C1.54,12.432 2.108,13 2.809,13C3.387,13 3.883,13.396 4.095,13.935C4.129,14.02 4.165,14.105 4.2,14.188C4.431,14.719 4.361,15.35 3.952,15.76C3.714,15.998 3.581,16.321 3.581,16.657C3.581,16.993 3.714,17.316 3.952,17.554L4.986,18.588C5.224,18.826 5.547,18.959 5.883,18.959C6.219,18.959 6.542,18.826 6.78,18.588C7.19,18.178 7.82,18.108 8.352,18.339C8.435,18.376 8.52,18.411 8.605,18.445C9.144,18.657 9.54,19.153 9.54,19.731C9.54,20.432 10.108,21 10.809,21H12.271C12.972,21 13.54,20.432 13.54,19.731C13.54,19.153 13.936,18.657 14.475,18.444C14.56,18.411 14.645,18.376 14.728,18.34C15.259,18.108 15.89,18.179 16.299,18.588C16.417,18.706 16.557,18.799 16.711,18.863C16.865,18.927 17.03,18.96 17.197,18.96C17.363,18.96 17.528,18.927 17.682,18.863C17.836,18.799 17.976,18.706 18.094,18.588L19.128,17.554C19.366,17.316 19.499,16.993 19.499,16.657C19.499,16.321 19.366,15.998 19.128,15.76C18.718,15.35 18.648,14.72 18.879,14.188C18.916,14.105 18.951,14.02 18.985,13.935C19.197,13.396 19.693,13 20.271,13C20.972,13 21.54,12.432 21.54,11.731V10.27C21.54,9.569 20.972,9.001 20.271,9.001C19.693,9.001 19.197,8.605 18.984,8.066C18.951,7.981 18.916,7.897 18.879,7.813C18.649,7.282 18.719,6.651 19.128,6.241C19.366,6.003 19.499,5.68 19.499,5.344C19.499,5.008 19.366,4.685 19.128,4.447L18.094,3.413C17.856,3.175 17.533,3.042 17.197,3.042C16.861,3.042 16.538,3.175 16.3,3.413C15.89,3.823 15.26,3.893 14.728,3.662C14.644,3.625 14.56,3.59 14.475,3.556C13.936,3.343 13.54,2.846 13.54,2.269Z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"/>
|
||||
<path
|
||||
android:pathData="M15.54,11C15.54,12.061 15.119,13.078 14.368,13.828C13.618,14.579 12.601,15 11.54,15C10.479,15 9.462,14.579 8.712,13.828C7.961,13.078 7.54,12.061 7.54,11C7.54,9.939 7.961,8.922 8.712,8.172C9.462,7.421 10.479,7 11.54,7C12.601,7 13.618,7.421 14.368,8.172C15.119,8.922 15.54,9.939 15.54,11Z"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#E22F60"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/shape_text_loading.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/color_trans"/>
|
||||
<corners android:radius="6dp"/>
|
||||
|
||||
|
||||
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/share_icon.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="17.142857dp" android:viewportHeight="20" android:viewportWidth="21" android:width="18dp">
|
||||
|
||||
<path android:fillColor="#00000000" android:fillType="evenOdd" android:pathData="M15.989,10.416H8.251C7.397,10.416 6.704,11.121 6.704,11.99V15.925C6.704,16.795 7.397,17.499 8.251,17.499H15.989C16.844,17.499 17.537,16.795 17.537,15.925V11.99C17.537,11.121 16.844,10.416 15.989,10.416Z" android:strokeColor="#ffffff" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.66667"/>
|
||||
|
||||
<path android:fillColor="#ffffff" android:pathData="M12.979,2.212L16.312,4.295C16.834,4.622 16.834,5.382 16.312,5.709L12.979,7.792C12.424,8.139 11.704,7.74 11.704,7.085V2.919C11.704,2.264 12.424,1.865 12.979,2.212Z"/>
|
||||
|
||||
<path android:fillColor="#00000000" android:pathData="M12.537,5H9.667C5.985,5 3,7.985 3,11.667V13.333" android:strokeColor="#ffffff" android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="1.66667"/>
|
||||
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/svg_back.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M395.2,513.6l323.1,-312.4c19.1,-18.4 19.1,-48.3 0,-66.7 -19.1,-18.4 -49.9,-18.4 -69,0L291.8,480.3c-19.1,18.4 -19.1,48.3 0,66.7l357.6,345.7c9.5,9.2 22,13.8 34.5,13.8 12.5,0 25,-4.6 34.5,-13.8 19.1,-18.4 19.1,-48.2 0,-66.7L395.2,513.6z"
|
||||
android:fillColor="#272636"/>
|
||||
</vector>
|
||||
20
app/src/main/res/drawable/view_back.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="25dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:pathData="M11.505,5.5L3.505,12.5L11.505,19.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/white"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M3.505,12.5H21.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/white"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
20
app/src/main/res/drawable/view_back_privacy.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25dp"
|
||||
android:height="25dp"
|
||||
android:viewportWidth="25"
|
||||
android:viewportHeight="25">
|
||||
<path
|
||||
android:pathData="M11.505,5.5L3.505,12.5L11.505,19.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/white"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M3.505,12.5H21.5"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/white"
|
||||
android:strokeLineCap="round"/>
|
||||
</vector>
|
||||
40
app/src/main/res/layout/activity_details.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/details_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blue"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/imageview_back"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="23dp"
|
||||
android:src="@drawable/svg_back" />
|
||||
<TextView
|
||||
android:id="@+id/details_text"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:text="Nature"
|
||||
android:textColor="#2A2E33"
|
||||
android:textStyle="bold"
|
||||
android:textSize="24sp">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/details_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</LinearLayout>
|
||||
41
app/src/main/res/layout/activity_initial.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?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"
|
||||
android:background="@drawable/background"
|
||||
tools:context=".InitialActivity">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_logo"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="150dp"
|
||||
android:src="@drawable/initial_page_logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_appname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/imageview_logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#E22F60"
|
||||
android:textSize="22sp" />
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="140dp"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_style_h_scene"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
31
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<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=".MainActivity">
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bottomNavigation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:itemTextAppearanceActiveBoldEnabled="false"
|
||||
app:itemActiveIndicatorStyle="@null"
|
||||
android:background="@color/white"
|
||||
app:labelVisibilityMode="selected"
|
||||
app:itemRippleColor="@color/itemRippleColor"
|
||||
app:activeIndicatorLabelPadding="@null"
|
||||
app:itemIconTint="@color/bottom_nav_colors"
|
||||
app:itemTextColor="@color/bottom_nav_colors"
|
||||
app:elevation="0dp"
|
||||
app:menu="@menu/nav_menu">
|
||||
</com.google.android.material.bottomnavigation.BottomNavigationView>
|
||||
</RelativeLayout>
|
||||
29
app/src/main/res/layout/activity_privacy.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".PrivacyActivity">
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<FrameLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:background="@drawable/round_button"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/view_back"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
153
app/src/main/res/layout/activity_view.xml
Normal file
@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".ViewActivity">
|
||||
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/viewpager_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
tools:ignore="UselessLeaf">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/set_wallpaper"
|
||||
android:textColor="@color/text_color"
|
||||
android:textSize="14sp" />
|
||||
</androidx.viewpager.widget.ViewPager>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="42dp"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:background="@drawable/round_button"
|
||||
android:padding="5dp">
|
||||
<ImageView
|
||||
android:id="@+id/imageview_back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="23dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/view_back"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_loading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/shape_text_loading"
|
||||
android:padding="7dp"
|
||||
android:text="@string/set_text_loading"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardView"
|
||||
android:layout_width="327dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="70dp"
|
||||
app:cardCornerRadius="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/set_wallpaper"
|
||||
android:textColor="@color/text_color">
|
||||
</TextView>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_above="@+id/cardView"
|
||||
android:layout_marginBottom="22dp">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/download"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/round_button"
|
||||
tools:ignore="ContentDescription" >
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center"
|
||||
android:foreground="@drawable/down_load"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/share"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_toLeftOf="@id/download"
|
||||
android:background="@drawable/round_button"
|
||||
tools:ignore="RtlHardcoded">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center"
|
||||
android:foreground="@drawable/share_icon"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_toRightOf="@id/download"
|
||||
android:background="@drawable/round_button"
|
||||
tools:ignore="RtlHardcoded">
|
||||
<ImageView
|
||||
android:id="@+id/collection"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="center"
|
||||
android:foreground="@drawable/dislike"
|
||||
tools:ignore="ContentDescription" />
|
||||
</FrameLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/black"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
22
app/src/main/res/layout/details_vh.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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:id="@+id/item_root"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_height="320dp" />
|
||||
<!--<ImageView
|
||||
android:id="@+id/collection"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="80dp"
|
||||
android:layout_marginTop="280dp"
|
||||
android:background="@drawable/dislike"
|
||||
/>-->
|
||||
</LinearLayout>
|
||||
79
app/src/main/res/layout/fragment_favorite.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/blue"
|
||||
tools:context=".fragment.FavoriteFragment"
|
||||
>
|
||||
|
||||
<!--<TextView
|
||||
android:id="@+id/like"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/like"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textColor="#2A2E33"
|
||||
android:textStyle="bold"
|
||||
android:textSize="24sp" />-->
|
||||
<LinearLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:padding="5dp">
|
||||
<TextView
|
||||
android:id="@+id/details_text"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="Like"
|
||||
android:textColor="#2A2E33"
|
||||
android:textStyle="bold"
|
||||
android:textSize="24sp">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/like_background"
|
||||
android:layout_width="193dp"
|
||||
android:layout_height="193dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/top_bar"
|
||||
android:layout_marginTop="153dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/like_background">
|
||||
</ImageView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/like_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/like_background"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/favorite_text"
|
||||
android:textColor="#AAAAAA"
|
||||
android:textSize="14sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
</RelativeLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/like_recyclerview"
|
||||
android:layout_below="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
|
||||
</RelativeLayout>
|
||||
39
app/src/main/res/layout/fragment_home.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blue"
|
||||
android:orientation="vertical"
|
||||
tools:context=".fragment.HomeFragment">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:id="@+id/top_image"
|
||||
tools:ignore="ContentDescription">
|
||||
</ImageView>
|
||||
<TextView
|
||||
android:layout_width="298.8dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/top_text"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
</RelativeLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/home_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="16dp" />
|
||||
</LinearLayout>
|
||||
31
app/src/main/res/layout/fragment_preview.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?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=".fragment.PreviewFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageview_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
||||
<!--<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateTint="@color/pink" />-->
|
||||
<ImageView
|
||||
android:id="@+id/preview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/preview" />
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
114
app/src/main/res/layout/fragment_setting.xml
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/blue"
|
||||
android:orientation="vertical"
|
||||
tools:context=".fragment.SettingFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/setting"
|
||||
android:textSize="24dp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/about"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignTop="@+id/setting"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="#4DFFFFFF">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:gravity="center"
|
||||
android:text="About"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="320dp"
|
||||
android:src="@drawable/setting_enter"
|
||||
tools:ignore="ContentDescription,RtlHardcoded"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/feedback"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignTop="@+id/about"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="#4DFFFFFF">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:gravity="center"
|
||||
android:text="Feedback"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="320dp"
|
||||
android:src="@drawable/setting_enter"
|
||||
tools:ignore="ContentDescription,RtlHardcoded" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/Privacy"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignTop="@+id/feedback"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="#4DFFFFFF"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:gravity="center"
|
||||
android:text="Privacy Policy"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="320dp"
|
||||
android:src="@drawable/setting_enter"
|
||||
tools:ignore="ContentDescription,RtlHardcoded" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
10
app/src/main/res/layout/fragment_topic.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragment.TopicFragment">
|
||||
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
71
app/src/main/res/layout/home_wallpaper_adapter_list.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/item_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:orientation="vertical">
|
||||
<RelativeLayout
|
||||
android:id="@+id/vh_see_all"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="24dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_toStartOf="@+id/enter_button"
|
||||
android:text="@string/see_all"
|
||||
android:textColor="#2A2E33"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/enter_button"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/setting_enter" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_marginStart="24dp"
|
||||
android:id="@+id/vh_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:text="@string/nature"
|
||||
android:textStyle="bold"
|
||||
android:textColor="#2A2E33"
|
||||
android:textSize="20sp"/>
|
||||
</RelativeLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:id="@+id/vh_left_image"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_width="163dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="280dp">
|
||||
</ImageView>
|
||||
<ImageView
|
||||
android:id="@+id/vh_right_image"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_width="163dp"
|
||||
android:layout_height="280dp"
|
||||
android:layout_weight="1">
|
||||
</ImageView>
|
||||
<View
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="match_parent">
|
||||
</View>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
33
app/src/main/res/layout/sd.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/black"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:src="@drawable/dislike"
|
||||
android:layout_height="40dp"/>
|
||||
<ImageView
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:src="@drawable/dislike"
|
||||
android:layout_height="40dp"/>
|
||||
<ImageView
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:src="@drawable/dislike"
|
||||
android:layout_height="40dp"/>
|
||||
<ImageView
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:src="@drawable/dislike"
|
||||
android:layout_height="40dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
15
app/src/main/res/menu/nav_menu.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/home_icon"
|
||||
android:title="Home" />
|
||||
<item
|
||||
android:id="@+id/navigation_favorite"
|
||||
android:icon="@drawable/dislike_icon"
|
||||
android:title="Like"/>
|
||||
<item
|
||||
android:id="@+id/navigation_setting"
|
||||
android:icon="@drawable/setting_icon"
|
||||
android:title="Setting" />
|
||||
</menu>
|
||||
16
app/src/main/res/menu/nav_select.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/home_icon"
|
||||
android:title="Home"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/navigation_favorite"
|
||||
android:icon="@drawable/dislike_icon"
|
||||
android:title="Home"/>
|
||||
<item
|
||||
android:id="@+id/navigation_setting"
|
||||
android:icon="@drawable/setting_icon"
|
||||
android:title="Home" />
|
||||
</menu>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
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 |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
7
app/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Wallpaper2" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
17
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="black_trans_privacy">#80000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="lucency">#80FFFFFF</color>
|
||||
<color name="blue">#ECF6FF</color>
|
||||
<color name="setting_blue">#80ECF6FF</color>
|
||||
<color name="text_color">#E22F60</color>
|
||||
<color name="setting_white">#4DFFFFFF</color>"
|
||||
<color name="nav_selected_color">#E22F60</color>
|
||||
<color name="pink">#E22F60</color>
|
||||
<color name="color_trans">#80FFFFFF</color>
|
||||
<color name="itemRippleColor">#1AE22F60</color>
|
||||
<color name="black_trans">#33000000</color>
|
||||
|
||||
</resources>
|
||||
17
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<string name="app_name">Wallpapers Haven</string>
|
||||
<string name="nature">Nature</string>
|
||||
<string name="see_all">See all</string>
|
||||
<string name="setting">Settings</string>
|
||||
<string name="like">Like</string>
|
||||
<string name="net_download_fail">Loading failed, please try again</string>
|
||||
<string name="set_wallpaper_fail">There was a problem setting the wallpaper, please try again</string>
|
||||
<string name="set_wallpaper_success">Congratulations, you set the wallpaper successfully</string>
|
||||
<string name="set_text_loading">Setting wallpaper, please wait…</string>
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||
<string name="set_wallpaper">Set Wallpaper</string>
|
||||
<string name="top_text">The beauty of minimalism at your fingertips— Wallpapers Haven, bringing elegance to your screen</string>
|
||||
<string name="favorite_text" tools:ignore="StringEscaping">you dont have a favorite wallpaperGo to the homepage and take a look</string>
|
||||
|
||||
</resources>
|
||||
10
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.Wallpaper2" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<item name="android:statusBarColor" />
|
||||
</style>
|
||||
<style name="Theme.Wallpaper2" parent="Base.Theme.Wallpaper2" />
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
17
app/src/test/java/com/lh/wallpaper2/ExampleUnitTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.lh.wallpaper2;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
6
build.gradle.kts
Normal file
@ -0,0 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||
kotlin("kapt") version "1.9.0"
|
||||
}
|
||||