Search in sources :

Example 11 with UserDetailsView

use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.

the class ParticipantHeaderFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_participants_header, container, false);
    toolbar = ViewUtils.getView(rootView, R.id.t__participants__toolbar);
    membersCountTextView = ViewUtils.getView(rootView, R.id.ttv__participants__sub_header);
    userDetailsView = ViewUtils.getView(rootView, R.id.udv__participants__user_details);
    headerReadOnlyTextView = ViewUtils.getView(rootView, R.id.ttv__participants__header);
    headerEditText = ViewUtils.getView(rootView, R.id.taet__participants__header__editable);
    bottomBorder = ViewUtils.getView(rootView, R.id.v_participants__header__bottom_border);
    shieldView = ViewUtils.getView(rootView, R.id.sv__otr__verified_shield);
    shieldView.setVisibility(View.GONE);
    penIcon = ViewUtils.getView(rootView, R.id.gtv__participants_header__pen_icon);
    penIcon.setVisibility(View.GONE);
    membersCountTextView.setVisibility(View.GONE);
    userDetailsView.setVisibility(View.GONE);
    headerEditText.setOnTouchListener(headerOnTouchListener);
    headerEditText.setOnEditorActionListener(editorActionListener);
    // Hide bottom border initially
    bottomBorder.setVisibility(View.GONE);
    if (LayoutSpec.isTablet(getContext())) {
        toolbar.setNavigationIcon(null);
        toolbar.setContentInsetsAbsolute(toolbar.getContentInsetEnd(), getResources().getDimensionPixelSize(R.dimen.content__padding_left));
    } else {
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (userRequester == IConnectStore.UserRequester.POPOVER) {
                    getContainer().dismissDialog();
                } else {
                    getControllerFactory().getConversationScreenController().hideParticipants(true, false);
                }
            }
        });
    }
    return rootView;
}
Also used : ShieldView(com.waz.zclient.ui.views.e2ee.ShieldView) View(android.view.View) UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) TextView(android.widget.TextView)

Example 12 with UserDetailsView

use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.

the class UserDetailsViewTest method assertAddressBookNameThatIsSameThanWireNameIsShown.

@Test
public void assertAddressBookNameThatIsSameThanWireNameIsShown() {
    User mockUser = MockHelper.createMockUser("Anna", "123");
    ContactDetails mockContactDetails = mock(ContactDetails.class);
    String addressBookName = "Anna";
    when(mockContactDetails.getDisplayName()).thenReturn(addressBookName);
    when(mockUser.getFirstContact()).thenReturn(mockContactDetails);
    UserDetailsView userDetailsView = new UserDetailsView(activity);
    userDetailsView.setUser(mockUser);
    setView(userDetailsView);
    final String addressBookInfo = activity.getString(com.waz.zclient.ui.R.string.content__message__connect_request__user_info, "");
    onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
    onView(withId(R.id.ttv__user_details__user_info)).check(hasText(addressBookInfo));
}
Also used : UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) User(com.waz.api.User) ContactDetails(com.waz.api.ContactDetails) Test(org.junit.Test) ViewTest(com.waz.zclient.testutils.ViewTest)

Example 13 with UserDetailsView

use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.

the class UserDetailsViewTest method assertAddressBookNameThatIsDifferentThanWireNameIsShown.

@Test
public void assertAddressBookNameThatIsDifferentThanWireNameIsShown() {
    User mockUser = MockHelper.createMockUser("Anna", "123");
    ContactDetails mockContactDetails = mock(ContactDetails.class);
    String addressBookName = "Mom";
    when(mockContactDetails.getDisplayName()).thenReturn(addressBookName);
    when(mockUser.getFirstContact()).thenReturn(mockContactDetails);
    UserDetailsView userDetailsView = new UserDetailsView(activity);
    userDetailsView.setUser(mockUser);
    setView(userDetailsView);
    final String addressBookInfo = activity.getString(com.waz.zclient.ui.R.string.content__message__connect_request__user_info, addressBookName);
    onView(withId(R.id.ttv__user_details__user_info)).check(isVisible());
    onView(withId(R.id.ttv__user_details__user_info)).check(hasText(addressBookInfo));
}
Also used : UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) User(com.waz.api.User) ContactDetails(com.waz.api.ContactDetails) Test(org.junit.Test) ViewTest(com.waz.zclient.testutils.ViewTest)

Example 14 with UserDetailsView

use of com.waz.zclient.ui.views.UserDetailsView in project wire-android by wireapp.

the class SendConnectRequestFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup viewContainer, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_send_connect_request, viewContainer, false);
    if (savedInstanceState == null) {
        userId = getArguments().getString(ARGUMENT_USER_ID);
        userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
    } else {
        userId = savedInstanceState.getString(ARGUMENT_USER_ID);
        userRequester = IConnectStore.UserRequester.valueOf(savedInstanceState.getString(ARGUMENT_USER_REQUESTER));
    }
    Toolbar toolbar = ViewUtils.getView(rootView, R.id.t__send_connect__toolbar);
    displayNameTextView = ViewUtils.getView(rootView, R.id.tv__send_connect__toolbar__title);
    userDetailsView = ViewUtils.getView(rootView, R.id.udv__send_connect__user_details);
    connectButton = ViewUtils.getView(rootView, R.id.zb__send_connect_request__connect_button);
    footerMenu = ViewUtils.getView(rootView, R.id.fm__footer);
    imageAssetImageViewProfile = ViewUtils.getView(rootView, R.id.iaiv__send_connect);
    imageAssetImageViewProfile.setDisplayType(ImageAssetImageView.DisplayType.CIRCLE);
    imageAssetImageViewProfile.setSaturation(0);
    View backgroundContainer = ViewUtils.getView(rootView, R.id.fl__send_connect_request__background_container);
    backgroundContainer.setClickable(true);
    if (userRequester == IConnectStore.UserRequester.PARTICIPANTS && getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.AVATAR && getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.COMMON_USER) {
        backgroundContainer.setBackgroundColor(Color.TRANSPARENT);
    }
    connectButton.setText(getResources().getString(R.string.send_connect_request__connect_button__text));
    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();
        }
    });
    footerMenu.setVisibility(View.GONE);
    return rootView;
}
Also used : ImageAssetImageView(com.waz.zclient.views.images.ImageAssetImageView) View(android.view.View) UserDetailsView(com.waz.zclient.ui.views.UserDetailsView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

UserDetailsView (com.waz.zclient.ui.views.UserDetailsView)14 User (com.waz.api.User)8 ViewTest (com.waz.zclient.testutils.ViewTest)8 Test (org.junit.Test)8 View (android.view.View)6 TextView (android.widget.TextView)6 ImageAssetImageView (com.waz.zclient.views.images.ImageAssetImageView)5 Toolbar (android.support.v7.widget.Toolbar)3 ContactDetails (com.waz.api.ContactDetails)3 ShieldView (com.waz.zclient.ui.views.e2ee.ShieldView)2 Bundle (android.os.Bundle)1 IConnectStore (com.waz.zclient.core.stores.connect.IConnectStore)1