This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventChannel(getFlutterView(), | |
CHANNEL_PLAYBACK_EVENTS, | |
JSONMethodCodec.INSTANCE) | |
.setStreamHandler( | |
object : EventChannel.StreamHandler { | |
override fun onListen(args: Any?, | |
events: EventChannel.EventSink) { | |
playbackEventSink = events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | |
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewModelFactory(private val mApplication: App, | |
private val irepo: IRepo) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
return when (modelClass) { | |
GVM::class.java -> GVM(irepo) as T | |
VVM::class.java -> VVM(mApplication, irepo) as T | |
AVM::class.java -> AVM(irepo) as T | |
else -> throw IllegalArgumentException("Use standard ViewModelProvider to retrieve this ViewModel") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log | |
import androidx.annotation.MainThread | |
import androidx.annotation.Nullable | |
import com.google.ads.interactivemedia.v3.internal.w | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.MutableLiveData | |
import androidx.lifecycle.Observer | |
import java.util.concurrent.atomic.AtomicBoolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create observer | |
class ActivityLifecycleObserver: LifecycleObserver { | |
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME) | |
fun lifecycleResume() { | |
Log.d(MainActivity.TAG, "$this on resume") | |
} | |
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) | |
fun lifecyclePause() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add to app build file | |
kapt { | |
arguments { | |
arg("room.schemaLocation", "$projectDir/schemas".toString()) | |
} | |
} | |
// set expostSchema to true# | |
...exportSchema = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -sI https://dl.google.com/dl/android/aosp/nakasi-ktu84l-factory-93385880.zip | grep -i Content-Length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.stroeer.androiddevapplicant | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData | |
import androidx.lifecycle.ViewModel | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.launch | |
class WeatherViewModel : ViewModel() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.stroeer.androiddevapplicant | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData | |
import androidx.lifecycle.ViewModel | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.launch | |
class WeatherViewModel : ViewModel() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<title>JS-Flutter Communication</title> | |
<style> | |
.switch { | |
position: relative; | |
display: inline-block; | |
width: 60px; | |
height: 20px; | |
} |