- basic build.gradle directory using flatDir
 
repositories {
    mavenCentral()
    flatDir {
 dirs 'libs'| fun TextView.setHtmlText(text: String) { | |
| val formattedText = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | |
| Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY) | |
| } else { | |
| Html.fromHtml(text) | |
| } | |
| setText(formattedText, TextView.BufferType.SPANNABLE) | |
| movementMethod = LinkMovementMethod.getInstance() | |
| } | 
| class Optional<out M>(val data: M?) | |
| @Dao | |
| interface PatientDao { | |
| @Query("SELECT * FROM $patientTableName LIMIT 1") | |
| fun getFirst(): Maybe<User> | |
| } | 
| # Update, upgrade and install development tools: | |
| apt-get update | |
| apt-get -y upgrade | |
| apt-get -y install build-essential | |
| apt-get -y install git-core | |
| # Install rbenv | |
| git clone git://github.com/rbenv/rbenv.git /opt/rbenv | |
| # Add rbenv to the path: | 
| stages: | |
| - build | |
| - test | |
| - deploy | |
| variables: | |
| GIT_STRATEGY: clone | |
| cache: | |
| key: ${CI_PROJECT_ID} | 
| stages: | |
| - build | |
| - test | |
| cache: | |
| key: ${CI_PROJECT_ID} | |
| paths: | |
| - .gradle/ | |
| before_script: | 
| fun uploadFile(user: User, avatarPath: String, mimeType: String): Observable<Answer<Any>> { | |
| val avatarFile = File(avatarPath) | |
| val requestFile = RequestBody.create(MediaType.parse(mimeType.toLowerCase()), avatarFile) | |
| val body = MultipartBody.Part.createFormData("file", avatarFile.name, requestFile) | |
| return service.uploadFile(user.id, body) // Service is an instance created by retrofit with Service.kt | |
| } | 
| # Show back arrow on actionBar/toolbar | |
| supportActionBar?.setDisplayHomeAsUpEnabled(true) | 
| #!/usr/bin/env bash | |
| # | |
| # Install required dependencies with android command | |
| # | |
| for DEP in android-25 \ | |
| build-tools-25.0.2 \ | |
| tool \ | |
| extra-android-m2repository \ | |
| extra-android-support \ | 
| class AndroidDevice(val activity: AppCompatActivity) { | |
| /** | |
| * Source: http://stackoverflow.com/a/22174245/273119 | |
| */ | |
| fun readLogFile(): String { | |
| val fullName = "appLog.log" | |
| val file = File(activity.cacheDir, fullName) | |
| val pid = android.os.Process.myPid().toString() |