This file contains hidden or 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
| //convert gson String to Map<K, V>. Crash when invalid structure found | |
| inline fun <reified K, reified V> String.toMapByGson(): Map<K, V> = if (isNotEmpty()) { | |
| Gson().fromJson<HashMap<K, V>>(this, TypeToken.getParameterized(HashMap::class.java, K::class.java, V::class.java).type) | |
| } else { | |
| mapOf<K, V>() | |
| } | |
| //convert gson String to List<T>. Crash when invalid structure found | |
| inline fun <reified T> String.toListByGson(): List<T> = if (isNotEmpty()) { | |
| Gson().fromJson<List<T>>(this, TypeToken.getParameterized(ArrayList::class.java, T::class.java).type) |
This file contains hidden or 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
| /** | |
| * persistence property that implements Parcelable on Fragment. | |
| * The set value also write to Fragment.arguments, and always read from Fragment.arguments if need. | |
| */ | |
| class ParcelableProperty<T : Any>(private val defaultValue: T? = null) : kotlin.properties.ReadWriteProperty<Fragment, T> { | |
| var value: T? = null | |
| override operator fun getValue(thisRef: android.support.v4.app.Fragment, property: kotlin.reflect.KProperty<*>): T { | |
| if (value == null) { |
This file contains hidden or 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
| /** | |
| * LiveData that behaviors like as stateless. the set value will be override by null. | |
| * Obervers have soem limit not to detect null-value-to-override as new value. | |
| * | |
| * cited: | |
| * https://github.com/googlesamples/android-architecture/blob/dev-todo-mvvm-live/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/SingleLiveEvent.java | |
| * https://android.jlelse.eu/android-arch-handling-clicks-and-single-actions-in-your-view-model-with-livedata-ab93d54bc9dc | |
| */ | |
This file contains hidden or 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
| /** | |
| * LiveData that ignore current value broadcast when observe. | |
| * Like PulseLiveData(https://gist.github.com/niwatly/3b1ee17f25a63276e36194cd86f9b223), but ActionLiveData holds last value. so, result is defferent when getValue. | |
| * | |
| * cited: | |
| * https://github.com/googlesamples/android-architecture/blob/dev-todo-mvvm-live/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/SingleLiveEvent.java | |
| * https://android.jlelse.eu/android-arch-handling-clicks-and-single-actions-in-your-view-model-with-livedata-ab93d54bc9dc | |
| * | |
| * see also: | |
| * https://qiita.com/KazaKago/items/acce0c1a970441b44f39 |
This file contains hidden or 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
| using System.Linq; | |
| using UnityEngine; | |
| namespace Btf.View | |
| { | |
| public class DynamicScreenView : MonoBehaviour | |
| { | |
| [SerializeField] | |
| [Tooltip("端末サイズに合わせて拡大/縮小したいRectを設定します")] |
This file contains hidden or 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
| copyfluttericons() { | |
| if test $# != 1; then | |
| echo "フォルダを指定してください" | |
| else | |
| flutterIconsFolder=$1 | |
| \mv -f $flutterIconsFolder/*.dart ./lib/resource/icon_resource.dart | |
| \mv -f $flutterIconsFolder/fonts/*.ttf ./fonts/ | |
| \mv -f $flutterIconsFolder/config.json ./fonts/ |
This file contains hidden or 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 'package:collabo_base_app/helper/route_helper.dart'; | |
| import 'package:collabo_base_app/view/space_box.dart'; | |
| import 'package:flutter/cupertino.dart'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:provider/provider.dart'; | |
| import '../app.dart'; | |
| class _TestNotifier = ValueNotifier<int> with Type; |
This file contains hidden or 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 'package:collabo_base_app/common.dart'; | |
| import 'package:flutter/widgets.dart'; | |
| import 'package:is_lock_screen/is_lock_screen.dart'; | |
| import 'package:rxdart/rxdart.dart'; | |
| class AppStateNotifier with WidgetsBindingObserver { | |
| final Subject<AppLifecycleState> _appStateChanged = PublishSubject(); | |
| late Stream<AppLifecycleState> appStateStream; | |
| final CompositeSubscription _compositeSubscription = CompositeSubscription(); |