Пример #1
0
        public CompassRenderer(
            Context context,
            OrientationManager orientationManager,
            Landmarks landmarks)
        {
            _orientationManager = orientationManager;
            _landmarks = landmarks;

            try
            {
                _renderingCallbackWrapper = new RenderingCallbackWrapper(this);
                _onChangedListener = new OnChangedListener(this);

                var inflater = LayoutInflater.From(context);
                _layout = (FrameLayout)inflater.Inflate(Resource.Layout.compass, null);
                _layout.SetWillNotDraw(false);

                _compassView = (CompassView)_layout.FindViewById(Resource.Id.compass);
                _tipsContainer = (RelativeLayout)_layout.FindViewById(Resource.Id.tips_container);

                _tipsView = (TextView) _layout.FindViewById(Resource.Id.tips_view);

                _compassView.OrientationManager = _orientationManager;
            }
            catch (Exception e)
            {
                Log.Debug("Exception", e.Message);
            }
        }
Пример #2
0
 public void OnOrientationChanged(OrientationManager orientationManager)
 {
     _compassView.Heading = _orientationManager.Heading;
     var oldTooSteep = _tooSteep;
     _tooSteep = Math.Abs(_orientationManager.Pitch) > TOO_STEEP_PITCH_DEGREES;
     if (_tooSteep != oldTooSteep)
     {
         updateTipsView();
     }
 }
Пример #3
0
        public override void OnCreate()
        {
            base.OnCreate();

            _speech = new TextToSpeech(this, this);

            _orientationManager = new OrientationManager(
                this.getSensorManager(),
                this.getLocationManager());

            _landmarks = new Landmarks(this);
        }
Пример #4
0
 public void OnAccuracyChanged(OrientationManager orientationManager)
 {
     _callback.OnAccuracyChanged(orientationManager);
 }
Пример #5
0
 public void OnLocationChanged(OrientationManager orientationManager)
 {
     _callback.OnLocationChanged(orientationManager);
 }
Пример #6
0
 public OnChangedListener(OrientationManager.IOnChangedListener callback)
 {
     _callback = callback;
 }
Пример #7
0
        public override void OnDestroy()
        {
            _speech.Shutdown();
            _speech = null;
            _orientationManager = null;
            _landmarks = null;

            base.OnDestroy();
        }
Пример #8
0
        public override void OnCreate()
        {
            base.OnCreate();

            _speech = new TextToSpeech(this, this);

            _orientationManager = new OrientationManager(
                this.getSensorManager(),
                this.getLocationManager());

            _landmarks = new Landmarks(AndroidResourceReader.read(this, Resource.Raw.landmarks));
        }
Пример #9
0
 public void OnLocationChanged(OrientationManager orientationManager)
 {
     var location = _orientationManager.Location;
     var places = _landmarks.getNearbyLandmarks(location.Latitude, location.Longitude);
     _compassView.NearbyPlaces = places;
 }
Пример #10
0
 public void OnAccuracyChanged(OrientationManager orientationManager)
 {
     _interference = _orientationManager.HasInterference;
     updateTipsView();
 }