This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
234 additions
and
100 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
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 |
---|---|---|
@@ -1,43 +1,13 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
android { | ||
compileSdkVersion 29 | ||
buildToolsVersion "29.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.lockwood.robotospandemo" | ||
minSdkVersion 15 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
applicationIdSuffix ".debug" | ||
minifyEnabled true | ||
shrinkResources true | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
apply from: rootProject.file('gradle/android/app.gradle') | ||
apply from: rootProject.file('gradle/deps.gradle') | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
implementation 'androidx.core:core-ktx:1.2.0' | ||
implementation "com.google.android.material:material:1.2.0-alpha06" | ||
|
||
implementation( | ||
deps.kotlin.stdlib, | ||
deps.android.appcompat, | ||
deps.android.material | ||
) | ||
|
||
implementation project(':font-library') | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/lockwood/fontspandemo/extensions/Attrs.kt
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,30 @@ | ||
package com.lockwood.fontspandemo.extensions | ||
|
||
import android.content.Context | ||
import android.content.res.TypedArray | ||
import android.util.AttributeSet | ||
import androidx.annotation.AttrRes | ||
import androidx.annotation.StyleRes | ||
|
||
internal inline fun fetchAttrs( | ||
context: Context, | ||
attrs: IntArray, | ||
set: AttributeSet? = null, | ||
@AttrRes defStyleAttr: Int = 0, | ||
@StyleRes defStyleRes: Int = 0, | ||
fetch: TypedArray .() -> Unit = {} | ||
) { | ||
val typedArray = context.theme.obtainStyledAttributes( | ||
set, | ||
attrs, | ||
defStyleAttr, | ||
defStyleRes | ||
) | ||
with(typedArray) { | ||
try { | ||
fetch() | ||
} finally { | ||
recycle() | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/lockwood/fontspandemo/extensions/TypedArray.kt
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,24 @@ | ||
package com.lockwood.fontspandemo.extensions | ||
|
||
import android.content.res.TypedArray | ||
import androidx.annotation.ColorInt | ||
|
||
internal fun TypedArray.getStringOrEmpty( | ||
index: Int | ||
): String { | ||
return getString(index) ?: "" | ||
} | ||
|
||
internal fun TypedArray.getTextSizeOrDefault( | ||
index: Int, | ||
default: Int | ||
): Int { | ||
return getDimensionPixelSize(index, default) | ||
} | ||
|
||
internal fun TypedArray.getTextColorOrDefault( | ||
index: Int, | ||
@ColorInt default: Int | ||
): Int { | ||
return getColor(index, default) | ||
} |
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 |
---|---|---|
@@ -1,37 +1,14 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
|
||
group = 'com.github.lndmflngs' | ||
|
||
android { | ||
compileSdkVersion 29 | ||
|
||
defaultConfig { | ||
minSdkVersion 15 | ||
targetSdkVersion 29 | ||
versionCode 1 | ||
versionName "1.0" | ||
consumerProguardFiles 'consumer-rules.pro' | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
} | ||
apply from: rootProject.file('gradle/android/library.gradle') | ||
apply from: rootProject.file('gradle/kotlin/target.gradle') | ||
apply from: rootProject.file('gradle/publish.gradle') | ||
apply from: rootProject.file('gradle/deps.gradle') | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" | ||
implementation "androidx.appcompat:appcompat:1.1.0" | ||
implementation "androidx.core:core-ktx:1.2.0" | ||
api "com.github.lndmflngs:multispan-view:1.0.1" | ||
} | ||
implementation( | ||
deps.kotlin.stdlib, | ||
deps.android.appcompat, | ||
deps.android.ktx | ||
) | ||
|
||
repositories { | ||
mavenCentral() | ||
api deps.lndmflngs.multispan | ||
} |
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
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
30 changes: 30 additions & 0 deletions
30
font-library/src/main/java/com/lockwood/multispan/font/extensions/Attrs.kt
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,30 @@ | ||
package com.lockwood.multispan.font.extensions | ||
|
||
import android.content.Context | ||
import android.content.res.TypedArray | ||
import android.util.AttributeSet | ||
import androidx.annotation.AttrRes | ||
import androidx.annotation.StyleRes | ||
|
||
internal inline fun fetchAttrs( | ||
context: Context, | ||
attrs: IntArray, | ||
set: AttributeSet? = null, | ||
@AttrRes defStyleAttr: Int = 0, | ||
@StyleRes defStyleRes: Int = 0, | ||
fetch: TypedArray .() -> Unit = {} | ||
) { | ||
val typedArray = context.theme.obtainStyledAttributes( | ||
set, | ||
attrs, | ||
defStyleAttr, | ||
defStyleRes | ||
) | ||
with(typedArray) { | ||
try { | ||
fetch() | ||
} finally { | ||
recycle() | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
font-library/src/main/java/com/lockwood/multispan/font/extensions/TypedArray.kt
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,9 @@ | ||
package com.lockwood.multispan.font.extensions | ||
|
||
import android.content.res.TypedArray | ||
|
||
internal fun TypedArray.getStringOrEmpty( | ||
index: Int | ||
): String { | ||
return getString(index) ?: "" | ||
} |
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,3 @@ | ||
apply plugin: 'com.android.application' | ||
apply from: rootProject.file('gradle/android/base.gradle') | ||
apply from: rootProject.file('gradle/android/build.gradle') |
Oops, something went wrong.