Пример #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.fragment_profile, null);
            imageLoader = new ImageLoader(Activity);
            view.FindViewById<TextView>(Resource.Id.profile_name).Text = "James Montemagno";
			view.FindViewById<TextView>(Resource.Id.profile_description).Text = "James Montemagno is a Developer Evangelist at Xamarin and Microsoft MVP. He has been a .NET developer for over a decade working in a wide range of industries and before joining Xamarin was a professional mobile developer on the Xamarin platform for over 4 years. He can be found on Twitter @JamesMontemagno and blogs regularly at  www.MotzCod.es";
			imageLoader.DisplayImage("https://pbs.twimg.com/profile_images/618564939523862528/TMHi-4M-.jpg", view.FindViewById<ImageView>(Resource.Id.profile_image), -1);

            view.FindViewById<ImageView>(Resource.Id.profile_image).Click += (sender, args) =>
                {
                    var builder = new NotificationCompat.Builder(Activity)
                    .SetSmallIcon(Resource.Drawable.ic_launcher)
                    .SetContentTitle("Click to go to friend details!")
                    .SetContentText("New Friend!!");
                            
                    var friendActivity = new Intent(Activity, typeof(FriendActivity));

                    PendingIntent pendingIntent = PendingIntent.GetActivity(Activity, 0, friendActivity, 0);
                  

                    builder.SetContentIntent(pendingIntent);
                    builder.SetAutoCancel(true);
                    var notificationManager = 
                        (NotificationManager) Activity.GetSystemService(Context.NotificationService);
                    notificationManager.Notify(0, builder.Build());
                };
            return view;
        }
Пример #2
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
           
						m_ImageLoader = new ImageLoader(this);

						
            _friends = Util.GenerateFriends();
            _friends.RemoveRange(0, _friends.Count - 2);
            var title = Intent.GetStringExtra("Title");
            var image = Intent.GetStringExtra("Image");

            title = string.IsNullOrWhiteSpace(title) ? "New Friend" : title;
            this.Title = title;

            if (string.IsNullOrWhiteSpace(image))
                image = _friends[0].Image;


            m_ImageLoader.DisplayImage(image, this.FindViewById<ImageView>(Resource.Id.friend_image), -1);
            this.FindViewById<TextView>(Resource.Id.friend_description).Text = title;

            var grid = FindViewById<GridView>(Resource.Id.grid);
            grid.Adapter = new MonkeyAdapter(this, _friends);
            grid.ItemClick += GridOnItemClick;

            //set title here
						SupportActionBar.Title = Title;
        }
Пример #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.fragment_profile, null);
            m_ImageLoader = new ImageLoader(Activity);
            view.FindViewById<TextView>(Resource.Id.profile_name).Text = "James Montemagno";
            view.FindViewById<TextView>(Resource.Id.profile_description).Text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.";
            m_ImageLoader.DisplayImage("https://lh6.googleusercontent.com/-cGOyhvv0Xb0/UQV41NcgFHI/AAAAAAAAKz4/MKYmmtSgajI/w140-h140-p/6b27f0ec682011e2bd9a22000a9f14ba_7.jpg", view.FindViewById<ImageView>(Resource.Id.profile_image), -1);

            view.FindViewById<ImageView>(Resource.Id.profile_image).Click += (sender, args) =>
                {
                    var builder = new NotificationCompat.Builder(Activity)
                    .SetSmallIcon(Resource.Drawable.ic_launcher)
                    .SetContentTitle("Click to go to friend details!")
                    .SetContentText("New Friend!!");
                            
                    var friendActivity = new Intent(Activity, typeof(FriendActivity));

                    PendingIntent pendingIntent = PendingIntent.GetActivity(Activity, 0, friendActivity, 0);
                  

                    builder.SetContentIntent(pendingIntent);
                    builder.SetAutoCancel(true);
                    var notificationManager = 
                        (NotificationManager) Activity.GetSystemService(Context.NotificationService);
                    notificationManager.Notify(0, builder.Build());
                };
            return view;
        }
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
       SetContentView(Resource.Layout.ImageLoader);
       // Create your application here
       friends = Util.GenerateFriends();
       imageLoader = new ImageLoader(this, 64, 40);
       ListAdapter = new ImageLoaderAdapter(this, imageLoader, friends);
 }
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            App.CurrentActivity = this;
            ViewModel = new QuestViewModel();
            SetContentView(Resource.Layout.quest);
            ViewModel.PropertyChanged += HandlePropertyChanged;
            imageLoader = new ImageLoader(this, 256, 5);
            beacon1 = FindViewById<ImageView>(Resource.Id.beacon1);
            beacon2 = FindViewById<ImageView>(Resource.Id.beacon2);
            beacon3 = FindViewById<ImageView>(Resource.Id.beacon3);
            beacons = new List<ImageView> { beacon1, beacon2, beacon3 };
            mainImage = FindViewById<ImageView>(Resource.Id.main_image);
            mainText = FindViewById<TextView>(Resource.Id.main_text);
            beaconNearby = FindViewById<TextView>(Resource.Id.text_beacons);
            progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
            buttonContinue = FindViewById<Button>(Resource.Id.button_continue);
            buttonContinue.Click += ButtonContinueClick;
            buttonContinue.Visibility = ViewStates.Gone;
            beaconManager = new BeaconManager(this);
            scanner = new ZXing.Mobile.MobileBarcodeScanner();

            beaconManager.Ranging += BeaconManagerRanging;
    

            beaconManager.EnteredRegion += (sender, args) => SetBeaconText(true);

            beaconManager.ExitedRegion += (sender, args) => SetBeaconText(false);

      
            beacon1.Visibility = beacon2.Visibility = beacon3.Visibility = ViewStates.Invisible;
            options.PossibleFormats = new List<ZXing.BarcodeFormat>()
            { 
                ZXing.BarcodeFormat.QR_CODE
            };

            ViewModel.LoadQuestCommand.Execute(null);

        }
Пример #6
0
 public MonkeyAdapter(Activity context, IEnumerable<FriendViewModel> friends)
 {
     this.context = context;
     this.friends = friends;
     ImageLoader = new ImageLoader(context, 128);
 }
 public MonkeyAdapter(Activity context, IEnumerable<Friend> friends)
 {
     m_Context = context;
     this.m_Friends = friends;
     ImageLoader = new ImageLoader(context);
 }
Пример #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            imageLoader = new ImageLoader (this);
            progressDialog = new ProgressDialog (this);
            progressDialog.Indeterminate = true;
            progressDialog.SetMessage ("Connecting");

            plusClient = new PlusClient.Builder(this, this, this).Build();

            googleLoginButton = FindViewById<SignInButton> (Resource.Id.sign_in_button);
            plusOneButton = FindViewById<PlusOneButton> (Resource.Id.plus_one_button);

            var logoutButton = FindViewById<Button> (Resource.Id.logout_button);
            logoutButton.Click += (sender, e) => {
                if(!plusClient.IsConnected || plusClient.IsConnecting)
                    return;

                plusClient.RevokeAccessAndDisconnect(this);
            };

            googleLoginButton.Click += (sender, e) => {
                if(plusClient.IsConnected || plusClient.IsConnecting)
                    return;

                progressDialog.Show();

                if (connectionResult == null) {
                    plusClient.Connect();
                }
                else{
                    ResolveLogin(connectionResult);
                }
            };

            plusClient.RegisterConnectionCallbacks (this);
            plusClient.IsConnectionFailedListenerRegistered (this);
        }