Skip to content

Commit

Permalink
añadiendo primera structura de test
Browse files Browse the repository at this point in the history
  • Loading branch information
luisansal committed Oct 27, 2021
1 parent 3ad5f7a commit b0bbb58
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 8 deletions.
23 changes: 21 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
buildTypes {
debug {
Expand All @@ -33,6 +35,7 @@ android {
buildConfigField "String", "PUSHER_API_CLUSTER", debugPusherApiCluster
buildConfigField "String", "GMAPS_PLACES_HOST", placesMapsUrl
buildConfigField "String", "GMAPS_DIRECTIONS_HOST", directionsMapsUrl
applicationIdSuffix ".debug"
}
release {
minifyEnabled false
Expand All @@ -43,8 +46,22 @@ android {
buildConfigField "String", "GMAPS_PLACES_HOST", placesMapsUrl
buildConfigField "String", "GMAPS_DIRECTIONS_HOST", directionsMapsUrl
signingConfig signingConfigs.releasesignin
applicationIdSuffix ""
}
}

def date = new Date().format('ddMMyyyy')
applicationVariants.all { variant ->

variant.outputs.all {

def buildType = variant.buildType.name
def version = variant.versionName
outputFileName = "androidtesting-${buildType}-${version}-${date}.apk"
}

}

dataBinding {
enabled = true
}
Expand All @@ -63,7 +80,7 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
compileOnly 'com.google.android.wearable:wearable:2.7.0'
def lifecycle_version = "2.2.0"
def room_version = "2.2.5"
def room_version = "2.3.0"
def navigation_version = "2.3.0"
def work_version = "1.0.1"
def paging_version = "2.1.2"
Expand Down Expand Up @@ -114,7 +131,7 @@ dependencies {
//Room components
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version" //agrega funcionalidad de coroutinas
kapt "android.arch.persistence.room:compiler:$room_version"
kapt("androidx.room:room-compiler:$room_version")
//end-Room components

androidTestImplementation "androidx.room:room-testing:$room_version"
Expand Down Expand Up @@ -199,6 +216,8 @@ dependencies {

debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'

//test
androidTestImplementation project(path: ':core', configuration: 'androidTestDependencies')
}
repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"client_info": {
"mobilesdk_app_id": "1:896033508442:android:6a8d1c02b9437eadc81c63",
"android_client_info": {
"package_name": "com.luisansal.jetpack"
"package_name": "com.luisansal.jetpack.debug"
}
},
"oauth_client": [
{
"client_id": "896033508442-3jalru2jog537m3mluvm94ampismno16.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.luisansal.jetpack",
"package_name": "com.luisansal.jetpack.debug",
"certificate_hash": "24c03881d6f74cb0cbc4c7c9696443f104bc133c"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.luisansal.jetpack.features.design

import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProviders
import com.luisansal.jetpack.R
import com.luisansal.jetpack.base.BaseFragment

Expand All @@ -16,4 +16,10 @@ class DesignFragment : BaseFragment() {
viewModel = ViewModelProviders.of(this).get(DesignViewModel::class.java)
}

companion object {
fun newInstance(): DesignFragment {

return DesignFragment();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.luisansal.jetpack.utils

import android.text.InputFilter
import android.text.SpannableString
import android.text.Spanned
import android.text.TextUtils

class AllLowerInputFilter : InputFilter {

override fun filter(source: CharSequence, start: Int, end: Int, dest: Spanned?, dstart: Int, dend: Int): CharSequence? {

for (i in start until end) {
if (source[i].isUpperCase()) {
val v = CharArray(end - start)
TextUtils.getChars(source, start, end, v, 0)
val s = String(v).toLowerCase()

return if (source is Spanned) {
val sp = SpannableString(s)
TextUtils.copySpansFrom(source, start, end, null, sp, 0)
sp
} else {
s
}
}
}

return null // keep original
}
}
33 changes: 33 additions & 0 deletions app/src/main/java/com/luisansal/jetpack/utils/BindingAdapters.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.luisansal.jetpack.utils

import android.text.InputFilter
import android.widget.EditText
import android.widget.ImageView
import androidx.annotation.DrawableRes
import androidx.databinding.BindingAdapter

@BindingAdapter("toLowerCase")
fun toLowerCase(view: EditText, isLowerCase: Boolean?) {
isLowerCase?.let {
if(it){
view.filters = arrayOf<InputFilter>(AllLowerInputFilter())
} else {
view.filters = null
}
}
}

@BindingAdapter("app:loadImage")
fun loadImage(view: ImageView?, @DrawableRes imageId: Int) {
view?.setImageResource(imageId)
}

@BindingAdapter("requestFocus")
fun requestFocus(view: EditText, requestFocus: Boolean?) {
requestFocus?.also {
if (it) {
view.requestFocus()
view.showKeyboard()
}
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/com/luisansal/jetpack/utils/ViewUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ fun View.createBitmapFromView(ctx: Context): Bitmap {
this.layout(this.left, this.top, this.right, this.bottom)
this.draw(canvas)
return bitmap
}

fun View.showKeyboard() {
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include ':app'
include ':core'

0 comments on commit b0bbb58

Please sign in to comment.