Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
Aloha

Quentin Klein quentin7b

🌴
Aloha
View GitHub Profile
@quentin7b
quentin7b / app_build.gradle
Last active Mar 7, 2019
gradle build file for Android
View app_build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "your.app.id"
minSdkVersion 21
@quentin7b
quentin7b / MainActivity.kt
Last active Oct 17, 2019
CAF_Sender_Activity
View MainActivity.kt
package com.github.quentin7b.estimateit
import android.os.Bundle
import android.util.Log
import android.view.Menu
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.MenuItemCompat
import androidx.mediarouter.app.MediaRouteActionProvider
import androidx.mediarouter.media.MediaControlIntent
import androidx.mediarouter.media.MediaRouteSelector
@quentin7b
quentin7b / AndroidManifest.xml
Created Nov 13, 2018
CAF_Sender_Manifest_1
View AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.quentin7b.estimateit">
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.github.quentin7b.estimateit.CastOptionsProvider" />
View CastOptionsProvider.kt
package com.github.quentin7b.estimateit
import android.content.Context
import com.google.android.gms.cast.framework.CastOptions
import com.google.android.gms.cast.framework.OptionsProvider
class CastOptionsProvider : OptionsProvider {
override fun getCastOptions(ctx: Context): CastOptions {
return CastOptions
.Builder()
@quentin7b
quentin7b / build.gradle
Last active Oct 15, 2019
CAF_Sender_build
View build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.quentin7b.estimateit"
@quentin7b
quentin7b / index.html
Last active Oct 16, 2019
CAF_Receiver
View index.html
<!doctype html>
<html>
<head>
<title>Estimate It</title>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<style>
body {
background: white;
color: black;
@quentin7b
quentin7b / TheActivity.kt
Last active Jun 6, 2019
Android ViewModel use LiveData as an Event bus
View TheActivity.kt
class TheActivity : AppCompatActivity() {
private val theSharedViewModel by viewModel<TheSharedViewModel>()
override fun onCreate(savedInstanceState: Bundle?) {
// bla bla bla
theSharedViewModel.getEvent().observe(this, Observer {
Log.i("TheSharedEvent", "Event Triggered")
})
}
@quentin7b
quentin7b / Android_tests.gradle
Last active May 23, 2018
Android build.gradle adds
View Android_tests.gradle
// Root build.gradle
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
// Module build.gradle
@quentin7b
quentin7b / Test_module_build.gradle
Last active Aug 29, 2015
[Robolectric / Jacoco] Test module build.gradle
View Test_module_build.gradle
apply plugin: 'jacoco'
android {
testOptions {
unitTests.returnDefaultValues = true
}
jacoco {
version "0.7.1.201405082137"
}
}
@quentin7b
quentin7b / Test_TestMyObject.java
Last active Aug 29, 2015
[Robolectric / Jacoco] Test Example
View Test_TestMyObject.java
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;