示例#1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.main);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.main_toolbar);

            drawerLayout               = FindViewById <DrawerLayout>(Resource.Id.main_drawer_layout);
            navigationView             = FindViewById <NavigationView>(Resource.Id.main_navigation_view);
            drawerToggle               = new DrawerToggle(this, drawerLayout, toolbar, Resource.String.executed, Resource.String.measurement);
            drawerToggle.DrawerOpened += OnDrawerOpened;
            drawerToggle.DrawerClosed += OnDrawerClosed;
            drawerLayout.AddDrawerListener(drawerToggle);
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerview);
            var layoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.Vertical);

            recyclerView.SetLayoutManager(layoutManager);
            recyclerView.HasFixedSize = false;
            adapter = new MainAdapter(Resources, SetAsExecuted, (a, i) => { }, (a) => { }, (a) => { });
            recyclerView.SetAdapter(adapter);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            }
        }
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        var data = new DataSource();

        ListAdapter = new MainAdapter(this, data.result);
    }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            //Заполнение list
            list = new List <pModelKitchen>
            {
                new pModelKitchen {
                    nameKitchen = "name 1", Kitchen = 1
                },
                new pModelKitchen {
                    nameKitchen = "name 2", Kitchen = 2
                },
                new pModelKitchen {
                    nameKitchen = "name 3", Kitchen = 3
                },
                new pModelKitchen {
                    nameKitchen = "name 4", Kitchen = 4
                },
                new pModelKitchen {
                    nameKitchen = "name 5", Kitchen = 5
                },
                new pModelKitchen {
                    nameKitchen = "name 6", Kitchen = 6
                },
                new pModelKitchen {
                    nameKitchen = "name 7", Kitchen = 7
                },
                new pModelKitchen {
                    nameKitchen = "name 8", Kitchen = 8
                },
                new pModelKitchen {
                    nameKitchen = "name 9", Kitchen = 9
                },
                new pModelKitchen {
                    nameKitchen = "name 10", Kitchen = 10
                },
                new pModelKitchen {
                    nameKitchen = "name 11", Kitchen = 11
                },
            };

            listView         = FindViewById <ListView>(Resource.Id.listView);
            adapter          = new MainAdapter(this, list);
            listView.Adapter = adapter;

            //click ListView
            listView.ItemClick += clickListView;

            //Toolbar
            var btnToolbar = FindViewById <ImageView>(Resource.Id.image1);

            btnToolbar.Click += (s, e) =>
            {
                Toast.MakeText(this, "ToolBar click", ToastLength.Short).Show();
            };
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.grid_activity);
			mPager = FindViewById<GridViewPager> (Resource.Id.fragment_container);
			mAdapter = new MainAdapter (FragmentManager, this);
			mPager.Adapter = mAdapter;
		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.grid_activity);
            mPager         = FindViewById <GridViewPager> (Resource.Id.fragment_container);
            mAdapter       = new MainAdapter(FragmentManager, this);
            mPager.Adapter = mAdapter;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            ListView    list    = FindViewById <ListView>(Resource.Id.lv_modules);
            MainAdapter adapter = new MainAdapter(this, this.modules);

            list.Adapter = adapter;
        }
示例#7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View view = inflater.Inflate(Resource.Layout.MainFragment, container, false);

            adapter = new MainAdapter(Activity);
            adapter.UpdateAdapter(view);
            var button = view.FindViewById <ImageButton>(Resource.Id.button1);

            button.Click += AddNetwork;
            return(view);
        }
示例#8
0
 private Task InitializeAdapter()
 {
     return(Task.Factory.StartNew(() =>
     {
         adapter = new MainAdapter(
             Resources,
             workoutExecutedSetter.Execute,
             restingCycleSetter.SetChallengeRestingCycle,
             challengePauser.Pause,
             challengeActivator.Activate);
         recyclerView.SetAdapter(adapter);
     }));
 }
示例#9
0
        private async void LoadInventoryData()
        {
            mProgressDialog = ProgressDialog.Show(this, "Please wait...", "Getting data...", true);
            mStorages       = await mStorageDataService.GetAll();

            this.mInventories = await mInventoryDataService.GetAll();

            this.mProducts = await mProductDataService.GetAll();

            if (mInventories != null)
            {
                this.mInventoryAdapter            = new MainAdapter(this.mInventories, this.mProducts, this);
                this.mInventoryAdapter.ItemClick += OnInventoryClick;
                this.mListViewInventory.SetAdapter(this.mInventoryAdapter);
            }
            mProgressDialog.Hide();
        }
    private DataTable GetData(char[] queryItem)
    {
        DataTable dt = new DataTable();

        SqlDataAdapter MainAdapter;
        DataSet        MainDataSet = new DataSet();

        MainAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT " +
                                                     "ID, Email, FirstName, LastName, City, State, Country, PrimaryTelephone, EveningTelephone, MobileTelephone, Website, " +
                                                     "CompanyName FROM Users_Backup WHERE (ID <> 1) AND " +
                                                     "lastname like '[" + queryItem[0] + "-" + queryItem[1] + "]%' order by lastname",
                                                     SqlDbType.Int);

        MainAdapter.Fill(MainDataSet, "Users_Backup");
        dt = MainDataSet.Tables[0];

        return(dt);
    }
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.activity_animator_sample);

			var toolbar = FindViewById<Toolbar> (Resource.Id.tool_bar);
			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayShowTitleEnabled (false);

			var recyclerView = FindViewById<RecyclerView> (Resource.Id.list);

			if (Intent.GetBooleanExtra ("GRID", true)) {
				recyclerView.SetLayoutManager (new GridLayoutManager (this, 2));
			} else {
				recyclerView.SetLayoutManager (new LinearLayoutManager (this));
			}

			recyclerView.SetItemAnimator (new SlideInLeftAnimator ());

			var adapter = new MainAdapter (this, data.ToList ());
			recyclerView.SetAdapter (adapter);

			var spinner = FindViewById<Spinner> (Resource.Id.spinner);
			var spinnerAdapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleListItem1);
			foreach (var type in AnimatorTypes) {
				spinnerAdapter.Add (type.Key);
			}
			spinner.Adapter = spinnerAdapter;
			spinner.ItemSelected += (sender, e) => {
				recyclerView.SetItemAnimator (AnimatorTypes.Values.ToArray () [e.Position]);
				recyclerView.GetItemAnimator ().AddDuration = 500;
				recyclerView.GetItemAnimator ().RemoveDuration = 500;
			};

			FindViewById (Resource.Id.add).Click += (sender, e) => {
				adapter.Add ("newly added item", 1);
			};

			FindViewById (Resource.Id.del).Click += (sender, e) => {
				adapter.Remove (1);
			};
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            string mapboxAccessToken = Utils.GetMapboxAccessToken(ApplicationContext);

            if (string.IsNullOrWhiteSpace(mapboxAccessToken) || string.Equals(mapboxAccessToken, "YOUR_MAPBOX_ACCESS_TOKEN"))
            {
                throw new InvalidOperationException("Please configure your Mapbox access token");
            }

            Mapbox.GetInstance(ApplicationContext, mapboxAccessToken);

            var samples = new[]
            {
                new SampleItem {
                    Name         = GetString(Resource.String.title_navigation_view_ui),
                    Description  = GetString(Resource.String.description_navigation_view_ui),
                    ActivityType = typeof(NavigationViewActivity)
                },
                new SampleItem
                {
                    Name         = GetString(Resource.String.title_mock_navigation),
                    Description  = GetString(Resource.String.description_mock_navigation),
                    ActivityType = typeof(MockNavigationActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_reroute),
                    Description  = GetString(Resource.String.description_reroute),
                    ActivityType = typeof(RerouteActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_navigation_route_ui),
                    Description  = GetString(Resource.String.description_navigation_route_ui),
                    ActivityType = typeof(NavigationMapRouteActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_waypoint_navigation),
                    Description  = GetString(Resource.String.description_waypoint_navigation),
                    ActivityType = typeof(WaypointNavigationActivity)
                },
                new SampleItem {
                    Name         = "MockNavigation - OptimizedTrips API",
                    Description  = "MockNavigation - OptimizedTrips API",
                    ActivityType = typeof(OptimizedTripsNavigationActivity)
                }
            };

            // RecyclerView
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            recyclerView.HasFixedSize = true;

            // Use a linear layout manager
            RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);

            // Specify an adapter
            RecyclerView.Adapter adapter = new MainAdapter(samples, recyclerView);
            recyclerView.SetAdapter(adapter);

            // Check for location permission
            permissionsManager = new PermissionsManager(this);
            if (!PermissionsManager.AreLocationPermissionsGranted(this))
            {
                recyclerView.Enabled = (false);
                permissionsManager.RequestLocationPermissions(this);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            fm = SupportFragmentManager;

            Forms.Init(this, null);

            MobileCenter.Start("d19450d5-6882-4bea-9b6e-0b3f2e4afe02",
                               typeof(Analytics), typeof(Crashes));

            MessagingCenter.Subscribe <NativeNavigation, string>(this, "NativeNav", (sender, arg) =>
            {
                System.Console.WriteLine("Got the message from Xamarin Forms to load Global Search");
                NativeNavigationModel nnm = JsonConvert.DeserializeObject <NativeNavigationModel>(arg);
                NavigateByString nav      = new NavigateByString(nnm);
                nav.NavigateXF();
            }
                                                                 );

            SetContentView(Resource.Layout.Main);

            MainToolBar = FindViewById <V7Toolbar>(Resource.Id.mainToolBar);

            //UpwardFontTextView upwardLogo = ViewUtil.GetUpwardFontTextView(this, "U", 60, Resource.Color.white);
            //MainToolBar.FindViewById<RelativeLayout>(Resource.Id.upwardLogo_container).AddView(upwardLogo);

            ViewUtil.AddUpwardLogoToView(this, MainToolBar.FindViewById <Android.Widget.RelativeLayout>(Resource.Id.upwardLogo_container),
                                         Resources.GetInteger(Resource.Integer.upward_toolbar_logo_size));

            SetSupportActionBar(MainToolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(new IconDrawable(this, "md-menu").SizeDp(28).Color(Android.Graphics.Color.White));

            MainTabLayout = FindViewById <TabLayout>(Resource.Id.mainTabLayout);
            MainViewPager = FindViewById <ViewPager>(Resource.Id.mainViewPager);

            //NOTE: The following group of lines restores the old tab layout. These were removed in favor of the singular home page fragment approach for Upward
            SetUpFragments();
            MainFragAdapter       = new MainAdapter(this, fm, Fragments);
            MainViewPager.Adapter = MainFragAdapter;
            MainTabLayout.SetupWithViewPager(MainViewPager);
            MainViewPager.OffscreenPageLimit = Fragments.Count - 1;
            MainViewPager.AddOnPageChangeListener(this);

            //HomeFeedFragment fragment = new HomeFeedFragment();
            //FragmentUtil.LoadFragment(SupportFragmentManager, Resource.Id.staticFragmentContainer, fragment, Constants.VALUE_TYPE_HOME_FEED);

            NavView = FindViewById <NavigationView>(Resource.Id.nav_view);
            //NavView.NavigationItemSelected += DrawerItemSelected;
            DrawerLayout = FindViewById <FRDrawerLayout>(Resource.Id.drawer_layout);


            //Fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
            ////var icon = new IconDrawable(this, "md-create").Color(Android.Graphics.Color.White).SizeDp(20);
            //Fab.Click += (sender, e) =>
            //{
            //    IntentUtil.GoToCreatePost(this);
            //    //add layout and tint to layout

            //};
            //Fab.SetImageDrawable(icon);
            SetUpFab();

            SetTabIcons();
            SetConnectivityMessage();

            //The following 6 lines of code will set up the drawer for a non-logged in state to start, and change it later as required
            Fab.Visibility = ViewStates.Gone;
            NavView.FindViewById(Resource.Id.drawerLogout).Visibility = ViewStates.Gone;
            NavView.FindViewById(Resource.Id.drawerNonAuthenticatedHeader).Visibility = ViewStates.Visible;
            NavView.FindViewById(Resource.Id.drawerAuthenticatedHeader).Visibility    = ViewStates.Gone;
            NavView.FindViewById <ImageView>(Resource.Id.drawerNonAuthenticatedHeader_Avatar)
            .SetImageDrawable(ViewUtil.GetSVGDrawable(this, "profile_empty", 200, Resource.Color.Upward_dark_grey));
            MainTabLayout.Visibility = ViewStates.Gone;
            FindViewById(Resource.Id.flDrawerNonAuthenticatedHeader_AvatarContainer).SetOnClickListener(this);

            //Setup MainView
            var linear = new LinearLayout(this);

            linear.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            linear.Orientation      = Orientation.Vertical;

            var frame = new FrameLayout(this);

            frame.LayoutParameters = linear.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            frame.Id = 100;

            //linear.AddView(frame);

            //SetContentView(linear);

            //Setup navigation
            if (!Forms.IsInitialized)
            {
                Forms.Init(this, savedInstanceState);
            }

            DependencyService.Register <IAppNavigation, AppNavigation>();

            //AppNavigation.Manager = FragmentManager;
            //AppNavigation.ResourceId = 100;

            var appNavigation = DependencyService.Get <IAppNavigation>();

            //appNavigation.Push(App.StartPage);
        }
示例#14
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            challengeRepository = Activity as IGetChallenge;

            workoutRepository = Activity as IGetWorkout;

            measurementRepository = Activity as IGetMeasurements;

            workoutExecutedSetter = Activity as ISetWorkoutAsExecuted;

            restingCycleSetter = Activity as ISetRestingCycle;

            challengePauser = Activity as IPauseChallenge;

            challengeActivator = Activity as IActivateChallenge;

            var changeEvent = Activity as INotifyPropertyChanged;

            if (challengeRepository == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(IGetChallenge)}");
            }
            if (workoutRepository == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(IGetWorkout)}");
            }
            if (measurementRepository == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(IGetMeasurements)}");
            }
            if (workoutExecutedSetter == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(ISetWorkoutAsExecuted)}");
            }
            if (restingCycleSetter == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(ISetRestingCycle)}");
            }
            if (challengePauser == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(IPauseChallenge)}");
            }
            if (challengeActivator == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(IActivateChallenge)}");
            }
            if (changeEvent == null)
            {
                throw new NotImplementedException($"{Activity.Class.SimpleName} must implement {nameof(INotifyPropertyChanged)}");
            }

            changeEvent.PropertyChanged += delegate { Populate(); };
            //InitializeAdapter()
            adapter = new MainAdapter(
                Resources,
                workoutExecutedSetter.Execute,
                restingCycleSetter.SetChallengeRestingCycle,
                challengePauser.Pause,
                challengeActivator.Activate);
            recyclerView.SetAdapter(adapter);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            List <SampleItem> sampleItems = new List <SampleItem>
            {
                new SampleItem(
                    GetString(Resource.String.title_navigation_launcher),
                    GetString(Resource.String.description_navigation_launcher),
                    typeof(NavigationLauncherActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_end_navigation),
                    GetString(Resource.String.description_end_navigation),
                    typeof(EndNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_dual_navigation_map),
                    GetString(Resource.String.description_dual_navigation_map),
                    typeof(DualNavigationMapActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_mock_navigation),
                    GetString(Resource.String.description_mock_navigation),
                    typeof(MockNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_reroute),
                    GetString(Resource.String.description_reroute),
                    typeof(RerouteActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_navigation_route_ui),
                    GetString(Resource.String.description_navigation_route_ui),
                    typeof(NavigationMapRouteActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_waypoint_navigation),
                    GetString(Resource.String.description_waypoint_navigation),
                    typeof(WaypointNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_embedded_navigation),
                    GetString(Resource.String.description_embedded_navigation),
                    typeof(EmbeddedNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_fragment_navigation),
                    GetString(Resource.String.description_fragment_navigation),
                    typeof(FragmentNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_component_navigation),
                    GetString(Resource.String.description_component_navigation),
                    typeof(ComponentNavigationActivity)
                    ),
            };

            // RecyclerView
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            recyclerView.HasFixedSize = true;

            // Use a linear layout manager
            RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);

            // Specify an adapter
            RecyclerView.Adapter adapter = new MainAdapter(recyclerView, sampleItems);
            recyclerView.SetAdapter(adapter);

            // Check for location permission
            permissionsManager = new PermissionsManager(this);
            if (!PermissionsManager.AreLocationPermissionsGranted(this))
            {
                recyclerView.Visibility = ViewStates.Invisible;
                permissionsManager.RequestLocationPermissions(this);
            }
            else
            {
                RequestPermissionsIfNotGranted(Android.Manifest.Permission.WriteExternalStorage);
            }
        }