mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
work around fast-scrolling eating taps for nearby objects
As happened with expander arrows on the right when I turned on fast scrolling, the on-left-side scrollbar was preventing selecting rows when there were enough list elements for fast scrolling to be enabled. So use a listener to turn it on only after the user starts to scroll. And move the bar back to the right side since that's where people expect it.
This commit is contained in:
parent
5998132d4b
commit
22582f247d
3 changed files with 40 additions and 9 deletions
|
@ -30,6 +30,7 @@
|
|||
without an invitation (but: you should still use an
|
||||
invitation when you can)</li>
|
||||
<li>Indicate selected games and groups with a checkmark</li>
|
||||
<li>Move games list scrollbar to the right side</li>
|
||||
<li>Tweak layout of wordlist filter</li>
|
||||
<li>Improve player-config dialog</li>
|
||||
<li>Fix occasional problems remembering game groups
|
||||
|
|
|
@ -31,11 +31,14 @@ import android.net.Uri;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView.OnScrollListener;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
|
@ -43,7 +46,6 @@ import android.widget.EditText;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.eehouse.android.xw4.DBUtils.GameChangeType;
|
||||
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
|
||||
|
@ -614,6 +616,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
private boolean m_haveShownGetDict;
|
||||
private Bundle m_rematchExtras;
|
||||
private Object[] m_newGameParams;
|
||||
private int mCurScrollState;
|
||||
|
||||
public GamesListDelegate( Delegator delegator, Bundle sis )
|
||||
{
|
||||
|
@ -982,10 +985,41 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
};
|
||||
|
||||
mkListAdapter();
|
||||
getListView().setOnItemLongClickListener( this );
|
||||
// Only works if scroller's on left side, as it otherwise steals
|
||||
// events from the expander arrow things
|
||||
getListView().setFastScrollEnabled( true );
|
||||
|
||||
final ListView lv = getListView();
|
||||
lv.setOnItemLongClickListener( this );
|
||||
|
||||
// Can't just enable fast scrolling because the scroller's wide touch
|
||||
// area disables taps on what's underneath. The expander arrows in
|
||||
// this case. So these two listener callbacks enable fast scrolling
|
||||
// only after the user's started scrolling and disable it when [s]he's
|
||||
// done
|
||||
//
|
||||
// See https://stackoverflow.com/questions/33619453/scrollbar-touch-area-in-android-6
|
||||
mCurScrollState = OnScrollListener.SCROLL_STATE_IDLE;
|
||||
lv.setOnScrollListener( new OnScrollListener() {
|
||||
@Override
|
||||
public void onScroll( AbsListView absListView, int ii, int i1, int i2 )
|
||||
{
|
||||
if ( mCurScrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL ) {
|
||||
lv.setFastScrollEnabled( true );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onScrollStateChanged( AbsListView absListView, int state )
|
||||
{
|
||||
if ( state == OnScrollListener.SCROLL_STATE_IDLE
|
||||
&& mCurScrollState != state ) {
|
||||
lv.postDelayed( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
lv.setFastScrollEnabled( false );
|
||||
}
|
||||
}, 500 );
|
||||
}
|
||||
mCurScrollState = state;
|
||||
}
|
||||
} );
|
||||
|
||||
NetUtils.informOfDeaths( m_activity );
|
||||
|
||||
|
|
|
@ -12,11 +12,8 @@
|
|||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:verticalScrollbarPosition="left"
|
||||
/>
|
||||
|
||||
<!-- These are hidden once the list is large enough that scrolling
|
||||
is required -->
|
||||
<Button android:id="@+id/button_newgame_solo"
|
||||
android:text="@string/new_game"
|
||||
style="@style/new_game_buttons"
|
||||
|
@ -25,5 +22,4 @@
|
|||
android:text="@string/new_game_networked"
|
||||
style="@style/new_game_buttons"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
Loading…
Reference in a new issue