Browse Source

[1001743]增加首页内容显示

zk 1 year ago
parent
commit
79bebea8d8
29 changed files with 934 additions and 6 deletions
  1. 48 0
      app/src/main/java/com/datarecovery/master/module/homepage/FunctionBean.java
  2. 58 0
      app/src/main/java/com/datarecovery/master/module/homepage/HomePageFragment.java
  3. 64 0
      app/src/main/java/com/datarecovery/master/module/homepage/HomePageViewModel.java
  4. 70 0
      app/src/main/java/com/datarecovery/master/module/homepage/OtherFunctionAdapter.java
  5. 154 0
      app/src/main/java/com/datarecovery/master/widget/InformationSwitchBanner.java
  6. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_audio_recovery.webp
  7. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_banner.webp
  8. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_file_recovery.webp
  9. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_friend_recovery.webp
  10. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_img_clearing.webp
  11. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_img_recovery.webp
  12. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_logo.webp
  13. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_message_recovery.webp
  14. BIN
      app/src/main/res/drawable-xxhdpi/icon_home_page_video_recovery.webp
  15. 7 0
      app/src/main/res/drawable/bg_home_page.xml
  16. 7 0
      app/src/main/res/drawable/bg_home_page_content.xml
  17. 5 0
      app/src/main/res/drawable/bg_home_page_information.xml
  18. 10 0
      app/src/main/res/drawable/bg_home_page_radial.xml
  19. 9 0
      app/src/main/res/drawable/bg_home_page_scroll.xml
  20. 7 0
      app/src/main/res/drawable/bg_img_recovery.xml
  21. 7 0
      app/src/main/res/drawable/bg_wx_friend_recovery.xml
  22. 7 0
      app/src/main/res/drawable/bg_wx_message_recovery.xml
  23. 373 4
      app/src/main/res/layout/fragment_home_page.xml
  24. 45 0
      app/src/main/res/layout/item_home_page_other_function.xml
  25. 35 0
      app/src/main/res/layout/view_home_page_switch_text.xml
  26. 4 2
      app/src/main/res/values/colors.xml
  27. 5 0
      app/src/main/res/values/dimens.xml
  28. 13 0
      app/src/main/res/values/strings.xml
  29. 6 0
      app/src/main/res/values/style.xml

+ 48 - 0
app/src/main/java/com/datarecovery/master/module/homepage/FunctionBean.java

@@ -0,0 +1,48 @@
+package com.datarecovery.master.module.homepage;
+
+import androidx.annotation.DrawableRes;
+import androidx.annotation.IntDef;
+import androidx.annotation.StringRes;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+public class FunctionBean {
+
+    public static final int FILE_RECOVERY = 1;
+    public static final int VIDEO_RECOVERY = 2;
+    public static final int AUDIO_RECOVERY = 3;
+    public static final int IMG_CLEARING = 4;
+
+
+    @IntDef({FILE_RECOVERY, VIDEO_RECOVERY, AUDIO_RECOVERY, IMG_CLEARING})
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface FunctionId {
+    }
+
+    private int functionId;
+    @StringRes
+    private int functionName;
+    @DrawableRes
+    private int functionIcon;
+
+
+    public FunctionBean(@FunctionId int functionId, int functionName, int functionIcon) {
+        this.functionId = functionId;
+        this.functionName = functionName;
+        this.functionIcon = functionIcon;
+    }
+
+    @FunctionId
+    public int getFunctionId() {
+        return functionId;
+    }
+
+    public int getFunctionName() {
+        return functionName;
+    }
+
+    public int getFunctionIcon() {
+        return functionIcon;
+    }
+}

+ 58 - 0
app/src/main/java/com/datarecovery/master/module/homepage/HomePageFragment.java

@@ -1,9 +1,14 @@
 package com.datarecovery.master.module.homepage;
 
+import android.os.Bundle;
+import android.view.View;
+
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
 
 import com.atmob.app.lib.base.BaseFragment;
 import com.datarecovery.master.databinding.FragmentHomePageBinding;
