Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.Share);

            List<HistoryList> hl = new List<HistoryList> () {
            new HistoryList() { Left="History1", Right="" },
             new HistoryList() { Left="", Right="History2" },
                new HistoryList() { Left="History3", Right="" },
             new HistoryList() { Left="", Right="History4" },
                new HistoryList() { Left="History5", Right="" },
             new HistoryList() { Left="", Right="History6" }
            };
            historyListAdap = new HistoryListAdapter (this, hl);
            var listView = FindViewById<ListView> (Resource.Id.listViewHistory);
            listView.Adapter = historyListAdap;
            listView.ItemClick += listView_ItemClick;

            listData = "";
            var btnSend = FindViewById<Button> (Resource.Id.buttonGo);
            var txtMsg = FindViewById<EditText> (Resource.Id.textViewUpload);
            btnSend.Click += (sender, args) => {
                if (!String.IsNullOrEmpty (txtMsg.Text)) {
                    CrossCopyApp.Srv.Send (txtMsg.Text.Trim ());
                    //Paste (new DataItem (txtMsg.Text.Trim (), DataItemDirection.Out, DateTime.Now));
                }
            };

            string phrase = Intent.GetStringExtra ("Secret");
            secret = new Secret (phrase);
            CrossCopyApp.Srv.CurrentSecret = secret;
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            ViewModel = new HistoryItemViewModel(new ServiceLocator().GetDatabaseHelper);

            _view             = inflater.Inflate(Resource.Layout.history_page_layout, null);
            _listview         = (ListView)_view.FindViewById(Resource.Id.history_list_view);
            _progressBar      = (ProgressBar)_view.FindViewById(Resource.Id.loading_bar);
            _adapter          = new HistoryListAdapter(Activity, ViewModel);
            _listview.Adapter = _adapter;
            return(_view);
        }
Example #3
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.HistoryList);

            historyAdapter = new HistoryListAdapter();
            historyAdapter.ShareItemRequested       += HistoryAdapter_ShareItemRequested;
            historyAdapter.MoveFilesRequested       += HistoryAdapter_MoveFilesRequested;
            historyAdapter.BrowseFilesRequested     += HistoryAdapter_BrowseFilesRequested;
            historyAdapter.CopyToClipboardRequested += HistoryAdapter_CopyToClipboardRequested;
            historyAdapter.OpenFileRequested        += HistoryAdapter_OpenFileRequested;
            historyAdapter.RemoveItemRequested      += HistoryAdapter_RemoveItemRequested;
            historyAdapter.UrlLaunchRequested       += HistoryAdapter_UrlLaunchRequested;

            historyRecyclerView = FindViewById <RecyclerView>(Resource.Id.historyList_RecyclerView);
            historyRecyclerView.SetAdapter(historyAdapter);

            historyLayoutManager = new LinearLayoutManager(this);
            historyRecyclerView.SetLayoutManager(historyLayoutManager);

            historyEmptyMessage            = FindViewById <TextView>(Resource.Id.historyList_emptyMessage);
            historyEmptyMessage.Visibility = (historyAdapter.ItemCount == 0) ? ViewStates.Visible : ViewStates.Gone;

            var toolbar = FindViewById <Toolbar>(Resource.Id.historyList_toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Receive History";

            if (Intent.GetStringExtra("itemGuid") != null)
            {
                Guid itemGuid = Guid.Parse(Intent.GetStringExtra("itemGuid"));
                var  position = await historyAdapter.GetItemWithIdPosition(itemGuid);

                if (position >= 0)
                {
                    historyAdapter.HighlightItem(position);
                    historyRecyclerView.SmoothScrollToPosition(position);
                }
            }
        }
        private void MClient_DownloadDataCompleted(object sender, System.Net.DownloadDataCompletedEventArgs e)
        {
            RunOnUiThread(() =>
            {
                try
                {
                    string json = Encoding.UTF8.GetString(e.Result);
                    mHistoric   = JsonConvert.DeserializeObject <List <Historic> >(json);

                    // Cargo la Listview con los Vehiculos
                    mListAdapter         = new HistoryListAdapter(this, mHistoric);
                    mListView.Adapter    = mListAdapter;
                    mListView.ItemClick += MListView_ItemClick;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("** Error al cargar el Historial **");
                    //Managment.ActivityManager.TakeMeTo(this, typeof(ErrorActivity), true);
                }
            });
        }
