commit 05c50e7acdd3b07e4a3920e0996dbbe5885c2442 Author: rst10h Date: Mon May 10 17:37:27 2021 +0300 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..aaab2f8 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..fcb0704 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,51 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "su.rst10h.inspiry" + minSdkVersion 24 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation project(path: ':app:loopedworld') + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.fragment:fragment-ktx:1.3.3' + implementation 'androidx.activity:activity-ktx:1.2.3' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' +} \ No newline at end of file diff --git a/app/loopedworld/.gitignore b/app/loopedworld/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/loopedworld/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/loopedworld/build.gradle b/app/loopedworld/build.gradle new file mode 100644 index 0000000..80a38b2 --- /dev/null +++ b/app/loopedworld/build.gradle @@ -0,0 +1,48 @@ +plugins { + id 'com.android.library' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + + minSdkVersion 24 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8' + implementation 'com.google.android.material:material:1.3.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + +} \ No newline at end of file diff --git a/app/loopedworld/proguard-rules.pro b/app/loopedworld/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/loopedworld/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/loopedworld/src/androidTest/java/su/rst10h/loopedworld/ExampleInstrumentedTest.kt b/app/loopedworld/src/androidTest/java/su/rst10h/loopedworld/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..0a0e3a7 --- /dev/null +++ b/app/loopedworld/src/androidTest/java/su/rst10h/loopedworld/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package su.rst10h.loopedworld + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("su.rst10h.loopedworld", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/loopedworld/src/main/AndroidManifest.xml b/app/loopedworld/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0f79829 --- /dev/null +++ b/app/loopedworld/src/main/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/java/su/rst10h/loopedworld/HelloSurface.kt b/app/loopedworld/src/main/java/su/rst10h/loopedworld/HelloSurface.kt new file mode 100644 index 0000000..b5576a3 --- /dev/null +++ b/app/loopedworld/src/main/java/su/rst10h/loopedworld/HelloSurface.kt @@ -0,0 +1,229 @@ +package su.rst10h.loopedworld + +import android.content.Context +import android.graphics.* +import android.text.TextPaint +import android.util.AttributeSet +import android.util.Log +import android.view.Surface +import android.view.SurfaceHolder +import android.view.SurfaceView +import kotlinx.coroutines.* +import kotlin.system.measureTimeMillis + + +class HelloSurface : SurfaceView, SurfaceHolder.Callback { + + private var _helloWorldString: String = "" + private var _textSize: Float = 100f + private var _frameNumber: Int = 7 + private lateinit var textPaint: TextPaint + private lateinit var backgroundPaint: Paint + private var textWidth: Float = 0f + private var textHeight: Float = 0f + private var textPositionVertical = 0f + private var frameDelta = 0f + + private var mainJob: Job? = null + private var persistentSurface: Surface? = null + + /** + * The text to draw + */ + var helloWorldString: String + get() = _helloWorldString + set(value) { + _helloWorldString = value + invalidateTextPaintAndMeasurements() + } + + /** + * font Size + */ + var textSize: Float + get() = _textSize + set(value) { + _textSize = value + invalidateTextPaintAndMeasurements() + } + var frameNumber: Int + get() = _frameNumber + set(value) { + _frameNumber = value % 20 + invalidateTextPaintAndMeasurements() + } + + + init { + holder.addCallback(this) + } + + constructor(context: Context) : super(context) { + attrsInit(null, 0) + } + + constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { + attrsInit(attrs, 0) + } + + constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super( + context, + attrs, + defStyle + ) { + attrsInit(attrs, defStyle) + } + + private fun attrsInit(attrs: AttributeSet?, defStyle: Int) { + // Load attributes + val a = context.obtainStyledAttributes( + attrs, R.styleable.TestView, defStyle, 0 + ) + + _helloWorldString = a.getString(R.styleable.TestView_helloString) ?: "Test String" + _textSize = a.getDimension( + R.styleable.TestView_textSize, + textSize + ) + _frameNumber = a.getInteger( + R.styleable.TestView_frameNumber, + frameNumber + ) + a.recycle() + + textPaint = TextPaint().apply { + color = Color.BLACK + flags = Paint.ANTI_ALIAS_FLAG + textAlign = Paint.Align.LEFT + typeface = Typeface.DEFAULT_BOLD + } + backgroundPaint = Paint().apply { + color = Color.RED + } + + invalidateTextPaintAndMeasurements() + } + fun setExternalSurface(surface: Surface) { + persistentSurface = surface + } + + override fun onDraw(canvas: Canvas?) { + super.onDraw(canvas) + if (isInEditMode) + canvas?.let { + drawHello(canvas, _frameNumber) + } + + } + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec) + invalidateTextPaintAndMeasurements() + } + private fun invalidateTextPaintAndMeasurements() { + val textBounds = Rect() + textPaint.let { + it.textSize = textSize + } + textPaint.getTextBounds(helloWorldString, 0, helloWorldString.length, textBounds) + textHeight = textBounds.height()+0f + textWidth = textBounds.width()+0f + } + private fun drawBounds(canvas: Canvas, sx: Int, sy: Int) { + val textBounds = Rect() + textPaint.getTextBounds(helloWorldString, 0, helloWorldString.length, textBounds) + textBounds.right = textPaint.measureText(helloWorldString).toInt() + textBounds.offsetTo(sx, sy-textHeight.toInt()+textPaint.descent().toInt()) + canvas.drawRect(textBounds, backgroundPaint) + } + /** + * todo comment + */ + + fun drawHello(canvas: Canvas, frameNumber: Int) { + + val textSize = canvas.height/20f + textPaint.textSize = textSize + textWidth = textPaint.measureText(helloWorldString) + + textPositionVertical = canvas.height/2f+textSize/2f + frameDelta = (canvas.width+textWidth)/20f + + var xPos = frameNumber*frameDelta-textWidth + + if (isInEditMode) drawBounds(canvas, xPos.toInt(), textPositionVertical.toInt()) + + canvas.drawText( helloWorldString, xPos, textPositionVertical, textPaint) + + } + private fun clearCanvas(canvas: Canvas) { + canvas.drawColor(Color.LTGRAY) + } + + override fun surfaceCreated(holder: SurfaceHolder) { + + mainJob = GlobalScope.launch { + renderLoop() + } + } + @Volatile private var maxFramesRender = 120 + @Volatile private var framesRendered = -1 + + + fun startRecording(maxFrames: Int) { + maxFramesRender = maxFrames + framesRendered++ + } + var onLastFrame : () -> Unit = @Synchronized {} + + fun setOnLastFrameRecordedListener(listener: () -> Unit) { + onLastFrame = listener +} + + private suspend fun renderLoop() { + while(GlobalScope.isActive) { + val timeInMillis = measureTimeMillis { + if (framesRendered>=0) { + render() + framesRendered++ + if (framesRendered>maxFramesRender) { + onLastFrame() + framesRendered = -1 + } + } + preview() + + _frameNumber++ + } + if (_frameNumber >= 20) _frameNumber = 0 + delay(33-timeInMillis) + + } + } + fun render() { + persistentSurface?.let { + val pCanvas = it.lockCanvas(null) + clearCanvas(pCanvas) + synchronized(it) { + drawHello(pCanvas, _frameNumber) + } + it.unlockCanvasAndPost(pCanvas) + } + } + + fun preview() { + val canvas = holder.lockCanvas() + clearCanvas(canvas) + drawHello(canvas, _frameNumber) + holder.unlockCanvasAndPost(canvas) + } + + override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) { + + } + + override fun surfaceDestroyed(holder: SurfaceHolder) { + runBlocking { + mainJob?.cancelAndJoin() + } + } +} diff --git a/app/loopedworld/src/main/java/su/rst10h/loopedworld/TestView.kt b/app/loopedworld/src/main/java/su/rst10h/loopedworld/TestView.kt new file mode 100644 index 0000000..13e9d43 --- /dev/null +++ b/app/loopedworld/src/main/java/su/rst10h/loopedworld/TestView.kt @@ -0,0 +1,141 @@ +package su.rst10h.loopedworld + +import android.content.Context +import android.graphics.Canvas +import android.graphics.Paint +import android.graphics.Typeface +import android.text.TextPaint +import android.util.AttributeSet +import android.util.Log +import android.view.SurfaceView +import android.view.View + +/** + * TODO: document your custom view class. + */ +class TestView : View { + + private var _helloWorldString: String = "" + private var _textSize: Float = 100f // TODO: use a default from R.dimen... + private var _frameNumber: Int = 12 + + private lateinit var textPaint: TextPaint + private var textWidth: Float = 0f + private var textHeight: Float = 0f + private var textPositionVertical = 0f + private var frameDelta = 0f + + /** + * The text to draw + */ + var helloWorldString: String + get() = _helloWorldString + set(value) { + _helloWorldString = value + invalidateTextPaintAndMeasurements() + } + + /** + * font Size + */ + var textSize: Float + get() = _textSize + set(value) { + _textSize = value + invalidateTextPaintAndMeasurements() + } + var frameNumber: Int + get() = _frameNumber + set(value) { + _frameNumber = value + invalidateTextPaintAndMeasurements() + } + constructor(context: Context) : super(context) { + init(null, 0) + } + + constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { + init(attrs, 0) + } + + constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super( + context, + attrs, + defStyle + ) { + init(attrs, defStyle) + } + + private fun init(attrs: AttributeSet?, defStyle: Int) { + // Load attributes + val a = context.obtainStyledAttributes( + attrs, R.styleable.TestView, defStyle, 0 + ) + + _helloWorldString = a.getString(R.styleable.TestView_helloString) ?: "Test String Hello" + _textSize = a.getDimension( + R.styleable.TestView_textSize, + textSize + ) + _frameNumber = a.getInteger( + R.styleable.TestView_frameNumber, + frameNumber + ) + a.recycle() + + textPaint = TextPaint().apply { + flags = Paint.ANTI_ALIAS_FLAG + textAlign = Paint.Align.LEFT + typeface = Typeface.DEFAULT_BOLD + } + + + invalidateTextPaintAndMeasurements() + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec) + invalidateTextPaintAndMeasurements() + } + private fun invalidateTextPaintAndMeasurements() { + textPaint.let { + it.textSize = textSize + textWidth = it.measureText(helloWorldString) + textHeight = it.fontMetrics.bottom + } + invalidate() + } + + /** + * todo commen + */ + private fun drawHelloWorld(canvas: Canvas, frameNumber: Int) { + + textPositionVertical = canvas.height/2f+textHeight + frameDelta = (width+textWidth)/20f + var xPos = frameNumber*frameDelta-textWidth +// if (isInEditMode) { +// xPos = width/2f-textWidth/2f +// } + helloWorldString.let { + canvas.drawText( it, xPos, textPositionVertical, textPaint) + } + } + override fun onDraw(canvas: Canvas) { + + super.onDraw(canvas) + + // TODO: consider storing these as member variables to reduce + + val paddingLeft = paddingLeft + val paddingTop = paddingTop + val paddingRight = paddingRight + val paddingBottom = paddingBottom + + val contentWidth = width - paddingLeft - paddingRight + val contentHeight = height - paddingTop - paddingBottom + + drawHelloWorld(canvas, _frameNumber) + + } +} \ No newline at end of file diff --git a/app/loopedworld/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/loopedworld/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/loopedworld/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/drawable/ic_launcher_background.xml b/app/loopedworld/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/loopedworld/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/loopedworld/src/main/res/layout/sample_test_view.xml b/app/loopedworld/src/main/res/layout/sample_test_view.xml new file mode 100644 index 0000000..a985d44 --- /dev/null +++ b/app/loopedworld/src/main/res/layout/sample_test_view.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/loopedworld/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher.png b/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a571e60 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..61da551 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher.png b/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c41dd28 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..db5080a Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6dba46d Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..da31a87 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..15ac681 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..b216f2d Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f25a419 Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e96783c Binary files /dev/null and b/app/loopedworld/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/loopedworld/src/main/res/values-night/styles.xml b/app/loopedworld/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..294c14c --- /dev/null +++ b/app/loopedworld/src/main/res/values-night/styles.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values-night/themes.xml b/app/loopedworld/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..860243b --- /dev/null +++ b/app/loopedworld/src/main/res/values-night/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values/attrs_test_view.xml b/app/loopedworld/src/main/res/values/attrs_test_view.xml new file mode 100644 index 0000000..33e34e8 --- /dev/null +++ b/app/loopedworld/src/main/res/values/attrs_test_view.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values/colors.xml b/app/loopedworld/src/main/res/values/colors.xml new file mode 100644 index 0000000..66e3f6c --- /dev/null +++ b/app/loopedworld/src/main/res/values/colors.xml @@ -0,0 +1,14 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + #FF29B6F6 + #FF039BE5 + #FFBDBDBD + #FF757575 + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values/strings.xml b/app/loopedworld/src/main/res/values/strings.xml new file mode 100644 index 0000000..bf04f88 --- /dev/null +++ b/app/loopedworld/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + loopedworld + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values/styles.xml b/app/loopedworld/src/main/res/values/styles.xml new file mode 100644 index 0000000..62311c2 --- /dev/null +++ b/app/loopedworld/src/main/res/values/styles.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/loopedworld/src/main/res/values/themes.xml b/app/loopedworld/src/main/res/values/themes.xml new file mode 100644 index 0000000..85026ed --- /dev/null +++ b/app/loopedworld/src/main/res/values/themes.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/app/loopedworld/src/test/java/su/rst10h/loopedworld/ExampleUnitTest.kt b/app/loopedworld/src/test/java/su/rst10h/loopedworld/ExampleUnitTest.kt new file mode 100644 index 0000000..adf1934 --- /dev/null +++ b/app/loopedworld/src/test/java/su/rst10h/loopedworld/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package su.rst10h.loopedworld + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/su/rst10h/inspiry/ExampleInstrumentedTest.kt b/app/src/androidTest/java/su/rst10h/inspiry/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..03bba92 --- /dev/null +++ b/app/src/androidTest/java/su/rst10h/inspiry/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package su.rst10h.inspiry + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("su.rst10h.inspiry", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d9e7b49 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/su/rst10h/inspiry/MainActivity.kt b/app/src/main/java/su/rst10h/inspiry/MainActivity.kt new file mode 100644 index 0000000..59d155f --- /dev/null +++ b/app/src/main/java/su/rst10h/inspiry/MainActivity.kt @@ -0,0 +1,47 @@ +package su.rst10h.inspiry + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.util.Log +import android.widget.Button +import androidx.activity.viewModels +import androidx.appcompat.app.AppCompatDelegate +import su.rst10h.inspiry.data.ActivityState + +import su.rst10h.loopedworld.HelloSurface + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + setContentView(R.layout.activity_main) + val viewModel : MainViewModel by viewModels() + + val btn = findViewById