|
1 | 1 | package com.panoramagl.sample |
2 | 2 |
|
| 3 | +import android.annotation.SuppressLint |
3 | 4 | import android.graphics.BitmapFactory |
4 | 5 | import android.os.Bundle |
5 | 6 | import android.os.Handler |
6 | 7 | import android.os.Looper |
| 8 | +import android.util.Log |
7 | 9 | import android.view.MotionEvent |
8 | 10 | import android.widget.Toast |
9 | 11 | import androidx.appcompat.app.AppCompatActivity |
@@ -43,6 +45,30 @@ class MainActivity : AppCompatActivity(), HotSpotListener { |
43 | 45 | changePanorama(0) |
44 | 46 | binding.button1.setOnClickListener { changePanorama(0) } |
45 | 47 | binding.button2.setOnClickListener { changePanorama(1) } |
| 48 | + |
| 49 | + changeTo1() |
| 50 | + } |
| 51 | + |
| 52 | + @SuppressLint("SetTextI18n") |
| 53 | + private fun changeTo1() { |
| 54 | + Handler(Looper.getMainLooper()).postDelayed({ |
| 55 | + count++ |
| 56 | + Log.d("count", count.toString()) |
| 57 | + binding.countView.text = "count= $count" |
| 58 | + changePanorama(1) |
| 59 | + changeTo0() |
| 60 | + }, DELAY) |
| 61 | + } |
| 62 | + |
| 63 | + @SuppressLint("SetTextI18n") |
| 64 | + private fun changeTo0() { |
| 65 | + Handler(Looper.getMainLooper()).postDelayed({ |
| 66 | + count++ |
| 67 | + Log.d("count", count.toString()) |
| 68 | + binding.countView.text = "count= $count" |
| 69 | + changePanorama(0) |
| 70 | + changeTo1() |
| 71 | + }, DELAY) |
46 | 72 | } |
47 | 73 |
|
48 | 74 | override fun onResume() { |
@@ -125,4 +151,9 @@ class MainActivity : AppCompatActivity(), HotSpotListener { |
125 | 151 | override fun onHotspotClick(identifier: Long) { |
126 | 152 | runOnUiThread { Toast.makeText(this@MainActivity, "HotSpotClicked! Id is-> $identifier", Toast.LENGTH_SHORT).show() } |
127 | 153 | } |
| 154 | + |
| 155 | + companion object { |
| 156 | + var count = 0 |
| 157 | + const val DELAY = 700L |
| 158 | + } |
128 | 159 | } |
0 commit comments