@Override protected void layout() { height = 32; shield.size(width, shield.height); avatar.x = PixelScene.align(camera(), shield.x + 15 - avatar.width / 2); avatar.y = PixelScene.align(camera(), shield.y + 16 - avatar.height / 2); compass.x = avatar.x + avatar.width / 2 - compass.origin.x; compass.y = avatar.y + avatar.height / 2 - compass.origin.y; hp.x = 30; hp.y = 3; depth.x = width - 24 - depth.width() - 18; depth.y = 6; keys.y = 6; danger.setPos(width - danger.width(), 18); buffs.setPos(31, 9); btnMenu.setPos(width - btnMenu.width(), 1); }
public void onClick_startNavigate(View view) { userLatitude = Float.valueOf(userLatitudeTxt.getText().toString()); userLongitude = Float.valueOf(userLongitudeTxt.getText().toString()); compass = new Compass(this); compass.adjustArrow(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compass); compass = new Compass(this); compass.arrowView = (ImageView) findViewById(R.id.main_image_hands); userLatitudeTxt = (EditText) findViewById(R.id.Latitude); userLongitudeTxt = (EditText) findViewById(R.id.Longitude); findMyCurrentLocation(); }
@Override public void onCompassPointerRotate(int roseAngle, int needleAngle) { compass.rotateRose(roseAngle); compass.rotateNeedle(needleAngle); }
@Override protected void onStop() { super.onStop(); Log.d(TAG, "stop compass"); compass.stop(); }
@Override protected void onResume() { super.onResume(); compass.start(); }
@Override protected void onPause() { super.onPause(); compass.stop(); }