Skip to content

Instantly share code, notes, and snippets.

View lukeduncan-scot's full-sized avatar

L Duncan lukeduncan-scot

  • Highlands, Scotland
  • 15:03 (UTC)
View GitHub Profile
@lukeduncan-scot
lukeduncan-scot / Event.kt
Created January 21, 2020 13:59
LiveData Event
/**
* Used as a wrapper for data that is exposed via a LiveData that represents an event.
*/
open class Event<out T>(private val content: T) {
var hasBeenHandled = false
private set // Allow external read but not write
/**
* Returns the content and prevents its use again.
@lukeduncan-scot
lukeduncan-scot / AndroidManifest.xml
Last active November 21, 2018 23:32
Activity that loads a URL into a WebView
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="***">
// This is required
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"