diff --git a/app/build.gradle b/app/build.gradle index 29478fe..0b3a2c0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,11 +5,11 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 28 + compileSdkVersion 27 defaultConfig { applicationId "com.mindorks.editdrawabletextsample" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -20,15 +20,22 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + buildToolsVersion '27.0.3' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + productFlavors { + } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" - implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' + implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' - implementation 'com.github.MindorksOpenSource:EditDrawableText:0.1.0' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + implementation project(':editdrawabletext') } diff --git a/app/src/main/assets/EditDrawableText.png b/app/src/main/assets/EditDrawableText.png new file mode 100644 index 0000000..ec3ee45 Binary files /dev/null and b/app/src/main/assets/EditDrawableText.png differ diff --git a/editdrawabletext/build.gradle b/editdrawabletext/build.gradle index 44e1831..9834843 100644 --- a/editdrawabletext/build.gradle +++ b/editdrawabletext/build.gradle @@ -2,33 +2,34 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 28 - - - + compileSdkVersion 27 defaultConfig { minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } - buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - + buildToolsVersion '27.0.3' + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + productFlavors { + } } dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - implementation 'com.android.support:appcompat-v7:28.0.0-alpha3' + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support:appcompat-v7:27.1.1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/DrawablePosition.kt b/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/DrawablePosition.kt index ec46909..ecb47d3 100644 --- a/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/DrawablePosition.kt +++ b/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/DrawablePosition.kt @@ -1,8 +1,6 @@ package com.mindorks.editdrawabletext enum class DrawablePosition { - TOP, - BOTTOM, LEFT, RIGHT } \ No newline at end of file diff --git a/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/EditDrawableText.kt b/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/EditDrawableText.kt index b6e9551..d810751 100644 --- a/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/EditDrawableText.kt +++ b/editdrawabletext/src/main/java/com/mindorks/editdrawabletext/EditDrawableText.kt @@ -38,15 +38,7 @@ class EditDrawableText : EditText { if (event.action == MotionEvent.ACTION_DOWN) { positionX = event.x.toInt() positionY = event.y.toInt() - if (drawableBottom != null && drawableBottom!!.bounds.contains(positionX, positionY)) { - onDrawableClickListener!!.onClick(DrawablePosition.BOTTOM) - return super.onTouchEvent(event) - } - - if (drawableTop != null && drawableTop!!.bounds.contains(positionX, positionY)) { - onDrawableClickListener!!.onClick(DrawablePosition.TOP) - return super.onTouchEvent(event) - } + // this works for left since container shares 0,0 origin with bounds if (drawableLeft != null) {