public override async void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            Bitmap result = ChadderImagePicker.OnPickImageResult(requestCode, resultCode, data, Activity);

            if (result != null)
            {
                result = await CropImageFragment.CropImage(Activity as BaseActionBarActivity, result);

                await ChadderUI.ChangePicture(result.CompressToJPEG());
            }
        }
Пример #2
0
        public override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            try
            {
                var image = ChadderImagePicker.OnPickImageResult(requestCode, resultCode, data, Activity);
                if (image != null)
                {
                    image.DefaultResize();
                    ChadderUI.SendPicture(image.CompressToJPEG(), _conversation);
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(Activity, e.Message, ToastLength.Long).Show();
                Insight.Report(e);
                Console.WriteLine(e);
            }
        }
Пример #3
0
        private void SetupButtonClicks()
        {
            _btnSend        = _view.FindViewById <Button>(Resource.Id.chat_btn_send);
            _btnSend.Click += (object sender, EventArgs e) =>
            {
                if (ChadderUI.SendMessage(_editText.Text, _conversation))
                {
                    _editText.Text = "";
                }
            };

            var chadderRed = Resources.GetColor(Resource.Color.chadderred);


            _btnCapture = _view.FindViewById <ImageButton>(Resource.Id.chat_btn_capture);
            _btnCapture.SetColorFilter(chadderRed, Android.Graphics.PorterDuff.Mode.SrcIn);
            _btnCapture.Click += (object sender, EventArgs e) =>
            {
                ChadderImagePicker.MultiSourcePick(this);
            };
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.profile_fragment, container, false);

            grid = view.FindViewById <GridView>(Resource.Id.profile_devices);

            _adapter = new DevicesAdapter(Activity, ChadderUI.Source.db.LocalUser.Devices);

            grid.Adapter    = _adapter;
            grid.ItemClick += grid_ItemClick;
            SetupMenu();

            _btnPicture        = view.FindViewById <ImageButton>(Resource.Id.profile_picture);
            _btnPicture.Click += (sender, e) =>
            {
                ChadderImagePicker.MultiSourcePick(this);
            };

            var btnName = view.FindViewById <Button>(Resource.Id.profile_name_btn);

            _tvName = view.FindViewById <TextView>(Resource.Id.profile_name_label);

            btnName.Click += async(object sender, EventArgs e) =>
                             await ChadderUI.ChangeName();

            var btnEmail = view.FindViewById <Button>(Resource.Id.profile_email_btn);

            _tvEmail = view.FindViewById <TextView>(Resource.Id.profile_email_label);

            btnEmail.Click += async(object sender, EventArgs e) =>
                              await ChadderUI.ChangeEmail();

            var btnPhone = view.FindViewById <Button>(Resource.Id.profile_phone_btn);

            _tvPhone        = view.FindViewById <TextView>(Resource.Id.profile_phone_label);
            btnPhone.Click += async(object sender, EventArgs e) =>
                              await ChadderUI.ChangePhone();

            var btnShareName = view.FindViewById <Button>(Resource.Id.profile_sharename_btn);

            _tvShareName = view.FindViewById <TextView>(Resource.Id.profile_sharename_label);

            btnShareName.Click += async(object sender, EventArgs e) =>
                                  await ChadderUI.ChangeShareName();

            var btnFacebook = view.FindViewById <Button>(Resource.Id.profile_facebook_btn);

            btnFacebook.Click += (object sender, EventArgs e) =>
                                 //++RegisterEndFragment.ShareFacebook(Activity, uiHelper);
                                 RegisterEndFragment.ShareFacebook(Activity);

            var btnDevicePassword = view.FindViewById <Button>(Resource.Id.profile_device_pwd_btn);

            btnDevicePassword.Click += async(object sender, EventArgs e) =>
                                       await ChadderUI.ChangeDevicePassword();

            var btnAccPassword = view.FindViewById <Button>(Resource.Id.profile_account_pwd_btn);

            btnAccPassword.Click += async(object sender, EventArgs e) =>
                                    await ChadderUI.ChangeAccountPassword();

            var btnLogout = view.FindViewById <Button>(Resource.Id.profile_logout_btn);

            btnLogout.Click += async(object sender, EventArgs e) =>
            {
                await ChadderUI.Logout();

                ChadderApp.UIHelper.Source_OnNotAuthorized();
            };

            view.FindViewById <Button>(Resource.Id.profile_scan_btn)
            .Click += (object sender, EventArgs e) => MainActivity.ScanFingerprint(Activity as MainActivity);

            _btnFingerprint        = view.FindViewById <Button>(Resource.Id.profile_fingerprint_btn);
            _btnFingerprint.Click += async(object sender, EventArgs e) =>
            {
                var layout = new RelativeLayout(Activity);

                var image = new ImageView(Activity);
                image.Focusable            = true;
                image.FocusableInTouchMode = true;
                image.SetScaleType(ImageView.ScaleType.FitCenter);
                image.SetBackgroundResource(Android.Resource.Color.White);
                layout.AddView(image, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent));

                var bottomText = new TextView(Activity);
                var param      = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
                param.SetMargins(20, 20, 20, 20);
                param.AddRule(LayoutRules.CenterHorizontal);
                param.AddRule(LayoutRules.AlignParentBottom);
                layout.AddView(bottomText, param);
                bottomText.Text = GetString(Resource.String.ProfileFingerprintBottomMessage);

                InputDialog.ShowProgressDialog(Activity);
                var writer = new ZXing.BarcodeWriter {
                    Format = ZXing.BarcodeFormat.QR_CODE
                };
                var qr = writer.Write(await ChadderUI.GetFingerprint());
                image.SetImageBitmap(qr);
                InputDialog.DismissProgressDialog();

                var wnd = new PopupWindow(layout, RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
                wnd.ShowAtLocation(View, GravityFlags.Center, 0, 0);
                image.Touch += (object s, Android.Views.View.TouchEventArgs e2) =>
                {
                    wnd.Dismiss();
                };
            };

            view.FindViewById <Button>(Resource.Id.Erase_All_Msgs_btn)
            .Click += async(object sender, EventArgs e) => await ChadderUI.DeleteAllMessages();

            view.FindViewById <Button>(Resource.Id.profile_contactbook_btn)
            //++.Click += async (s, e) => await ChadderUI.ToggleUploadContactBook();
            .Click        += (s, e) => { };
            _tvContactBook = view.FindViewById <TextView>(Resource.Id.profile_contactbook_label);

            return(view);
        }