update commons to 3.18.6
This commit is contained in:
parent
19a66d7e6e
commit
866803b88f
|
@ -41,7 +41,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.8.8'
|
||||
implementation 'com.simplemobiletools:commons:3.18.6'
|
||||
implementation 'com.squareup:otto:1.3.8'
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import android.view.WindowManager
|
|||
import android.widget.ImageView
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_KOTLIN
|
||||
import com.simplemobiletools.commons.helpers.LICENSE_OTTO
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_CAMERA
|
||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
||||
import com.simplemobiletools.flashlight.BuildConfig
|
||||
import com.simplemobiletools.flashlight.R
|
||||
import com.simplemobiletools.flashlight.extensions.config
|
||||
|
@ -27,7 +27,6 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private var mBus: Bus? = null
|
||||
private var mCameraImpl: MyCameraImpl? = null
|
||||
private var mStoredUseEnglish = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -46,16 +45,10 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
setupStroboscope()
|
||||
storeStateVariables()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredUseEnglish != config.useEnglish) {
|
||||
restartActivity()
|
||||
return
|
||||
}
|
||||
|
||||
mCameraImpl!!.handleCameraSetup()
|
||||
checkState(MyCameraImpl.isFlashlightOn)
|
||||
|
||||
|
@ -82,11 +75,6 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
storeStateVariables()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
mBus!!.unregister(this)
|
||||
|
@ -111,18 +99,12 @@ class MainActivity : SimpleActivity() {
|
|||
return true
|
||||
}
|
||||
|
||||
private fun storeStateVariables() {
|
||||
config.apply {
|
||||
mStoredUseEnglish = useEnglish
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchSettings() {
|
||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
}
|
||||
|
||||
private fun launchAbout() {
|
||||
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_OTTO, BuildConfig.VERSION_NAME)
|
||||
startAboutActivity(R.string.app_name, LICENSE_OTTO, BuildConfig.VERSION_NAME)
|
||||
}
|
||||
|
||||
private fun setupCameraImpl() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.flashlight.activities
|
|||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.extensions.useEnglishToggled
|
||||
import com.simplemobiletools.flashlight.R
|
||||
import com.simplemobiletools.flashlight.extensions.config
|
||||
import kotlinx.android.synthetic.main.activity_settings.*
|
||||
|
@ -38,7 +37,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_use_english_holder.setOnClickListener {
|
||||
settings_use_english.toggle()
|
||||
config.useEnglish = settings_use_english.isChecked
|
||||
useEnglishToggled()
|
||||
System.exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import android.content.Context
|
|||
import android.graphics.SurfaceTexture
|
||||
import android.hardware.Camera
|
||||
import android.os.Handler
|
||||
import com.simplemobiletools.commons.extensions.isMarshmallowPlus
|
||||
import com.simplemobiletools.commons.extensions.isNougatPlus
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
|
||||
import com.simplemobiletools.commons.helpers.isNougatPlus
|
||||
import com.simplemobiletools.flashlight.R
|
||||
import com.simplemobiletools.flashlight.extensions.updateWidgets
|
||||
import com.simplemobiletools.flashlight.models.Events
|
||||
|
@ -26,14 +26,16 @@ class MyCameraImpl(val context: Context) {
|
|||
private var shouldEnableFlashlight = false
|
||||
|
||||
private var marshmallowCamera: MarshmallowCamera? = null
|
||||
@Volatile private var shouldStroboscopeStop = false
|
||||
@Volatile private var isStroboscopeRunning = false
|
||||
@Volatile
|
||||
private var shouldStroboscopeStop = false
|
||||
@Volatile
|
||||
private var isStroboscopeRunning = false
|
||||
|
||||
fun newInstance(context: Context) = MyCameraImpl(context)
|
||||
}
|
||||
|
||||
init {
|
||||
isMarshmallow = context.isMarshmallowPlus()
|
||||
isMarshmallow = isMarshmallowPlus()
|
||||
|
||||
if (bus == null) {
|
||||
bus = BusProvider.instance
|
||||
|
@ -53,7 +55,7 @@ class MyCameraImpl(val context: Context) {
|
|||
disableFlashlight()
|
||||
}
|
||||
|
||||
if (!context.isNougatPlus()) {
|
||||
if (!isNougatPlus()) {
|
||||
if (camera == null) {
|
||||
initCamera()
|
||||
}
|
||||
|
@ -196,7 +198,7 @@ class MyCameraImpl(val context: Context) {
|
|||
shouldStroboscopeStop = false
|
||||
isStroboscopeRunning = true
|
||||
|
||||
if (context.isNougatPlus()) {
|
||||
if (isNougatPlus()) {
|
||||
while (!shouldStroboscopeStop) {
|
||||
try {
|
||||
marshmallowCamera!!.toggleMarshmallowFlashlight(bus!!, true)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.simplemobiletools.flashlight.helpers
|
||||
|
||||
import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
import android.service.quicksettings.Tile
|
||||
import android.service.quicksettings.TileService
|
||||
import android.support.annotation.RequiresApi
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
@TargetApi(Build.VERSION_CODES.N)
|
||||
class MyTileService : TileService() {
|
||||
|
||||
override fun onClick() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.2.21'
|
||||
ext.kotlin_version = '1.2.31'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
|
@ -9,7 +9,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
Loading…
Reference in New Issue