import android.util.Log
import android.view.MotionEvent
import android.view.View
+import android.view.ViewConfiguration
import android.view.WindowManager
import android.widget.ImageButton
import android.widget.TextView
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
+import androidx.core.view.InputDeviceCompat
+import androidx.core.view.MotionEventCompat
+import androidx.core.view.ViewConfigurationCompat
+import androidx.core.widget.NestedScrollView
import androidx.preference.PreferenceManager
import jp.sfjp.gokigen.a01c.IShowInformation.operation
import jp.sfjp.gokigen.a01c.liveview.*
import jp.sfjp.gokigen.a01c.preference.PreferenceAccessWrapper
import jp.sfjp.gokigen.a01c.thetacamerawrapper.ThetaCameraController
import jp.sfjp.gokigen.a01c.utils.GestureParser
+import kotlin.math.roundToInt
/**
* メインのActivity
}
}
+ override fun onGenericMotionEvent(ev: MotionEvent?): Boolean
+ {
+ try
+ {
+ if ((ev?.action == MotionEvent.ACTION_SCROLL)&& (ev.isFromSource(InputDeviceCompat.SOURCE_ROTARY_ENCODER)))
+ {
+ // ロータリー入力でスクロールする
+ // Log.v(TAG, "Rotary Encoder Input")
+ val view = findViewById<NestedScrollView>(R.id.main_screen)
+ val delta = -ev.getAxisValue(MotionEventCompat.AXIS_SCROLL) *
+ ViewConfigurationCompat.getScaledVerticalScrollFactor(ViewConfiguration.get(this), this)
+ view.scrollBy(0, delta.roundToInt())
+ return (true)
+ }
+ }
+ catch (e: Exception)
+ {
+ e.printStackTrace()
+ }
+ return (super.onGenericMotionEvent(ev))
+ }
+
/**
* Intentを使ってWiFi設定画面を開く
*
return (packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS))
}
+
/**
* タッチイベントをフックする
*
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:id="@+id/main_screen"
android:padding="@dimen/box_inset_layout_padding"
android:background="@color/black"
android:focusable="true"
android:scrollbars="vertical"
tools:context=".MainActivity"
tools:deviceIds="wear">
-
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="match_parent"
android:layout_width="match_parent"