public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var ret = inflater.Inflate(Resource.Layout.fragment_report_sessions, container, false); list = ret.FindViewById <SwipeRecyclerView>(Resource.Id.list); delete = ret.FindViewById(Resource.Id.delete); delete.Click += (sender, e) => { RequestDeleteSessions(adapter.GetCheckedSessions()); }; export = ret.FindViewById(Resource.Id.export); export.Click += (sender, e) => { StartExportActivity(); }; adapter = new ReportSessionAdapter(list); adapter.emptyView = ret.FindViewById(Resource.Id.empty); adapter.sessionActions = this; list.SetAdapter(adapter); return(ret); }
// Overridden from Activity protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_portal_remote_viewing_manager); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetIcon(GetColoredDrawable(Resource.Drawable.ic_cloud, Resource.Color.gray)); refresh = FindViewById <SwipeRefreshLayout>(Resource.Id.refresh); list = FindViewById <SwipeRecyclerView>(Resource.Id.list); button = FindViewById <Button>(Resource.Id.button); button.Visibility = ViewStates.Invisible; button.Click += async(sender, e) => { var ri = ion as RemoteION; var i = adapter.IndexOfRecord(adapter.checkedRecord); if (ri != null && ri.connectionData.id == adapter.checkedRecord.data.id) { await StartLocalIONAsync(); } else { await StartRemoteIONAsync(adapter.checkedRecord.data); } ion.PostToMainDelayed(() => { adapter.NotifyDataSetChanged(); var r = adapter[i] as PortalRemoteViewingRecord; if (r.isBeingDownloaded) { button.SetText(Resource.String.portal_remote_mode); } else { button.SetText(Resource.String.portal_local_mode); } if (ion is RemoteION) { ActionBar.SetBackgroundDrawable(new ColorDrawable(Resource.Color.red.AsResourceColor(this))); } else { ActionBar.SetBackgroundDrawable(new ColorDrawable(Android.Resource.Color.BackgroundDark.AsResourceColor(this))); } }, TimeSpan.FromMilliseconds(500)); }; adapter = new PortalRemoteViewingAdapter(); adapter.emptyView = FindViewById(Resource.Id.empty); adapter.onRecordCheckChange = (obj) => { var ri = ion as RemoteION; var r = adapter[obj] as PortalRemoteViewingRecord; if (r.isChecked) { if (ri != null && ri.connectionData.id == r.data.id) { button.SetText(Resource.String.portal_local_mode); } else { button.SetText(Resource.String.portal_remote_mode); } button.Visibility = ViewStates.Visible; } else { button.Visibility = ViewStates.Invisible; } }; refresh.SetOnRefreshListener(this); list.SetAdapter(adapter); }