示例#1
0
 public override void OnAttach(Activity activity)
 {
     base.OnAttach(activity);
     contactPicture = SvgUtils.GetBitmapFromSvgRes(activity.Resources,
                                                   Resource.Drawable.ic_contact_picture,
                                                   80.ToPixels (),
                                                   80.ToPixels ());
 }
示例#2
0
        public ActivityItemAdapter(Activity activity)
        {
            this.activity  = activity;
            this.cache     = BitmapCache.CreateCache(activity, "MapCache");
            this.faceCache = BitmapCache.CreateCache(activity, "FaceCache");

            var display = activity.WindowManager.DefaultDisplay;
            var point   = new Point();

            display.GetSize(point);
            this.mapWidth = point.X;

            NoFacePicture = SvgUtils.GetBitmapFromSvgRes(activity.Resources,
                                                         Resource.Drawable.ic_contact_picture,
                                                         64.ToPixels (),
                                                         64.ToPixels ());
            NoFaceDrawable = new VignetteDrawable(NoFacePicture, withEffect: false);
            NoMapPicture   = PrepareNoMapPicture(Resource.Drawable.gmaps);
        }
示例#3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.ParticipantSelectionLayout, container, false);

            view.FindViewById <LinearLayout> (Resource.Id.animatedLayout).LayoutTransition = new Android.Animation.LayoutTransition();

            selfFace              = view.FindViewById <ImageView> (Resource.Id.selfFace);
            otherFace             = view.FindViewById <ImageView> (Resource.Id.otherFace);
            faceLayout            = view.FindViewById <LinearLayout> (Resource.Id.userFacesLayout);
            selfFaceLayout        = view.FindViewById <FrameLayout> (Resource.Id.selfFaceLayout);
            otherFaceLayout       = view.FindViewById <FrameLayout> (Resource.Id.otherFaceLayout);
            selfFaceLayout.Drag  += HandleDrag;
            otherFaceLayout.Drag += HandleDrag;
            arrowWay              = view.FindViewById <Arrow> (Resource.Id.arrowWay);
            statsSpinner          = view.FindViewById <ProgressBar> (Resource.Id.StatsLoadSpinner);
            whatEntry             = view.FindViewById <LinearLayout> (Resource.Id.whatEntry);
            whatLayout            = view.FindViewById <LinearLayout> (Resource.Id.whatLayout);

            userDropZone = view.FindViewById <LinearLayout> (Resource.Id.whoLayout);

            var inset = view.FindViewById <InsetTextView> (Resource.Id.testInset);

            inset.Text   = "Drag Us";
            karmaBar     = view.FindViewById <KarmaMeter> (Resource.Id.karmaBar);
            flashBarCtrl = new FlashBarController(view.FindViewById(Resource.Id.flashbar));

            Task.Factory.StartNew(() => {
                var contactData = ContactsContract.Profile.ContentUri;
                var stream      = ContactsContract.Contacts.OpenContactPhotoInputStream(Activity.ContentResolver,
                                                                                        contactData,
                                                                                        false);
                if (stream != null)
                {
                    var options = new BitmapFactory.Options {
                        InPreferQualityOverSpeed = true,
                        InPreferredConfig        = Bitmap.Config.Argb8888,
                    };
                    var bmp = BitmapFactory.DecodeStream(stream, null, options);
                    Activity.RunOnUiThread(() => selfFace.SetImageBitmap(bmp));
                }
            });

            userBadge = (TapUserBadge)FragmentManager.FindFragmentById(Resource.Id.userBadge);
            CategoryBadge.StartDragValidate = () => userBadge.SelectedUser != null;
            userBadge.SelectedUserChanged  += HandleSelectedUserChanged;

            categoryPlaceholder = view.FindViewById <LinearLayout> (Resource.Id.categoryPlaceholder);
            TabTypes.GetTabTypes().ContinueWith(types => {
                var badges = types.Result
                             .Select(t => Tuple.Create(t, SvgUtils.GetBitmapFromSvgString(t.SvgImage,
                                                                                          40.ToPixels (),
                                                                                          40.ToPixels ())))
                             .ToArray();
                Activity.RunOnUiThread(() => AddTabTypeBadges(badges, inflater));
            });

            if (lastSelectedUser != null)
            {
                userBadge.RestoreSelectedUserInfo(lastSelectedUser);
            }

            return(view);
        }