mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
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....
This commit is contained in:
parent
3632c27f04
commit
57fe0a6f06
2 changed files with 45 additions and 1 deletions
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4sp">
|
||||
|
||||
<TextView android:id="@+id/players"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/role"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<TextView android:id="@+id/state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
/>
|
||||
<TextView android:id="@+id/dict"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue