Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c167f7ab authored by Mark Harman's avatar Mark Harman
Browse files

MainUI.onOrientationChanged() only needed if lock_to_landscape==true.

parent 41096d3f
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -466,7 +466,9 @@ public class MainActivity extends AppCompatActivity {
        // initialise state of on-screen icons
        mainUI.updateOnScreenIcons();

        // listen for orientation event change
        if( MainActivity.lock_to_landscape ) {
            // listen for orientation event change (only required if lock_to_landscape==true
            // (MainUI.onOrientationChanged() does nothing if lock_to_landscape==false)
            orientationEventListener = new OrientationEventListener(this) {
                @Override
                public void onOrientationChanged(int orientation) {
@@ -475,6 +477,7 @@ public class MainActivity extends AppCompatActivity {
            };
            if( MyDebug.LOG )
                Log.d(TAG, "onCreate: time after setting orientation event listener: " + (System.currentTimeMillis() - debug_time));
        }

        layoutChangeListener = new View.OnLayoutChangeListener() {
            @Override
@@ -1466,7 +1469,9 @@ public class MainActivity extends AppCompatActivity {

        mSensorManager.registerListener(accelerometerListener, mSensorAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
        magneticSensor.registerMagneticListener(mSensorManager);
        if( orientationEventListener != null ) {
            orientationEventListener.enable();
        }
        getWindow().getDecorView().addOnLayoutChangeListener(layoutChangeListener);

        // if BLE remote control is enabled, then start the background BLE service
@@ -1600,7 +1605,9 @@ public class MainActivity extends AppCompatActivity {
        unregisterDisplayListener();
        mSensorManager.unregisterListener(accelerometerListener);
        magneticSensor.unregisterMagneticListener(mSensorManager);
        if( orientationEventListener != null ) {
            orientationEventListener.disable();
        }
        getWindow().getDecorView().removeOnLayoutChangeListener(layoutChangeListener);
        bluetoothRemoteControl.stopRemoteControl();
        freeAudioListener(false);