Skip to content

Commit

Permalink
destroy handled
Browse files Browse the repository at this point in the history
  • Loading branch information
milindrc committed Jan 27, 2020
1 parent a51392d commit 09d28fb
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class GyroCardView extends CardView {
private Sensor sensor3;
private float XOffset = 0.7f;
private boolean isVerticalRotationEnabled;
private SensorEventListener2 sensorListener3;

public GyroCardView(@NonNull Context context) {
super(context);
Expand Down Expand Up @@ -137,7 +138,7 @@ public void onAccuracyChanged(Sensor sensor, int i) {
// sensorManager.registerListener(sensorListener, sensor2, SensorManager.SENSOR_DELAY_FASTEST);


sensorManager.registerListener(new SensorEventListener2() {
sensorListener3 = new SensorEventListener2() {
@Override
public void onFlushCompleted(Sensor sensor) {

Expand Down Expand Up @@ -165,12 +166,22 @@ public void onSensorChanged(SensorEvent sensorEvent) {
public void onAccuracyChanged(Sensor sensor, int i) {

}
},sensor3,SensorManager.SENSOR_DELAY_FASTEST);
};
sensorManager.registerListener(sensorListener3,sensor3,SensorManager.SENSOR_DELAY_FASTEST);

}

@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
try{
sensorManager.unregisterListener(sensorListener3);
}catch (Exception e){
e.printStackTrace();
}
}

// @Override
// @Override
// protected boolean getChildStaticTransformation(View child, Transformation t) {
//
// // apply transform to child view - child triggers this call by call to `invalidate()`
Expand Down

0 comments on commit 09d28fb

Please sign in to comment.