From 2d5441acb0f992781af6e1d726c5a497bccf23dc Mon Sep 17 00:00:00 2001 From: renwj Date: Tue, 19 Dec 2023 18:15:43 +0800 Subject: [PATCH] =?UTF-8?q?[6.2.6][View=E7=82=B9=E5=87=BB=E6=80=81]=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/res/layout/charter_p_video_view.xml | 1 + .../src/main/res/layout/taxi_p_video_show.xml | 1 + .../main/res/layout/task_fragment_current.xml | 1 + .../main/res/layout/taxt_u_p_video_show.xml | 1 + .../lancet/ViewPressedStateLancet.java | 130 ++++++++++++++---- .../src/main/res/layout/item_notice_video.xml | 2 + .../mogo-core-res/src/main/res/values/ids.xml | 1 + gradle/bytex/bytex_lancetx.gradle | 2 +- 8 files changed, 114 insertions(+), 25 deletions(-) diff --git a/OCH/charter/passenger/src/main/res/layout/charter_p_video_view.xml b/OCH/charter/passenger/src/main/res/layout/charter_p_video_view.xml index ec63d7a270..d711fe3a71 100644 --- a/OCH/charter/passenger/src/main/res/layout/charter_p_video_view.xml +++ b/OCH/charter/passenger/src/main/res/layout/charter_p_video_view.xml @@ -62,6 +62,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_height="@dimen/dp_119" + app:pressed_enabled="false" app:layout_constraintBottom_toBottomOf="parent"> 0) { + if (context != null) { + try { + ret = LayoutInflater.from(context).createView(name, null, attrs); + } catch (ClassNotFoundException ignore) {} + + if (ret == null) { + String[] prefixList = { + "android.widget.", + "android.webkit.", + "android.app." + }; + for (String prefix : prefixList) { + try { + ret = LayoutInflater.from(context).createView(name, prefix, attrs); + } catch (ClassNotFoundException ignore) { } + } + } + } + } + return ret; + } + + private static void checkSetBgIfNeed(View parent, View view, AttributeSet attr) { try { TypedArray t = null; - float alpha; + float alpha = 0.6f; boolean enabled; try { - if (view == null) { + if (parent == null && view == null) { return; } - Context context = view.getContext(); + Context context = parent == null ? view.getContext() : parent.getContext(); if (context == null) { return; } - if (attr == null) { - return; + + if (parent != null) { + Object tag = parent.getTag(R.id.click_pressed_attr_enabled); + if (tag != null && !((Boolean) tag)) { + view.setTag(R.id.click_pressed_attr_enabled, false); + return; + } } - t = context.obtainStyledAttributes(attr, R.styleable.ClickPressedStyle); - enabled = t.getBoolean(R.styleable.ClickPressedStyle_pressed_enabled, true); - if (!enabled) { - return; + if (view != null) { + Object tag = view.getTag(R.id.click_pressed_attr_enabled); + if (tag != null && !((Boolean) tag)) { + view.setTag(R.id.click_pressed_attr_enabled, false); + return; + } + if (attr != null) { + t = context.obtainStyledAttributes(attr, R.styleable.ClickPressedStyle); + enabled = t.getBoolean(R.styleable.ClickPressedStyle_pressed_enabled, true); + if (!enabled) { + view.setTag(R.id.click_pressed_attr_enabled, false); + return; + } + alpha = t.getFloat(R.styleable.ClickPressedStyle_pressed_alpha, 0.6f); + if (alpha < 0.0f || alpha > 1.0f) { + throw new AssertionError("view custom attr \\'alpha\\' must be in [0.0, 1.0]"); + } + } + view.setTag(R.id.click_pressed_attr_id, attr); } - alpha = t.getFloat(R.styleable.ClickPressedStyle_pressed_alpha, 0.6f); - if (alpha < 0.0f || alpha > 1.0f) { - throw new AssertionError("view custom attr \\'alpha\\' must be in [0.0, 1.0]"); - } - view.setTag(R.id.click_pressed_attr_id, attr); } finally { if (t != null) { t.recycle(); @@ -203,7 +285,7 @@ public class ViewPressedStateLancet { if (constantState != null) { Drawable pressed = DrawableCompat.wrap(constantState.newDrawable().mutate()); pressed.setAlpha((int)(255 * alpha)); - drawable.addState(new int[] {android.R.attr.state_pressed}, pressed); + drawable.addState(new int[] { android.R.attr.state_pressed }, pressed); return drawable; } } diff --git a/core/mogo-core-res/src/main/res/layout/item_notice_video.xml b/core/mogo-core-res/src/main/res/layout/item_notice_video.xml index 9bb2686408..e990ebc08b 100644 --- a/core/mogo-core-res/src/main/res/layout/item_notice_video.xml +++ b/core/mogo-core-res/src/main/res/layout/item_notice_video.xml @@ -1,5 +1,6 @@ @@ -31,6 +32,7 @@ android:layout_height="match_parent" android:layout_alignParentBottom="true" android:gravity="bottom" + app:pressed_enabled="false" android:orientation="horizontal"> + \ No newline at end of file diff --git a/gradle/bytex/bytex_lancetx.gradle b/gradle/bytex/bytex_lancetx.gradle index 6120e724c7..9f9ed05765 100644 --- a/gradle/bytex/bytex_lancetx.gradle +++ b/gradle/bytex/bytex_lancetx.gradle @@ -31,7 +31,7 @@ LancetX { enable rootProject.isJunkDetectEnable() } view_pressed_state { - enable false + enable true } } }