コード例 #1
0
 public void OnClick(IDialogInterface dialog, int which)
 {
     try
     {
         if (which == 0)
         {
             Intent intent = new Intent(MediaStore.ActionImageCapture);
             BitmapHelper._file           = ImageToPath.GetOutputMediaFile(ImageToPath.UploadFileType.image);
             BitmapHelper.captureImageUri = Android.Net.Uri.FromFile(BitmapHelper._file);
             intent.PutExtra(MediaStore.ExtraOutput, BitmapHelper.captureImageUri);
             context.StartActivityForResult(intent, CAMERA_REQUEST);
         }
         else
         if (which == 1)
         {
             Intent pictureActionIntent = null;
             pictureActionIntent = new Intent(Intent.ActionPick, Android.Provider.MediaStore.Images.Media.ExternalContentUri);
             pictureActionIntent.PutExtra(Intent.ExtraLocalOnly, true);
             context.StartActivityForResult(pictureActionIntent, GALLERY_PICTURE);
         }
     }
     catch (Java.Lang.Exception ex)
     {
         new CrashReportAsync("dialogeItemClickListner", "OnClick", ex.Message + ex.StackTrace).Execute();
     }
 }
コード例 #2
0
 public override void OnStart()
 {
     base.OnStart();
     imageToPath = new ImageToPath();
     etBio       = rootView.FindViewById <EditText>(Resource.Id.etBio);
     userName    = rootView.FindViewById <EditText>(Resource.Id.etUserName);
     emailId     = rootView.FindViewById <EditText>(Resource.Id.etUserEmail);
     SetProfileInfo();
     drawerProfile_pic = (ImageView)Activity.FindViewById(Resource.Id.profile_pic);
     drawerUsername    = (TextView)Activity.FindViewById(Resource.Id.tvUsername);
 }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetContentView(Resource.Layout.AddEventPic);
                Toolbar toolbar = (Toolbar)FindViewById(Resource.Id.toolbar);
                SetSupportActionBar(toolbar);
                TextView toolbar_title = (TextView)this.FindViewById(Resource.Id.toolbar_title);
                SupportActionBar.Title = "";
                toolbar_title.Text     = "Post picture";

                if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
                {
                    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                    Window.SetStatusBarColor(new Android.Graphics.Color(Android.Support.V4.Content.ContextCompat.GetColor(this, Resource.Color.primaryDark)));
                }

                eventData = this.Intent.GetStringExtra("strCreateEvent") ?? null;
                if (eventData != null)
                {
                    imageToPath                    = new ImageToPath();
                    imgEventPic                    = FindViewById <ImageView>(Resource.Id.ivEventPic);
                    imgBack                        = FindViewById <ImageButton>(Resource.Id.ivAddEventPicBack);
                    imgCreateEvent                 = FindViewById <ImageButton>(Resource.Id.ivCreateEvent);
                    eventTag                       = FindViewById <EditText>(Resource.Id.etEventDescription);
                    btnUploadEventDefultPic        = FindViewById <Button>(Resource.Id.btnUploadEventDefultPic);
                    imgEventPic.Click             += ImgEventPic_Click;
                    btnUploadEventDefultPic.Click += ImgEventPic_Click;

                    imgCreateEvent.Click += ImgCreateEvent_Click;
                    imgBack.Click        += ImgBack_Click;
                    eventModel            = JsonConvert.DeserializeObject <EventModel>(eventData);

                    if (eventModel.EventID != 0)
                    {
                        fillEventPicData();
                    }
                }
                else
                {
                    this.Finish();
                }
            }
            catch (Java.Lang.Exception ex)
            {
                new CrashReportAsync("AddEventPic", "OnCreate", ex.Message + ex.StackTrace).Execute();
            }
        }