@@ -38,44 +38,72 @@ Autofill data that suitable with inflated form inputs are shown in the selection
38
38
</table >
39
39
40
40
### Usage
41
- ``` kotlin
42
- AutofillService .Builder (this )
43
- .withFilePath(" autofill.json" )
44
- .build()
41
+ Autofill will automatically started if added as dependency. It checks ` autofill.json ` file on assets directory of the
42
+ project. If you want to disable Autofill to be initialized, you can modify ` AndroidManifest.xml ` like below on ` main ` or
43
+ desired flavor/variant.
44
+
45
+ ``` xml
46
+ <?xml version =" 1.0" encoding =" utf-8" ?>
47
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
48
+ xmlns : tools =" http://schemas.android.com/tools" >
49
+
50
+ <application >
51
+
52
+ <provider
53
+ android : name =" androidx.startup.InitializationProvider"
54
+ android : authorities =" ${applicationId}.androidx-startup"
55
+ tools : node =" remove" >
56
+
57
+ <meta-data
58
+ android : name =" com.trendyol.android.devtools.autofillservice.AutofillInitializer"
59
+ android : value =" androidx.startup" />
60
+ </provider >
61
+ </application >
62
+ </manifest >
45
63
```
46
64
47
65
### Configuration
48
- Configuration Json file can be located in ` /debug/assets ` folder. You can define autofill data by following this structure.
49
- You should also note that the order of the defined form field resource id's and order of input values must match.
66
+ Configuration Json file can be located in ` /[variant/flavor or main]/assets ` folder. You can define autofill data by
67
+ following this structure. You should also note that the order of the defined form field resource id's and order of
68
+ input values must match.
69
+
50
70
``` json
51
71
{
52
72
"forms" : [
53
73
{
54
- "fields" : [" inputEmail" , " inputPassword" ], // Form input resource id's
74
+ "fields" : [" inputEmail" , " inputPassword" ],
75
+ "matchAnyField" : true ,
55
76
"categories" : {
56
77
"Temporary Users" : [
57
- { "description" : " Has more then one order history." , "values" : [" test@mail.com" , " 123456" ] },
58
- { "description" : " Has more then one order history." , "values" : [" meal@mail.com" , " 123456" ] },
59
- { "description" : " Has more then one order history." , "values" : [" dev@mail.com" , " 123456" ] },
60
- { "description" : " Has more then one order history." , "values" : [" tools@mail.com" , " 123456" ] }
78
+ { "description" : " Temporary test user." , "values" : [" test@mail.com" , " 123456" ] },
79
+ { "description" : " Temporary tool user." , "values" : [" tools@mail.com" , " 123456" ] }
61
80
],
62
81
"Test Users" : [
63
- { "description" : " Has more then one order history." , "values" : [" test@mail.com" , " 123456" ] },
64
- { "description" : " Has more then one order history." , "values" : [" meal@mail.com" , " 123456" ] },
65
- { "description" : " Has more then one order history." , "values" : [" dev@mail.com" , " 123456" ] },
66
- { "description" : " Has more then one order history." , "values" : [" tools@mail.com" , " 123456" ] }
82
+ { "description" : " Test regular user." , "values" : [" test@mail.com" , " 123456" ] },
83
+ { "description" : " Test tool user." , "values" : [" tools@mail.com" , " 123456" ] }
67
84
]
68
85
}
69
86
}
70
87
]
71
88
}
72
89
```
73
90
91
+ - ` forms ` object declares the forms that will be cheched on activity/fragment screen.
92
+ - ` fields ` are input view ids.
93
+ - ` matchAnyField ` is optional flag to enable the feature whether if all ` fields ` should be exist or not. Default is ` false ` .
94
+ - ` categories ` declares inputs, you can provide multiple category and multiple input values.
95
+
74
96
### Setup
75
- ``` gradle
76
- "com.trendyol.android.devtools:autofill-service:$version"
77
- "com.trendyol.android.devtools:autofill-service-no-op:$version"
97
+ Since Autofill not requires any initialization code, all you need to add the dependency on desired variant/flavor like
98
+ below.
99
+
100
+ ``` kotlin
101
+ dependencies {
102
+
103
+ debugImplementation(" com.trendyol.android.devtools:autofill-service:$version " )
104
+ }
78
105
```
106
+
79
107
![ Maven Central] ( https://img.shields.io/maven-central/v/com.trendyol.android.devtools/autofill-service?color=%2373c248 )
80
108
81
109
## Analytics Logger
0 commit comments