功能更新v1.4(5)

This commit is contained in:
denghaina 2024-08-19 15:20:21 +08:00
parent 865de17436
commit 7248334018
36 changed files with 637 additions and 242 deletions

View File

@ -14,12 +14,12 @@ android {
compileSdk = 34
defaultConfig {
applicationId = "com.wp.pretty.wallpapers.selection"
applicationId = "com.wp.pretty.wallpapers.selection.test"
minSdk = 23
targetSdk = 34
versionCode = 4
versionName = "1.3"
setProperty("archivesBaseName", "Prettywallpapers_v" + versionName + "(${versionCode})_$timestamp")
versionCode = 5
versionName = "1.4"
setProperty("archivesBaseName", "Prettywallpapers_v" + versionName + "(${versionCode})_$timestamp")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@ -38,6 +38,12 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
dataBinding {
enable = true;
}
buildFeatures {
viewBinding = true
}
}
dependencies {

View File

@ -9,7 +9,7 @@
"client_info": {
"mobilesdk_app_id": "1:303460456405:android:8d406898372602f1dacf5c",
"android_client_info": {
"package_name": "com.wp.pretty.wallpapers.selection"
"package_name": "com.wp.pretty.wallpapers.selection.test"
}
},
"oauth_client": [],

View File

@ -10,7 +10,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<application
android:name=".base.PrettyWallPaper"
android:name=".PrettyWallPaper"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
@ -21,7 +21,7 @@
android:theme="@style/Theme.PrettyWallPapers"
tools:targetApi="31">
<activity
android:name=".activity.PrettyPaperActivity"
android:name=".activity.PreviewActivity"
android:exported="false" />
<activity
android:name=".activity.PrettyCategoryListActivity"

View File

@ -1,15 +1,17 @@
package com.example.prettywallpapers.base;
package com.example.prettywallpapers;
import android.app.Application;
import android.util.Log;
import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback;
import com.example.prettywallpapers.base.Readmyfile;
import com.example.prettywallpapers.list.PrettyCategory;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.MyTool;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.toponad.AdManager;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -17,12 +19,12 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Set;
public class PrettyWallPaper extends Application {
private static List<PrettyCategory> prettyCategories;
public static String TAG = "-----AD";
private String AppId = "h66a246bc81483";
private int i = 0;
private String AppKey = "aa66c6b36a70016db7e34aae6bce0f9bd";
@Override
public void onCreate() {
@ -39,7 +41,7 @@ public class PrettyWallPaper extends Application {
} catch (IOException e) {
throw new RuntimeException(e);
}
setentity();
}
public void initad() {
@ -70,6 +72,25 @@ public class PrettyWallPaper extends Application {
return prettyCategories;
}
}
private void setentity() {
while (i<prettyCategories.size()){
Log.d("dhn","-------------fin"+i);
PrettyCategory list = prettyCategories.get(i);
List<PrettyPaper> data = list.getList();
MyTool.runIO(new Runnable() {
@Override
public void run() {
for (PrettyPaper datalist : data) {
PrettyPaperEntity entity = new PrettyPaperEntity();
entity.setImage(datalist.getSourceUrl());
entity.setPaperlike(false);
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().insertLikeData(entity);
//SecurityLockDataBase.getSecurityLockDataBase().getsecurityLockDAO().InsertSecurityEntity(entityApp);
}
}
});
i++;
}
}
}

View File

@ -31,7 +31,7 @@ public class IntoActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_into);
customProgressBar = findViewById(R.id.progressBar);
countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new Function1<Long, Unit>() {
/*countDownTimer = AdManager.showWelcomeAd(IntoActivity.this, tim, new Function1<Long, Unit>() {
@Override
public Unit invoke(Long aLong) {
count = count+1;
@ -50,6 +50,18 @@ public class IntoActivity extends AppCompatActivity {
return null;
}
});
countDownTimer.start();*/
countDownTimer = new CountDownTimer(1000,500) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
startMainActivity();
}
};
countDownTimer.start();
}

View File

@ -5,43 +5,18 @@ import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.transition.Transition;
import com.example.prettywallpapers.fragment.HomeFragment;
import com.example.prettywallpapers.fragment.LikeFragment;
import com.example.prettywallpapers.prettyadapter.FragmentAdapter;
import com.example.prettywallpapers.prettyadapter.ViewPaperAdapter;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.youth.banner.Banner;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.base.PrettyWallPaper;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;
import com.youth.banner.adapter.BannerImageAdapter;
import com.youth.banner.holder.BannerImageHolder;
import com.youth.banner.indicator.CircleIndicator;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private ViewPager2 viewPager2;
@ -49,14 +24,11 @@ public class MainActivity extends AppCompatActivity {
private RelativeLayout relative_main;
private TabLayout tabLayout;
List<String> stringList = new ArrayList<>();
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image_set = findViewById(R.id.image_set);
image_set.setOnClickListener(new View.OnClickListener() {
@Override
@ -75,11 +47,15 @@ public class MainActivity extends AppCompatActivity {
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
switch (position) {
case 0:
tab.setText(R.string.home);
tab.setIcon(R.drawable.table_home_src);
break;
case 1:
tab.setText(R.string.like);
tab.setIcon(R.drawable.table_category_src);
break;
case 2:
tab.setIcon(R.drawable.table_like_src);
break;
}
}
});

View File

@ -46,7 +46,8 @@ public class PrettyCategoryListActivity extends AppCompatActivity {
imageView_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showad(true);
//showad(true);
finish();
}
});
recycle_name =findViewById(R.id.name_list_recycle);
@ -70,7 +71,7 @@ public class PrettyCategoryListActivity extends AppCompatActivity {
@Override
public void onBackPressed() {
super.onBackPressed();
showad(false);
//showad(false);
}
private void gotoGetData() {

View File

@ -2,21 +2,22 @@ package com.example.prettywallpapers.activity;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.WallpaperManager;
import android.content.ContentValues;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@ -25,15 +26,11 @@ import android.widget.RelativeLayout;
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.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
@ -44,25 +41,20 @@ import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperDao;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.room.MyTool;
import com.example.prettywallpapers.toponad.AdManager;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
public class PrettyPaperActivity extends AppCompatActivity {
public class PreviewActivity extends AppCompatActivity {
private RelativeLayout relative_main;
private TextView text_set;
@ -77,25 +69,10 @@ public class PrettyPaperActivity extends AppCompatActivity {
private PrettyPaperDatabase db;
private boolean liked;
private List<PrettyPaper> likelist;
private List<PrettyPaperEntity> LIST;
private PrettyPaperEntity entity;
private PrettyPaper resource;
private boolean islike1 = false;
private PrettyPaperEntity one;
private SwitchType switchType;
private String switchtype;
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 0) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//保存图片到相册
downPreview(image);
} else {
Toast.makeText(this, "你拒绝了该权限,无法保存图片!", Toast.LENGTH_SHORT).show();
}
}
}
private Dialog dialog;
@SuppressLint("MissingInflatedId")
@Override
@ -111,45 +88,42 @@ public class PrettyPaperActivity extends AppCompatActivity {
image_share = findViewById(R.id.image_share);
imageView_back = findViewById(R.id.paper_back);
image_hert = findViewById(R.id.image_heart);
image_hert.setBackgroundResource(R.drawable.unselect_like);
gotoGetData();
image_hert.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!islike1) {
image_hert.setBackgroundResource(R.drawable.unselect_like);
islike1 = true;
mytool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().deletelike(image);
}
});
} else {
image_hert.setBackgroundResource(R.drawable.select_like);
islike1 = false;
PrettyPaperEntity prettyPaperEntity = new PrettyPaperEntity();
prettyPaperEntity.setPaperlike(like);
prettyPaperEntity.setImage(image);
mytool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().insertLikeData(prettyPaperEntity);
}
});
//Toast.makeText(PrettyPaperActivity.this,getString(R.string.like_success),Toast.LENGTH_LONG).show();
}
image_hert.setSelected(!image_hert.isSelected());
if (image_hert.isSelected()) {
entity.setPaperlike(true);
MyTool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(entity);
Log.d("dhn","----islike"+entity.getPaperlike());
}
});
Toast.makeText(PreviewActivity.this,getString(R.string.like_success),Toast.LENGTH_SHORT).show();
} else {
entity.setPaperlike(false);
MyTool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(entity);
Log.d("dhn","----islike"+entity.getPaperlike());
}
});
Toast.makeText(PreviewActivity.this,getString(R.string.like_cancle), Toast.LENGTH_SHORT).show();
}
}
});
image_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(PrettyPaperActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(PrettyPaperActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && ContextCompat.checkSelfPermission(PreviewActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(PreviewActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0);
} else {
//保存图片到相册
downPreview(image);
@ -162,7 +136,8 @@ public class PrettyPaperActivity extends AppCompatActivity {
text_set.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showad();
//showad();
showdialog();
}
});
image_share.setOnClickListener(new View.OnClickListener() {
@ -179,17 +154,46 @@ public class PrettyPaperActivity extends AppCompatActivity {
});
}
private void gotoGetData() {
Intent intent = getIntent();
image = intent.getStringExtra(MyValues.PAPER_IMAGE);
MyTool.runIO(new Runnable() {
@Override
public void run() {
entity = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().queryimage(image);
Log.d("dhn","--------------entity--"+entity.getPaperlike());
if (entity.getPaperlike()) {
image_hert.setSelected(true);
} else {
image_hert.setSelected(false);
}
}
});
Glide.with(this).load(image).addListener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
return false;
}
}).into(paper_image);
}
private void showad() {
AdManager.showAD(PrettyPaperActivity.this, new Function1<Integer, Unit>() {
AdManager.showAD(PreviewActivity.this, new Function1<Integer, Unit>() {
@Override
public Unit invoke(Integer integer) {
if (integer == AdManager.type_no_cache || integer == AdManager.type_show_close || integer == AdManager.type_show_fail) {
Toast.makeText(PrettyPaperActivity.this, getString(R.string.set_wait), Toast.LENGTH_SHORT).show();
Toast.makeText(PreviewActivity.this, getString(R.string.set_wait), Toast.LENGTH_SHORT).show();
if (image != null) {
loadPreview(image);
} else {
Toast.makeText(PrettyPaperActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
Toast.makeText(PreviewActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
return null;
@ -221,8 +225,20 @@ public class PrettyPaperActivity extends AppCompatActivity {
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
SaveImage(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
private void LoadLockPreview(String preURl) {
Glide.with(this)
.asBitmap()
.load(preURl)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
setLockWallPaper(resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
@ -236,36 +252,17 @@ public class PrettyPaperActivity extends AppCompatActivity {
Toast.makeText(this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
private void gotoGetData() {
Intent intent = getIntent();
image = intent.getStringExtra(MyValues.PAPER_IMAGE);
mytool.runIO(new Runnable() {
@Override
public void run() {
LIST = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().queryimage(image);
if (LIST.isEmpty()) {
} else {
image_hert.setBackgroundResource(R.drawable.select_like);
islike1 = true;
}
private void setLockWallPaper(Bitmap lockbitmap) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
wallpaperManager.setBitmap(lockbitmap,null,true,WallpaperManager.FLAG_LOCK);
Toast.makeText(this, getString(R.string.set_success), Toast.LENGTH_SHORT).show();
}else {
wallpaperManager.setBitmap(lockbitmap);
}
});
Glide.with(this).load(image).addListener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, @Nullable Object model, @NonNull Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(@NonNull Drawable resource, @NonNull Object model, Target<Drawable> target, @NonNull DataSource dataSource, boolean isFirstResource) {
return false;
}
}).into(paper_image);
} catch (Exception e) {
Toast.makeText(this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
private void init() {
Window window = getWindow();
@ -289,18 +286,18 @@ public class PrettyPaperActivity extends AppCompatActivity {
Uri saveUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues());
if (TextUtils.isEmpty(saveUri.toString())) {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Toast.makeText(PreviewActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Looper.loop();
return;
}
OutputStream outputStream = getContentResolver().openOutputStream(saveUri);
if (bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream)) {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Toast.makeText(PreviewActivity.this, getString(R.string.save_success), Toast.LENGTH_SHORT).show();
Looper.loop();
} else {
Looper.prepare();
Toast.makeText(PrettyPaperActivity.this, getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
Toast.makeText(PreviewActivity.this, getString(R.string.save_fail), Toast.LENGTH_SHORT).show();
Looper.loop();
}
@ -310,6 +307,73 @@ public class PrettyPaperActivity extends AppCompatActivity {
}
}).start();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 0) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//保存图片到相册
downPreview(image);
} else {
Toast.makeText(this, "你拒绝了该权限,无法保存图片!", Toast.LENGTH_SHORT).show();
}
}
}
private void showdialog() {
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.switch_set_type);
dialog.setCancelable(false);
dialog.getWindow().setGravity(Gravity.CENTER);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.findViewById(R.id.type_home).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (image != null) {
loadPreview(image);
dialog.cancel();
} else {
Toast.makeText(PreviewActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
});
dialog.findViewById(R.id.type_screen).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (image != null) {
LoadLockPreview(image);
dialog.cancel();
} else {
Toast.makeText(PreviewActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
});
dialog.findViewById(R.id.type_both).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (image != null) {
loadPreview(image);
LoadLockPreview(image);
dialog.cancel();
} else {
Toast.makeText(PreviewActivity.this, getString(R.string.set_wallpaper_fail), Toast.LENGTH_SHORT).show();
}
}
});
dialog.findViewById(R.id.close_dialog_image).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.cancel();
}
});
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.show();
dialog.getWindow().setAttributes(lp);
}
}

View File

@ -0,0 +1,36 @@
package com.example.prettywallpapers.fragment;
import android.annotation.SuppressLint;
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 com.example.prettywallpapers.R;
import com.example.prettywallpapers.PrettyWallPaper;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;
public class CategoryFragment extends Fragment {
private RecyclerView recyclerView_prettywall;
@SuppressLint("MissingInflatedId")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home, container, false);
recyclerView_prettywall = view.findViewById(R.id.recyclerview_pretty);
setPrettyWallpaper();
return view;
}
private void setPrettyWallpaper() {
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),1);
recyclerView_prettywall.setLayoutManager(gridLayoutManager);
WallpaperAdapter wallpaperAdapter = new WallpaperAdapter(PrettyWallPaper.getCategorylist(),getActivity());
recyclerView_prettywall.setAdapter(wallpaperAdapter);
}
}

