Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ references:

## Cache
cache_key: &cache_key
key: cache-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: cache-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}-{{ checksum "buildSrc/src/main/kotlin/Versions.kt" }}
restore_cache: &restore_cache
restore_cache:
<<: *cache_key
Expand Down
159 changes: 0 additions & 159 deletions app/build.gradle

This file was deleted.

127 changes: 127 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import io.gitlab.arturbosch.detekt.extensions.DetektExtension

plugins {
id("com.android.application")
id("io.gitlab.arturbosch.detekt").version(Versions.DETEKT)
kotlin("android")
kotlin("android.extensions")
}

apply(from = "checkstyle/checkstyle.gradle")
apply(from = "./jacoco.gradle")

// val STORE_PASSWORD = System.getenv("PROJECT_NAME_STORE_PASSWORD")
// val KEY_ALIAS = System.getenv("PROJECT_NAME_KEY_ALIAS")
// val KEY_PASSWORD = System.getenv("PROJECT_NAME_KEY_PASSWORD")

detekt {
toolVersion = Versions.DETEKT
input = files("src/main/java")
filters = ".*/resources/.*,.*/build/.*"
}

android {
compileSdkVersion(Versions.TARGET_SDK_VERSION)
buildToolsVersion(Versions.BUILD_TOOLS_VERSION)

defaultConfig {
minSdkVersion(Versions.MIN_SDK_VERSION)
targetSdkVersion(Versions.TARGET_SDK_VERSION)

applicationId = "com.flatstack.android"
versionCode = 1
versionName = "0.9.1"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}

flavorDimensions("environment")

signingConfigs {
getByName("debug") {
storeFile = file("$rootDir/debug.jks")
storePassword = "12345678"
keyAlias = "debug"
keyPassword = "12345678"
}
create("release") {
// storeFile file("$rootDir/project_name.jks")
// storePassword STORE_PASSWORD
// keyAlias KEY_ALIAS
// keyPassword KEY_PASSWORD
}
}

productFlavors {
create("staging") {
buildConfigField("String", "API_URL", "\"https://example-staging.com\"")
applicationIdSuffix = ".staging"
setDimension("environment")
}

create("production") {
buildConfigField("String", "API_URL", "\"https://example.com\"")
setDimension("environment")
}
}

buildTypes {
getByName("debug") {
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
isUseProguard = true
// signingConfig = signingConfigs.getByName("release")
proguardFiles(getDefaultProguardFile ("proguard-android.txt"), "proguard-rules.pro")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
setTargetCompatibility(JavaVersion.VERSION_1_8)
}

dexOptions {
preDexLibraries = true
}

packagingOptions {
exclude("META-INF/LICENSE")
exclude("META-INF/NOTICE")
exclude("META-INF/services/javax.annotation.processing.Processor")
}

lintOptions {
textReport = true
textOutput("stdout")
setLintConfig(file("$projectDir/lint.xml"))
setWarningsAsErrors(true)
}

configurations.all {
resolutionStrategy.force(Libs.SUPPORT_ANNOTATIONS)
}
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.KOTLIN}")
implementation(Libs.APPCOMPATV7)
implementation(Libs.RECYCLER_VIEW)
implementation(Libs.RX_JAVA)
implementation(Libs.RX_ANDROID)

implementation("com.google.code.gson:gson:2.4")
implementation("com.github.bumptech.glide:glide:3.7.0")

testImplementation(Libs.JUNIT)
testImplementation(Libs.ASSERTJ)
testImplementation(Libs.SUPPORT_ANNOTATIONS)
}


apply(from = "quality.gradle")
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package com.flatstack.android.mainscreen
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.ImageView
import butterknife.BindView

import com.bumptech.glide.Glide
import com.flatstack.android.R
Expand All @@ -16,12 +14,10 @@ class MainFragment : BaseFragment() {
override val layoutRes: Int
get() = R.layout.fragment_main

@BindView(R.id.ivImage) internal lateinit var uiImage: ImageView

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@BindView(R.id.btnButton) internal lateinit var uiButton: Button

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val uiImage = view.findViewById<ImageView>(R.id.ivImage)
uiImage.setOnClickListener {
fragmentManager?.let {
TestDialog.show("Example Hello", "Ublyudok, mat' tvoyu, a nu idi syuda, govno" +
Expand All @@ -30,7 +26,7 @@ class MainFragment : BaseFragment() {
}
}

uiButton.setOnClickListener {
view.findViewById<View>(R.id.btnButton).setOnClickListener {
startActivity(Intent(activity, SecondActivity::class.java))
}

Expand Down
27 changes: 11 additions & 16 deletions app/src/main/java/com/flatstack/android/mainscreen/TestDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ import android.os.Bundle
import android.support.v4.app.FragmentManager
import android.view.View
import android.widget.TextView
import butterknife.BindView

import com.flatstack.android.R
import com.flatstack.android.utils.ui.BaseDialogFragment

class TestDialog : BaseDialogFragment() {
@BindView(R.id.dialog_title) internal lateinit var uiTitle: TextView
@BindView(R.id.dialog_message) internal lateinit var uiMessage: TextView

private var title: String? = null
private var message: String? = null

Expand All @@ -28,8 +24,8 @@ class TestDialog : BaseDialogFragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
uiTitle.text = title
uiMessage.text = message
view.findViewById<TextView>(R.id.dialog_title).text = title
view.findViewById<TextView>(R.id.dialog_message).text = message
}

companion object {
Expand All @@ -38,17 +34,16 @@ class TestDialog : BaseDialogFragment() {
private const val KEY_MESSAGE = "dialogMessage"

fun show(
title: String?,
message: String?,
fm: FragmentManager
title: String?,
message: String?,
fm: FragmentManager
) {

val dialog = TestDialog()

val args = Bundle()
args.putString(KEY_TITLE, title ?: "")
args.putString(KEY_MESSAGE, message ?: "")
dialog.arguments = args
val dialog = TestDialog().apply {
arguments = Bundle().apply {
putString(KEY_TITLE, title ?: "")
putString(KEY_MESSAGE, message ?: "")
}
}

dialog.show(fm, TestDialog::class.java.name)
}
Expand Down
Loading