Exemplo n.º 1
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     mPhotoAlbum = new PhotoAlbum();
     // Set our view from the "main" layout resource
     SetContentView(Resource.Layout.Main);
     mRecycleView   = FindViewById <RecyclerView>(Resource.Id.recyclerView);
     mLayoutManager = new LinearLayoutManager(this);
     mRecycleView.SetLayoutManager(mLayoutManager);
     mAdapter            = new PhotoAlbumAdapter(mPhotoAlbum);
     mAdapter.ItemClick += MAdapter_ItemClick;
     mRecycleView.SetAdapter(mAdapter);
 }
Exemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container,
                                          Bundle savedInstanceState)
        {
            var photoAlbum = PhotoAlbum.GetPhotoAlbum();
            // Set our view from the "main" layout resource

            var view         = inflater.Inflate(Resource.Layout.NewsFragmentView, container, false);
            var recyclerView = view.FindViewById(Resource.Id.recyclerView) as RecyclerView;

            var layoutManager = new LinearLayoutManager(Context);
            var adapter       = new PhotoAlbumAdapter(photoAlbum);

            recyclerView.SetLayoutManager(layoutManager);
            recyclerView.SetAdapter(adapter);

            base.OnCreateView(inflater, container, savedInstanceState);

            return(view);
        }
Exemplo n.º 3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.fragment1, container, false);

            //var ignored = base.OnCreateView(inflater, container, savedInstanceState);
            mPhotoAlbum    = new taskCompilation();
            mRecyclerView  = rootView.FindViewById <RecyclerView>(Resource.Id.recyclerView);
            mLayoutManager = new LinearLayoutManager(rootView.Context);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mAdapter            = new PhotoAlbumAdapter(mPhotoAlbum);
            mAdapter.itemClick += MAdapter_ItemClick;

            //for (int i = 0; i<myLists.D.Results.Length;i++) {
            //    mPhotoAlbum.addPhotos(myLists.D.Results[i].Title, myLists.D.Results[i].TaskName, myLists.D.Results[i].Date, myLists.D.Results[i].HoursRendered);
            //}

            mRecyclerView.SetAdapter(mAdapter);

            return(rootView);
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.Main);
            var toolbar = FindViewById<Android.Widget.Toolbar> (Resource.Id.toolbar);
            //Toolbar will now take on default Action Bar characteristics

            mPhotoAlbum = new PhotoAlbum();

            // Set our view from the "main" layout resource:
            SetContentView (Resource.Layout.Main);
            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.button1);

            button.Click += (object sender, EventArgs e) =>
            {
                DetectNetwork();
                Toast line = new Toast((Context) Application.Context);
                Toast.MakeText(this, "Detecting", ToastLength.Short).Show();

            };

            Button refresh1 = FindViewById<Button> (Resource.Id.button2);

            refresh1.Click += (object sender, EventArgs e) =>
            {

                Console.WriteLine(count.ToString());
                //Context lineContext = new Context();
                if (count%2==0)
                {
                    Console.WriteLine("Track Initilized");
                    Toast line = new Toast((Context) Application.Context);
                    Toast.MakeText(this, "Tracking Initilized", ToastLength.Short).Show();

                }
                else
                {
                    Console.WriteLine("Track Ended");
                    Toast line = new Toast((Context) Application.Context);
                    Toast.MakeText(this, "Track ended", ToastLength.Short).Show();

                }
                Console.WriteLine("Press again to Stop/Start");

                count =count+1;

            };

            Button refresher = FindViewById<Button> (Resource.Id.button3);

            refresher.Click += (object sender, EventArgs e) =>
            {
                TextView countDownTextView = FindViewById<TextView> (Resource.Id.mbView1);
                if (TestNetwork ())
                {
                    Console.WriteLine (TrafficStats.MobileRxBytes);
                    mStartRX = TrafficStats.MobileRxBytes;
                    KB = (double) mStartRX%100000000000;
                    KB = Math.Round(KB/1000,0);
                    kB = (int) KB;
                    MB = Math.Round(KB/1000,0);
                    mB = (int) MB;
                    //kB = Convert.ToDouble(kB);
                    Percent();

                    if (!c)
                    {
                        countDownTextView.Text = kB.ToString();
                    }
                    else
                        countDownTextView.Text = mB.ToString();
                    Console.WriteLine (convertedbit);
                }
                else
                    countDownTextView.Text = convertedbit.ToString();

            };
            //This runs the trafficcontrol
            //while (count % 2 == 0) {

            // Maybe something will be set here later

            ToggleButton togglebutton = FindViewById<ToggleButton>(Resource.Id.toggleButton1);

            togglebutton.Click += (o, e) => {
                // Perform action on clicks

                if (togglebutton.Checked)
                {
                    c=true;
                    Toast.MakeText(this, "mBs", ToastLength.Short).Show ();
                    //convertedbit = mB;
                }
                else
                {
                    c=false;
                    Toast.MakeText(this, "kBs", ToastLength.Short).Show ();
                    //convertedbit = kB;
                }
            };
            //v
            // Get our RecyclerView layout:
            mRecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView);

            //............................................................
            // Layout Manager Setup:

            // Use the built-in linear layout manager:
            mLayoutManager = new LinearLayoutManager (this);

            // Or use the built-in grid layout manager (two horizontal rows):
            // mLayoutManager = new GridLayoutManager
            //        (this, 2, GridLayoutManager.Horizontal, false);

            // Plug the layout manager into the RecyclerView:
            mRecyclerView.SetLayoutManager (mLayoutManager);

            //............................................................
            // Adapter Setup:

            // Create an adapter for the RecyclerView, and pass it the
            // data set (the photo album) to manage:
            mAdapter = new PhotoAlbumAdapter (mPhotoAlbum);

            // Register the item click handler (below) with the adapter:
            mAdapter.ItemClick += OnItemClick;

            // Plug the adapter into the RecyclerView:
            mRecyclerView.SetAdapter (mAdapter);
            //V thinks oncreate ends here
        }