+import com.datarecovery.master.widget.InformationSwitchBanner;
 import com.gyf.immersionbar.ImmersionBar;
 
 import dagger.hilt.android.AndroidEntryPoint;
@@ -13,6 +18,59 @@ import dagger.hilt.android.AndroidEntryPoint;
 public class HomePageFragment extends BaseFragment<FragmentHomePageBinding> {
 
 
+    private HomePageViewModel homePageViewModel;
+
+    private OtherFunctionAdapter otherFunctionAdapter;
+
+    @Override
+    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        initView();
+        initObserver();
+    }
+
+    private void initObserver() {
+
+    }
+
+    private void initView() {
+        initTextViewBanner();
+        initHotFunction();
+        initOtherFunction();
+    }
+
+    private void initHotFunction() {
+
+    }
+
+    private void initOtherFunction() {
+        otherFunctionAdapter = new OtherFunctionAdapter(homePageViewModel.getFunctionList());
+        binding.ryOtherFunction.setAdapter(otherFunctionAdapter);
+        otherFunctionAdapter.setOnItemClick(bean -> {
+            switch (bean.getFunctionId()) {
+                case FunctionBean.AUDIO_RECOVERY:
+                    break;
+                case FunctionBean.FILE_RECOVERY:
+                    break;
+                case FunctionBean.IMG_CLEARING:
+                    break;
+                case FunctionBean.VIDEO_RECOVERY:
+                    break;
+            }
+        });
+    }
+
+    private void initTextViewBanner() {
+        InformationSwitchBanner mTextSwitchBanner = new InformationSwitchBanner(getContext(), binding.viewSwitcher);
+        mTextSwitchBanner.update(homePageViewModel.getInformationList());
+    }
+
+    @Override
+    protected void initViewModel() {
+        super.initViewModel();
+        homePageViewModel = getViewModelProvider().get(HomePageViewModel.class);
+    }
+
     @Override
     protected void configImmersion(@NonNull ImmersionBar immersionBar) {
         immersionBar.statusBarDarkFont(true);

+ 64 - 0
app/src/main/java/com/datarecovery/master/module/homepage/HomePageViewModel.java

@@ -0,0 +1,64 @@
+package com.datarecovery.master.module.homepage;
+
+import com.atmob.app.lib.base.BaseViewModel;
+import com.datarecovery.master.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import dagger.hilt.android.lifecycle.HiltViewModel;
+
+import android.util.Pair;
+
+
+@HiltViewModel
+public class HomePageViewModel extends BaseViewModel {
+
+
+    private final List<Pair<CharSequence, CharSequence>> informationList = new ArrayList<>();
+    private final List<FunctionBean> functionList = new ArrayList<>();
+
+
+    @Inject
+    public HomePageViewModel() {
+        initList();
+    }
+
+    public List<FunctionBean> getFunctionList() {
+        return functionList;
+    }
+
+    public List<Pair<CharSequence, CharSequence>> getInformationList() {
+        return informationList;
+    }
+
+    private void initList() {
+        informationList.add(new Pair<>("华为P40用户  微信消息恢复", "2分钟前"));
+        informationList.add(new Pair<>("小米Mi 11用户 图片恢复", "4分钟前"));
+        informationList.add(new Pair<>("三星S20用户 微信好友恢复", "5分钟前"));
+        informationList.add(new Pair<>("OPPOFind X3用户 微信消息恢复", "9分钟前"));
+        informationList.add(new Pair<>("VivoY72用户 通讯录恢复", "11分钟前"));
+        informationList.add(new Pair<>("华为P30用户 微信好友恢复", "15分钟前"));
+
+        functionList.add(new FunctionBean(FunctionBean.FILE_RECOVERY, R.string.home_page_file_recovery, R.drawable.icon_home_page_file_recovery));
+        functionList.add(new FunctionBean(FunctionBean.VIDEO_RECOVERY, R.string.home_page_video_recovery, R.drawable.icon_home_page_video_recovery));
+        functionList.add(new FunctionBean(FunctionBean.AUDIO_RECOVERY, R.string.home_page_audio_recovery, R.drawable.icon_home_page_audio_recovery));
+        functionList.add(new FunctionBean(FunctionBean.IMG_CLEARING, R.string.home_page_img_clearing, R.drawable.icon_home_page_img_clearing));
+    }
+
+
+    public void onWxMessageRecoveryClick() {
+
+    }
+
+    public void onWxFriendRecoveryClick() {
+
+    }
+
+    public void onImgRecoveryClick() {
+
+    }
+
+}

+ 70 - 0
app/src/main/java/com/datarecovery/master/module/homepage/OtherFunctionAdapter.java

@@ -0,0 +1,70 @@
+package com.datarecovery.master.module.homepage;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.datarecovery.master.databinding.ItemHomePageOtherFunctionBinding;
+
+import java.util.List;
+
+public class OtherFunctionAdapter extends RecyclerView.Adapter<OtherFunctionAdapter.ViewHolder> {
+
+
+    @NonNull
+    private final List<FunctionBean> beanList;
+
+    private onItemClick onItemClick;
+
+    public OtherFunctionAdapter(@NonNull List<FunctionBean> beanList) {
+        this.beanList = beanList;
+    }
+
+    public void setOnItemClick(OtherFunctionAdapter.onItemClick onItemClick) {
+        this.onItemClick = onItemClick;
+    }
+
+    @NonNull
+    @Override
+    public OtherFunctionAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+        Context context = parent.getContext();
+        LayoutInflater layoutInflater = LayoutInflater.from(context);
+        ItemHomePageOtherFunctionBinding binding = ItemHomePageOtherFunctionBinding.inflate(layoutInflater, parent, false);
+        return new ViewHolder(binding);
+    }
+
+    @Override
+    public void onBindViewHolder(@NonNull OtherFunctionAdapter.ViewHolder holder, int position) {
+        holder.bind(beanList.get(position));
+    }
+
+    @Override
+    public int getItemCount() {
+        return beanList.size();
+    }
+
+    public class ViewHolder extends RecyclerView.ViewHolder {
+
+        ItemHomePageOtherFunctionBinding binding;
+
+        public ViewHolder(@NonNull ItemHomePageOtherFunctionBinding binding) {
+            super(binding.getRoot());
+            this.binding = binding;
+            binding.getRoot().setOnClickListener(v -> {
+                if (onItemClick != null) onItemClick.onClick(binding.getBean());
+            });
+        }
+
+        public void bind(FunctionBean bean) {
+            binding.setBean(bean);
+        }
+    }
+
+    public interface onItemClick {
+        void onClick(FunctionBean bean);
+    }
+}

