コード例 #1
0
 private void InitNavigationBar()
 {
     _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_new_nav_bar);
     _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.CancelCommand);
     _navigationBarView.SetTitle(ViewModel.LocalizedStrings.NewChat);
     _navigationBarView.SetBackground(Resource.Color.chat_content_color);
 }
コード例 #2
0
 private void InitNavigationBarView(View view)
 {
     _navigationBarView = view.FindViewById <NavigationBarView>(Resource.Id.dialog_select_members_nav_bar);
     _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, new RelayCommand(Close));
     _navigationBarView.SetRightButton(ViewModel.Resources.Done, ViewModel.DoneCommand);
     _navigationBarView.SetTitle(ViewModel.Title);
     _navigationBarView.SetBackground(StyleHelper.Style.ContentColor);
 }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OverridePendingTransition(0, 0);

            SetTheme(StyleHelper.Style.CommonActivityStyle);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_chat_details);

            _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_details_navigation_bar);
            _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand);
            _navigationBarView.SetTitle(ViewModel.LocalizedStrings.DetailsTitle);
            _navigationBarView.SetRightButton(ViewModel.LocalizedStrings.Save, new RelayCommand(OnSaveClick));
            _navigationBarView.RightTextButton.Visibility = ViewStates.Gone;

            _chatPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo);

            _chatEditedPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo_edited);

            _chatNameText     = FindViewById <TextView>(Resource.Id.activity_chat_details_chat_name);
            _chatNameEditText = FindViewById <EditText>(Resource.Id.activity_chat_details_chat_name_edit);

            _chatMembersCountTextView = FindViewById <TextView>(Resource.Id.tv_members_count);

            _addMemberContainer = FindViewById <LinearLayout>(Resource.Id.activity_chat_details_add_member_container);
            _addmemberImageView = FindViewById <ImageView>(Resource.Id.activity_chat_details_add_member_image);
            _addmemberImageView.SetImageResource(StyleHelper.Style.AddMemberIcon);
            _addMemberTextView      = FindViewById <TextView>(Resource.Id.activity_chat_details_add_member_text);
            _addMemberTextView.Text = ViewModel.LocalizedStrings.AddMembers;

            _membersRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_contacts_list);

            _changeChatPhotoButton = FindViewById <Button>(Resource.Id.b_chat_change_photo);
            _changeChatPhotoButton.SetCommand(new RelayCommand(OpenImagePicker));
            _changeChatPhotoButton.Text = ViewModel.LocalizedStrings.ChangePhoto;

            _muteNotificationsLabel      = FindViewById <TextView>(Resource.Id.activity_chat_details_mute_label);
            _muteNotificationsLabel.Text = ViewModel.LocalizedStrings.Notifications;
            _muteNotificationsSwitch     = FindViewById <SwitchCompat>(Resource.Id.activity_chat_details_mute_switch);
            _muteNotificationsSwitch.SetCommand(ViewModel.HeaderViewModel.ChangeMuteNotificationsCommand);

            InitializeMembersRecyclerView();

            // TODO YP: remove ServiceLocator
            _imagePicker = new ImagePicker(
                Dependencies.Container.Resolve <IPermissionsManager>(),
                Dependencies.Container.Resolve <IImagePickerService>())
            {
                MaxImageWidth = 300
            };

            _busyOverlayView = FindViewById <BusyOverlayView>(Resource.Id.activity_chat_details_busy_view);
        }
コード例 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OverridePendingTransition(0, 0);

            SetTheme(StyleHelper.Style.CommonActivityStyle);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_chat_create);

            _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_create_navigation_bar);
            _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand);
            _navigationBarView.SetTitle(ViewModel.LocalizedStrings.CreateGroup);
            _navigationBarView.SetRightButton(ViewModel.LocalizedStrings.Create, new RelayCommand(() =>
            {
                KeyboardService.HideSoftKeyboard(_chatNameEditTextView);

                ViewModel.SaveCommand.Execute(_imagePicker.GetStreamFunc());
            }));
            _navigationBarView.RightTextButton.SetBackgroundColor(Color.Transparent);

            _chatPhotoImageView       = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo);
            _chatEditedPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo_edited);
            _chatNameEditTextView     = FindViewById <EditText>(Resource.Id.et_chat_name);
            _contactsRecyclerView     = FindViewById <RecyclerView>(Resource.Id.rv_contacts_list);
            _membersCountTextView     = FindViewById <TextView>(Resource.Id.tv_members_count);
            _changeChatPhotoButton    = FindViewById <Button>(Resource.Id.b_chat_change_photo);
            _changeChatPhotoButton.SetCommand(new RelayCommand(ChangePhoto));
            _changeChatPhotoButton.Text = ViewModel.LocalizedStrings.ChangePhoto;

            InitializeContactsRecyclerView();

            _imagePicker = new ImagePicker(Dependencies.PermissionsManager, Dependencies.Container.Resolve <IImagePickerService>())
            {
                MaxImageWidth = 300
            };

            _chatPhotoImageView.SetImageResource(StyleHelper.Style.ChatGroupNoAvatarIcon);
            _chatEditedPhotoImageView.Visibility = ViewStates.Gone;

            _addMembers      = FindViewById <Button>(Resource.Id.activity_chat_create_add_member);
            _addMembers.Text = ViewModel.LocalizedStrings.AddMembers;
            _addMembers.SetCommand(ViewModel.AddMembersCommand);

            _chatNameEditTextView.Hint = ViewModel.LocalizedStrings.ChatName;

            _busyOverlayView = FindViewById <BusyOverlayView>(Resource.Id.activity_chat_create_busy_view);
        }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OverridePendingTransition(0, 0);

            SetTheme(StyleHelper.Style.CommonActivityStyle);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_chat_conversations);

            _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_conversations_navigation_bar);
            _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand);
            if (ViewModel.HasInfo)
            {
                _navigationBarView.SetRightButton(StyleHelper.Style.NavigationBarDetailsButtonIcon, ViewModel.ShowInfoCommand);
            }

            _conversationsRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_conversations_list);

            _scrollDownImageButton = FindViewById <ImageButton>(Resource.Id.ib_conversations_scroll_down);
            _scrollDownImageButton.SetImageResource(StyleHelper.Style.ScrollDownButtonIcon);

            _chatInputView = FindViewById <ChatInputView>(Resource.Id.ll_chat_input_view);

            InitializeConversationsRecyclerView();

            _contextMenuHandler = new ContextMenuHandler <ChatMessageViewModel>(itemViewModel =>
            {
                var commandActions = ViewModel.GetCommandActionsForMessage(itemViewModel);
                return(new ContextMenuComponent(commandActions));
            });

            _scrollDownImageButton.SetCommand(nameof(_scrollDownImageButton.Click), new RelayCommand(ScrollToBottom));

            ViewModel.MessageAddedCommand = new RelayCommand(ScrollToBottomIfNeeded);
        }