swarawan/kacang-goreng


Sample library for me to learn how to build my own library. My first library..? Yeaa...!

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.swarawan:kacang-goreng:1.0.2'
	}
	dependencies {
		implementation("com.github.swarawan:kacang-goreng:1.0.2")
	}
	<dependency>
	    <groupId>com.github.swarawan</groupId>
	    <artifactId>kacang-goreng</artifactId>
	    <version>1.0.2</version>
	</dependency>

                            
    libraryDependencies += "com.github.swarawan" % "kacang-goreng" % "1.0.2"
        
        

                            
    :dependencies [[com.github.swarawan/kacang-goreng "1.0.2"]]
        
        

Readme


Simple library for managing font of TextView, Button, and EditText

How to use

Add font on assets folder

Here is my hierarchy of my asset folder

- app
    - java
    - assets
        - font
            - lato
                - Lato-Bold.ttf
                - Lato-Italic.ttf
                - Lato-Regular.ttf
            - notosans
                - NotoSans-Bold.ttf
                - NotoSans-Italic.ttf
                - NotoSans-Regular.ttf
            - roboto
                - Roboto-Bold.ttf
                - Roboto-Italic.ttf
                - Roboto-Regular.ttf
            - zeyada
                - Zeyada.ttf
    - res

String value

Add strings to store font path from assets

<resources>
    <string name="app_name" translatable="false">Kacang Goreng</string>

    <!-- Font path. -->
    <string name="roboto_bold" translatable="false">font/roboto/Roboto-Bold.ttf</string>
    <string name="roboto_italic" translatable="false">font/roboto/Roboto-Italic.ttf</string>
    <string name="roboto_regular" translatable="false">font/roboto/Roboto-Regular.ttf</string>

    <string name="lato_bold" translatable="false">font/lato/Lato-Bold.ttf</string>
    <string name="lato_italic" translatable="false">font/lato/Lato-Italic.ttf</string>
    <string name="lato_regular" translatable="false">font/lato/Lato-Regular.ttf</string>

    <string name="notosans_bold" translatable="false">font/notosans/NotoSans-Bold.ttf</string>
    <string name="notosans_italic" translatable="false">font/notosans/NotoSans-Italic.ttf</string>
    <string name="notosans_regular" translatable="false">font/notosans/NotoSans-Regular.ttf</string>

    <string name="zeyada" translatable="false">font/zeyada/Zeyada.ttf</string>
</resources>

Let's use

    <com.swarawan.lib.TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Sample Noto Sans"
        app:path="@string/zeyada" />