-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
Batu Tasvaluan edited this page May 14, 2020
·
6 revisions
This chapter would show you how to setup BubbleMock. If you DO NOT want to support changing mock response through Bubble in run time, you just have to do these first three steps.
implementation 'com.github.Dcard:BubbleMock:0.0.7'
- You can init MockBubbleManager in your Application class.
-
MyMockSource
, inherited fromMockSource
, would setup all the mock model.
class DcardApplication : Application() {
override fun onCreate() {
super.onCreate()
MockBubbleManager.init(MyMockSource())
}
}
val mockInterceptor = BubbleMockInterceptor(
isEnable = true
)
Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create(Gson()))
.baseUrl(BASE_URL)
.client(
OkHttpClient.Builder()
.addInterceptor(mockInterceptor)
.build()
)
.build()
If you don't want to support changing mock response through Bubble in run time, you just have to do these first three steps.
- You have to implement your
AppTheme.NoActionBar
style, or just useAppTheme
is fine as well.
<activity
android:name="tw.dcard.bubblemock.sample.screen.BubbleActivity"
android:allowEmbedded="true"
android:documentLaunchMode="always"
android:resizeableActivity="true"
android:theme="@style/AppTheme.NoActionBar"
tools:ignore="UnusedAttribute" />
class YourActivity: AppCompatActivity(){
override fun onCreate(savedInstanceState: Bundle?) {
MockBubbleManager.getInstance().launchBubble(
activity = this,
isEnable = true
)
}
}
- Right now you can prepare you mock model. check out Mock Model Chapter.
- If you want to know how to use Bubble Interface, check out Bubble Chapter