Skip to content

Instantly share code, notes, and snippets.

@nakamuuu
nakamuuu / test.html
Created May 29, 2019
openUrl JSブリッジテスト用ページ
View test.html
<head>
<script>
var bridge;
document.addEventListener('WebViewJavascriptBridgeReady', function onBridgeReady(event) {
bridge = event.bridge;
bridge.init(function(message, responseCallback) {});
}, false);
function runCallbackWithBridge(callback) {
@nakamuuu
nakamuuu / wwww.kt
Last active Oct 18, 2018
草の渦
View wwww.kt
import kotlin.math.*
const val size = 15
const val interval = 3
fun main(args: Array<String>) {
val center = Point(size / 2, size / 2)
repeat(size) { y ->
repeat(size) { x ->
val distance = Point(x, y).distance(center)
@nakamuuu
nakamuuu / StateAwareViewModel.kt
Last active Nov 16, 2018
StateAwareViewModel.kt
View StateAwareViewModel.kt
import android.app.Application
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProviders
fun <T : StateAwareViewModel> FragmentActivity.getStateAwareViewModel(
@nakamuuu
nakamuuu / SpinnerDatePickerDialogFragment.kt
Created Dec 19, 2017
SpinnerDatePickerDialogFragment
View SpinnerDatePickerDialogFragment.kt
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatDialogFragment
import android.text.format.DateUtils
import android.view.View
import android.widget.DatePicker
import icepick.Icepick
import icepick.State
@nakamuuu
nakamuuu / InfiniteFragmentStatePagerAdapter.kt
Last active Dec 21, 2019
InfiniteFragmentStatePagerAdapter
View InfiniteFragmentStatePagerAdapter.kt
import android.annotation.SuppressLint
import android.os.Bundle
import android.os.Parcelable
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentTransaction
import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup