https://github.com/trendyol/android-dev-tools
Android QA/Debug tools to speed up and streamline the development progress.
https://github.com/trendyol/android-dev-tools
android-debug-tools android-library autofill-service http-inspection http-interceptor
Last synced: 6 months ago
JSON representation
Android QA/Debug tools to speed up and streamline the development progress.
- Host: GitHub
- URL: https://github.com/trendyol/android-dev-tools
- Owner: Trendyol
- Created: 2021-05-07T10:43:41.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2025-02-24T12:17:37.000Z (10 months ago)
- Last Synced: 2025-03-22T05:33:00.664Z (9 months ago)
- Topics: android-debug-tools, android-library, autofill-service, http-inspection, http-interceptor
- Language: Kotlin
- Homepage:
- Size: 9.64 MB
- Stars: 112
- Watchers: 36
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Android Dev Tools
Android Dev Tools is a library that contains various QA/Debug tools to speed up and streamline the development progress.
[](https://opensource.org/licenses/Apache-2.0)





## Tools ##
* [Autofill Service](#autofill-service)
* [Analytics Logger](#analytics-logger)
* [Http Inspector (Alpha)](#http-inspector-alpha)
* [Environment Manager](#environment-manager)
* [Debug Menu](#debug-menu)
* [DeepLink Launcher](#deeplink-launcher)
* [SharedPref Manager](#sharedpref-manager)
## Autofill Service
Autofill Service allows developers and QA to fill form inputs automatically with predefined form data.
### How it Works?
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.
### Demo
### Usage
Autofill will automatically started if added as dependency. It checks `autofill.json` file on assets directory of the
project. If you want to disable Autofill to be initialized, you can modify `AndroidManifest.xml` like below on `main` or
desired flavor/variant.
```xml
```
### Configuration
Configuration Json file can be located in `/[variant/flavor or main]/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.
```json
{
"forms": [
{
"fields": ["inputEmail", "inputPassword"],
"matchAnyField": true,
"categories": {
"Temporary Users": [
{ "description": "Temporary test user.", "values": ["test@mail.com", "123456"] },
{ "description": "Temporary tool user.", "values": ["tools@mail.com", "123456"] }
],
"Test Users": [
{ "description": "Test regular user.", "values": ["test@mail.com", "123456"] },
{ "description": "Test tool user.", "values": ["tools@mail.com", "123456"] }
]
}
}
]
}
```
- `forms` object declares the forms that will be cheched on activity/fragment screen.
- `fields` are input view ids.
- `matchAnyField` is optional flag to enable the feature whether if all `fields` should be exist or not. Default is `false`.
- `categories` declares inputs, you can provide multiple category and multiple input values.
### Setup
Since Autofill not requires any initialization code, all you need to add the dependency on desired variant/flavor like
below.
```kotlin
dependencies {
debugImplementation("com.trendyol.android.devtools:autofill-service:$version")
}
```

## Analytics Logger
Analytics Logger allows to log & inspect analytics events sent by client.
### Demo
### Usage
```kotlin
AnalyticsLogger.init(applicationContext)
AnalyticsLogger.report(
key = "eventKey",
value = "{\"category\": \"Cart\", \"data\": \"TestData\" }", // Should be Json string.
platform = "EventPlatform",
)
// or
AnalyticsLogger.report(
key = "eventKey",
value = "{\"category\": \"Cart\", \"data\": \"TestData\" }", // Should be Json string.
platform = "EventPlatform",
isSuccess = true, // send your event result
)
```
### Setup
```gradle
"com.trendyol.android.devtools:analytics-logger:$version"
"com.trendyol.android.devtools:analytics-logger-no-op:$version"
```

## Http Inspector (Alpha)
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`.
### How it Works
Any request passing through the interceptor is held in the request queue to sync with each other.
Held requests are being sent to the web interface via Ktor local webserver.
After doing any changes in the response data using web interface, it waits for the acceptance, then sends manipulated response back to the request queue.
The actual response data is replaced with the manipulated one and reflected to the application.
### Mocking Requests
With this feature, we can imitate the API by preparing mock request and response data for the REST API that has not been prepared yet.
It provides a web interface where we can create mock request and response data, and allows us to enable/disable the previously added mock data.
The point to be considered is which requests will be answered with mock data rather than going to the real API is decided by comparing the URL, method and request body data of the request in the real request and mock data. If this data is completely matched, the mock response will be served to the client.
### Usage
```kotlin
val client = OkHttpClient.Builder()
.addInterceptor(MockInterceptor(context))
.build()
```
### Setup
```gradle
"com.trendyol.android.devtools:http-inspector:$version"
"com.trendyol.android.devtools:http-inspector-no-op:$version"
```

## Environment Manager
Environment Manager provides environment selection dialog can be opened from the app notifications with predefined environment data.
### Setup
```gradle
"com.trendyol.android.devtools:environment-manager:$version"
```

## Debug Menu
Debug Menu provides a debug page build with predefined custom action and events.
### Setup
```gradle
"com.trendyol.android.devtools:debug-menu:$version"
```

## DeepLink Launcher(Beta)
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.
### Demo
### Initialize
You need to initialize it first
```kotlin
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.
```kotlin
DeepLinkLauncher.importAppDeepLinks(jsonString)
```
For importing external list to DeepLink Launcher, your json format be like that sample:
```json
{
"deepLinks": [
"dl://?Page=Home&Tab=Man",
"dl://?Page=AppLink&Data=1",
"dl://?Page=AppLink&Data=2"
]
}
```
### Usage
And just call this function to open DeepLink Launcher screen.
```kotlin
DeepLinkLauncher.show()
```
### Setup
```gradle
"com.trendyol.android.devtools:deeplink-launcher:$version"
```

## SharedPref Manager
SharedPref Manager allows you manage shared preferences
### Demo
### Initialize
You need to initialize the library with with your `android.app.Application` instance.
```kotlin
SharedPrefManager.init(this)
```
### Usage
And just call this function to open SharedPref Manager screen.
```kotlin
SharedPrefManager.show("shared_pref_name")
```
### Setup
```gradle
"com.trendyol.android.devtools:sharedpref-manager:$version"
```

License
--------
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.