diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index b3cb4c1..7b8011f 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -30,8 +30,15 @@
-
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/java/com/metallic/chiaki/TestStartActivity.kt b/android/app/src/main/java/com/metallic/chiaki/TestStartActivity.kt
index 5bb3849..4392899 100644
--- a/android/app/src/main/java/com/metallic/chiaki/TestStartActivity.kt
+++ b/android/app/src/main/java/com/metallic/chiaki/TestStartActivity.kt
@@ -19,63 +19,30 @@ package com.metallic.chiaki
import android.content.Context
import android.content.Intent
-import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Base64
import android.view.View
-import android.view.ViewAnimationUtils
-import android.view.ViewTreeObserver
-import android.view.animation.AccelerateInterpolator
+import android.view.Window
+import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.edit
import androidx.core.widget.addTextChangedListener
-import com.metallic.chiaki.lib.*
+import com.metallic.chiaki.common.ext.RevealActivity
+import com.metallic.chiaki.lib.ConnectInfo
+import com.metallic.chiaki.lib.ConnectVideoProfile
import com.metallic.chiaki.stream.StreamActivity
import kotlinx.android.synthetic.main.activity_test_start.*
-import kotlin.math.max
-class TestStartActivity : AppCompatActivity()
+class TestStartActivity : AppCompatActivity(), RevealActivity
{
- companion object
- {
- const val EXTRA_REVEAL_X = "reveal_x"
- const val EXTRA_REVEAL_Y = "reveal_y"
- }
-
- private fun revealActivity(x: Float, y: Float)
- {
- val finalRadius = max(rootLayout.width, rootLayout.height).toFloat()
- val reveal = ViewAnimationUtils.createCircularReveal(rootLayout, x.toInt(), y.toInt(), 0f, finalRadius)
- reveal.interpolator = AccelerateInterpolator()
- rootLayout.visibility = View.VISIBLE
- reveal.start()
- }
+ override val revealIntent: Intent get() = intent
+ override val revealRootLayout: View get() = rootLayout
+ override val revealWindow: Window get() = window
override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test_start)
-
- window.setBackgroundDrawableResource(android.R.color.transparent)
-
- if(intent.hasExtra(EXTRA_REVEAL_X) && intent.hasExtra(EXTRA_REVEAL_Y))
- {
- val revealX = intent.getFloatExtra(EXTRA_REVEAL_X, 0.0f)
- val revealY = intent.getFloatExtra(EXTRA_REVEAL_Y, 0.0f)
- rootLayout.visibility = View.INVISIBLE
-
- rootLayout.viewTreeObserver.also {
- if(it.isAlive)
- {
- it.addOnGlobalLayoutListener(object: ViewTreeObserver.OnGlobalLayoutListener {
- override fun onGlobalLayout()
- {
- revealActivity(revealX, revealY)
- rootLayout.viewTreeObserver.removeOnGlobalLayoutListener(this)
- }
- })
- }
- }
- }
+ handleReveal()
val prefs = getPreferences(Context.MODE_PRIVATE)
diff --git a/android/app/src/main/java/com/metallic/chiaki/common/ext/RevealActivity.kt b/android/app/src/main/java/com/metallic/chiaki/common/ext/RevealActivity.kt
new file mode 100644
index 0000000..db4faac
--- /dev/null
+++ b/android/app/src/main/java/com/metallic/chiaki/common/ext/RevealActivity.kt
@@ -0,0 +1,78 @@
+/*
+ * This file is part of Chiaki.
+ *
+ * Chiaki is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chiaki is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chiaki. If not, see .
+ */
+
+package com.metallic.chiaki.common.ext
+
+import android.content.Intent
+import android.graphics.Rect
+import android.view.*
+import android.view.animation.AccelerateInterpolator
+import kotlin.math.max
+
+interface RevealActivity
+{
+ companion object
+ {
+ const val EXTRA_REVEAL_X = "reveal_x"
+ const val EXTRA_REVEAL_Y = "reveal_y"
+ }
+
+ val revealRootLayout: View
+ val revealIntent: Intent
+ val revealWindow: Window
+
+ private fun revealActivity(x: Int, y: Int)
+ {
+ val finalRadius = max(revealRootLayout.width, revealRootLayout.height).toFloat()
+ val reveal = ViewAnimationUtils.createCircularReveal(revealRootLayout, x, y, 0f, finalRadius)
+ reveal.interpolator = AccelerateInterpolator()
+ revealRootLayout.visibility = View.VISIBLE
+ reveal.start()
+ }
+
+ fun handleReveal()
+ {
+ if(!revealIntent.hasExtra(EXTRA_REVEAL_X) || !revealIntent.hasExtra(EXTRA_REVEAL_Y))
+ return
+ revealWindow.setBackgroundDrawableResource(android.R.color.transparent)
+ val revealX = revealIntent.getIntExtra(EXTRA_REVEAL_X, 0)
+ val revealY = revealIntent.getIntExtra(EXTRA_REVEAL_Y, 0)
+ revealRootLayout.visibility = View.INVISIBLE
+
+ revealRootLayout.viewTreeObserver.also {
+ if(it.isAlive)
+ {
+ it.addOnGlobalLayoutListener(object: ViewTreeObserver.OnGlobalLayoutListener {
+ override fun onGlobalLayout()
+ {
+ revealActivity(revealX, revealY)
+ revealRootLayout.viewTreeObserver.removeOnGlobalLayoutListener(this)
+ }
+ })
+ }
+ }
+ }
+}
+
+fun Intent.putRevealExtra(originView: View, rootLayout: ViewGroup)
+{
+ val offsetRect = Rect()
+ originView.getDrawingRect(offsetRect)
+ rootLayout.offsetDescendantRectToMyCoords(originView, offsetRect)
+ putExtra(RevealActivity.EXTRA_REVEAL_X, offsetRect.left)
+ putExtra(RevealActivity.EXTRA_REVEAL_Y, offsetRect.top)
+}
diff --git a/android/app/src/main/java/com/metallic/chiaki/main/FloatingActionButtonSpeedDialBehavior.kt b/android/app/src/main/java/com/metallic/chiaki/main/FloatingActionButtonSpeedDialBehavior.kt
index f41bceb..bf9294f 100644
--- a/android/app/src/main/java/com/metallic/chiaki/main/FloatingActionButtonSpeedDialBehavior.kt
+++ b/android/app/src/main/java/com/metallic/chiaki/main/FloatingActionButtonSpeedDialBehavior.kt
@@ -37,6 +37,8 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.transformation.ExpandableTransformationBehavior
import com.metallic.chiaki.R
+// see https://github.com/lcdsmao/ExpandableFABExample
+
class FloatingActionButtonSpeedDialBehavior @JvmOverloads constructor(context: Context? = null, attrs: AttributeSet? = null) : ExpandableTransformationBehavior(context, attrs)
{
companion object
diff --git a/android/app/src/main/java/com/metallic/chiaki/main/MainActivity.kt b/android/app/src/main/java/com/metallic/chiaki/main/MainActivity.kt
index d58f6fd..b98a706 100644
--- a/android/app/src/main/java/com/metallic/chiaki/main/MainActivity.kt
+++ b/android/app/src/main/java/com/metallic/chiaki/main/MainActivity.kt
@@ -21,7 +21,6 @@ import android.app.ActivityOptions
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
-import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
@@ -30,12 +29,14 @@ import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.LinearLayoutManager
import com.metallic.chiaki.R
import com.metallic.chiaki.TestStartActivity
+import com.metallic.chiaki.common.ext.RevealActivity
+import com.metallic.chiaki.common.ext.putRevealExtra
import com.metallic.chiaki.common.getDatabase
import com.metallic.chiaki.common.ext.viewModelFactory
+import com.metallic.chiaki.regist.RegistActivity
import com.metallic.chiaki.settings.SettingsActivity
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.activity_main.*
-import kotlinx.android.synthetic.main.activity_test_start.*
class MainActivity : AppCompatActivity()
{
@@ -63,6 +64,9 @@ class MainActivity : AppCompatActivity()
addManualButton.setOnClickListener { addManualConsole() }
addManualLabelButton.setOnClickListener { addManualConsole() }
+ registerButton.setOnClickListener { showRegistration() }
+ registerLabelButton.setOnClickListener { showRegistration() }
+
viewModel = ViewModelProviders
.of(this, viewModelFactory { MainViewModel(getDatabase(this)) })
.get(MainViewModel::class.java)
@@ -148,13 +152,16 @@ class MainActivity : AppCompatActivity()
private fun addManualConsole()
{
- val parent = addManualButton.parent as View
- val parentParent = parent.parent as View
- val x = addManualButton.x + parent.x + parentParent.x + addManualButton.width * 0.5f
- val y = addManualButton.y + parent.y + parentParent.y + addManualButton.height * 0.5f
Intent(this, TestStartActivity::class.java).also {
- it.putExtra(TestStartActivity.EXTRA_REVEAL_X, x)
- it.putExtra(TestStartActivity.EXTRA_REVEAL_Y, y)
+ it.putRevealExtra(addManualButton, rootLayout)
+ startActivity(it, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
+ }
+ }
+
+ private fun showRegistration()
+ {
+ Intent(this, RegistActivity::class.java).also {
+ it.putRevealExtra(registerButton, rootLayout)
startActivity(it, ActivityOptions.makeSceneTransitionAnimation(this).toBundle())
}
}
diff --git a/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt b/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt
new file mode 100644
index 0000000..fa1f2df
--- /dev/null
+++ b/android/app/src/main/java/com/metallic/chiaki/regist/RegistActivity.kt
@@ -0,0 +1,41 @@
+/*
+ * This file is part of Chiaki.
+ *
+ * Chiaki is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chiaki is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Chiaki. If not, see .
+ */
+
+package com.metallic.chiaki.regist
+
+import android.content.Intent
+import android.os.Bundle
+import android.view.View
+import android.view.Window
+import androidx.appcompat.app.AppCompatActivity
+import com.metallic.chiaki.R
+import com.metallic.chiaki.common.ext.RevealActivity
+import kotlinx.android.synthetic.main.activity_regist.*
+
+class RegistActivity: AppCompatActivity(), RevealActivity
+{
+ override val revealWindow: Window get() = window
+ override val revealIntent: Intent get() = intent
+ override val revealRootLayout: View get() = rootLayout
+
+ override fun onCreate(savedInstanceState: Bundle?)
+ {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_regist)
+ handleReveal()
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/activity_main.xml b/android/app/src/main/res/layout/activity_main.xml
index 7eb10f7..94d5136 100644
--- a/android/app/src/main/res/layout/activity_main.xml
+++ b/android/app/src/main/res/layout/activity_main.xml
@@ -1,5 +1,6 @@
+
+
+
\ No newline at end of file