public override View GetView(int position, View view, ViewGroup parent) { ViewHolder holder; if (view == null) { view = LayoutInflater.From(context).Inflate(Resource.Layout.sample_list_detail_item, parent, false); holder = new ViewHolder { image = view.FindViewById <ImageView>(Resource.Id.photo), text = view.FindViewById <TextView>(Resource.Id.url) }; view.Tag = holder; } else { holder = (ViewHolder)view.Tag; } // Get the image URL for the current position. string url = this[position]; holder.text.Text = url; // Trigger the download of the URL asynchronously into the image view. Picasso.Get() .Load(url) .Placeholder(Resource.Drawable.placeholder) .Error(Resource.Drawable.error) .ResizeDimen(Resource.Dimension.list_detail_image_size, Resource.Dimension.list_detail_image_size) .CenterInside() .Tag(context) .Into(holder.image); return(view); }
public override View GetView(int position, View convertView, ViewGroup parent) { SquaredImageView view = convertView as SquaredImageView; if (view == null) { view = new SquaredImageView(context); view.SetScaleType(ImageView.ScaleType.CenterCrop); } // Get the image URL for the current position. string url = this[position]; // Trigger the download of the URL asynchronously into the image view. Picasso.Get() .Load(url) .Placeholder(Resource.Drawable.placeholder) .Error(Resource.Drawable.error) .Fit() .Tag(context) .Into(view); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); CurrentUserUid = Intent.GetStringExtra("CurrentUserUid"); CurrentUserDisplayName = Intent.GetStringExtra("CurrentUserDisplayName"); //CurrentUserEmail = Intent.GetStringExtra("CurrentUserEmail"); CurrentUserPhoto = Intent.GetStringExtra("CurrentUserPhoto"); // var ButtonClickStatus = Intent.GetStringExtra("ButtonClickStatus"); database = AppDataHelper.GetDatabase(); firebaseAuth = AppDataHelper.GetFirebaseAuth(); this.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); this.Window.ClearFlags(WindowManagerFlags.TranslucentStatus); this.Window.SetStatusBarColor(Color.ParseColor("#204060")); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); toolbar.SetNavigationOnClickListener(this); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(true); // SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.baseline_notes_24); nodataicon = FindViewById <ImageView>(Resource.Id.nodataicon); homeText = FindViewById <TextView>(Resource.Id.homeText); statsText = FindViewById <TextView>(Resource.Id.statsText); calendarpickericon = FindViewById <ImageView>(Resource.Id.calendarpickericon); calendarpickericon.SetColorFilter(Color.ParseColor("#04040C")); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawerLayout.AddDrawerListener(this); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); View headerView = navigationView.GetHeaderView(0); navheader_username = headerView.FindViewById <TextView>(Resource.Id.navheader_username); navheader_username.Text = CurrentUserDisplayName; ProfilePic = headerView.FindViewById <ImageView>(Resource.Id.ProfilePic); versionno = FindViewById <TextView>(Resource.Id.versionno); versionno.Text = "v " + Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionName; //Android.Net.Uri myUri = Android.Net.Uri.Parse(CurrentUserPhoto); //if (CrossConnectivity.Current.IsConnected) //{ // var imageBitmap = GetImageBitmapFromUrl(CurrentUserPhoto); // ProfilePic.SetImageBitmap(imageBitmap); //} Picasso.Get().Load(CurrentUserPhoto).Placeholder(Resource.Drawable.icon).Into(ProfilePic); // ProfilePic.SetImageURI(myUri); //ProfilePic.SetImageURI(CurrentUserPhoto); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); nestedscroolview = FindViewById <NestedScrollView>(Resource.Id.nestedscroolview); MarginItemDecoration_Hor marginItemDecoration_Hor = new MarginItemDecoration_Hor(15, true, true); recyclerView.AddItemDecoration(marginItemDecoration_Hor); prefs = PreferenceManager.GetDefaultSharedPreferences(this); AppDataHelper.editor = prefs.Edit(); var mString = prefs.GetString("CurrencySymbolSelected", ""); if (mString == "") { AppDataHelper.editor.PutString("CurrencySymbolSelected", GetString(Resource.String.Rs)); AppDataHelper.editor.PutString("CurrencyTextSelected", GetString(Resource.String.RsCurrency)); AppDataHelper.editor.Apply(); } var mStringOrderBySelected = prefs.GetString("OrderBySelected", ""); if (mStringOrderBySelected == "") { AppDataHelper.editor.PutString("OrderBySelected", "DateDay"); AppDataHelper.editor.Apply(); } //else //{ //} totalexpenseVALUE = FindViewById <TextView>(Resource.Id.totalexpenseVALUE); totalexpenseVALUE.Text = prefs.GetString("CurrencySymbolSelected", "") + "0"; Datetxt = FindViewById <TextView>(Resource.Id.Datetxt); Datetxt.Text = DateTime.Now.DayOfWeek + ", " + DateTime.Today.Day + " " + DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture) + " " + DateTime.Today.Year; YearSelected = DateTime.Today.Year.ToString(); MonthSelected = DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture); homeText.SetCompoundDrawablesWithIntrinsicBounds(null, GetDrawable(Resource.Drawable.baseline_home_24), null, null); statsText.SetCompoundDrawablesWithIntrinsicBounds(null, GetDrawable(Resource.Drawable.outline_insert_chart_24), null, null); homeText.Click += HomeText_Click; statsText.Click += StatsText_Click; fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += Fab_Click; if (VersionTracking.IsFirstLaunchEver) { currencyModal_Fragment = new CurrencyModal_Fragment(); var trans = SupportFragmentManager.BeginTransaction(); currencyModal_Fragment.Show(trans, "Currency"); } calendarpickericon.Click += Calendartxt_Click; TotalExpenseValue = new List <string>(); parentObjects = new List <IParentObject>(); SetupVerticalRecyclerView(); DisplayAndBindMonthRecyclerView(); int day = DateTime.Now.Day; int month = DateTime.Now.Month - 1; int year = DateTime.Now.Year; picker = new DatePickerDialog(this); picker.UpdateDate(year, month, day); bottomAppBar = FindViewById <BottomAppBar>(Resource.Id.bar); childListsearch = new List <ExpenseItemChild>(); //FetchAndListenExpensesTable(); recyclerView.SetOnClickListener(this); }
protected override void OnDestroy() { base.OnDestroy(); Picasso.Get().CancelTag(this); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { int row = GetItemViewType(position); switch (row) { case Sheep_Class: var holderSheep = holder as SheepViewHolder; holderSheep.textSheep.Text = animalModelsArray[position].Name; if (animalModelsArray[position].IsDead) { Picasso.Get() .Load(Resource.Drawable.rip) .Into(holderSheep.imageSheep); } else { Picasso.Get() .Load(animalModelsArray[position].URL) .Into(holderSheep.imageSheep); } break; case Wolf_Class: var holderWolf = holder as WolfViewHolder; holderWolf.textWolf.Text = animalModelsArray[position].Name; if (animalModelsArray[position].IsDead) { Picasso.Get() .Load(Resource.Drawable.wolf_rip) .Into(holderWolf.imageWolf); } else { Picasso.Get() .Load(animalModelsArray[position].URL) .Into(holderWolf.imageWolf); } break; case Duck_Class: var holderDuck = holder as DuckViewHolder; holderDuck.textDuck.Text = animalModelsArray[position].Name; Picasso.Get() .Load(animalModelsArray[position].URL) .Into(holderDuck.imageDuck); break; case Hunter_Class: var holderHunter = holder as HunterViewHolder; holderHunter.textHunter.Text = animalModelsArray[position].Name; if (animalModelsArray[position].IsDead) { Picasso.Get() .Load(Resource.Drawable.hunter_rip) .Into(holderHunter.imageHunter); } else { Picasso.Get() .Load(animalModelsArray[position].URL) .Into(holderHunter.imageHunter); } break; } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { Customer_Home_Advertisement_ViewModel_ViewHolder vh = holder as Customer_Home_Advertisement_ViewModel_ViewHolder; Picasso.Get().Load(mdAdvertisement_List[position].Image).Into(vh.AdvertisementImg); }