From 57fe0a6f067816c5599f49907508fb111c98cb00 Mon Sep 17 00:00:00 2001 From: eehouse Date: Sat, 8 May 2010 15:25:13 +0000 Subject: [PATCH] RelativeLayout is broken on 1.5 devices, so add an alternative and use it on 1.5. It might be good enough for the rest too.... --- .../res/layout/game_list_item_onefive.xml | 35 +++++++++++++++++++ .../eehouse/android/xw4/GameListAdapter.java | 11 +++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 xwords4/android/XWords4/res/layout/game_list_item_onefive.xml diff --git a/xwords4/android/XWords4/res/layout/game_list_item_onefive.xml b/xwords4/android/XWords4/res/layout/game_list_item_onefive.xml new file mode 100644 index 000000000..e76c23cd5 --- /dev/null +++ b/xwords4/android/XWords4/res/layout/game_list_item_onefive.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + 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 a97a0c972..67b29107b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -36,11 +36,20 @@ import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole; public class GameListAdapter extends XWListAdapter { Context m_context; LayoutInflater m_factory; + int m_layoutId; public GameListAdapter( Context context ) { super( context, Utils.gamesList(context).length ); m_context = context; m_factory = LayoutInflater.from( context ); + + int sdk_int = 0; + try { + sdk_int = Integer.decode( android.os.Build.VERSION.SDK ); + } catch ( Exception ex ) {} + + m_layoutId = sdk_int >= android.os.Build.VERSION_CODES.DONUT + ? R.layout.game_list_item : R.layout.game_list_item_onefive; } public int getCount() { @@ -49,7 +58,7 @@ public class GameListAdapter extends XWListAdapter { public Object getItem( int position ) { - final View layout = m_factory.inflate( R.layout.game_list_item, null ); + final View layout = m_factory.inflate( m_layoutId, null ); String path = Utils.gamesList(m_context)[position]; byte[] stream = open( path );