Skip to content

Commit

Permalink
NoRelayoutTextView: Enable requestLayout in more cases (#7175)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteHamster committed May 10, 2024
1 parent 084723a commit 8d3eb6a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package de.danoeh.antennapod.ui.screen.playback.audio;

import android.content.Context;
import android.os.Parcelable;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

public class NoRelayoutTextView extends AppCompatTextView {
private boolean requestLayoutEnabled = false;
private boolean requestLayoutEnabled = true;
private float maxTextLength = 0;

public NoRelayoutTextView(@NonNull Context context) {
Expand All @@ -30,6 +31,12 @@ public void requestLayout() {
requestLayoutEnabled = false;
}

@Override
public void onRestoreInstanceState(Parcelable state) {
requestLayoutEnabled = true;
super.onRestoreInstanceState(state);
}

@Override
public void setText(CharSequence text, BufferType type) {
float textLength = getPaint().measureText(text.toString());
Expand Down

0 comments on commit 8d3eb6a

Please sign in to comment.