use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class UserDetailsViewTest method assertCommonUsersIsShownForPendingIncomingUserThatIsNotInAddressBook.
@Test
public void assertCommonUsersIsShownForPendingIncomingUserThatIsNotInAddressBook() {
User mockUser = MockHelper.createMockUser("Anna", "123");
when(mockUser.getConnectionStatus()).thenReturn(User.ConnectionStatus.PENDING_FROM_OTHER);
int commonUsersCount = 3;
when(mockUser.getCommonConnectionsCount()).thenReturn(commonUsersCount);
when(mockUser.getFirstContact()).thenReturn(null);
UserDetailsView userDetailsView = new UserDetailsView(activity);
userDetailsView.setUser(mockUser);
setView(userDetailsView);
final String commonUsersSummary = activity.getResources().getQuantityString(com.waz.zclient.ui.R.plurals.connect_request__common_users__summary, commonUsersCount, commonUsersCount);
onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
onView(withId(R.id.ttv__user_details__user_info)).check(hasText(commonUsersSummary));
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class PendingConnectRequestFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup viewContainer, Bundle savedInstanceState) {
if (savedInstanceState != null) {
userId = savedInstanceState.getString(ARGUMENT_USER_ID);
conversationId = savedInstanceState.getString(ARGUMENT_CONVERSATION_ID);
loadMode = ConnectRequestLoadMode.valueOf(savedInstanceState.getString(ARGUMENT_LOAD_MODE));
userRequester = IConnectStore.UserRequester.valueOf(savedInstanceState.getString(ARGUMENT_USER_REQUESTER));
isShowingFooterMenu = savedInstanceState.getBoolean(STATE_IS_SHOWING_FOOTER_MENU);
} else {
userId = getArguments().getString(ARGUMENT_USER_ID);
conversationId = getArguments().getString(ARGUMENT_CONVERSATION_ID);
loadMode = ConnectRequestLoadMode.valueOf(getArguments().getString(ARGUMENT_LOAD_MODE));
userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
isShowingFooterMenu = false;
}
View rootView = inflater.inflate(R.layout.fragment_connect_request_pending, viewContainer, false);
userDetailsView = ViewUtils.getView(rootView, R.id.udv__pending_connect__user_details);
unblockButton = ViewUtils.getView(rootView, R.id.zb__connect_request__unblock_button);
footerMenu = ViewUtils.getView(rootView, R.id.fm__footer);
toolbar = ViewUtils.getView(rootView, R.id.t__pending_connect__toolbar);
displayNameTextView = ViewUtils.getView(rootView, R.id.tv__pending_connect_toolbar__title);
imageAssetImageViewProfile = ViewUtils.getView(rootView, R.id.iaiv__pending_connect);
imageAssetImageViewProfile.setDisplayType(ImageAssetImageView.DisplayType.CIRCLE);
imageAssetImageViewProfile.setSaturation(0);
updateToolbarNavigationIcon();
if (userRequester == IConnectStore.UserRequester.PARTICIPANTS) {
toolbar.setBackground(null);
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch(userRequester) {
case CONVERSATION:
if (LayoutSpec.isTablet(getContext()) && ViewUtils.isInLandscape(getContext())) {
return;
}
getActivity().onBackPressed();
KeyboardUtils.closeKeyboardIfShown(getActivity());
break;
default:
getContainer().dismissUserProfile();
break;
}
}
});
View backgroundContainer = ViewUtils.getView(rootView, R.id.ll__pending_connect__background_container);
if (getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.AVATAR || getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.COMMON_USER) {
backgroundContainer.setClickable(true);
} else {
backgroundContainer.setBackgroundColor(Color.TRANSPARENT);
}
// Hide views until connection status of user is determined
footerMenu.setVisibility(View.GONE);
unblockButton.setVisibility(View.GONE);
return rootView;
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class ConnectRequestInboxRow method init.
private void init() {
View container = LayoutInflater.from(getContext()).inflate(R.layout.fragment_connect_request_pending_inbox, this, true);
ignoreButton = ViewUtils.getView(container, R.id.zb__connect_request__ignore_button);
acceptButton = ViewUtils.getView(container, R.id.zb__connect_request__accept_button);
displayNameTextView = ViewUtils.getView(container, R.id.ttv__connect_request__display_name);
userDetailsView = ViewUtils.getView(container, R.id.udv__connect_request__user_details);
acceptMenu = ViewUtils.getView(container, R.id.ll__connect_request__accept_menu);
if (LayoutSpec.isTablet(getContext())) {
View mainContainerView = ViewUtils.getView(container, R.id.ll__connect_request__main_container);
ViewUtils.setWidth(mainContainerView, getResources().getDimensionPixelSize(R.dimen.connect_request__inbox__max_width));
}
imageAssetImageViewProfile = ViewUtils.getView(container, R.id.iaiv__pending_connect);
if (imageAssetImageViewProfile != null) {
imageAssetImageViewProfile.setDisplayType(ImageAssetImageView.DisplayType.CIRCLE);
}
// Hide accept menu, check later when user loaded
acceptMenu.setVisibility(View.GONE);
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class BlockedUserProfileFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup viewContainer, Bundle savedInstanceState) {
if (savedInstanceState != null) {
userId = savedInstanceState.getString(ARGUMENT_USER_ID);
userRequester = IConnectStore.UserRequester.valueOf(savedInstanceState.getString(ARGUMENT_USER_REQUESTER));
isShowingFooterMenu = savedInstanceState.getBoolean(STATE_IS_SHOWING_FOOTER_MENU);
} else {
userId = getArguments().getString(ARGUMENT_USER_ID);
userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
isShowingFooterMenu = true;
}
View view = inflater.inflate(R.layout.fragment_blocked_user_profile, viewContainer, false);
unblockButton = ViewUtils.getView(view, R.id.zb__connect_request__unblock_button);
cancelButton = ViewUtils.getView(view, R.id.zb__connect_request__ignore_button);
smallUnblockButton = ViewUtils.getView(view, R.id.zb__connect_request__accept_button);
Toolbar toolbar = ViewUtils.getView(view, R.id.t__blocked_user__toolbar);
nameTextView = ViewUtils.getView(view, R.id.tv__blocked_user__toolbar__title);
userDetailsView = ViewUtils.getView(view, R.id.udv__blocked_user__user_details);
footerMenu = ViewUtils.getView(view, R.id.fm__footer);
unblockMenu = ViewUtils.getView(view, R.id.ll__connect_request__accept_menu);
separatorLine = ViewUtils.getView(view, R.id.v__connect_request__separator_line);
imageAssetImageViewProfile = ViewUtils.getView(view, R.id.iaiv__blocked_user);
imageAssetImageViewProfile.setDisplayType(ImageAssetImageView.DisplayType.CIRCLE);
if (ThemeUtils.isDarkTheme(getContext())) {
toolbar.setNavigationIcon(R.drawable.action_back_light);
} else {
toolbar.setNavigationIcon(R.drawable.action_back_dark);
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getContainer().dismissUserProfile();
}
});
// Split Unblock / Cancel menu when opened from group conversation
cancelButton.setText(getString(R.string.confirmation_menu__cancel));
smallUnblockButton.setText(getString(R.string.connect_request__unblock__button__text));
// Hide some views irrelevant for blocking
footerMenu.setVisibility(View.GONE);
unblockButton.setVisibility(View.GONE);
separatorLine.setVisibility(View.GONE);
unblockButton.setVisibility(View.GONE);
View backgroundContainer = ViewUtils.getView(view, R.id.fl__blocked_user__background_container);
if ((LayoutSpec.isPhone(getActivity()) && getControllerFactory().getNavigationController().getPagerPosition() == NavigationController.FIRST_PAGE) || (getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.AVATAR || getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.COMMON_USER)) {
backgroundContainer.setClickable(true);
} else {
backgroundContainer.setBackgroundColor(Color.TRANSPARENT);
}
return view;
}
use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.
the class SingleParticipantFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_participants_single, viewGroup, false);
Toolbar toolbar = ViewUtils.getView(view, R.id.t__single_participant__toolbar);
shieldView = ViewUtils.getView(view, R.id.sv__otr__verified_shield);
shieldView.setVisibility(View.GONE);
Bundle args = getArguments();
IConnectStore.UserRequester requester = null;
if (args != null) {
requester = (IConnectStore.UserRequester) args.getSerializable(ARGUMENT_USER_REQUESTER);
}
header = ViewUtils.getView(view, R.id.tv__single_participant__toolbar__title);
userDetailsView = ViewUtils.getView(view, R.id.udv__single_participant__user_details);
footerMenu = ViewUtils.getView(view, R.id.upm__footer);
imageAssetImageViewProfile = ViewUtils.getView(view, R.id.iaiv__single_participant);
imageAssetImageViewProfile.setDisplayType(ImageAssetImageView.DisplayType.CIRCLE);
if (requester == IConnectStore.UserRequester.PARTICIPANTS) {
footerMenu.setVisibility(View.GONE);
imageAssetImageViewProfile.setVisibility(View.GONE);
getChildFragmentManager().beginTransaction().add(R.id.fl__participant__tab__container, TabbedParticipantBodyFragment.newInstance(TabbedParticipantBodyFragment.USER_PAGE), TabbedParticipantBodyFragment.TAG).commit();
// Posting so that we can get height after onMeasure has been called
view.post(new Runnable() {
@Override
public void run() {
View header = ViewUtils.getView(view, R.id.ll__single_participant__header_container);
View tabContainer = ViewUtils.getView(view, R.id.fl__participant__tab__container);
if (header == null || tabContainer == null) {
return;
}
int height = header.getHeight();
tabContainer.setPadding(0, height, 0, 0);
}
});
}
View backgroundContainer = ViewUtils.getView(view, R.id.fl__send_connect_request__background_container);
if ((LayoutSpec.isPhone(getActivity()) && getControllerFactory().getNavigationController().getPagerPosition() == NavigationController.FIRST_PAGE) || (getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.AVATAR || getControllerFactory().getConversationScreenController().getPopoverLaunchMode() == DialogLaunchMode.COMMON_USER)) {
backgroundContainer.setClickable(true);
} else {
backgroundContainer.setBackgroundColor(Color.TRANSPARENT);
}
if (ThemeUtils.isDarkTheme(getContext())) {
toolbar.setNavigationIcon(R.drawable.action_back_light);
} else {
toolbar.setNavigationIcon(R.drawable.action_back_dark);
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getContainer().dismissSingleUserProfile();
}
});
// Hide footer until user is loaded
footerMenu.setVisibility(View.GONE);
if (savedInstanceState == null) {
otherUserProfileScreenWasTracked = false;
} else {
otherUserProfileScreenWasTracked = savedInstanceState.getBoolean(SAVE_STATE_OTHER_USER_PROFILE_SCREEN_WAS_TRACKED);
}
return view;
}
Aggregations