Esempio n. 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.empty_recycleview, container, false);

            main = Activity as MainActivity;

            wtfList.Clear();
            wtfList2.Clear();
            periodTemp.Clear();
            oldPosition    = -1;
            mRecyclerView  = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);
            mLayoutManager = new LinearLayoutManager(view.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            mPeriodz = new TimesheetPeriodz();
            foreach (var item in main.offline)
            {
                wtfList.Add(JsonConvert.DeserializeObject <TimesheetPeriod.Result>(item.period));
                wtfList2.Add(JsonConvert.DeserializeObject <List <string> >(item.offlineTimesheetWork));
            }
            foreach (var item in wtfList)
            {
                periodTemp.Add(item.Name + ": " + item.Start.ToShortDateString() + " - " + item.End.ToShortDateString());
            }

            mPeriodz.addPeriod(periodTemp, currentDayPosition);
            mPeriozAdapter            = new SavedTimesheetPeriodAdapter(mPeriodz, main, this);
            mPeriozAdapter.itemClick += Adapter_ItemClick;
            mRecyclerView.SetAdapter(mPeriozAdapter);

            return(view);
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.empty_recycleview, container, false);

            main        = (Activity as MainActivity);
            core        = main.getCore();
            periodList  = main.getTimesheetPeriods();
            oldPosition = -1;

            periodTemp.Clear();
            TimeSpan span;

            for (int i = 0; i < periodList.D.Results.Count; i++)
            {
                periodTemp.Add(periodList.D.Results[i].Name + ": " + periodList.D.Results[i].Start.ToShortDateString() + " - " + periodList.D.Results[i].End.ToShortDateString());
                span = periodList.D.Results[i].End.Subtract(periodList.D.Results[i].Start);
                for (int j = 0; j <= span.Days; j++)
                {
                    if (periodList.D.Results[i].Start.Date.AddDays(j).Equals(DateTime.Now.Date))
                    {
                        currentDayPosition = i;
                        break;
                    }
                }
            }

            mRecyclerView  = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);
            mLayoutManager = new LinearLayoutManager(view.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            mPeriodz = new TimesheetPeriodz();
            mPeriodz.addPeriod(periodTemp, currentDayPosition);

            mPeriozAdapter            = new TimesheetPeriodAdapter(mPeriodz, main, this);
            mPeriozAdapter.itemClick += Adapter_ItemClick;
            mRecyclerView.SetAdapter(mPeriozAdapter);
            return(view);
        }