Commit fbc4513c authored by Grigory Fedorov's avatar Grigory Fedorov

ContactViewer: status icon removed from toolbar and shown for each resource.

parent 7d17df87
...@@ -18,6 +18,7 @@ import android.content.Context; ...@@ -18,6 +18,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import com.xabber.android.data.Application; import com.xabber.android.data.Application;
import com.xabber.android.data.LogManager; import com.xabber.android.data.LogManager;
...@@ -197,6 +198,7 @@ public class ContactViewer extends ManagedActivity implements ...@@ -197,6 +198,7 @@ public class ContactViewer extends ManagedActivity implements
AbstractContact bestContact = RosterManager.getInstance().getBestContact(account, bareAddress); AbstractContact bestContact = RosterManager.getInstance().getBestContact(account, bareAddress);
contactTitleExpandableToolbarInflater.onCreate(bestContact); contactTitleExpandableToolbarInflater.onCreate(bestContact);
findViewById(R.id.status_icon).setVisibility(View.GONE);
} }
@Override @Override
......
...@@ -105,14 +105,27 @@ public class ContactViewerFragment extends Fragment { ...@@ -105,14 +105,27 @@ public class ContactViewerFragment extends Fragment {
} }
} }
resourceItem.getStatusMode().getStatusLevel();
String label = String.valueOf(resourceItem.getPriority()); String label = String.valueOf(resourceItem.getPriority());
if (!client.isEmpty()) { if (!client.isEmpty()) {
label = label + ", " + client; label = label + ", " + client;
} }
addXmppItem(label, resourceItem.getVerbose(), R.drawable.ic_xmpp_24dp); LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View contactInfoItem = inflater.inflate(R.layout.contact_info_item, xmppItems, false);
((TextView)contactInfoItem.findViewById(R.id.contact_info_item_name)).setText(label);
((TextView)contactInfoItem.findViewById(R.id.contact_info_item_value)).setText(resourceItem.getVerbose());
((ImageView) contactInfoItem.findViewById(R.id.contact_info_group_icon)).setImageResource(R.drawable.ic_xmpp_24dp);
ImageView statusIcon = (ImageView) contactInfoItem.findViewById(R.id.contact_info_right_icon);
statusIcon.setVisibility(View.VISIBLE);
statusIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_status));
statusIcon.setImageLevel(resourceItem.getStatusMode().getStatusLevel());
xmppItems.addView(contactInfoItem);
} }
} }
......
...@@ -44,4 +44,15 @@ ...@@ -44,4 +44,15 @@
android:id="@+id/contact_info_item_name" /> android:id="@+id/contact_info_item_name" />
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/contact_info_right_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:visibility="gone"
/>
</RelativeLayout> </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