From 75602c47d80364a8c3fbbd2e05c6cd5383c87397 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 6 Jul 2012 07:13:11 -0700 Subject: [PATCH] on Amazon-made devices only, sleep randomly during load of game summary. This seems to work around a bug where only the last item in the list is clickable but once it's clicked events are received for every failed click up to that point. --- .../eehouse/android/xw4/GameListAdapter.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index 5f0ac8eda..a08fa2e3f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -22,6 +22,7 @@ package org.eehouse.android.xw4; import android.widget.ListAdapter; import android.content.Context; import android.os.AsyncTask; +import android.os.Build; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; @@ -47,6 +48,8 @@ public class GameListAdapter extends XWListAdapter { private Context m_context; private LayoutInflater m_factory; private int m_fieldID; + private static final boolean s_isFire = + Build.MANUFACTURER.equals( "Amazon" ); private class ViewInfo implements View.OnClickListener { private View m_view; @@ -123,13 +126,17 @@ public class GameListAdapter extends XWListAdapter { @Override protected Void doInBackground( Void... unused ) { - // force slow loading for debugging - // try { - // Random random = new Random(); - // int sleepTime = random.nextInt() % 3000; - // Thread.sleep( sleepTime ); - // } catch ( Exception e ) { - // } + // Without this, on the Fire only the last item in the + // list it tappable. Likely my fault, but this seems to + // work around it. + if ( s_isFire ) { + try { + Random random = new Random(); + int sleepTime = 500 + (random.nextInt() % 500); + Thread.sleep( sleepTime ); + } catch ( Exception e ) { + } + } View layout = m_factory.inflate( R.layout.game_list_item, null ); boolean hideTitle = false;//CommonPrefs.getHideTitleBar(m_context); GameSummary summary = DBUtils.getSummary( m_context, m_rowid );