Skip to content

Instantly share code, notes, and snippets.

View mataku's full-sized avatar
🍊
one of NICOLE FUJITA fans

Takuma Homma mataku

🍊
one of NICOLE FUJITA fans
View GitHub Profile
@mataku
mataku / AndroidManifest.xml
Last active August 26, 2019 02:50
On demand
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
package="com.mataku.amazingapp.feature.ondemandfeature">
<dist:module
dist:instant="false"
dist:onDemand="true"
dist:title="@string/module_title">
<dist:fusing dist:include="true" />
</dist:module>
@mataku
mataku / ActivityList.kt
Last active July 11, 2019 11:32
マルチモジュール構成での画面クラス名の名前解決
// startActivity(ActivityList.Main.toIntent()) で遷移
object ActivityList {
const val BASE_PACKAGE_NAME = "com.mataku.amazing"
object Main : MatakuActivity {
override val className: String
get() = "$BASE_PACKAGE_NAME.app.ui.activity.MainActivity"
}
class ApiErrorHandler(val context: Context?) {
fun handle(throwable: Throwable) {
// レスポンスコードとエラーレスポンスの中身をパースしてユーザにエラー内容を伝えるためのなにかをする
if (throwable is HttpException) {
...
}
}
}
import retrofit2.Response
class ApiErrorHandler(val context: Context?) {
fun handle(response: Response) {
// レスポンスコードとエラーレスポンスの中身をパースしてユーザにエラー内容を伝えるためのなにかをする
}
}
@mataku
mataku / build.gradle
Created February 17, 2019 14:46
medium で使う
buildTypes {
test {
buildConfigField "String", "HOST", "\"${System.getenv('SUBDOMAIN')}.mataku.com\""
debuggable true
applicationIdSuffix '.dev'
}
}
@mataku
mataku / build.gradle
Last active February 17, 2019 14:42
medium で使う
buildTypes {
test-a {
buildConfigField "String", "HOST", "\"test-a.mataku.com\""
debuggable true
applicationIdSuffix '.dev'
}
test-b {
buildConfigField "String", "HOST", "\"test-b.mataku.com\""
debuggable true

基本

docker info    # イメージやコンテナ, ユーザ情報などの表示

コンテナの起動

docker run [OPTIONS] IMAGE_NAME:TAG [COMMAND] [ARGUMENTS]

# e.g. my_alpine というホスト名で alpine:3.8 を起動し, sh のプロセスを立ち上げる
import android.arch.lifecycle.ViewModel
import com.mataku.scrobscrob.app.model.entity.Artist
import com.mataku.scrobscrob.app.model.entity.Album
class MusicContentViewModel : ViewModel() {
var artists = mutableListOf<Artist>()
var albums = mutableListOf<Album>()
}
android_permissions_checker.check(
apk: '/path/to/apk',
permission_list_file: '/path/to/generated_permission_list'
)
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<android.support.constraint.ConstraintLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >