Skip to content

Commit

Permalink
Launched Alpha02
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-manshu committed Oct 7, 2020
1 parent 0fe381e commit 271ea33
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation project(":sticker")

// implementation project(":sticker")
implementation 'com.gappein:sticker:1.0.0-alpha1'
}
9 changes: 4 additions & 5 deletions app/src/main/java/com/gappein/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ class MainActivity : AppCompatActivity() {


override fun afterTextChanged(s: Editable?) {
if (s.toString().length < 20) {
// stickerView.updateText(s.toString())
background.setImageBitmap(
stickerView.generateSticker(s.toString())
)
}
background.setImageBitmap(
stickerView.generateSticker(s.toString())
)
}

}
)
}
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
108 changes: 107 additions & 1 deletion sticker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

ext {
bintrayRepo = 'Gappein'
bintrayName = 'Gappein-Sticker-SDK'
org = 'gappein'

publishedGroupId = 'com.gappein'
libraryName = 'Gappein-Sticker-SDK'
artifact = 'sticker'
libraryDescription = 'A Sticker SDK!'

siteUrl = 'https://www.gappein.com/'
gitUrl = 'https://github.com/Gappein/Gappein-Sticker-SDK.git'

libraryVersion = '1.0.0-alpha2'

developerId = 'hi-manshu'
developerName = 'Himanshu Singh'
developerEmail = 'hello2himanshusingh@gmail.com'

licenseName = 'MIT License'
licenseUrl = 'https://opensource.org/licenses/MIT'
allLicenses = ["MIT"]
}

android {
compileSdkVersion 30
Expand All @@ -10,7 +36,7 @@ android {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionName "1.0.0-alpha2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
Expand All @@ -22,8 +48,88 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}


kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
version = libraryVersion
group = publishedGroupId

install {
repositories.mavenInstaller {
pom.project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact

name libraryName
description libraryDescription
url siteUrl

licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

artifacts {
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
userOrg = org
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
dryRun = false
publish = true
override = false
publicDownloadNumbers = true
version {
desc = libraryDescription
}
}
}


dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand Down
6 changes: 5 additions & 1 deletion sticker/src/main/java/com/gappein/ui/StickerView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class StickerView : AppCompatTextView {
updateShadowColor()
}

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
setMeasuredDimension(measuredWidth, measuredHeight)
}

fun updateText(text: String) {
layoutParams = ViewGroup.LayoutParams(measuredWidth, measuredHeight)
if (text.contains(DEFAULT_TEXT)) {
Expand All @@ -76,7 +81,6 @@ class StickerView : AppCompatTextView {
}
}


override fun invalidate() {
if (_isDrawing) return
super.invalidate()
Expand Down

0 comments on commit 271ea33

Please sign in to comment.