cleanup, resolved some warnings

This commit is contained in:
Torge Rosendahl 2023-02-15 20:19:10 -05:00
parent fd99f3caa1
commit 0a8d73dc0b
1 changed files with 4 additions and 8 deletions

View File

@ -15,7 +15,6 @@ import android.text.Spanned;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.SoundEffectConstants; import android.view.SoundEffectConstants;
import android.view.ViewConfiguration;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -27,12 +26,12 @@ import me.grishka.appkit.utils.V;
public class ClickableLinksDelegate { public class ClickableLinksDelegate {
private Paint hlPaint; final private Paint hlPaint;
private Path hlPath; private Path hlPath;
private LinkSpan selectedSpan; private LinkSpan selectedSpan;
private TextView view; final private TextView view;
GestureDetector gestureDetector; final GestureDetector gestureDetector;
public ClickableLinksDelegate(TextView view) { public ClickableLinksDelegate(TextView view) {
this.view=view; this.view=view;
@ -82,8 +81,7 @@ public class ClickableLinksDelegate {
return false; return false;
} }
CharSequence text=view.getText(); CharSequence text=view.getText();
if(text instanceof Spanned){ if(text instanceof Spanned s){
Spanned s=(Spanned)text;
LinkSpan[] spans=s.getSpans(0, s.length()-1, LinkSpan.class); LinkSpan[] spans=s.getSpans(0, s.length()-1, LinkSpan.class);
if(spans.length>0){ if(spans.length>0){
for(LinkSpan span:spans){ for(LinkSpan span:spans){
@ -100,7 +98,6 @@ public class ClickableLinksDelegate {
} }
hlPath=new Path(); hlPath=new Path();
selectedSpan=span; selectedSpan=span;
view.postDelayed(copyTextToClipboard, ViewConfiguration.getLongPressTimeout());
hlPaint.setColor((span.getColor() & 0x00FFFFFF) | 0x33000000); hlPaint.setColor((span.getColor() & 0x00FFFFFF) | 0x33000000);
//l.getSelectionPath(start, end, hlPath); //l.getSelectionPath(start, end, hlPath);
for(int j=lstart;j<=lend;j++){ for(int j=lstart;j<=lend;j++){
@ -132,7 +129,6 @@ public class ClickableLinksDelegate {
@Override @Override
public boolean onSingleTapUp(@NonNull MotionEvent event) { public boolean onSingleTapUp(@NonNull MotionEvent event) {
if(selectedSpan!=null){ if(selectedSpan!=null){
view.removeCallbacks(copyTextToClipboard);
view.playSoundEffect(SoundEffectConstants.CLICK); view.playSoundEffect(SoundEffectConstants.CLICK);
selectedSpan.onClick(view.getContext()); selectedSpan.onClick(view.getContext());
resetAndInvalidate(); resetAndInvalidate();