# HG changeset patch # User Medo # Date 1343848419 -7200 # Node ID 8e86d8d2927d67a3368ae928912b7f6157b02f33 # Parent 915f824039ba9264727f6261e4c53c281c057703 Hedgeroid: Fix argument passing to ChatFragment, small layout fixes diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/AndroidManifest.xml --- a/project_files/Android-build/SDL-android-project/AndroidManifest.xml Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/AndroidManifest.xml Wed Aug 01 21:13:39 2012 +0200 @@ -70,7 +70,7 @@ android:name=".netplay.LobbyActivity" android:label="@string/title_activity_lobby" android:screenOrientation="landscape" - android:windowSoftInputMode="adjustResize" > + android:windowSoftInputMode="adjustPan" > \ No newline at end of file diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/res/layout-large/activity_lobby.xml --- a/project_files/Android-build/SDL-android-project/res/layout-large/activity_lobby.xml Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/res/layout-large/activity_lobby.xml Wed Aug 01 21:13:39 2012 +0200 @@ -36,7 +36,7 @@ @@ -61,8 +61,8 @@ android:id="@+id/chatFragment" android:layout_width="fill_parent" android:layout_height="fill_parent" - class="org.hedgewars.hedgeroid.netplay.LobbyChatFragment" - tools:layout="@layout/lobby_chat_fragment" /> + class="org.hedgewars.hedgeroid.netplay.ChatFragment" + tools:layout="@layout/fragment_chat" /> diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/res/layout/activity_lobby.xml --- a/project_files/Android-build/SDL-android-project/res/layout/activity_lobby.xml Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/res/layout/activity_lobby.xml Wed Aug 01 21:13:39 2012 +0200 @@ -40,7 +40,7 @@ android:id="@+id/chatFragment" android:layout_width="fill_parent" android:layout_height="fill_parent" - class="org.hedgewars.hedgeroid.netplay.LobbyChatFragment" + class="org.hedgewars.hedgeroid.netplay.ChatFragment" tools:layout="@layout/fragment_chat" /> diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/res/layout/listview_player.xml --- a/project_files/Android-build/SDL-android-project/res/layout/listview_player.xml Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/res/layout/listview_player.xml Wed Aug 01 21:13:39 2012 +0200 @@ -8,4 +8,5 @@ android:drawablePadding="5dp" android:drawableLeft="@drawable/playerlist_player" android:gravity="center_vertical|left" + android:singleLine="true" android:textAppearance="?android:attr/textAppearanceMedium" /> \ No newline at end of file diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/ChatFragment.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/ChatFragment.java Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/ChatFragment.java Wed Aug 01 21:13:39 2012 +0200 @@ -19,22 +19,31 @@ private ChatlogAdapter adapter; private Netplay netconn; private MessageLog messageLog; + private boolean inRoom; + + public void setInRoom(boolean inRoom) { + this.inRoom = inRoom; + } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - Bundle bundle = getArguments(); netconn = Netplay.getAppInstance(getActivity().getApplicationContext()); adapter = new ChatlogAdapter(getActivity()); - messageLog = bundle.getBoolean(ARGUMENT_INROOM) ? netconn.roomChatlog : netconn.lobbyChatlog; + } + + @Override + public void onStart() { + super.onStart(); + messageLog = inRoom ? netconn.roomChatlog : netconn.lobbyChatlog; adapter.setLog(messageLog.getLog()); messageLog.registerObserver(adapter); } @Override - public void onStart() { - super.onStart(); + public void onStop() { + super.onStop(); + messageLog.unregisterObserver(adapter); } @Override @@ -54,12 +63,6 @@ return view; } - @Override - public void onDestroy() { - super.onDestroy(); - messageLog.unregisterObserver(adapter); - } - private final class ChatSendListener implements OnEditorActionListener { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { String text = v.getText().toString(); diff -r 915f824039ba -r 8e86d8d2927d project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/LobbyActivity.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/LobbyActivity.java Wed Aug 01 20:56:32 2012 +0200 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/LobbyActivity.java Wed Aug 01 21:13:39 2012 +0200 @@ -5,7 +5,6 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; @@ -27,8 +26,8 @@ super.onCreate(icicle); setContentView(R.layout.activity_lobby); - Fragment chatFragment = getSupportFragmentManager().findFragmentById(R.id.chatFragment); - chatFragment.getArguments().putBoolean(ChatFragment.ARGUMENT_INROOM, false); + ChatFragment chatFragment = (ChatFragment)getSupportFragmentManager().findFragmentById(R.id.chatFragment); + chatFragment.setInRoom(false); FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.add(new NetplayStateFragment(), "netplayFragment");