Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 private void OnSaveClick()
 {
     ViewModel.HeaderViewModel.SaveCommand.Execute(_imagePicker.GetStreamFunc());
 }