Browse Source

Update for new developer preview.

master
Robert Jacob 1 year ago
parent
commit
274f2d87df

+ 5
- 5
app/build.gradle View File

@@ -24,12 +24,12 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compileOnly 'com.google.android.things:androidthings:+'
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compileOnly 'com.google.android.things:androidthings:0.8-devpreview'
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

+ 4
- 3
app/src/main/java/de/hacknology/spaceui/MainActivity.kt View File

@@ -4,9 +4,8 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.util.Log
import android.view.MotionEvent
import com.google.android.things.device.ScreenManager
import android.view.WindowManager

class MainActivity : Activity() {

@@ -20,7 +19,9 @@ class MainActivity : Activity() {
override fun onResume() {
super.onResume()

ScreenManager.getInstance(0).setBrightness(255)
val lp = window.attributes
lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL
window.attributes = lp

resetScreenTimeout()
}

+ 8
- 5
app/src/main/java/de/hacknology/spaceui/ScreensaverActivity.kt View File

@@ -3,23 +3,26 @@ package de.hacknology.spaceui
import android.app.Activity
import android.os.Bundle
import android.view.MotionEvent
import com.google.android.things.device.ScreenManager
import android.view.WindowManager

class ScreensaverActivity : Activity() {

private val screenManager = ScreenManager.getInstance(0)
class ScreensaverActivity : Activity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_screensaver)

screenManager.setBrightness(0)
val lp = window.attributes
lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF
window.attributes = lp
}

override fun onPause() {
super.onPause()

screenManager.setBrightness(255)
val lp = window.attributes
lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL
window.attributes = lp
}

override fun onTouchEvent(event: MotionEvent?): Boolean {

+ 2
- 2
build.gradle View File

@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.31'
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong

Loading…
Cancel
Save