Home

Awesome

Android-Iconics String Generator

Icons fields generator for Android-Iconics Library

Download

Install

testImplementation 'junit:junit:4.12' // required
testImplementation 'ru.ztrap.iconics:string-generator:1.0.8'

Compatibility

string-generator v1.0.5 compatible with iconics v3.2.x

string-generator v1.0.7 compatible with iconics v4.x.x

string-generator v1.0.8 compatible with iconics v5.x.x

Usage

  1. Create some test-class in test directory
@RunWith(JUnit4::class)
class TestStringGenerator
  1. Make it extends from IconicsStringGenerator
@RunWith(JUnit4::class)
class TestStringGenerator : IconicsStringGenerator
  1. Override field for definition file creation strategy
@RunWith(JUnit4::class)
class TestStringGenerator : IconicsStringGenerator {
    override val fileCreationStrategy: FileCreationStrategy 
        get() = FileCreationStrategy.SAVE_ONLY_CURRENT // or FileCreationStrategy.SAVE_OLD
}
  1. Create @Test-method which will generate fields from your font
@RunWith(JUnit4::class)
class TestStringGenerator : IconicsStringGenerator {
    
    @Test fun generateGoogleMaterial() {
        generateIconsFrom(GoogleMaterial) // or GoogleMaterial.generateIcons()
    }

    override val fileCreationStrategy: FileCreationStrategy 
        get() = FileCreationStrategy.SAVE_ONLY_CURRENT
}
  1. Run test

Optional settings

You can override this fields as you need:

/** @return modifier for mark file as current-version file */
protected open val modifierCurrent: String get() =  "_current_"

/** @return modifier for mark file as old-version file */
protected open val modifierOld: String get() =  "_old_"

/** @return directory path for generated .xml file */
protected open val outputDirectory: String
    get() = "src${File.separator}main${File.separator}res${File.separator}values"

Developed By

License

   Copyright 2018-2020 zTrap

   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.