public override View GetView(int position, View convertView, ViewGroup parent) { var view = activity.LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem2, null); var work = works[position]; TextView text1 = view.FindViewById <TextView>(Android.Resource.Id.Text1); if (work.Name.Length > 40) { text1.Text = work.Name.Substring(0, 37) + "... (" + work.WorkCode + ")"; } else { text1.Text = work.Name + " (" + work.WorkCode + ")"; } TextView text2 = view.FindViewById <TextView>(Android.Resource.Id.Text2); text2.Text = "Norma: " + work.Norm + " min."; if (tag == WORK_ACTIVITY_TAG) { view.Click += (o, e) => { Intent intent = new Intent(activity, typeof(MainActivity)); intent.PutExtra(CHOOSEN_WORK_ID_EXTRA_NAME, work.Id); activity.SetResult(Result.Ok, intent); activity.Finish(); }; } else if (tag == MAIN_ACTIVITY_TAG) { var minutes = DataManager.GetDailyMinutes(activity, DateTime.Now); var quantity = DataManager.GetNeededQuantity(activity, work); if (quantity != 0) { text2.Text = "Do końca dnia: " + quantity + "x"; } var mainActivity = ((MainActivity)activity); view.Click += (o, e) => { var dialog_AddJob = new AddJobDialogFragment(); Bundle args = new Bundle(); args.PutInt(CHOOSEN_WORK_ID_EXTRA_NAME, work.Id); dialog_AddJob.Arguments = args; var fragmentTransaction = mainActivity.SupportFragmentManager.BeginTransaction(); dialog_AddJob.Show(fragmentTransaction, WORK_LISTVIEW_ADAPTER_TAG); var drawerLayout = mainActivity.FindViewById <DrawerLayout>(Resource.Id.mainLayoutDrawerLayout); var rightDrawer_mainLayoutLinearLayout = mainActivity.FindViewById <LinearLayout>(Resource.Id.rightDrawer_mainLayoutLinearLayout); drawerLayout.CloseDrawer(rightDrawer_mainLayoutLinearLayout); }; } //fill in your items //holder.Title.Text = "new text here"; return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); toolbar = FindViewById <SupportToolbar>(Resource.Id.mainToolbar); SetSupportActionBar(toolbar); var mainTabLayout = FindViewById <TabLayout>(Resource.Id.mainTabLayout); mainTabLayout.TabSelected += MainTabLayout_TabSelected; database = new Database(); currentJobsListView = FindViewById <ListView>(Resource.Id.currentJobsListView); reserveJobsListView = FindViewById <ListView>(Resource.Id.reserveJobsListView); LoadJobAdapter(); var addJobButton = FindViewById <ImageButton>(Resource.Id.AddJobButton); addJobButton.Click += (o, e) => { Android.Support.V4.App.FragmentTransaction transaction = SupportFragmentManager.BeginTransaction(); AddJobDialogFragment dialog_AddJob = new AddJobDialogFragment(); dialog_AddJob.Show(transaction, TAG); }; //Drawers drawerLayout = FindViewById <DrawerLayout>(Resource.Id.mainLayoutDrawerLayout); drawerToggle = new MyActionBarDrawerToggle(this, drawerLayout); drawerLayout.AddDrawerListener(drawerToggle); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); drawerToggle.SyncState(); rightDrawer_mainLayoutLinearLayout = FindViewById <LinearLayout>(Resource.Id.rightDrawer_mainLayoutLinearLayout); rightDrawer_mainLayoutLinearLayout.Tag = RIGHT_DRAWER_TAG; CountMonthlyNorm(); }