Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions app/src/main/java/com/panoramagl/sample/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.panoramagl.sample

import android.annotation.SuppressLint
import android.graphics.BitmapFactory
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.MotionEvent
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -43,6 +45,30 @@ class MainActivity : AppCompatActivity(), HotSpotListener {
changePanorama(0)
binding.button1.setOnClickListener { changePanorama(0) }
binding.button2.setOnClickListener { changePanorama(1) }

changeTo1()
}

@SuppressLint("SetTextI18n")
private fun changeTo1() {
Handler(Looper.getMainLooper()).postDelayed({
count++
Log.d("count", count.toString())
binding.countView.text = "count= $count"
changePanorama(1)
changeTo0()
}, DELAY)
}

@SuppressLint("SetTextI18n")
private fun changeTo0() {
Handler(Looper.getMainLooper()).postDelayed({
count++
Log.d("count", count.toString())
binding.countView.text = "count= $count"
changePanorama(0)
changeTo1()
}, DELAY)
}

override fun onResume() {
Expand Down Expand Up @@ -125,4 +151,9 @@ class MainActivity : AppCompatActivity(), HotSpotListener {
override fun onHotspotClick(identifier: Long) {
runOnUiThread { Toast.makeText(this@MainActivity, "HotSpotClicked! Id is-> $identifier", Toast.LENGTH_SHORT).show() }
}

companion object {
var count = 0
const val DELAY = 700L
}
}
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
android:layout_margin="@dimen/activity_horizontal_margin"
android:text="Image 2"
tools:ignore="HardcodedText" />

<TextView
android:id="@+id/countView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="count" />
</LinearLayout>

<RelativeLayout
Expand Down
Loading