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