[add] 心形资源替换-事件面板适配新UI

This commit is contained in:
liujing
2020-11-23 16:42:00 +08:00
parent 6eb97f55e7
commit beb429d3af
11 changed files with 33 additions and 5 deletions

View File

@@ -103,8 +103,8 @@
<ImageView
android:id="@+id/module_entrance_id_uploading"
android:layout_width="@dimen/module_entrance_id_uploading_width"
android:layout_height="@dimen/module_entrance_id_uploading_height"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:scaleType="fitCenter"

View File

@@ -4,6 +4,7 @@ import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
@@ -36,8 +37,16 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
public HeartLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
inflate(context, R.layout.view_heart_like, this);
mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.HeartLikeView, defStyleAttr,
0);
boolean showGrayBack = typedArray.getBoolean(R.styleable.HeartLikeView_showGrayBack, false);
if (showGrayBack) {
inflate(context, R.layout.view_heart_like_gray_back, this);
mIllegalParkingLike = findViewById(R.id.ivLikeForGrayBack);
} else {
inflate(context, R.layout.view_heart_like, this);
mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike);
}
setOnClickListener(v -> {
if (!isAnimator) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -90,7 +90,8 @@
android:layout_marginEnd="@dimen/dp_40"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/llIllegalParkingUnLike"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:showGrayBack="true" />
<com.mogo.module.v2x.view.HeartUnLikeView
android:id="@+id/llIllegalParkingUnLike"

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llIllegalParkingLike"
android:layout_width="@dimen/module_v2x_event_button_size"
android:layout_height="@dimen/module_v2x_event_button_size"
android:background="@drawable/icon_gray_back_heart"
android:gravity="center">
<ImageView
android:id="@+id/ivLikeForGrayBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_heart_like_for_gray_back" />
</LinearLayout>

View File

@@ -7,4 +7,8 @@
<style name="customTabLayoutTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">@dimen/dp_40</item>
</style>
<declare-styleable name="HeartLikeView">
<attr name="showGrayBack" format="boolean" />
</declare-styleable>
</resources>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB