Commit 27d458eb authored by Grigory Fedorov's avatar Grigory Fedorov

Conference add activity separated to activity and fragment.

Scroll v iew added to layout - toolbar do not pushed up by keyboard.;
Unified layout for activity with toolbar and fragment container.
parent 9e9de3e3
......@@ -167,7 +167,7 @@
android:label="@string/account_oauth"
/>
<activity
android:name="com.xabber.android.ui.MUCEditor"
android:name=".ui.ConferenceAdd"
android:label="@string/muc_add"
android:parentActivityName="com.xabber.android.ui.ContactList"
>
......
......@@ -20,7 +20,7 @@ import com.xabber.android.R;
import com.xabber.android.data.Application;
import com.xabber.android.data.entity.BaseEntity;
import com.xabber.android.data.notification.EntityNotificationItem;
import com.xabber.android.ui.MUCEditor;
import com.xabber.android.ui.ConferenceAdd;
public class RoomAuthorizationError extends BaseEntity implements
EntityNotificationItem {
......@@ -31,7 +31,7 @@ public class RoomAuthorizationError extends BaseEntity implements
@Override
public Intent getIntent() {
return MUCEditor.createIntent(Application.getInstance(),
return ConferenceAdd.createIntent(Application.getInstance(),
account, user);
}
......
......@@ -43,10 +43,10 @@ public class AccountAdd extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.account_add);
setContentView(R.layout.activity_with_toolbar_and_container);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.container, AccountAddFragment.newInstance()).commit();
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, AccountAddFragment.newInstance()).commit();
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -73,7 +73,7 @@ public class AccountAdd extends ManagedActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_account:
((AccountAddFragment)getSupportFragmentManager().findFragmentById(R.id.container)).addAccount();
((AccountAddFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container)).addAccount();
return true;
......
......@@ -448,7 +448,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
return true;
case R.id.action_authorization_settings:
startActivity(MUCEditor.createIntent(getActivity(), account, user));
startActivity(ConferenceAdd.createIntent(getActivity(), account, user));
return true;
case R.id.action_close_chat:
......
/**
* Copyright (c) 2013, Redsolution LTD. All rights reserved.
*
* This file is part of Xabber project; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, Version 3.
*
* Xabber is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License,
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.xabber.android.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import com.xabber.android.R;
import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.intent.AccountIntentBuilder;
import com.xabber.android.data.intent.EntityIntentBuilder;
import com.xabber.android.ui.helper.BarPainter;
import com.xabber.android.ui.helper.ManagedActivity;
import java.util.Collection;
public class ConferenceAdd extends ManagedActivity implements ConferenceAddFragment.Listener {
private static final String SAVED_ACCOUNT = "com.xabber.android.ui.MUCEditor.SAVED_ACCOUNT";
private static final String SAVED_ROOM = "com.xabber.android.ui.MUCEditor.SAVED_ROOM";
private BarPainter barPainter;
private String account;
private String room;
public static Intent createIntent(Context context) {
return ConferenceAdd.createIntent(context, null, null);
}
public static Intent createIntent(Context context, String account,
String room) {
return new EntityIntentBuilder(context, ConferenceAdd.class).setAccount(account).setUser(room).build();
}
private static String getAccount(Intent intent) {
return AccountIntentBuilder.getAccount(intent);
}
private static String getUser(Intent intent) {
return EntityIntentBuilder.getUser(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (isFinishing()) {
return;
}
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
setTitle(null);
setSupportActionBar(toolbar);
barPainter = new BarPainter(this, toolbar);
barPainter.setDefaultColor();
Intent intent = getIntent();
account = null;
room = null;
if (savedInstanceState != null) {
account = savedInstanceState.getString(SAVED_ACCOUNT);
room = savedInstanceState.getString(SAVED_ROOM);
} else {
account = getAccount(intent);
room = getUser(intent);
}
if (account == null) {
Collection<String> accounts = AccountManager.getInstance().getAccounts();
if (accounts.size() == 1) {
account = accounts.iterator().next();
}
}
if (account != null) {
barPainter.updateWithAccountName(account);
}
if (savedInstanceState == null) {
getFragmentManager()
.beginTransaction()
.add(R.id.fragment_container, ConferenceAddFragment.newInstance(account, room))
.commit();
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(SAVED_ACCOUNT, account);
outState.putString(SAVED_ROOM, room);
}
@Override
public void onAccountSelected(String account) {
barPainter.updateWithAccountName(account);
this.account = account;
}
}
......@@ -55,7 +55,7 @@ public class ContactAdd extends ManagedActivity implements ContactAddFragment.Li
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contact_add);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
setTitle(null);
......@@ -70,14 +70,14 @@ public class ContactAdd extends ManagedActivity implements ContactAddFragment.Li
if (savedInstanceState == null) {
getSupportFragmentManager()
.beginTransaction()
.add(R.id.container, ContactAddFragment.newInstance(getAccount(intent), getUser(intent)))
.add(R.id.fragment_container, ContactAddFragment.newInstance(getAccount(intent), getUser(intent)))
.commit();
}
}
private void addContact() {
((ContactAddFragment)getSupportFragmentManager().findFragmentById(R.id.container)).addContact();
((ContactAddFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container)).addContact();
}
@Override
......
......@@ -414,7 +414,7 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
closeAllChats();
return true;
case R.id.action_join_conference:
startActivity(MUCEditor.createIntent(this));
startActivity(ConferenceAdd.createIntent(this));
return true;
case R.id.action_chat_list:
startActivity(ChatViewer.createRecentChatsIntent(this));
......
......@@ -59,7 +59,7 @@ public class GroupEditor extends ManagedActivity implements OnContactChangedList
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.group_editor);
setContentView(R.layout.activity_with_toolbar_and_container);
contactTitleActionBarInflater = new ContactTitleActionBarInflater(this, (Toolbar) findViewById(R.id.toolbar_default));
contactTitleActionBarInflater.setUpActionBarView();
......@@ -75,7 +75,7 @@ public class GroupEditor extends ManagedActivity implements OnContactChangedList
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, GroupEditorFragment.newInstance(account, user)).commit();
.add(R.id.fragment_container, GroupEditorFragment.newInstance(account, user)).commit();
}
}
......
......@@ -67,7 +67,7 @@ public class MUCInvite extends ManagedDialog {
@Override
public void onAccept() {
super.onAccept();
startActivity(MUCEditor.createIntent(this, account, room));
startActivity(ConferenceAdd.createIntent(this, account, room));
finish();
}
......
......@@ -38,11 +38,11 @@ import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.PresenceManager;
import com.xabber.android.data.roster.ShowOfflineMode;
import com.xabber.android.ui.ChatViewer;
import com.xabber.android.ui.ConferenceAdd;
import com.xabber.android.ui.ContactAdd;
import com.xabber.android.ui.ContactEditor;
import com.xabber.android.ui.ContactViewer;
import com.xabber.android.ui.GroupEditor;
import com.xabber.android.ui.MUCEditor;
import com.xabber.android.ui.StatusEditor;
import com.xabber.android.ui.adapter.UpdatableAdapter;
import com.xabber.android.ui.dialog.ContactDeleteDialogFragment;
......@@ -81,7 +81,7 @@ public class ContextMenuHelper {
if (MUCManager.getInstance().hasRoom(account, user)) {
if (!MUCManager.getInstance().inUse(account, user))
menu.add(R.string.muc_edit).setIntent(
MUCEditor.createIntent(activity, account, user));
ConferenceAdd.createIntent(activity, account, user));
menu.add(R.string.muc_delete).setOnMenuItemClickListener(
new MenuItem.OnMenuItemClickListener() {
@Override
......
......@@ -71,12 +71,12 @@ public class AccountEditor extends ManagedActivity implements
token = accountItem.getConnectionSettings().getPassword();
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new AccountEditorFragment()).commit();
.add(R.id.fragment_container, new AccountEditorFragment()).commit();
} else {
token = savedInstanceState.getString(SAVED_TOKEN);
}
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......@@ -109,7 +109,7 @@ public class AccountEditor extends ManagedActivity implements
}
((AccountEditorFragment) getFragmentManager().findFragmentById(
R.id.preferences_activity_container)).onOAuthChange();
R.id.fragment_container)).onOAuthChange();
}
}
}
......
......@@ -18,7 +18,7 @@ public abstract class BasePhrasePreferences extends ManagedActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -30,7 +30,7 @@ public abstract class BasePhrasePreferences extends ManagedActivity
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new PhraseEditorFragment()).commit();
.add(R.id.fragment_container, new PhraseEditorFragment()).commit();
}
}
......
......@@ -62,7 +62,7 @@ public class ChatEditor extends ManagedActivity
return;
}
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......@@ -72,7 +72,7 @@ public class ChatEditor extends ManagedActivity
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new ChatEditorFragment()).commit();
.add(R.id.fragment_container, new ChatEditorFragment()).commit();
}
}
......
......@@ -16,7 +16,7 @@ public class ChatSettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -31,7 +31,7 @@ public class ChatSettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new ChatSettingsFragment()).commit();
.add(R.id.fragment_container, new ChatSettingsFragment()).commit();
}
}
}
......@@ -16,7 +16,7 @@ public class ConnectionSettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -31,7 +31,7 @@ public class ConnectionSettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new ConnectionSettingsFragment()).commit();
.add(R.id.fragment_container, new ConnectionSettingsFragment()).commit();
}
}
}
......@@ -15,7 +15,7 @@ public class ContactListSettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -30,7 +30,7 @@ public class ContactListSettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new ContactListSettingsFragment()).commit();
.add(R.id.fragment_container, new ContactListSettingsFragment()).commit();
}
}
}
......@@ -16,7 +16,7 @@ public class DebugSettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -31,7 +31,7 @@ public class DebugSettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new DebugSettingsFragment()).commit();
.add(R.id.fragment_container, new DebugSettingsFragment()).commit();
}
}
}
......@@ -17,7 +17,7 @@ public class NotificationsSettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -32,7 +32,7 @@ public class NotificationsSettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new NotificationsSettingsFragment()).commit();
.add(R.id.fragment_container, new NotificationsSettingsFragment()).commit();
}
}
}
......@@ -36,7 +36,7 @@ public class PhraseAdder extends BasePhrasePreferences {
case R.id.action_save:
boolean success = ((PhraseEditorFragment) getFragmentManager()
.findFragmentById(R.id.preferences_activity_container)).saveChanges();
.findFragmentById(R.id.fragment_container)).saveChanges();
if (success) {
finish();
......
......@@ -67,7 +67,7 @@ public class PhraseEditor extends BasePhrasePreferences {
super.onPause();
((PhraseEditorFragment) getFragmentManager()
.findFragmentById(R.id.preferences_activity_container)).saveChanges();
.findFragmentById(R.id.fragment_container)).saveChanges();
}
private Integer getPhraseIndex(Intent intent) {
......
......@@ -40,7 +40,7 @@ public class PreferenceEditor extends ManagedActivity
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
setSupportActionBar(toolbar);
barPainter = new BarPainter(this, toolbar);
......@@ -48,7 +48,7 @@ public class PreferenceEditor extends ManagedActivity
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new PreferencesFragment()).commit();
.add(R.id.fragment_container, new PreferencesFragment()).commit();
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......
......@@ -16,7 +16,7 @@ public class SecuritySettings extends ManagedActivity {
if (isFinishing())
return;
setContentView(R.layout.activity_preferences);
setContentView(R.layout.activity_with_toolbar_and_container);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
......@@ -31,7 +31,7 @@ public class SecuritySettings extends ManagedActivity {
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.preferences_activity_container, new SecuritySettingsFragment()).commit();
.add(R.id.fragment_container, new SecuritySettingsFragment()).commit();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/toolbar_default"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:id="@+id/toolbar_default"
/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_default"
>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:orientation="vertical">
<include layout="@layout/toolbar_default"/>
<include layout="@layout/toolbar_default" />
<RelativeLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/preferences_activity_container"
/>
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="@layout/toolbar_default"/>
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
>
android:layout_below="@+id/toolbar_default"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:text="@string/contact_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:text="@string/contact_account" />
<com.xabber.android.ui.widget.NoDefaultSpinner
android:id="@+id/contact_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/choose_account"
/>
android:prompt="@string/choose_account" />
<TextView
android:text="@string/muc_server"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:text="@string/muc_server" />
<EditText
android:id="@+id/muc_server"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/muc_server_hint"
android:singleLine="true"
android:inputType="textEmailAddress"
/>
android:singleLine="true" />
<TextView
android:text="@string/muc_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:text="@string/muc_room" />
<EditText
android:id="@+id/muc_room"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
android:singleLine="true" />
<TextView
android:text="@string/muc_nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:text="@string/muc_nick" />
<EditText
android:id="@+id/muc_nick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/muc_nick_hint"
/>
android:singleLine="true" />
<TextView
android:text="@string/muc_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:text="@string/muc_password" />
<EditText
android:id="@+id/muc_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true"
android:hint="@string/muc_password_hint"
/>
android:inputType="textPassword"
android:singleLine="true" />
<CheckBox
android:id="@+id/muc_join"
android:checked="true"
android:text="@string/muc_join"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:checked="true"
android:text="@string/muc_join" />
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/toolbar_default"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:id="@+id/toolbar_default"
/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_default"
>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/toolbar_default"
android:id="@+id/toolbar_default"
/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_default"
>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment