public BackgroundCheckRecyclerViewAdapter (List<BackgroundCheck> crewMembers, Resources resources)
		{
			_crewMembers = crewMembers;
			_imageManager = new ImageManager(resources);
		}
Exemplo n.º 2
0
 public ReportViewAdapter(List<Applicant> applicantReport, Resources resources)
 {
     _reportList = applicantReport;
     _imageManager = new ImageManager(resources);
 }
		protected override async void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			SetContentView(Resource.Layout.BackgroundCheck_Profile);

			_rank = FindViewById<TextView>(Resource.Id.crewMemberRankTextView);
			_name = FindViewById<TextView>(Resource.Id.crewMemberNameTextView);
			_position = FindViewById<TextView>(Resource.Id.crewMemberPositionTextView);
			_posting = FindViewById<TextView>(Resource.Id.crewMemberPostingTextView);
			_tenantScore = FindViewById<TextView>(Resource.Id.crewMemberTenantScoreTextView);
			_biogaphy = FindViewById<TextView>(Resource.Id.crewMemberBioTextView);
			_photo = FindViewById<ImageView>(Resource.Id.crewMemberImageView);



			var index = Intent.GetIntExtra("index", -1);
			if(index < 0)
			{
				return;
			}

			var imageResourceId = Intent.GetIntExtra("imageResourceId", -1);

			var crewMember = SharedData.CrewManifest[index];

			_rank.Text = crewMember.Rank;
			_name.Text = crewMember.Name;
			_position.Text = crewMember.Position;
			_posting.Text = crewMember.Posting;
			_tenantScore.Text = String.Format("Species: {0}", crewMember.TenantScore);
			_biogaphy.Text = crewMember.Biography;

			var imageManager = new ImageManager(this.Resources);
			var bitmap = await imageManager.GetScaledDownBitmapFromResourceAsync(imageResourceId, 150, 150);

			_photo.SetImageBitmap(bitmap);

			mPhotoAlbum = new PhotoAlbum();

			// Set our view from the "main" layout resource:
			//SetContentView (Resource.Layout.Main);

			// Get our RecyclerView layout:
			mRecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView);

			//............................................................
			// Layout Manager Setup:

			// Use the built-in linear layout manager:
			mLayoutManager = new LinearLayoutManager (this);

			// Or use the built-in grid layout manager (two horizontal rows):
			// mLayoutManager = new GridLayoutManager
			//        (this, 2, GridLayoutManager.Horizontal, false);

			// Plug the layout manager into the RecyclerView:
			mRecyclerView.SetLayoutManager (mLayoutManager);

			//............................................................
			// Adapter Setup:

			// Create an adapter for the RecyclerView, and pass it the
			// data set (the photo album) to manage:
			mAdapter = new PhotoAlbumAdapter (mPhotoAlbum);

			// Register the item click handler (below) with the adapter:
			//mAdapter.ItemClick += OnItemClick;

			// Plug the adapter into the RecyclerView:
			mRecyclerView.SetAdapter (mAdapter);

			//............................................................
			// Random Pick Button:

			// Get the button for randomly swapping a photo:
			//Button randomPickBtn = FindViewById<Button>(Resource.Id.randPickButton);

			// Handler for the Random Pick Button:
			//randomPickBtn.Click += delegate
			{
				if (mPhotoAlbum != null)
				{
					// Randomly swap a photo with the top:
					int idx = mPhotoAlbum.RandomSwap();

					// Update the RecyclerView by notifying the adapter:
					// Notify that the top and a randomly-chosen photo has changed (swapped):
					mAdapter.NotifyItemChanged(0);
					mAdapter.NotifyItemChanged(idx);
				}
			};



		}