mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +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 Context m_context;
|
||||||
private LayoutInflater m_factory;
|
private LayoutInflater m_factory;
|
||||||
private int m_fieldID;
|
private int m_fieldID;
|
||||||
private static final boolean s_isFire =
|
private static final boolean s_isFire;
|
||||||
Build.MANUFACTURER.equals( "Amazon" );
|
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 class ViewInfo implements View.OnClickListener {
|
||||||
private View m_view;
|
private View m_view;
|
||||||
|
@ -131,8 +137,7 @@ public class GameListAdapter extends XWListAdapter {
|
||||||
// work around it.
|
// work around it.
|
||||||
if ( s_isFire ) {
|
if ( s_isFire ) {
|
||||||
try {
|
try {
|
||||||
Random random = new Random();
|
int sleepTime = 500 + (s_random.nextInt() % 500);
|
||||||
int sleepTime = 500 + (random.nextInt() % 500);
|
|
||||||
Thread.sleep( sleepTime );
|
Thread.sleep( sleepTime );
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue