Comments (8)
-sad- But with given info I can't do anything.
Does the sample from here works with your image ?
from panoramagl.
I load the image from server with coil as bitmap,
and i set it on a view and when it start setting on it, the ui freezes and i cant do anything with the other views
from panoramagl.
this is my code :
`package com.jabama.android.panoramaviewer
import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.BitmapDrawable
import android.hardware.SensorEvent
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isVisible
import androidx.transition.Fade
import androidx.transition.TransitionManager
import androidx.transition.TransitionSet
import coil.ImageLoader
import coil.request.ImageRequest
import com.panoramagl.*
import com.panoramagl.utils.PLUtils
import kotlinx.android.synthetic.main.panorama_viewer.view.*
import kotlinx.coroutines.*
class PanoramaViewer @JvmOverloads constructor(
context: Context,
attributeSet: AttributeSet,
defStyleAttr: Int = 0
) : LinearLayout(context, attributeSet, defStyleAttr) {
private val plManager = PLManager(context)
private val panorama = PLSphericalPanorama()
private lateinit var properties: PanoramaProperties
private var job: Job? = null
init {
View.inflate(context, R.layout.panorama_viewer, this)
setupAttrs(attributeSet, defStyleAttr)
initPanorama()
setupArrowsClick()
}
fun loadImage(bitmap: Bitmap) {
panorama.setImage(PLImage(bitmap, false))
plManager.panorama = panorama
postDelayed({
isLoading(false)
}, 3000)
}
fun loadImage(url: String) {
isLoading(true)
job = CoroutineScope(Dispatchers.IO).launch {
ImageLoader([email protected]).also { loader ->
ImageRequest.Builder([email protected])
.data(url)
.target {
(it as? BitmapDrawable)?.bitmap?.also { bitmap ->
loadImage(bitmap)
}
job = null
}.build().also {
loader.execute(it)
}
}
}
}
/**
* init this in your activity or your fragment for handle touch screen and move camera
*/
fun handleOnTouch(event: MotionEvent?) {
event ?: return
plManager.onTouchEvent(event)
handleScreenOnTouchEvent(event)
}
/**
* if you want use gyroscope sensor for move camera with phone movement use this function
*/
fun handleGyroscope(event: SensorEvent) {
plManager.onSensorChanged(event)
}
fun onConfigurationChanged() {
val display = (context?.getSystemService(Context.WINDOW_SERVICE) as WindowManager)
val rotation = display.defaultDisplay.rotation
val isFullScreen = rotation != 0 && rotation != 2
changePanoramaViewConstraint(isFullScreen)
}
/**
* call these in your view lifecycles
*/
fun onResume() {
plManager.onResume()
}
fun onPause() {
plManager.onPause()
}
override fun onDetachedFromWindow() {
job?.cancel("")
plManager.onDestroy()
super.onDetachedFromWindow()
}
private fun initPanorama() {
plManager.setContentView(panorama_view)
plManager.onCreate()
panorama.camera.lookAt(properties.pitch, properties.raw)
panorama.camera.rotationSensitivity = properties.motionSpeed
if (properties.src != 0) {
panorama.setImage(PLImage(PLUtils.getBitmap(this.context, properties.src), false))
plManager.panorama = panorama
}
}
private fun setupAttrs(attrs: AttributeSet, defStyleAttr: Int) {
context.theme.obtainStyledAttributes(
attrs,
R.styleable.PanoramaViewer,
defStyleAttr,
0
).let {
try {
properties = PanoramaProperties(
motionSpeed = it.getFloat(R.styleable.PanoramaViewer_motionSpeed, 20f),
pitch = it.getFloat(R.styleable.PanoramaViewer_pitch, 5f),
raw = it.getFloat(R.styleable.PanoramaViewer_raw, 0f),
src = it.getResourceId(R.styleable.PanoramaViewer_src, 0)
)
} finally {
it.recycle()
}
}
}
}`
from panoramagl.
Ok, I tried a short smoke test with your code, but
There is too much to do !
Please provide a compile able and running example, otherwise it's too much afford for me
from panoramagl.
ok please test this,
and if you can load o panorama image from server as bitmap and test my issue thanks
`private val plManager = PLManager(context)
private val panorama = PLSphericalPanorama()
private lateinit var properties: PanoramaProperties
private var job: Job? = null
init {
View.inflate(context, R.layout.panorama_viewer, this)
setupAttrs(attributeSet, defStyleAttr)
initPanorama()
setupArrowsClick()
}
fun loadImage(bitmap: Bitmap) {
panorama.setImage(PLImage(bitmap, false))
plManager.panorama = panorama
}
fun loadImage(url: String) {
//TODO please use any library for load image as bitmap and call loadImage(bitmap) for test my issue
}
/**
- call these in your view lifecycles
*/
fun onResume() {
plManager.onResume()
}
fun onPause() {
plManager.onPause()
}
override fun onDetachedFromWindow() {
plManager.onDestroy()
super.onDetachedFromWindow()
}
private fun initPanorama() {
plManager.setContentView(panorama_view)
plManager.onCreate()
panorama.camera.lookAt(properties.pitch, properties.raw)
panorama.camera.rotationSensitivity = properties.motionSpeed
if (properties.src != 0) {
panorama.setImage(PLImage(PLUtils.getBitmap(this.context, properties.src), false))
plManager.panorama = panorama
}
}
private fun setupAttrs(attrs: AttributeSet, defStyleAttr: Int) {
context.theme.obtainStyledAttributes(
attrs,
R.styleable.PanoramaViewer,
defStyleAttr,
0
).let {
try {
properties = PanoramaProperties(
motionSpeed = it.getFloat(R.styleable.PanoramaViewer_motionSpeed, 20f),
pitch = it.getFloat(R.styleable.PanoramaViewer_pitch, 5f),
raw = it.getFloat(R.styleable.PanoramaViewer_raw, 0f),
src = it.getResourceId(R.styleable.PanoramaViewer_src, 0)
)
} finally {
it.recycle()
}
}
}
`
from panoramagl.
Please provide a compile able and running example,
No quick and dirty copy&paste something. I mean eg. a pull request where you transform this sample with your code.
But I can't promise anything. You have to decide, if it makes sense for you to do it, or not ... otherwise please close this issue
from panoramagl.
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!
from panoramagl.
Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.
from panoramagl.
Related Issues (20)
- allow gradle to include lib via JitPack repository dependency HOT 1
- jetpack build error 1.9.0 version HOT 3
- HotSpot not work HOT 13
- Development support HOT 2
- Hotspot on Click HOT 2
- -
- -
- Mark Multiple Hotspot on an event HOT 2
- Panorama Not Moving HOT 1
- Load Image From URI / URL to Panorama HOT 1
- How can I get the image coordinates of touched / clicked place? HOT 3
- Need Documentation For making Some HotSpots on 360 Degree image HOT 2
- How to make auto rotate animation HOT 2
- Problem with hotspot and ray collision HOT 3
- create hotspot with GestureDetector - onLongPress on the Screen HOT 7
- stop continuous scrolling HOT 9
- OutOfMemoryError HOT 3
- 64 bits support HOT 5
- Out of memory error when click next/prev HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panoramagl.