View File

@ -1,12 +1,8 @@
package com.example.prettywallpapers.fragment;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -15,22 +11,20 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
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.example.prettywallpapers.PrettyWallPaper;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.base.PrettyWallPaper;
import com.example.prettywallpapers.activity.PreviewActivity;
import com.example.prettywallpapers.base.MySpace;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.prettyadapter.WallpaperAdapter;
import com.example.prettywallpapers.prettyadapter.DiscoverAdapter;
import com.example.prettywallpapers.room.MyTool;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.youth.banner.Banner;
import com.youth.banner.adapter.BannerImageAdapter;
import com.youth.banner.holder.BannerImageHolder;
@ -41,22 +35,22 @@ import java.util.ArrayList;
import java.util.List;
public class HomeFragment extends Fragment {
private RecyclerView recyclerView_prettywall;
private Banner banner;
private List<PrettyPaper> prettyPapers;
private SwitchType switchintent;
List<String> stringList = new ArrayList<>();
private RecyclerView discover_recycle;
private List<PrettyPaperEntity> list;
@SuppressLint("MissingInflatedId")
List<String> stringList = new ArrayList<>();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home, container, false);
View view = inflater.inflate(R.layout.fragment_discover, container, false);
banner = view.findViewById(R.id.banner);
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/148499404d85516a86eeb5c2c30fafbd.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/989ccbceb5d165cc4b44ced23af4d5fb.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/b655bc8400774e2dc940b5a8291e2ca5.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/ffdee201ab115879fd038a7f529d7d2c.jpeg");
stringList.add("https://resource-sg-public.lux-ad.com/wallpaper/72306be102fb449d09c2f00190f333fd.jpeg");
banner.setAdapter(new BannerImageAdapter<String>(stringList) {
@Override
public void onBindView(BannerImageHolder holder, String data, int position, int size) {
@ -67,7 +61,7 @@ public class HomeFragment extends Fragment {
@Override
public void OnBannerClick(Object data, int position) {
//Log.d("-----data","------data"+data);
Intent intent = new Intent(getActivity(), PrettyPaperActivity.class);
Intent intent = new Intent(getActivity(), PreviewActivity.class);
//intent.putExtra(MyValues.TYPE,"1");
//Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
intent.putExtra(MyValues.PAPER_IMAGE,String.valueOf(data));
@ -76,14 +70,23 @@ public class HomeFragment extends Fragment {
}
});
banner.setIndicator(new CircleIndicator(getActivity()));
recyclerView_prettywall = view.findViewById(R.id.recyclerview_pretty);
setPrettyWallpaper();
discover_recycle = view.findViewById(R.id.discover_recycle);
setDiscoverRecycle();
return view;
}
private void setPrettyWallpaper() {
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(),1);
recyclerView_prettywall.setLayoutManager(gridLayoutManager);
WallpaperAdapter wallpaperAdapter = new WallpaperAdapter(PrettyWallPaper.getCategorylist(),getActivity());
recyclerView_prettywall.setAdapter(wallpaperAdapter);
private void setDiscoverRecycle() {
MyTool.runIO(new Runnable() {
@Override
public void run() {
list = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().getAllUsers();
MySpace mySpace = new MySpace(10,20,10);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),2);
discover_recycle.setLayoutManager(gridLayoutManager);
discover_recycle.addItemDecoration(mySpace);
DiscoverAdapter discoverAdapter = new DiscoverAdapter(getContext(), list.subList(153,353));
discover_recycle.setAdapter(discoverAdapter);
}
});
}
}

View File

@ -19,7 +19,7 @@ import com.example.prettywallpapers.R;
import com.example.prettywallpapers.prettyadapter.LIkePaperAdapter;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.room.MyTool;
import java.util.ArrayList;
import java.util.List;
@ -31,7 +31,7 @@ public class LikeFragment extends Fragment {
private ImageView like_back;
private LIkePaperAdapter lIkePaperAdapter;
private boolean islike = true;
private List<PrettyPaperEntity> list = new ArrayList<>();
private List<PrettyPaperEntity> list;
@SuppressLint("MissingInflatedId")
@Override
@ -51,10 +51,10 @@ public class LikeFragment extends Fragment {
return view;
}
private void setRecycleLike() {
mytool.runIO(new Runnable() {
MyTool.runIO(new Runnable() {
@Override
public void run() {
list = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().getAllUsers();
list = PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().queryData(true);
requireActivity().runOnUiThread(new Runnable() {
@Override
public void run() {

View File

@ -5,15 +5,7 @@ import java.io.Serializable;
public class PrettyPaper implements Serializable {
private String sourceUrl;
private String preUrl;
private boolean islike=false;
public boolean getIslike() {
return islike;
}
public void setIslike(boolean islike) {
this.islike = islike;
}
public String getSourceUrl() {
return sourceUrl;

View File

@ -1,6 +1,6 @@
package com.example.prettywallpapers.myvalue;
import com.example.prettywallpapers.base.PrettyWallPaper;
import com.example.prettywallpapers.PrettyWallPaper;
public class MyValues {
public static final String IMAGE = "image";

View File

@ -0,0 +1,62 @@
package com.example.prettywallpapers.prettyadapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.example.prettywallpapers.activity.PreviewActivity;
import com.example.prettywallpapers.databinding.DiscoverRecycleViewBinding;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import java.util.List;
public class DiscoverAdapter extends RecyclerView.Adapter<DiscoverAdapter.DiscoverVH> {
private List<PrettyPaperEntity> mylist;
private Context mycon;
public DiscoverAdapter(Context context, List<PrettyPaperEntity> list){
mycon = context;
mylist = list;
}
@NonNull
@Override
public DiscoverVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
DiscoverRecycleViewBinding discoverRecycleViewBinding = DiscoverRecycleViewBinding.inflate(LayoutInflater.from(mycon),parent,false);
return new DiscoverVH(discoverRecycleViewBinding);
}
@Override
public void onBindViewHolder(@NonNull DiscoverVH holder, int position) {
PrettyPaperEntity entity = mylist.get(position);
Glide.with(mycon).load(entity.getImage())
.into(holder.discoverbinding.discoverRecycleImage);
holder.discoverbinding.discoverRecycleImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mycon, PreviewActivity.class);
intent.putExtra(MyValues.PAPER_IMAGE,entity.getImage());
mycon.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return mylist.size();
}
public class DiscoverVH extends RecyclerView.ViewHolder {
private DiscoverRecycleViewBinding discoverbinding;
public DiscoverVH(@NonNull DiscoverRecycleViewBinding itemView) {
super(itemView.getRoot());
discoverbinding = itemView;
}
}
}

View File

@ -6,6 +6,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.example.prettywallpapers.fragment.HomeFragment;
import com.example.prettywallpapers.fragment.CategoryFragment;
import com.example.prettywallpapers.fragment.LikeFragment;
public class FragmentAdapter extends FragmentStateAdapter {
@ -19,6 +20,8 @@ public class FragmentAdapter extends FragmentStateAdapter {
switch (position){
case 0:
return new HomeFragment();
case 1:
return new CategoryFragment();
default:
return new LikeFragment();
}
@ -26,6 +29,6 @@ public class FragmentAdapter extends FragmentStateAdapter {
@Override
public int getItemCount() {
return 2;
return 3;
}
}

View File

@ -1,7 +1,5 @@
package com.example.prettywallpapers.prettyadapter;
import static com.example.prettywallpapers.myvalue.MyValues.*;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@ -22,7 +20,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.activity.PreviewActivity;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.listener.SwitchType;
import com.example.prettywallpapers.myvalue.MyValues;
@ -69,7 +67,7 @@ public class InfoAdapter extends RecyclerView.Adapter<InfoViewHolder> {
holder.getImage_layout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, PrettyPaperActivity.class);
Intent intent = new Intent(context, PreviewActivity.class);
//intent.putExtra(MyValues.TYPE,"2");
//Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaper.getSourceUrl());

View File

@ -8,6 +8,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -20,18 +21,18 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.activity.PreviewActivity;
import com.example.prettywallpapers.myvalue.MyValues;
import com.example.prettywallpapers.room.PrettyPaperDatabase;
import com.example.prettywallpapers.room.PrettyPaperEntity;
import com.example.prettywallpapers.room.mytool;
import com.example.prettywallpapers.room.MyTool;
import java.util.List;
public class LIkePaperAdapter extends RecyclerView.Adapter<LikeHolder> {
private List<PrettyPaperEntity> paperEntities ;
private Context mycontext;
private boolean mylike;
private boolean islike;
public LIkePaperAdapter(Context context,List<PrettyPaperEntity> entities){
mycontext = context;
paperEntities = entities;
@ -63,28 +64,35 @@ public class LIkePaperAdapter extends RecyclerView.Adapter<LikeHolder> {
return false;
}
}).into(holder.getImageView());
holder.getImageView_like().setBackgroundResource(R.drawable.select_like);
islike = prettyPaperEntities.getPaperlike();
if (islike){
holder.getImageView_like().setSelected(true);
}else {
holder.getImageView_like().setSelected(false);
}
holder.getImageView_like().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
paperEntities.remove(prettyPaperEntities);
notifyItemRemoved(position);
mytool.runIO(new Runnable() {
holder.getImageView_like().setSelected(!holder.getImageView_like().isSelected());
if (holder.getImageView_like().isSelected()){
prettyPaperEntities.setPaperlike(true);
Toast.makeText(mycontext,mycontext.getText(R.string.save_success),Toast.LENGTH_SHORT).show();
}else {
prettyPaperEntities.setPaperlike(false);
Toast.makeText(mycontext,mycontext.getText(R.string.like_cancle),Toast.LENGTH_SHORT).show();
}
MyTool.runIO(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().delete(prettyPaperEntities);
//PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(prettyPaperEntities);
// Log.d("---entities","-----entities"+entities.size());
//Toast.makeText(PrettyPaperActivity.this,"succes",Toast.LENGTH_LONG).show();
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(prettyPaperEntities);
}
});
//mytool.updateRoom(prettyPaperEntities);
}
});
holder.getImageView().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mycontext, PrettyPaperActivity.class);
Intent intent = new Intent(mycontext, PreviewActivity.class);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaperEntities.getImage());
mycontext.startActivity(intent);
}

View File

@ -3,7 +3,6 @@ package com.example.prettywallpapers.prettyadapter;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -20,7 +19,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.example.prettywallpapers.R;
import com.example.prettywallpapers.activity.PrettyPaperActivity;
import com.example.prettywallpapers.activity.PreviewActivity;
import com.example.prettywallpapers.list.PrettyPaper;
import com.example.prettywallpapers.myvalue.MyValues;
@ -61,9 +60,7 @@ public class SeeAllInFoAdapter extends RecyclerView.Adapter<SeeAllInFoViewHolder
holder.getImage_layout().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, PrettyPaperActivity.class);
// intent.putExtra(MyValues.TYPE,"2");
// Log.d("-----MyValues.TYPE","------MyValues.TYPE"+MyValues.TYPE);
Intent intent = new Intent(context, PreviewActivity.class);
intent.putExtra(MyValues.PAPER_IMAGE,prettyPaper.getSourceUrl());
context.startActivity(intent);
}

View File

@ -3,14 +3,11 @@ package com.example.prettywallpapers.room;
import android.os.Handler;
import android.os.Looper;
import com.example.prettywallpapers.listener.QueryPaperListener;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class mytool {
public class MyTool {
private static ExecutorService executorService;
private static Handler mainHandler;//处理线程通信和消息分发的重要工具
@ -55,12 +52,6 @@ public class mytool {
}
});
}*/
public static void updateRoom(PrettyPaperEntity entity) {
executorService.execute(new Runnable() {
@Override
public void run() {
PrettyPaperDatabase.getPrettyPaperDatabase().getPrettyPaperDao().UpdateLikePaper(entity);
}
});
}
}

View File

@ -26,7 +26,7 @@ public interface PrettyPaperDao {
@Delete()
void delete(PrettyPaperEntity prettyPaperEntity);
@Query("select * from table_name where image=:image")
List<PrettyPaperEntity> queryimage(String image);
PrettyPaperEntity queryimage(String image);
@Query("delete from table_name where image=:image")
void deletelike(String image);
}

View File

@ -7,7 +7,7 @@ import com.anythink.core.api.ATAdInfo
import com.anythink.core.api.AdError
import com.anythink.interstitial.api.ATInterstitial
import com.anythink.interstitial.api.ATInterstitialListener
import com.example.prettywallpapers.base.PrettyWallPaper
import com.example.prettywallpapers.PrettyWallPaper
import com.example.prettywallpapers.myvalue.MyValues

View File

@ -0,0 +1,20 @@
<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="M7.5,7L17.5,17"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#BCBCBC"
android:strokeLineCap="round"/>
<path
android:pathData="M7.5,17L17.5,7"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#BCBCBC"
android:strokeLineCap="round"/>
</vector>

View File

@ -0,0 +1,18 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="227dp"
android:height="39dp"
android:viewportWidth="227"
android:viewportHeight="39"
>
<group>
<clip-path
android:pathData="M19.5 0H207.5C218.27 0 227 8.73045 227 19.5C227 30.2696 218.27 39 207.5 39H19.5C8.73045 39 0 30.2696 0 19.5C0 8.73045 8.73045 0 19.5 0Z"
/>
<path
android:pathData="M0 0V39H227V0"
android:fillColor="#4F86F7"
/>
</group>
</vector>

View File

@ -0,0 +1,30 @@
<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="M9.5,3H4.5C3.948,3 3.5,3.448 3.5,4V9C3.5,9.552 3.948,10 4.5,10H9.5C10.052,10 10.5,9.552 10.5,9V4C10.5,3.448 10.052,3 9.5,3Z"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
<path
android:pathData="M9.5,14H4.5C3.948,14 3.5,14.448 3.5,15V20C3.5,20.552 3.948,21 4.5,21H9.5C10.052,21 10.5,20.552 10.5,20V15C10.5,14.448 10.052,14 9.5,14Z"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
<path
android:pathData="M20.5,3H15.5C14.948,3 14.5,3.448 14.5,4V9C14.5,9.552 14.948,10 15.5,10H20.5C21.052,10 21.5,9.552 21.5,9V4C21.5,3.448 21.052,3 20.5,3Z"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
<path
android:pathData="M20.5,14H15.5C14.948,14 14.5,14.448 14.5,15V20C14.5,20.552 14.948,21 15.5,21H20.5C21.052,21 21.5,20.552 21.5,20V15C21.5,14.448 21.052,14 20.5,14Z"
android:strokeLineJoin="round"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
</vector>

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="19dp"
android:height="22dp"
android:viewportWidth="19"
android:viewportHeight="22">
<path
android:pathData="M16.218,5.6L10.618,1.4C10.272,1.14 9.851,1 9.418,1C8.985,1 8.564,1.14 8.218,1.4L2.618,5.6C2.245,5.879 1.943,6.242 1.735,6.658C1.526,7.075 1.418,7.534 1.418,8V19C1.418,19.53 1.629,20.039 2.004,20.414C2.379,20.789 2.888,21 3.418,21H15.418C15.948,21 16.457,20.789 16.832,20.414C17.207,20.039 17.418,19.53 17.418,19V8C17.418,7.534 17.309,7.075 17.101,6.658C16.893,6.242 16.59,5.879 16.218,5.6V5.6Z"
android:strokeWidth="1.98657"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
</vector>

View File

@ -0,0 +1,12 @@
<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="M11.582,18.998C11.582,18.998 1.582,15.138 1.582,6.498C1.582,5.039 2.161,3.64 3.193,2.609C4.224,1.578 5.623,0.998 7.082,0.998C7.966,0.998 8.837,1.211 9.62,1.62C10.404,2.03 11.077,2.622 11.582,3.348C12.088,2.623 12.76,2.031 13.544,1.622C14.327,1.213 15.198,0.999 16.082,0.998C17.541,0.998 18.94,1.578 19.971,2.609C21.002,3.64 21.582,5.039 21.582,6.498C21.582,15.138 11.582,18.998 11.582,18.998Z"
android:strokeLineJoin="round"
android:strokeWidth="1.93288"
android:fillColor="#00000000"
android:strokeColor="#44475C"/>
</vector>

View File

@ -64,16 +64,21 @@
android:layout_marginBottom="50dp"
app:tabSelectedTextColor="@color/pretty_text"
app:tabIndicatorColor="@color/pretty_text"
app:tabIconTint="@color/table_icon_bg"
android:background="@drawable/table_bg">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home">
android:icon="@drawable/table_home_src" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/table_category_src">
</com.google.android.material.tabs.TabItem>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/like" />
android:icon="@drawable/table_like_src" />
</com.google.android.material.tabs.TabLayout>
</FrameLayout>

View File

@ -5,7 +5,7 @@
android:id="@+id/paper_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PrettyPaperActivity">
tools:context=".activity.PreviewActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -38,7 +38,7 @@
android:id="@+id/image_heart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/unselect_like" />
android:src="@drawable/selector_like" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="32dp"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_marginStart="3dp"
android:id="@+id/recycle_image_lay"
android:layout_height="wrap_content">
<ImageView
android:layout_width="170dp"
android:layout_height="250dp"
android:id="@+id/discover_recycle_image"
android:scaleType="fitXY" />
</LinearLayout>

View File

@ -0,0 +1,33 @@
<?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.HomeFragment">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="200dp"/>
<TextView
android:id="@+id/discover_text"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="@string/recommend"
android:textSize="20sp"
android:gravity="center_vertical"
android:layout_below="@+id/banner"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/discover_recycle"
android:layout_below="@id/discover_text"
android:layout_marginTop="10dp"/>
</RelativeLayout>
</FrameLayout>

View File

@ -1,24 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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.HomeFragment">
<LinearLayout
android:background="@color/pretty_main"
tools:context=".fragment.CategoryFragment">
<TextView
android:id="@+id/category_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/pretty_main"
android:orientation="vertical">
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="180dp"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="5dp"
android:layout_height="24dp"
android:text="@string/categoriza"
android:textSize="24sp"
android:layout_marginTop="50dp"
android:textStyle="bold"
android:gravity="center"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_below="@+id/category_text"
android:layout_marginTop="20dp"
android:id="@+id/recyclerview_pretty"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>

View File

@ -12,7 +12,7 @@
android:text="@string/like"
android:textSize="24sp"
android:gravity="center_horizontal"
android:layout_marginTop="40dp"
android:layout_marginTop="50dp"
/>
<androidx.recyclerview.widget.RecyclerView

View File

@ -26,7 +26,7 @@
android:id="@+id/recycle_like"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/selector_like"
android:src="@drawable/selector_like"
/>
</RelativeLayout>
</FrameLayout>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
app:cardCornerRadius="24dp">
<RelativeLayout
android:layout_width="327dp"
android:gravity="center_horizontal"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/text_dialog"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="@string/Set_wallpaper"
android:textSize="19sp"
android:textStyle="bold"
android:gravity="center_horizontal"/>
<TextView
android:id="@+id/type_home"
android:layout_width="227dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="@id/text_dialog"
android:textColor="@color/white"
android:background="@drawable/dialog_type_bg"
android:textSize="19sp"
android:text="@string/Home_screen"/>
<TextView
android:id="@+id/type_screen"
android:layout_width="227dp"
android:layout_centerHorizontal="true"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:background="@drawable/dialog_type_bg"
android:layout_below="@id/type_home"
android:textStyle="bold"
android:textSize="19sp"
android:textColor="@color/white"
android:text="@string/Lock_Screen"/>
<TextView
android:id="@+id/type_both"
android:layout_below="@+id/type_screen"
android:layout_width="227dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_centerHorizontal="true"
android:textStyle="bold"
android:textSize="19sp"
android:textColor="@color/white"
android:background="@drawable/dialog_type_bg"
android:text="@string/both_screen"/>
<ImageView
android:id="@+id/close_dialog_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/close_dialog"
android:layout_below="@+id/type_both"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>

View File

@ -6,7 +6,8 @@
<color name="pretty_text">#5B8BED</color>
<color name="name">#415E9A</color>
<color name="pretty_back">#91ABDF</color>
<string name="start">#779EED</string>
<string name="middle">#C4D1EC</string>
<string name="finsish">#4F72B8</string>
<color name="start">#779EED</color>
<color name="middle">#C4D1EC</color>
<color name="finsish">#4F72B8</color>
<color name="table_icon_bg">#49454F</color>
</resources>

View File

@ -5,6 +5,8 @@
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="home">Home</string>
<string name="discover">Discover</string>
<string name="recommend">Recommend</string>
<string name="like">Like</string>
<string name="like_success">Likes have been added</string>
<string name="like_cancle">Likes have been canceled</string>
@ -13,4 +15,9 @@
<string name="set_wait">Setting wallpaper, please wait</string>
<string name="save_success">The save was successful</string>
<string name="save_fail">Sorry,Save failed</string>
<string name="Home_screen">Home screen</string>
<string name="Lock_Screen">Lock Screen</string>
<string name="both_screen">Both</string>
<string name="Set_wallpaper">Set wallpaper</string>
<string name="categoriza">categoriza</string>
</resources>