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

            SetContentView(Resource.Layout.Main);


            Android.Views.Display display = WindowManager.DefaultDisplay;
            Point size = new Point();

            display.GetSize(size);
            MyGlobal.screenSize = new System.Drawing.Size(size.X, size.Y);

            MyPicasso.CreateNewPicasso(ApplicationContext);


            websiteReader.Add(new Core.Architecture.WebsiteHandler(new Website.IndiancinemagalleryWebsiteArchitecture()));
            websiteReader.Add(new Website.IdlebrainWebsiteReader());
            websiteReader.Add(new Core.Architecture.WebsiteHandler(new Website.BharatStudentWebsiteArchitecture()));

            gridView = FindViewById <GridView>(Resource.Id.mainGridView);
            adapter  = new GridViewAdapter()
            {
                parent = this
            };
            gridView.Adapter    = adapter;
            gridView.ItemClick += GridView_ItemClick;

            FindViewById <Button>(Resource.Id.showDownloadButton).Click += delegate
            {
                StartActivity(new Intent(this, typeof(Activities.DownloadActivity)));
            };
        }
		public SimulationView (Context context, SensorManager sensorManager, IWindowManager window)
			: base (context)
		{
			Bounds = new PointF ();

			// Get an accelorometer sensor
			sensor_manager = sensorManager;
			accel_sensor = sensor_manager.GetDefaultSensor (SensorType.Accelerometer);

			// Calculate screen size and dpi
			var metrics = new DisplayMetrics ();
			window.DefaultDisplay.GetMetrics (metrics);

			meters_to_pixels_x = metrics.Xdpi / 0.0254f;
			meters_to_pixels_y = metrics.Ydpi / 0.0254f;

			// Rescale the ball so it's about 0.5 cm on screen
			var ball = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Ball);
			var dest_w = (int)(BALL_DIAMETER * meters_to_pixels_x + 0.5f);
			var dest_h = (int)(BALL_DIAMETER * meters_to_pixels_y + 0.5f);
			ball_bitmap = Bitmap.CreateScaledBitmap (ball, dest_w, dest_h, true);

			// Load the wood background texture
			var opts = new BitmapFactory.Options ();
			opts.InDither = true;
			opts.InPreferredConfig = Bitmap.Config.Rgb565;
			wood_bitmap = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);
			wood_bitmap2 = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);

			display = window.DefaultDisplay;
			particles = new ParticleSystem (this);
		}
Esempio n. 3
0
 public static Point GetNaturalSize(Display display, Configuration configuration)
 {
     Point size = GetSize(display);
     Orientation orientation = GetNaturalOrientation(display, configuration);
     return (size.X > size.Y && orientation == Orientation.Portrait)
         || (size.X < size.Y && orientation == Orientation.Landscape )
         ? new Point(size.Y, size.X)
         : size;
 }
Esempio n. 4
0
        public static Orientation GetNaturalOrientation(Display display, Configuration configuration)
        {
            SurfaceOrientation rotation = display.Rotation;

            return ((rotation == SurfaceOrientation.Rotation0 || rotation == SurfaceOrientation.Rotation180) &&
                    configuration.Orientation == Orientation.Landscape)
                   || ((rotation == SurfaceOrientation.Rotation90 || rotation == SurfaceOrientation.Rotation270) &&
                       configuration.Orientation == Orientation.Portrait)
                ? Orientation.Landscape
                : Orientation.Portrait;
        }
Esempio n. 5
0
        public static Point GetSize(Display display)
        {
            int width;
            int heigth;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.HoneycombMr2)
            {
                Point size = new Point();
                display.GetSize(size);

                width = size.X;
                heigth = size.Y;
            }
            else
            {
                 width = display.Width;
                 heigth = display.Height;
            }
            return new Point(width, heigth);
        }
        /// <summary>
        /// Called when the activity is first created. </summary>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Get an instance of the SensorManager
            mSensorManager = (SensorManager)GetSystemService(SENSOR_SERVICE);

            // Get an instance of the PowerManager
            mPowerManager = (PowerManager)GetSystemService(POWER_SERVICE);

            // Get an instance of the WindowManager
            mWindowManager = (IWindowManager)GetSystemService(WINDOW_SERVICE);
            mDisplay = mWindowManager.DefaultDisplay;

            // Create a bright wake lock
            mWakeLock = mPowerManager.NewWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, this.GetType().Name);

            // instantiate our simulation view and set it as the activity's content
            mSimulationView = new SimulationView(this);
            SetContentView(mSimulationView);
        }
        public static Point GetDesiredSize(this WallpaperManager wallpaperManager, Display display, Configuration configuration)
        {
            int width = wallpaperManager.DesiredMinimumWidth;
            int height = wallpaperManager.DesiredMinimumHeight;
            bool noWidth = width < 1;
            bool noHeight = height < 1;
            if (noWidth || noHeight)
            {
                Point displaySize = DisplayExtensions.GetNaturalSize(display, configuration);
                if (noWidth)
                {
                    width = displaySize.X;
                }
                if (noHeight)
                {
                    height = displaySize.Y;
                }
            }

            return new Point(width, height);
        }
		public SamplePresentation (Context outerContext, Display display) : base (outerContext, display)
		{
		}
 public HorizontalPager(Context context, Display display)
     : base(context)
 {
     mDisplay = display;
     Init(mDisplay);
 }
        private void Init(Display display)
        {
            mScroller = new Scroller(Context);
            float density;

            if (display != null)
            {
                DisplayMetrics displayMetrics = new DisplayMetrics();
                display.GetMetrics(displayMetrics);
                density = displayMetrics.Density;
            }
            else
            {
                density = Context.Resources.DisplayMetrics.Density;
            }
            mDensityAdjustedSnapVelocity = (int)(density * SNAP_VELOCITY_DIP_PER_SECOND);

            ViewConfiguration configuration = ViewConfiguration.Get(Context);
            mTouchSlop = configuration.ScaledTouchSlop;
            mMaximumVelocity = configuration.ScaledMaximumFlingVelocity;
        }
Esempio n. 11
0
        public DisplayMetricsDensity GetScreenDensity(Display display)
        {
            Android.Util.DisplayMetrics metrics = new Android.Util.DisplayMetrics();
            display.GetMetrics(metrics);

            switch (metrics.DensityDpi)
            {
                case DisplayMetricsDensity.Low:
                    return DisplayMetricsDensity.Low;
                case DisplayMetricsDensity.Medium:
                    return DisplayMetricsDensity.Medium;
                case DisplayMetricsDensity.High:
                    return DisplayMetricsDensity.High;
                case DisplayMetricsDensity.Xhigh:
                    return DisplayMetricsDensity.Xhigh;
                case DisplayMetricsDensity.Tv:
                    return DisplayMetricsDensity.Tv;
            }

            return DisplayMetricsDensity.Default;
        }