+ 154 - 0
app/src/main/java/com/datarecovery/master/widget/InformationSwitchBanner.java

@@ -0,0 +1,154 @@
+package com.datarecovery.master.widget;
+
+import android.content.Context;
+import android.os.Handler;
+import android.util.Pair;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.view.animation.AnimationSet;
+import android.view.animation.TranslateAnimation;
+import android.widget.ViewSwitcher;
+
+import com.datarecovery.master.databinding.ViewHomePageSwitchTextBinding;
+
+import java.util.List;
+
+public class InformationSwitchBanner implements ViewSwitcher.ViewFactory, View.OnClickListener {
+
+    private final Context context;
+    private final ViewSwitcher viewSwitcher;
+    private List<Pair<CharSequence, CharSequence>> texts;
+    private OnItemClickListener listener;
+
+    private int marker;
+    private AnimationSet InAnimationSet;
+    private AnimationSet OutAnimationSet;
+
+    private int delayTime = 1500;
+    private static final int DURATION = 1500;
+
+    LayoutInflater inflater;
+    private final Handler handler = new Handler();
+    private final Runnable task = new Runnable() {
+        @Override
+        public void run() {
+            nextView();
+            handler.postDelayed(task, delayTime * 2L);
+        }
+    };
+
+    public InformationSwitchBanner(Context context, ViewSwitcher textSwitcher) {
+        this.context = context;
+        this.viewSwitcher = textSwitcher;
+        inflater = LayoutInflater.from(context);
+        init();
+    }
+
+    private void init() {
+        viewSwitcher.setFactory(this);
+        setText("", "");
+        createAnimation();
+        viewSwitcher.setInAnimation(InAnimationSet);
+        viewSwitcher.setOutAnimation(OutAnimationSet);
+        viewSwitcher.setOnClickListener(this);
+    }
+
+    private void setText(CharSequence left, CharSequence right) {
+        ViewHomePageSwitchTextBinding binding = ViewHomePageSwitchTextBinding.bind(viewSwitcher.getNextView());
+        binding.tvSwitchText.setText(left);
+        binding.tvSwitchDate.setText(right);
+        viewSwitcher.showNext();
+    }
+
+    @Override
+    public View makeView() {
+        ViewHomePageSwitchTextBinding viewHomePageSwitchTextBinding = ViewHomePageSwitchTextBinding.inflate(inflater);
+        return viewHomePageSwitchTextBinding.getRoot();
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (listener != null && texts != null && texts.size() != 0) {
+            listener.onClick(texts, marker);
+        }
+    }
+
+    public void update(List<Pair<CharSequence, CharSequence>> list) {
+        if (list == null || list.size() == 0) {
+            return;
+        }
+        stop();
+        texts = list;
+        marker = 0;
+        Pair<CharSequence, CharSequence> firstTxt = texts.get(0);
+        setText(firstTxt.first, firstTxt.second);
+        start();
+    }
+
+    public void start() {
+        stop();
+        handler.postDelayed(task, delayTime);
+    }
+
+    public void stop() {
+        handler.removeCallbacks(task);
+    }
+
+    public int getMarker() {
+        return marker;
+    }
+
+    public InformationSwitchBanner setTexts(List<Pair<CharSequence, CharSequence>> texts) {
+        this.texts = texts;
+        return this;
+    }
+
+    public void setDelayTime(int delayTime) {
+        this.delayTime = delayTime;
+    }
+
+    private void createAnimation() {
+        AlphaAnimation alphaAnimation;
+        TranslateAnimation translateAnimation;
+
+        int h = viewSwitcher.getHeight();
+        if (h <= 0) {
+            viewSwitcher.measure(0, 0);
+            h = viewSwitcher.getMeasuredHeight();
+        }
+
+        InAnimationSet = new AnimationSet(true);
+        OutAnimationSet = new AnimationSet(true);
+
+        alphaAnimation = new AlphaAnimation(0, 1);
+        translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0,
+                Animation.ABSOLUTE, h, Animation.ABSOLUTE, 0);
+        InAnimationSet.addAnimation(alphaAnimation);
+        InAnimationSet.addAnimation(translateAnimation);
+        InAnimationSet.setDuration(DURATION);
+
+        alphaAnimation = new AlphaAnimation(1, 0);
+        translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0,
+                Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -h);
+        OutAnimationSet.addAnimation(alphaAnimation);
+        OutAnimationSet.addAnimation(translateAnimation);
+        OutAnimationSet.setDuration(DURATION);
+    }
+
+    private void nextView() {
+        marker = ++marker % texts.size();
+        Pair<CharSequence, CharSequence> nextTxt = texts.get(marker);
+        setText(nextTxt.first, nextTxt.second);
+    }
+
+    public interface OnItemClickListener {
+        void onClick(List<Pair<CharSequence, CharSequence>> list, int position);
+    }
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        this.listener = listener;
+    }
+
+}

BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_audio_recovery.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_banner.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_file_recovery.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_friend_recovery.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_img_clearing.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_img_recovery.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_logo.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_message_recovery.webp


BIN
app/src/main/res/drawable-xxhdpi/icon_home_page_video_recovery.webp


+ 7 - 0
app/src/main/res/drawable/bg_home_page.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient
+        android:angle="90"
+        android:endColor="#D8F3FE"
+        android:startColor="#E1F6FF" />
+</shape>

+ 7 - 0
app/src/main/res/drawable/bg_home_page_content.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners
+        android:topLeftRadius="20dp"
+        android:topRightRadius="20dp" />
+    <solid android:color="@color/white" />
+</shape>

+ 5 - 0
app/src/main/res/drawable/bg_home_page_information.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="3dp" />
+    <solid android:color="#0259FE" />
+</shape>

+ 10 - 0
app/src/main/res/drawable/bg_home_page_radial.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient
+        android:gradientRadius="900"
+        android:startColor="#ADDBFF"
+        android:centerY="0%"
+        android:centerX="30%"
+        android:centerColor="#ADDBFF"
+        android:type="radial" />
+</shape>

+ 9 - 0
app/src/main/res/drawable/bg_home_page_scroll.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="8dp" />
+    <solid android:color="#EBF6FF" />
+    <stroke
+        android:width="0.2dp"
+        android:color="#E8EFFF" />
+
+</shape>

+ 7 - 0
app/src/main/res/drawable/bg_img_recovery.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="8dp" />
+    <gradient
+        android:endColor="#F4BE4A"
+        android:startColor="#EF923B" />
+</shape>

+ 7 - 0
app/src/main/res/drawable/bg_wx_friend_recovery.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="8dp" />
+    <gradient
+        android:endColor="#EF9581"
+        android:startColor="#EA6B5E" />
+</shape>

+ 7 - 0
app/src/main/res/drawable/bg_wx_message_recovery.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="8dp" />
+    <gradient
+        android:endColor="#79A3F6"
+        android:startColor="#602BF6" />
+</shape>

+ 373 - 4
app/src/main/res/layout/fragment_home_page.xml

@@ -1,6 +1,375 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
+<layout 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">
 
-</androidx.constraintlayout.widget.ConstraintLayout>
+    <data>
+
+        <variable
+            name="homePageViewModel"
+            type="com.datarecovery.master.module.homepage.HomePageViewModel" />
+
+        <import type="com.atmob.common.ui.SizeUtil" />
+
+    </data>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:background="@color/white"
+        android:layout_height="match_parent">
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:background="@drawable/bg_home_page"
+            app:layout_constraintDimensionRatio="360:280"
+            app:layout_constraintTop_toTopOf="parent"
+            tools:layout_editor_absoluteX="102dp"
+            tools:layout_editor_absoluteY="113dp" />
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:background="@drawable/bg_home_page_radial"
+            app:layout_constraintDimensionRatio="360:280"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <Space
+            android:id="@+id/space_status_bar"
+            android:layout_width="match_parent"
+            android:layout_height="@{SizeUtil.getStatusBarHeight(), default=@dimen/app_status_bar_height}"
+            app:layout_constraintTop_toTopOf="parent" />
+
+
+        <androidx.core.widget.NestedScrollView
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/space_status_bar">
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <Space
+                    android:id="@+id/space1"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:16"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <ImageView
+                    android:id="@+id/iv_logo"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
+                    android:src="@drawable/icon_home_page_logo"
+                    app:layout_constraintDimensionRatio="246:60"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/space1"
+                    app:layout_constraintWidth_percent="0.2277777777777778" />
+
+                <Space
+                    android:id="@+id/space2"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:16"
+                    app:layout_constraintTop_toBottomOf="@+id/iv_logo" />
+
+                <ImageView
+                    android:id="@+id/iv_banner"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
+                    android:src="@drawable/icon_home_page_banner"
+                    app:layout_constraintDimensionRatio="984:360"
+                    app:layout_constraintTop_toBottomOf="@+id/space2" />
+
+                <Space
+                    android:id="@+id/space3"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:20"
+                    app:layout_constraintTop_toBottomOf="@+id/iv_banner" />
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintBottom_toBottomOf="@+id/space9"
+                    android:background="@drawable/bg_home_page_content"
+                    app:layout_constraintTop_toBottomOf="@+id/space3" />
+
+                <Space
+                    android:id="@+id/space4"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:16"
+                    app:layout_constraintTop_toBottomOf="@+id/space3" />
+
+                <View
+                    android:id="@+id/v_information_bg"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
+                    android:background="@drawable/bg_home_page_scroll"
+                    app:layout_constraintDimensionRatio="328:32"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/space4" />
+
+                <TextView
+                    android:id="@+id/tv_information"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:layout_marginStart="8dp"
+                    android:background="@drawable/bg_home_page_information"
+                    android:gravity="center"
+                    android:text="@string/home_page_information"
+                    android:textColor="@color/white"
+                    android:textSize="12dp"
+                    app:layout_constraintBottom_toBottomOf="@+id/v_information_bg"
+                    app:layout_constraintDimensionRatio="32:16"
+                    app:layout_constraintStart_toStartOf="@+id/v_information_bg"
+                    app:layout_constraintTop_toTopOf="@+id/v_information_bg"
+                    app:layout_constraintWidth_percent="0.0888888888888889" />
+
+                <ViewSwitcher
+                    android:id="@+id/view_switcher"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginHorizontal="8dp"
+                    app:layout_constraintBottom_toBottomOf="@+id/v_information_bg"
+                    app:layout_constraintEnd_toEndOf="@+id/v_information_bg"
+                    app:layout_constraintStart_toEndOf="@+id/tv_information"
+                    app:layout_constraintTop_toTopOf="@+id/v_information_bg" />
+
+                <Space
+                    android:id="@+id/space5"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:16"
+                    app:layout_constraintTop_toBottomOf="@+id/v_information_bg" />
+
+                <TextView
+                    android:id="@+id/tv_hot_function"
+                    style="@style/Home_Page_Title_Text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
+                    android:text="@string/home_page_hot_function"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/space5" />
+
+                <Space
+                    android:id="@+id/space6"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:12"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_hot_function" />
+
+                <View
+                    android:onClick="@{()-> homePageViewModel.onWxMessageRecoveryClick()}"
+                    android:id="@+id/v_wx_message_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
+                    android:background="@drawable/bg_wx_message_recovery"
+                    app:layout_constraintDimensionRatio="152:108"
+                    app:layout_constraintHorizontal_chainStyle="spread_inside"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintRight_toLeftOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintTop_toBottomOf="@+id/space6"
+                    app:layout_constraintWidth_percent="0.4222222222222222" />
+
+
+                <ImageView
+                    android:id="@+id/iv_wx_message_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:src="@drawable/icon_home_page_message_recovery"
+                    app:layout_constraintBottom_toBottomOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintDimensionRatio="1:1"
+                    app:layout_constraintEnd_toEndOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintHorizontal_bias="0.1388888888888889"
+                    app:layout_constraintStart_toStartOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintTop_toTopOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintVertical_bias="0.21875"
+                    app:layout_constraintWidth_percent="0.1222222222222222" />
+
+                <TextView
+                    android:id="@+id/tv_wx_message_recovery"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/home_page_wx_msg_recovery"
+                    android:textColor="@color/white"
+                    android:textSize="15dp"
+                    android:textStyle="bold"
+                    app:layout_constraintStart_toStartOf="@+id/iv_wx_message_recovery"
+                    app:layout_constraintTop_toBottomOf="@+id/iv_wx_message_recovery" />
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/home_page_wx_msg_recovery_desc"
+                    android:textColor="@color/white"
+                    android:textSize="10dp"
+                    app:layout_constraintStart_toStartOf="@+id/tv_wx_message_recovery"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_wx_message_recovery" />
+
+
+                <View
+                    android:onClick="@{()-> homePageViewModel.onWxFriendRecoveryClick()}"
+                    android:id="@+id/v_wx_friend_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
+                    android:background="@drawable/bg_wx_friend_recovery"
+                    app:layout_constraintDimensionRatio="168:50"
+                    app:layout_constraintLeft_toRightOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintRight_toRightOf="parent"
+                    app:layout_constraintTop_toTopOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintWidth_percent="0.4666666666666667" />
+
+                <ImageView
+                    android:id="@+id/iv_wx_friend_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:src="@drawable/icon_home_page_friend_recovery"
+                    app:layout_constraintBottom_toBottomOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintDimensionRatio="111:114"
+                    app:layout_constraintEnd_toEndOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintHorizontal_bias="0.0757575757575758"
+                    app:layout_constraintStart_toStartOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintTop_toTopOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintWidth_percent="0.1" />
+
+                <TextView
+                    android:id="@+id/tv_wx_friend_recovery"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="8dp"
+                    android:text="@string/home_page_wx_friend_recovery"
+                    android:textColor="@color/white"
+                    android:textSize="14sp"
+                    android:textStyle="bold"
+                    app:layout_constraintBottom_toTopOf="@+id/tv_wx_friend_recovery_desc"
+                    app:layout_constraintStart_toEndOf="@+id/iv_wx_friend_recovery"
+                    app:layout_constraintTop_toTopOf="@+id/iv_wx_friend_recovery"
+                    app:layout_constraintVertical_chainStyle="packed" />
+
+                <TextView
+                    android:id="@+id/tv_wx_friend_recovery_desc"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/home_page_wx_friend_recovery_desc"
+                    android:textColor="@color/white"
+                    android:textSize="10sp"
+                    app:layout_constraintBottom_toBottomOf="@+id/iv_wx_friend_recovery"
+                    app:layout_constraintStart_toStartOf="@+id/tv_wx_friend_recovery"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_wx_friend_recovery" />
+
+                <View
+                    android:onClick="@{()-> homePageViewModel.onImgRecoveryClick()}"
+                    android:id="@+id/v_img_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:background="@drawable/bg_img_recovery"
+                    app:layout_constraintBottom_toBottomOf="@id/v_wx_message_recovery"
+                    app:layout_constraintDimensionRatio="168:50"
+                    app:layout_constraintEnd_toEndOf="@+id/v_wx_friend_recovery"
+                    app:layout_constraintLeft_toRightOf="@+id/v_wx_message_recovery"
+                    app:layout_constraintWidth_percent="0.4666666666666667" />
+
+                <ImageView
+                    android:id="@+id/iv_img_recovery"
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    android:src="@drawable/icon_home_page_img_recovery"
+                    app:layout_constraintBottom_toBottomOf="@+id/v_img_recovery"
+                    app:layout_constraintDimensionRatio="111:114"
+                    app:layout_constraintEnd_toEndOf="@+id/v_img_recovery"
+                    app:layout_constraintHorizontal_bias="0.0757575757575758"
+                    app:layout_constraintStart_toStartOf="@+id/v_img_recovery"
+                    app:layout_constraintTop_toTopOf="@+id/v_img_recovery"
+                    app:layout_constraintWidth_percent="0.1" />
+
+                <TextView
+                    android:id="@+id/tv_img_recovery"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="8dp"
+                    android:text="@string/home_page_img_recovery"
+                    android:textColor="@color/white"
+                    android:textSize="14sp"
+                    android:textStyle="bold"
+                    app:layout_constraintBottom_toTopOf="@+id/tv_img_recovery_desc"
+                    app:layout_constraintStart_toEndOf="@+id/iv_img_recovery"
+                    app:layout_constraintTop_toTopOf="@+id/iv_img_recovery"
+                    app:layout_constraintVertical_chainStyle="packed" />
+
+                <TextView
+                    android:id="@+id/tv_img_recovery_desc"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/home_page_img_recovery_desc"
+                    android:textColor="@color/white"
+                    android:textSize="10sp"
+                    app:layout_constraintBottom_toBottomOf="@+id/iv_img_recovery"
+                    app:layout_constraintStart_toStartOf="@+id/tv_img_recovery"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_img_recovery" />
+
+                <Space
+                    android:id="@+id/space7"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:20"
+                    app:layout_constraintTop_toBottomOf="@+id/v_wx_message_recovery" />
+
+
+                <TextView
+                    android:id="@+id/tv_other_function"
+                    style="@style/Home_Page_Title_Text"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
+                    android:text="@string/home_page_other_function"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/space7" />
+
+                <Space
+                    android:id="@+id/space8"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:6"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_other_function" />
+
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/ry_other_function"
+                    android:scrollbars="none"
+                    android:overScrollMode="never"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
+                    app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
+                    app:layout_constraintTop_toBottomOf="@+id/space8"
+                    app:spanCount="4"
+                    tools:itemCount="6"
+                    tools:listitem="@layout/item_home_page_other_function" />
+
+
+                <Space
+                    android:id="@+id/space9"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="360:20"
+                    app:layout_constraintTop_toBottomOf="@+id/ry_other_function" />
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+        </androidx.core.widget.NestedScrollView>
+
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</layout>

+ 45 - 0
app/src/main/res/layout/item_home_page_other_function.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout 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">
+
+    <data>
+
+        <variable
+            name="bean"
+            type="com.datarecovery.master.module.homepage.FunctionBean" />
+    </data>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingVertical="6dp">
+
+        <ImageView
+            imageRes="@{bean.functionIcon}"
+            android:id="@+id/iv_function_img"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:layout_constraintBottom_toTopOf="@+id/tv_function_name"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintVertical_chainStyle="packed"
+            tools:src="@drawable/icon_home_page_file_recovery" />
+
+        <TextView
+            android:text="@{bean.functionName}"
+            android:id="@+id/tv_function_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4dp"
+            android:textColor="#202020"
+            android:textSize="13sp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="@+id/iv_function_img"
+            app:layout_constraintStart_toStartOf="@+id/iv_function_img"
+            app:layout_constraintTop_toBottomOf="@+id/iv_function_img"
+            tools:text="文件恢复" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</layout>

+ 35 - 0
app/src/main/res/layout/view_home_page_switch_text.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <TextView
+        android:id="@+id/tv_switch_text"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
+        android:ellipsize="end"
+        android:lines="1"
+        android:singleLine="true"
+        android:textColor="#202020"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toStartOf="@+id/tv_switch_date"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="华为P40用户微信消息恢复" />
+
+    <TextView
+        android:id="@+id/tv_switch_date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:textColor="#A7A7A7"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="4分钟前" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 4 - 2
app/src/main/res/values/colors.xml

@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-
-
     <color name="colorPrimary">#2B66FE</color>
     <color name="colorClickPrimary">#2B66FE</color>
     <color name="colorPrimaryVariant">#E0EBFF</color>
 
+
+    <color name="transparent">#00FFFFFF</color>
+
     <color name="common_txt_color">#202020</color>
     <color name="main_tab_name_text_color">#999999</color>
+
 </resources>

+ 5 - 0
app/src/main/res/values/dimens.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <dimen name="app_common_page_horizontal_padding">16dp</dimen>
+    <dimen name="app_status_bar_height">24dp</dimen>
+</resources>

+ 13 - 0
app/src/main/res/values/strings.xml

@@ -18,4 +18,17 @@
     <string name="agreement_two_step_content">您需要同意相关协议才能使用本产品</string>
     <string name="user_terms_text">《用户协议》</string>
     <string name="privacy_policy_text">《隐私政策》</string>
+    <string name="home_page_information">资讯</string>
+    <string name="home_page_hot_function">热门功能</string>
+    <string name="home_page_wx_msg_recovery">消息恢复</string>
+    <string name="home_page_wx_msg_recovery_desc">微信聊天记录恢复</string>
+    <string name="home_page_wx_friend_recovery">好友恢复</string>
+    <string name="home_page_wx_friend_recovery_desc">微信好友误删恢复</string>
+    <string name="home_page_img_recovery">图片恢复</string>
+    <string name="home_page_img_recovery_desc">手机丢失图片恢复</string>
+    <string name="home_page_other_function">其他服务</string>
+    <string name="home_page_file_recovery">文件恢复</string>
+    <string name="home_page_video_recovery">视频恢复</string>
+    <string name="home_page_audio_recovery">音频恢复</string>
+    <string name="home_page_img_clearing">图片清除</string>
 </resources>

+ 6 - 0
app/src/main/res/values/style.xml

@@ -40,4 +40,10 @@
     </style>
 
 
+    <style name="Home_Page_Title_Text">
+        <item name="android:textSize">16sp</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:textColor">@color/common_txt_color</item>
+    </style>
+
 </resources>