mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-20 22:26:54 +01:00
make Random class static rather than generate one over and over
This commit is contained in:
parent
3c19a7ef44
commit
43fead368c
1 changed files with 9 additions and 4 deletions
|
@ -48,8 +48,14 @@ 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 static final boolean s_isFire;
|
||||
private static Random s_random;
|
||||
static {
|
||||
s_isFire = Build.MANUFACTURER.equals( "Amazon" );
|
||||
if ( s_isFire ) {
|
||||
s_random = new Random();
|
||||
}
|
||||
}
|
||||
|
||||
private class ViewInfo implements View.OnClickListener {
|
||||
private View m_view;
|
||||
|
@ -131,8 +137,7 @@ public class GameListAdapter extends XWListAdapter {
|
|||
// work around it.
|
||||
if ( s_isFire ) {
|
||||
try {
|
||||
Random random = new Random();
|
||||
int sleepTime = 500 + (random.nextInt() % 500);
|
||||
int sleepTime = 500 + (s_random.nextInt() % 500);
|
||||
Thread.sleep( sleepTime );
|
||||
} catch ( Exception e ) {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue