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
import okhttp3.OkHttpClient
import retrofit2.Retrofit
class ApiClient {
companion object {
fun <T> create(service: Class<T>): T {
val client = OkHttpClient.Builder()
.addInterceptor(CustomInterceptor())
.build()
import okhttp3.Interceptor
import okhttp3.Response
class CustomInterceptor : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val url = chain.request().url().newBuilder()
.addQueryParameter("client_id", "some_id")
.addQueryParameter("client_secret", "some_key")
.build()
val request = chain.request().newBuilder()
@mataku
mataku / pic
Created November 26, 2017 11:55
pic
dependencies {
// 有能なアノテーションが使える
compile 'com.android.support:support-annotations:22.2.0'
// テストのみで使用
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
}
package net.rhythnn.droidsunset
import android.app.Activity
import android.support.test.runner.AndroidJUnit4
import android.support.test.rule.ActivityTestRule
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.Espresso.onData
import android.support.test.espresso.action.ViewActions.click
import android.support.test.espresso.matcher.ViewMatchers.*
import android.support.test.espresso.assertion.ViewAssertions.matches