mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-17 06:55:03 -05:00
1eb37c2031
The standard ScrollView causes problems when selecting text (and the message is long enough so scrolling is possible). The newly introduced ToggleScrollView can be set to disable scrolling via touch gestures thus making copying multi-line text sections possible. Fixes issue 662
34 lines
777 B
Java
34 lines
777 B
Java
package com.fsck.k9.activity;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
import android.widget.ScrollView;
|
|
|
|
public class ToggleScrollView extends ScrollView
|
|
{
|
|
private boolean mScrolling = true;
|
|
|
|
public ToggleScrollView(Context context, AttributeSet attrs)
|
|
{
|
|
super(context, attrs);
|
|
}
|
|
|
|
public void setScrolling(boolean enable)
|
|
{
|
|
mScrolling = enable;
|
|
}
|
|
|
|
@Override
|
|
public boolean onTouchEvent(MotionEvent ev)
|
|
{
|
|
return (mScrolling) ? super.onTouchEvent(ev) : true;
|
|
}
|
|
|
|
@Override
|
|
public boolean onInterceptTouchEvent(MotionEvent ev)
|
|
{
|
|
return (mScrolling) ? super.onInterceptTouchEvent(ev) : false;
|
|
}
|
|
}
|