Skip to content

Commit

Permalink
Merge pull request #119 from hannesa2/HotspotFix
Browse files Browse the repository at this point in the history
Revert "More Kotlin conversions"
  • Loading branch information
hannesa2 authored Oct 16, 2021
2 parents 1b40282 + e273f58 commit 782492c
Show file tree
Hide file tree
Showing 14 changed files with 1,448 additions and 852 deletions.
17 changes: 17 additions & 0 deletions library/src/main/java/com/panoramagl/PLIImage.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* PanoramaGL library
* Version 0.2 beta
* Copyright (c) 2010 Javier Baez <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panoramagl

import android.graphics.Bitmap
Expand Down
17 changes: 17 additions & 0 deletions library/src/main/java/com/panoramagl/PLIObject.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* PanoramaGL library
* Version 0.2 beta
* Copyright (c) 2010 Javier Baez <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panoramagl

import com.panoramagl.structs.PLPosition
Expand Down
17 changes: 17 additions & 0 deletions library/src/main/java/com/panoramagl/PLImage.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* PanoramaGL library
* Version 0.2 beta
* Copyright (c) 2010 Javier Baez <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.panoramagl

import android.graphics.*
Expand Down
8 changes: 5 additions & 3 deletions library/src/main/java/com/panoramagl/PLManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import android.view.*
import android.view.GestureDetector.SimpleOnGestureListener
import android.widget.RelativeLayout
import java.util.ArrayList
import kotlin.math.abs

@Suppress("unused")
open class PLManager(private val context: Context) : PLIView, SensorEventListener, OnDoubleTapListener {
Expand Down Expand Up @@ -1156,7 +1155,10 @@ open class PLManager(private val context: Context) : PLIView, SensorEventListene
sensorManager.unregisterListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION))
}

fun resetWithShake(acceleration: UIAcceleration): Boolean {
/**
* shake methods
*/
fun resetWithShake(acceleration: UIAcceleration?): Boolean {
if (!mIsShakeResetEnabled || !mIsResetEnabled || this.isLocked || isValidForCameraAnimation || mIsValidForTransition) return false
var result = false
val currentTime = System.currentTimeMillis()
Expand All @@ -1165,7 +1167,7 @@ open class PLManager(private val context: Context) : PLIView, SensorEventListene
mShakeData!!.lastTime = currentTime
mShakeData!!.shakePosition.setValues(acceleration)
val speed =
abs(mShakeData!!.shakePosition.x + mShakeData!!.shakePosition.y + mShakeData!!.shakePosition.z - mShakeData!!.shakeLastPosition.x - mShakeData!!.shakeLastPosition.y - mShakeData!!.shakeLastPosition.z) / diffTime * 10000
Math.abs(mShakeData!!.shakePosition.x + mShakeData!!.shakePosition.y + mShakeData!!.shakePosition.z - mShakeData!!.shakeLastPosition.x - mShakeData!!.shakeLastPosition.y - mShakeData!!.shakeLastPosition.z) / diffTime * 10000
if (speed > mShakeThreshold) {
var isNotCancelable = true
if (mListener != null) isNotCancelable = mListener!!.onShouldReset(this)
Expand Down
Loading

0 comments on commit 782492c

Please sign in to comment.