Ejemplo n.º 1
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            //What to do with gallery image...

            base.OnActivityResult (requestCode, resultCode, data);

            if (resultCode == Result.Ok) {

                Uri selectedImageURI = data.Data;

                //get image filepath
                String result;
                var cursor = ContentResolver.Query (selectedImageURI, null, null, null, null);
                if (cursor == null) {
                    result = selectedImageURI.Path;
                } else {
                    cursor.MoveToFirst ();
                    int idx = cursor.GetColumnIndex (MediaStore.Images.ImageColumns.Data);
                    result = cursor.GetString (idx);
                    cursor.Close ();
                }

                Toast.MakeText(this, result, ToastLength.Long).Show();

                //next, launch a dialog
                var transaction = FragmentManager.BeginTransaction ();

                Bundle args = new Bundle();
                args.PutString ("filepath", result);
                args.PutString ("authToken", authToken);

                CreatePostDialog cpd = new CreatePostDialog();
                cpd.Arguments = args;

                cpd.Show (transaction, "dialog_fragment");

            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.EventPageLayout);
            eventName = Intent.GetStringExtra ("eventName");
            locationName = Intent.GetStringExtra ("location");
            address = Intent.GetStringExtra ("address");
            startDate = Intent.GetStringExtra ("startDate");
            eventID = Intent.GetLongExtra("eventID",0);

            authToken = CurrentAccount.authToken;

            TextView date = (TextView)FindViewById (Resource.Id.eventPageEventDate);
            date.Text = startDate;
            TextView location = (TextView) FindViewById (Resource.Id.eventPageEventLocation);
            location.Text = locationName;
            TextView name = (TextView)FindViewById (Resource.Id.eventPageEventName);
            name.Text = eventName;

            this.ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
            ActionBar.SetDisplayShowHomeEnabled(false);
            ActionBar.SetDisplayShowTitleEnabled(false);

            var openMapButton = FindViewById<ImageButton> (Resource.Id.eventPageMapIcon);
            openMapButton.Click += (sender, e) => {
                var geoUri = Android.Net.Uri.Parse ("geo:0,0?q="+address);
                var mapIntent = new Intent (Intent.ActionView, geoUri);
                StartActivity (mapIntent);
            };

            /*
            Button openGalleryButton = FindViewById<Button> (Resource.Id.eventPagePostImageButton);
            openGalleryButton.Click += (sender, e) => {
                var imageIntent = new Intent ();
                imageIntent.SetType ("image/*");
                imageIntent.SetAction (Intent.ActionGetContent);
                StartActivityForResult (Intent.CreateChooser (imageIntent, "Select photo"), 0);
            };
            */

            Button commentButton = FindViewById<Button> (Resource.Id.eventPagePostCommentButton);
            commentButton.Click += (sender, e) => {
                var transaction = FragmentManager.BeginTransaction ();
                CreatePostDialog cpd = new CreatePostDialog();
                cpd.Show (transaction, "dialog_fragment");
            };

            new FetchEventTask(this, authToken, eventID).Execute("fetch event");

            /*
            ListView mediaList = (ListView)FindViewById (Resource.Id.eventPageMediaList);

            List<Shoutout> posts = new List<Shoutout> ();
            //fetchPosts (posts);
            var eventShoutouts = thisEvent.Shoutouts;

            mediaList.Adapter = new EventPageAdapter(this, (List<Shoutout>)posts);
            */
        }