Commit 2627a460 authored by Grigory Fedorov's avatar Grigory Fedorov

ContactViewerFragment: edit text contact name in toolbar removed and replaced by simple text view.

parent f9d4c9a2
......@@ -17,6 +17,7 @@ import com.xabber.android.data.Application;
import com.xabber.android.data.NetworkException;
import com.xabber.android.data.extension.capability.CapabilitiesManager;
import com.xabber.android.data.extension.capability.ClientInfo;
import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.PresenceManager;
import com.xabber.android.data.roster.ResourceItem;
import com.xabber.android.data.roster.RosterContact;
......@@ -43,7 +44,7 @@ public class ContactViewerFragment extends Fragment {
String account;
String bareAddress;
private EditText contactNameEditText;
private TextView contactNameView;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -64,25 +65,11 @@ public class ContactViewerFragment extends Fragment {
contactTitleView.findViewById(R.id.status_icon).setVisibility(View.GONE);
contactTitleView.findViewById(R.id.status_text).setVisibility(View.GONE);
contactTitleView.findViewById(R.id.name).setVisibility(View.GONE);
contactNameEditText = (EditText) contactTitleView.findViewById(R.id.contact_name_edit);
contactNameEditText.setVisibility(View.VISIBLE);
contactNameView = (TextView) contactTitleView.findViewById(R.id.name);
return view;
}
@Override
public void onPause() {
super.onPause();
try {
String name = contactNameEditText.getText().toString();
RosterManager.getInstance().setName(account, bareAddress, name);
} catch (NetworkException e) {
Application.getInstance().onError(e);
}
}
/**
* @param source
* @param value
......@@ -101,6 +88,8 @@ public class ContactViewerFragment extends Fragment {
this.account = account;
this.bareAddress = bareAddress;
contactNameView.setText(RosterManager.getInstance().getBestContact(account, bareAddress).getName());
xmppItems.removeAllViews();
View jabberIdView = createItemView(xmppItems,
......@@ -110,15 +99,6 @@ public class ContactViewerFragment extends Fragment {
xmppItems.addView(jabberIdView);
}
RosterContact rosterContact = RosterManager.getInstance().getRosterContact(account, bareAddress);
if (rosterContact == null || !rosterContact.isConnected()) {
contactNameEditText.setText(bareAddress);
return;
}
contactNameEditText.setText(rosterContact.getName());
List<View> resourcesList = new ArrayList<>();
for (ResourceItem resourceItem
......
......@@ -72,20 +72,6 @@
android:textSize="18sp"
android:textStyle="bold" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:textColor="@color/primary_text_default_material_dark"
android:text="Name"
android:singleLine="true"
android:ems="10"
android:id="@+id/contact_name_edit"
android:gravity="center_vertical"
android:visibility="gone"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
/>
<TextView
android:id="@+id/status_text"
android:layout_width="wrap_content"
......
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