Revert "bigger hitbox for alt indicator"
This reverts commit 1b04440546
.
this commit just wasn't working properly. animation would have a
frame of stuttering and i don't know where that came from or how i
could fix that. also, the code was a mess anyway
This commit is contained in:
parent
396836760a
commit
527267b315
|
@ -12,6 +12,7 @@ import android.view.ViewTreeObserver;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.joinmastodon.android.GlobalUserPreferences;
|
import org.joinmastodon.android.GlobalUserPreferences;
|
||||||
|
@ -37,7 +38,7 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Holder extends ImageStatusDisplayItem.Holder<PhotoStatusDisplayItem>{
|
public static class Holder extends ImageStatusDisplayItem.Holder<PhotoStatusDisplayItem>{
|
||||||
private final FrameLayout altTextWrapper, altTextOpen;
|
private final FrameLayout altTextWrapper;
|
||||||
private final TextView altTextButton;
|
private final TextView altTextButton;
|
||||||
private final ImageView noAltTextButton;
|
private final ImageView noAltTextButton;
|
||||||
private final View altTextScroller;
|
private final View altTextScroller;
|
||||||
|
@ -51,13 +52,14 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
public Holder(Activity activity, ViewGroup parent){
|
public Holder(Activity activity, ViewGroup parent){
|
||||||
super(activity, R.layout.display_item_photo, parent);
|
super(activity, R.layout.display_item_photo, parent);
|
||||||
altTextWrapper=findViewById(R.id.alt_text_wrapper);
|
altTextWrapper=findViewById(R.id.alt_text_wrapper);
|
||||||
altTextOpen=findViewById(R.id.alt_text_open);
|
|
||||||
altTextButton=findViewById(R.id.alt_button);
|
altTextButton=findViewById(R.id.alt_button);
|
||||||
noAltTextButton=findViewById(R.id.no_alt_button);
|
noAltTextButton=findViewById(R.id.no_alt_button);
|
||||||
altTextScroller=findViewById(R.id.alt_text_scroller);
|
altTextScroller=findViewById(R.id.alt_text_scroller);
|
||||||
altTextClose=findViewById(R.id.alt_text_close);
|
altTextClose=findViewById(R.id.alt_text_close);
|
||||||
altText=findViewById(R.id.alt_text);
|
altText=findViewById(R.id.alt_text);
|
||||||
|
|
||||||
|
altTextButton.setOnClickListener(this::onShowHideClick);
|
||||||
|
noAltTextButton.setOnClickListener(this::onShowHideClick);
|
||||||
altTextClose.setOnClickListener(this::onShowHideClick);
|
altTextClose.setOnClickListener(this::onShowHideClick);
|
||||||
// altTextScroller.setNestedScrollingEnabled(true);
|
// altTextScroller.setNestedScrollingEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +80,6 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
altTextButton.setAlpha(1f);
|
altTextButton.setAlpha(1f);
|
||||||
noAltTextButton.setAlpha(1f);
|
noAltTextButton.setAlpha(1f);
|
||||||
altTextWrapper.setVisibility(View.VISIBLE);
|
altTextWrapper.setVisibility(View.VISIBLE);
|
||||||
altTextOpen.setOnClickListener(this::onShowHideClick);
|
|
||||||
|
|
||||||
if (altTextMissing){
|
if (altTextMissing){
|
||||||
if (GlobalUserPreferences.showNoAltIndicator) {
|
if (GlobalUserPreferences.showNoAltIndicator) {
|
||||||
|
@ -105,9 +106,7 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowHideClick(View v){
|
private void onShowHideClick(View v){
|
||||||
boolean show=v.getId()==R.id.alt_text_open;
|
boolean show=v.getId()==R.id.alt_button || v.getId()==R.id.no_alt_button;
|
||||||
|
|
||||||
altTextOpen.setOnClickListener(show ? null : this::onShowHideClick);
|
|
||||||
|
|
||||||
if(altTextShown==show)
|
if(altTextShown==show)
|
||||||
return;
|
return;
|
||||||
|
@ -128,8 +127,7 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
// This is the current size...
|
// This is the current size...
|
||||||
int prevLeft=altTextWrapper.getLeft();
|
int prevLeft=altTextWrapper.getLeft();
|
||||||
int prevRight=altTextWrapper.getRight();
|
int prevRight=altTextWrapper.getRight();
|
||||||
int prevBottom=altTextWrapper.getBottom();
|
int prevTop=altTextWrapper.getTop();
|
||||||
int prevTop=altTextOpen.getTop();
|
|
||||||
altTextWrapper.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(){
|
altTextWrapper.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(){
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreDraw(){
|
public boolean onPreDraw(){
|
||||||
|
@ -146,8 +144,7 @@ public class PhotoStatusDisplayItem extends ImageStatusDisplayItem{
|
||||||
set.playTogether(
|
set.playTogether(
|
||||||
ObjectAnimator.ofInt(altTextWrapper, "left", prevLeft, altTextWrapper.getLeft()),
|
ObjectAnimator.ofInt(altTextWrapper, "left", prevLeft, altTextWrapper.getLeft()),
|
||||||
ObjectAnimator.ofInt(altTextWrapper, "right", prevRight, altTextWrapper.getRight()),
|
ObjectAnimator.ofInt(altTextWrapper, "right", prevRight, altTextWrapper.getRight()),
|
||||||
ObjectAnimator.ofInt(altTextWrapper, "bottom", prevBottom, altTextWrapper.getBottom()),
|
ObjectAnimator.ofInt(altTextWrapper, "top", prevTop, altTextWrapper.getTop()),
|
||||||
ObjectAnimator.ofInt(altTextOpen, "top", prevTop, altTextOpen.getTop()),
|
|
||||||
ObjectAnimator.ofFloat(altOrNoAltButton, View.ALPHA, show ? 1f : 0f, show ? 0f : 1f),
|
ObjectAnimator.ofFloat(altOrNoAltButton, View.ALPHA, show ? 1f : 0f, show ? 0f : 1f),
|
||||||
ObjectAnimator.ofFloat(altTextScroller, View.ALPHA, show ? 0f : 1f, show ? 1f : 0f),
|
ObjectAnimator.ofFloat(altTextScroller, View.ALPHA, show ? 0f : 1f, show ? 1f : 0f),
|
||||||
ObjectAnimator.ofFloat(altTextClose, View.ALPHA, show ? 0f : 1f, show ? 1f : 0f)
|
ObjectAnimator.ofFloat(altTextClose, View.ALPHA, show ? 0f : 1f, show ? 1f : 0f)
|
||||||
|
|
|
@ -13,75 +13,67 @@
|
||||||
|
|
||||||
<!-- This is hidden from screenreaders because that same alt text is set as content description on the ImageView -->
|
<!-- This is hidden from screenreaders because that same alt text is set as content description on the ImageView -->
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/alt_text_open"
|
android:id="@+id/alt_text_wrapper"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start|bottom"
|
android:layout_gravity="start|bottom"
|
||||||
android:padding="12dp">
|
android:layout_margin="12dp"
|
||||||
|
android:importantForAccessibility="noHideDescendants"
|
||||||
|
android:background="@drawable/bg_image_alt_overlay">
|
||||||
|
|
||||||
<FrameLayout
|
<ImageView
|
||||||
android:id="@+id/alt_text_wrapper"
|
android:id="@+id/no_alt_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="start|bottom"
|
android:padding="4dp"
|
||||||
android:importantForAccessibility="noHideDescendants"
|
android:src="@drawable/ic_fluent_important_20_filled"
|
||||||
android:background="@drawable/bg_image_alt_overlay">
|
android:tint="@color/gray_25" />
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
android:id="@+id/no_alt_button"
|
android:id="@+id/alt_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="@style/m3_label_large"
|
||||||
|
android:textColor="@color/gray_25"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:paddingHorizontal="5dp"
|
||||||
|
android:paddingVertical="1dp"
|
||||||
|
android:text="@string/sk_alt_button"/>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/alt_text_close"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="end|top"
|
||||||
|
android:src="@drawable/ic_baseline_close_24"
|
||||||
|
android:tint="#FFF"
|
||||||
|
android:background="?android:actionBarItemBackground"/>
|
||||||
|
|
||||||
|
<org.joinmastodon.android.ui.views.NestableScrollView
|
||||||
|
android:id="@+id/alt_text_scroller"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="40dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="4dp"
|
android:orientation="vertical">
|
||||||
android:src="@drawable/ic_fluent_important_20_filled"
|
|
||||||
android:tint="@color/gray_25" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/alt_button"
|
android:id="@+id/alt_text"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="@style/m3_label_large"
|
|
||||||
android:textColor="@color/gray_25"
|
|
||||||
android:gravity="center"
|
|
||||||
android:includeFontPadding="false"
|
|
||||||
android:paddingHorizontal="5dp"
|
|
||||||
android:paddingVertical="1dp"
|
|
||||||
android:text="@string/sk_alt_button"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/alt_text_close"
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_gravity="end|top"
|
|
||||||
android:src="@drawable/ic_baseline_close_24"
|
|
||||||
android:tint="#FFF"
|
|
||||||
android:background="?android:actionBarItemBackground"/>
|
|
||||||
|
|
||||||
<org.joinmastodon.android.ui.views.NestableScrollView
|
|
||||||
android:id="@+id/alt_text_scroller"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_marginEnd="40dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_margin="8dp"
|
||||||
|
android:textAppearance="@style/m3_body_medium"
|
||||||
|
android:textColor="#FFF"
|
||||||
|
tools:text="Alt text goes here"/>
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/alt_text"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:textAppearance="@style/m3_body_medium"
|
|
||||||
android:textColor="#FFF"
|
|
||||||
tools:text="Alt text goes here"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</org.joinmastodon.android.ui.views.NestableScrollView>
|
||||||
|
|
||||||
</org.joinmastodon.android.ui.views.NestableScrollView>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue