Commit cf537c65 authored by Grigory Fedorov's avatar Grigory Fedorov

ContactAddFragment: part of views are not shown until account selected.

parent d2aef422
...@@ -31,7 +31,7 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi ...@@ -31,7 +31,7 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi
private Spinner accountView; private Spinner accountView;
private EditText userView; private EditText userView;
private EditText nameView; private EditText nameView;
private View selectGroupsView; private View accountSpecificPanel;
Listener listenerActivity; Listener listenerActivity;
...@@ -66,10 +66,9 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi ...@@ -66,10 +66,9 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi
userView = (EditText) headerView.findViewById(R.id.contact_user); userView = (EditText) headerView.findViewById(R.id.contact_user);
nameView = (EditText) headerView.findViewById(R.id.contact_name); nameView = (EditText) headerView.findViewById(R.id.contact_name);
selectGroupsView = headerView.findViewById(R.id.select_groups_text_view); accountSpecificPanel = headerView.findViewById(R.id.account_specific_panel);
selectGroupsView.setVisibility(View.GONE); hideAdditionalInputs();
getFooterView().setVisibility(View.GONE);
String name; String name;
...@@ -110,6 +109,11 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi ...@@ -110,6 +109,11 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi
} }
private void hideAdditionalInputs() {
accountSpecificPanel.setVisibility(View.GONE);
getFooterView().setVisibility(View.GONE);
}
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
...@@ -140,15 +144,18 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi ...@@ -140,15 +144,18 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi
setAccountGroups(); setAccountGroups();
updateGroups(); updateGroups();
} }
getFooterView().setVisibility(View.VISIBLE); setAdditionalPanelVisibility(View.VISIBLE);
selectGroupsView.setVisibility(View.VISIBLE);
} }
} }
private void setAdditionalPanelVisibility(int visible) {
getFooterView().setVisibility(visible);
accountSpecificPanel.setVisibility(visible);
}
@Override @Override
public void onNothingSelected(AdapterView<?> parent) { public void onNothingSelected(AdapterView<?> parent) {
getFooterView().setVisibility(View.GONE); setAdditionalPanelVisibility(View.GONE);
selectGroupsView.setVisibility(View.GONE);
} }
public void addContact() { public void addContact() {
...@@ -178,6 +185,6 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi ...@@ -178,6 +185,6 @@ public class ContactAddFragment extends GroupEditorFragment implements AdapterVi
} }
public interface Listener { public interface Listener {
public void onAccountSelected(String account); void onAccountSelected(String account);
} }
} }
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
<com.xabber.android.ui.widget.NoDefaultSpinner <com.xabber.android.ui.widget.NoDefaultSpinner
android:id="@+id/contact_account" android:id="@+id/contact_account"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -34,39 +35,46 @@ ...@@ -34,39 +35,46 @@
android:prompt="@string/choose_account" android:prompt="@string/choose_account"
/> />
<TextView <LinearLayout
android:text="@string/contact_user" android:id="@+id/account_specific_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:text=""
android:id="@+id/contact_user"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="user@domain.name" android:orientation="vertical"
android:singleLine="true" >
android:inputType="textEmailAddress" <TextView
/> android:text="@string/contact_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:text=""
android:id="@+id/contact_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="user@domain.name"
android:singleLine="true"
android:inputType="textEmailAddress"
/>
<TextView <TextView
android:text="@string/contact_name" android:text="@string/contact_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
<EditText <EditText
android:text="" android:text=""
android:id="@+id/contact_name" android:id="@+id/contact_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
/> />
<TextView <TextView
android:id="@+id/select_groups_text_view" android:id="@+id/select_groups_text_view"
android:text="@string/contact_group" android:text="@string/contact_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> />
</LinearLayout>
</LinearLayout> </LinearLayout>
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