-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from geekkoz/feature/add_support_for_generate_…
…android_fonts_files Add support to generate android fonts xml files
- Loading branch information
Showing
5 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.commit451.resourcespoet | ||
|
||
/** | ||
* Represents an Android Font | ||
* See <a https:></a>//developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml">https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml | ||
*/ | ||
data class FontFamily | ||
/** | ||
* Construct a Font family | ||
* @param fontStyle the font style | ||
* @param fontWeight the font weight value | ||
* @param font reference to the font file | ||
*/ | ||
(val fontStyle: String, val fontWeight: String, val font: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.commit451.resourcespoet | ||
|
||
import org.junit.Test | ||
|
||
/** | ||
* Tests the font resource creation | ||
*/ | ||
class FontsTest { | ||
|
||
@Test | ||
fun styleTest() { | ||
val poet = ResourcesPoet.create(elementType = ResourcesPoet.Companion.ELEMENT.FONT_FAMILIES) | ||
.addFontFamily(FontFamily("normal", "400", "@font/lobster_regular")) | ||
TestUtil.assertEquals("fonts.xml", poet) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<font-family xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<font android:font="@font/lobster_regular" android:fontStyle="normal" android:fontWeight="400"/> | ||
</font-family> |