Example #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            historyViewModel = ServiceContainer.Resolve <HistoryViewModel> ();
            menuViewModel    = ServiceContainer.Resolve <MenuViewModel> ();

            var view = inflater.Inflate(Resource.Layout.HistoryFragmentLayout, null, true);

            searchText              = view.FindViewById <EditText> (Resource.Id.historySearchText);
            searchText.TextChanged += (sender, e) => {
                if (historySearchAdapter != null)
                {
                    historySearchAdapter.FilterItems(searchText.Text);
                    historySearchAdapter.NotifyDataSetChanged();
                }
            };
            var clearSearch = view.FindViewById <ImageButton> (Resource.Id.historyClearSearch);

            clearSearch.Click += (sender, e) => searchText.Text = string.Empty;

            tabHost         = view.FindViewById <TabHost> (Resource.Id.historyTabHost);
            historyListView = view.FindViewById <ListView> (Resource.Id.historyListView);

            localManger = new LocalActivityManager(Activity, true);
            localManger.DispatchCreate(savedInstanceState);
            tabHost.Setup(localManger);

            var dateIndicator = CreateTab("DATE");

            TabHost.TabSpec dateTab = tabHost.NewTabSpec("Date");
            dateTab.SetIndicator(dateIndicator);
            dateTab.SetContent(new TabContent(new TextView(tabHost.Context)));

            var callsIndicator = CreateTab("CALLS");

            TabHost.TabSpec callsTab = tabHost.NewTabSpec("Calls");
            callsTab.SetIndicator(callsIndicator);
            callsTab.SetContent(new TabContent(new TextView(tabHost.Context)));

            var assignmentIndicator = CreateTab("ASSIGNMENTS");

            TabHost.TabSpec assignments = tabHost.NewTabSpec("Assignments");
            assignments.SetIndicator(assignmentIndicator);
            assignments.SetContent(new TabContent(new TextView(tabHost.Context)));

            tabHost.AddTab(dateTab);
            tabHost.AddTab(callsTab);
            tabHost.AddTab(assignments);

            tabHost.TabChanged += (sender, e) => {
                if (History != null)
                {
                    switch (tabHost.CurrentTab)
                    {
                    case 0:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.OrderBy(h => h.Date).ToList());
                        break;

                    case 1:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.Where(h => h.Type == AssignmentHistoryType.PhoneCall).ToList());
                        break;

                    default:
                        historySearchAdapter = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.Where(h => h.Type == AssignmentHistoryType.Assignment).ToList());
                        break;
                    }
                    historySearchAdapter.Assignment = Assignment;
                    historyListView.Adapter         = historySearchAdapter;
                }
            };
            if (History != null)
            {
                historySearchAdapter            = new HistoryListAdapter(Activity, Resource.Layout.HistoryItemLayout, History.OrderBy(a => a.Date).ToList());
                historySearchAdapter.Assignment = Assignment;
                historyListView.Adapter         = historySearchAdapter;
            }

            historyListView.ItemClick += (sender, e) => {
                var intent = new Intent(Activity, typeof(SummaryHistoryActivity));
                historyViewModel.SelectedAssignmentHistory = History.ElementAtOrDefault(e.Position);
                menuViewModel.MenuIndex = 0;
                StartActivity(intent);
            };

            return(view);
        }
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);

            historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
            menuViewModel = ServiceContainer.Resolve<MenuViewModel> ();

            var view = inflater.Inflate (Resource.Layout.HistoryFragmentLayout, null, true);

            searchText = view.FindViewById<EditText> (Resource.Id.historySearchText);
            searchText.TextChanged += (sender, e) => {
                if (historySearchAdapter != null) {
                    historySearchAdapter.FilterItems (searchText.Text);
                    historySearchAdapter.NotifyDataSetChanged ();
                }
            };
            var clearSearch = view.FindViewById<ImageButton> (Resource.Id.historyClearSearch);
            clearSearch.Click += (sender, e) => searchText.Text = string.Empty;

            tabHost = view.FindViewById<TabHost> (Resource.Id.historyTabHost);
            historyListView = view.FindViewById<ListView> (Resource.Id.historyListView);

            localManger = new LocalActivityManager (Activity, true);
            localManger.DispatchCreate (savedInstanceState);
            tabHost.Setup (localManger);

            var dateIndicator = CreateTab ("DATE");
            TabHost.TabSpec dateTab = tabHost.NewTabSpec ("Date");
            dateTab.SetIndicator (dateIndicator);
            dateTab.SetContent (new TabContent (new TextView (tabHost.Context)));

            var callsIndicator = CreateTab ("CALLS");
            TabHost.TabSpec callsTab = tabHost.NewTabSpec ("Calls");
            callsTab.SetIndicator (callsIndicator);
            callsTab.SetContent (new TabContent(new TextView(tabHost.Context)));

            var assignmentIndicator = CreateTab ("ASSIGNMENTS");
            TabHost.TabSpec assignments = tabHost.NewTabSpec ("Assignments");
            assignments.SetIndicator (assignmentIndicator);
            assignments.SetContent (new TabContent (new TextView(tabHost.Context)));

            tabHost.AddTab (dateTab);
            tabHost.AddTab (callsTab);
            tabHost.AddTab (assignments);

            tabHost.TabChanged += (sender, e) => {
                if (History != null) {
                    switch (tabHost.CurrentTab) {
                        case 0:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (h => h.Date).ToList ());
                            break;
                        case 1:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.PhoneCall).ToList ());
                            break;
                        default:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.Assignment).ToList ());
                            break;
                    }
                    historySearchAdapter.Assignment = Assignment;
                    historyListView.Adapter = historySearchAdapter; 
                }
            };
            if (History != null) {
                historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (a => a.Date).ToList ());
                historySearchAdapter.Assignment = Assignment;
                historyListView.Adapter = historySearchAdapter;
            }

            historyListView.ItemClick += (sender, e) => {
                var intent = new Intent (Activity, typeof (SummaryHistoryActivity));
                historyViewModel.SelectedAssignmentHistory = History.ElementAtOrDefault (e.Position);
                menuViewModel.MenuIndex = 0;
                StartActivity (intent);
            };

            return view;
        }