コード例 #1
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

            // Instantiate the photo album:
            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);
                }
            };
		}
コード例 #2
0
 public PhotoAlbumAdapter(PhotoAlbum photoAlbum)
 {
     mPhotoAlbum = photoAlbum;
 }
コード例 #3
0
 // Load the adapter with the data set (photo album) at construction time:
 public PhotoAlbumAdapter (PhotoAlbum photoAlbum)
 {
     mPhotoAlbum = photoAlbum;
 }
コード例 #4
0
ファイル: MainActivity.cs プロジェクト: michaelxu01/LimDa
        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
        }
コード例 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Instantiate the photo album:
            mPhotoAlbum = new PhotoAlbum();

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

            buttonTest = FindViewById <Button>(Resource.Id.buttonTest);

            buttonTest.Click += delegate {
                Toast.MakeText(this.ApplicationContext, "test", ToastLength.Long).Show();
            };



            // 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);
                }
            };
        }
コード例 #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Instantiate the photo album:
            mPhotoAlbum = new PhotoAlbum();
            SQlite_main.SortCard();

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

            ListItems.Syokika();

            // 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);

            ItemTouchHelper itemTouchHelper = new
                                              //ItemTouchHelper(new SwipeToDeleteCallback(mAdapter));
                                              //itemTouchHelper.AttachToRecyclerView(mRecyclerView);

                                              //............................................................
                                              // 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);
                }
            };
        }
コード例 #7
0
 // Load the adapter with the data set (photo album) at construction time:
 public PhotoAlbumAdapter(PhotoAlbum photoAlbum)
 {
     mPhotoAlbum = photoAlbum;
     Getfromdb();
 }
コード例 #8
0
 public PhotoAlbumAdapter(PhotoAlbum photoAlbum, Activity activity)
 {
     mPhotoAlbum = photoAlbum;
     mActivity   = activity;
 }