Android Dev Tools is a library that contains various QA/Debug tools to speed up and streamline the development progress.
- Autofill Service
- Analytics Logger
- Http Inspector (Alpha)
- Environment Manager
- Debug Menu
- DeepLink Launcher
- SharedPref Manager
Autofill Service allows developers and QA to fill form inputs automatically with predefined form data.
It observes both activity and fragment lifecycle events via application class to detect layout inflations. After each inflation, it seeks for determined input views in the inflated layout. If it has all required inputs, then shows the autofill action. Autofill data that suitable with inflated form inputs are shown in the selection dialog.
AutofillService.Builder(this)
.withFilePath("autofill.json")
.build()
Configuration Json file can be located in /debug/assets
folder. You can define autofill data by following this structure.
You should also note that the order of the defined form field resource id's and order of input values must match.
{
"forms": [
{
"fields": ["inputEmail", "inputPassword"], // Form input resource id's
"categories": {
"Temporary Users": [
{ "description": "Has more then one order history.", "values": ["test@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["meal@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["dev@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["tools@mail.com", "123456"] }
],
"Test Users": [
{ "description": "Has more then one order history.", "values": ["test@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["meal@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["dev@mail.com", "123456"] },
{ "description": "Has more then one order history.", "values": ["tools@mail.com", "123456"] }
]
}
}
]
}
"com.trendyol.android.devtools:autofill-service:$version"
"com.trendyol.android.devtools:autofill-service-no-op:$version"
Analytics Logger allows to log & inspect analytics events sent by client.
AnalyticsLogger.init(applicationContext)
AnalyticsLogger.report(
key = "eventKey",
value = "{\"category\": \"Cart\", \"data\": \"TestData\" }", // Should be Json string.
platform = "EventPlatform",
)
"com.trendyol.android.devtools:analytics-logger:$version"
"com.trendyol.android.devtools:analytics-logger-no-op:$version"
Http Inspector provides an OkHttp interceptor and web interface to inspect, manipulate in realtime and mock HTTP request and responses.
You can access the web client with http://deviceip:5001
. If you are running on virtual a device, you need to forward port by adb forward tcp:5001 tcp:5001
.
val client = OkHttpClient.Builder()
.addInterceptor(MockInterceptor(context))
.build()
"com.trendyol.android.devtools:http-inspector:$version"
"com.trendyol.android.devtools:http-inspector-no-op:$version"
Environment Manager provides environment selection dialog can be opened from the app notifications with predefined environment data.
"com.trendyol.android.devtools:environment-manager:$version"
Debug Menu provides a debug page build with predefined custom action and events.
"com.trendyol.android.devtools:debug-menu:$version"
DeepLink Launcher allows you, trigger deepLinks, and keep triggered deepLinks in history.
When a deepLink launched, it will be recorded to roomDB. And recorded datas will be listed under the History Tab.
And also you can import your deepLinks data to DeepLink Launcher. They will be listed under the APP'S DEEPLINK tab.
You need to initialize it first
DeepLinkLauncher.init(this)
If you have a deepLink json file which is includes your app deepLinks, you can init them like that. That's an optional area.
DeepLinkLauncher.importAppDeepLinks(jsonString)
For importing external list to DeepLink Launcher, your json format be like that sample:
{
"deepLinks": [
"dl://?Page=Home&Tab=Man",
"dl://?Page=AppLink&Data=1",
"dl://?Page=AppLink&Data=2"
]
}
And just call this function to open DeepLink Launcher screen.
DeepLinkLauncher.show()
"com.trendyol.android.devtools:deeplink-launcher:$version"
SharedPref Manager allows you manage shared preferences
You need to initialize the library with with your android.app.Application
instance.
SharedPrefManager.init(this)
And just call this function to open SharedPref Manager screen.
SharedPrefManager.show("shared_pref_name")
"com.trendyol.android.devtools:sharedpref-manager:$version"
Copyright 2022 Trendyol.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.