Exemplo n.º 5
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);



            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

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

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            //DrawerLayout drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
            //ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);
            //drawer.AddDrawerListener(toggle);
            //toggle.SyncState();


            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);


            #region RecyclerView
            var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView_main);

            var manager = new GridLayoutManager(this, 2);



            mPhotoAlbum = new PhotoAlbum();

            mAdapter = new PhotoAlbumAdapter(mPhotoAlbum);

            mAdapter.ItemClick += OnItemClick;

            manager.SetSpanSizeLookup(new MySpanSizeLookup(mAdapter));

            recyclerView.SetLayoutManager(manager);
            recyclerView.SetAdapter(mAdapter);

            UIHander uIHander = new UIHander(HandleiAction);
            recyclerView.AddOnScrollListener(new RecyclerViewOnScrollListtener(AddList, manager, uIHander));

            #endregion


            swipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.switch_refresh);
            swipeRefreshLayout.SetColorSchemeColors(Resource.Color.colorPrimary);
            swipeRefreshLayout.Refresh += SwipeRefreshLayout_Refresh;

            imagebutton        = FindViewById <RoundImageView>(Resource.Id.iv_userphoto_mycenter_myprofile);
            imagebutton.Click += Imagebutton_Click;

            // 更新用户头像
            ThreadPool.QueueUserWorkItem(q => SetImage());


            Init();
        }
Exemplo n.º 6
0
 public MySpanSizeLookup(PhotoAlbumAdapter mAdapter)
 {
     this.mAdapter = mAdapter;
 }
		protected override async void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			SetContentView(Resource.Layout.BackgroundCheck_Profile);

			_rank = FindViewById<TextView>(Resource.Id.crewMemberRankTextView);
			_name = FindViewById<TextView>(Resource.Id.crewMemberNameTextView);
			_position = FindViewById<TextView>(Resource.Id.crewMemberPositionTextView);
			_posting = FindViewById<TextView>(Resource.Id.crewMemberPostingTextView);
			_tenantScore = FindViewById<TextView>(Resource.Id.crewMemberTenantScoreTextView);
			_biogaphy = FindViewById<TextView>(Resource.Id.crewMemberBioTextView);
			_photo = FindViewById<ImageView>(Resource.Id.crewMemberImageView);



			var index = Intent.GetIntExtra("index", -1);
			if(index < 0)
			{
				return;
			}

			var imageResourceId = Intent.GetIntExtra("imageResourceId", -1);

			var crewMember = SharedData.CrewManifest[index];

			_rank.Text = crewMember.Rank;
			_name.Text = crewMember.Name;
			_position.Text = crewMember.Position;
			_posting.Text = crewMember.Posting;
			_tenantScore.Text = String.Format("Species: {0}", crewMember.TenantScore);
			_biogaphy.Text = crewMember.Biography;

			var imageManager = new ImageManager(this.Resources);
			var bitmap = await imageManager.GetScaledDownBitmapFromResourceAsync(imageResourceId, 150, 150);

			_photo.SetImageBitmap(bitmap);

			mPhotoAlbum = new PhotoAlbum();

			// Set our view from the "main" layout resource:
			//SetContentView (Resource.Layout.Main);

			// Get our RecyclerView layout:
			mRecyclerView = FindViewById<RecyclerView> (Resource.Id.recyclerView);

			//............................................................
			// Layout Manager Setup:

			// Use the built-in linear layout manager:
			mLayoutManager = new LinearLayoutManager (this);

			// Or use the built-in grid layout manager (two horizontal rows):
			// mLayoutManager = new GridLayoutManager
			//        (this, 2, GridLayoutManager.Horizontal, false);

			// Plug the layout manager into the RecyclerView:
			mRecyclerView.SetLayoutManager (mLayoutManager);

			//............................................................
			// Adapter Setup:

			// Create an adapter for the RecyclerView, and pass it the
			// data set (the photo album) to manage:
			mAdapter = new PhotoAlbumAdapter (mPhotoAlbum);

			// Register the item click handler (below) with the adapter:
			//mAdapter.ItemClick += OnItemClick;

			// Plug the adapter into the RecyclerView:
			mRecyclerView.SetAdapter (mAdapter);

			//............................................................
			// Random Pick Button:

			// Get the button for randomly swapping a photo:
			//Button randomPickBtn = FindViewById<Button>(Resource.Id.randPickButton);

			// Handler for the Random Pick Button:
			//randomPickBtn.Click += delegate
			{
				if (mPhotoAlbum != null)
				{
					// Randomly swap a photo with the top:
					int idx = mPhotoAlbum.RandomSwap();

					// Update the RecyclerView by notifying the adapter:
					// Notify that the top and a randomly-chosen photo has changed (swapped):
					mAdapter.NotifyItemChanged(0);
					mAdapter.NotifyItemChanged(idx);
				}
			};



		}