Skip to content

Commit

Permalink
Merge pull request #56 from MakinGiants/develop
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
danielgomezrico committed Aug 2, 2018
2 parents 9eeee65 + 840feaf commit c914bda
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 135 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,4 +1,13 @@
# 1.5.5
- Instant app

# 1.5.4
- Update kotlin to 1.2.51.

# 1.5.2 # 1.5.3
- Update android gradle plugin to 3.x.
- Update kotlin to 1.2.41.
- Update firebase to 15.0.0.
- Sdk to 27
- Update dependencies:
+ Firebase
Expand Down
83 changes: 57 additions & 26 deletions app/build.gradle
Expand Up @@ -2,16 +2,17 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'spoon'
apply plugin: "com.jaredsburrows.spoon"
apply from: '../jacoco.gradle'

def appId = "com.makingiants.android.banjotuner"
def appVersionName = "1.5.3"
def appVersionCode = 112
def appVersionName = "1.5.5"
def appVersionCode = 114


android {
compileSdkVersion setup.targetSdk
buildToolsVersion setup.buildTools
flavorDimensions "default"

defaultConfig {
applicationId appId
Expand All @@ -25,7 +26,7 @@ android {
// Enable just English configs for dependencies, allowing to shrink apk size more
resConfigs "en", "pt"

resValue "string", "ads_unit_id_banner", "$BANJEN_ADS_UNIT_ID_BANNER"
resValue "string", "ads_unit_id_banner", "${System.getenv("BANJEN_ADS_UNIT_ID_BANNER")}"
}

buildTypes {
Expand All @@ -43,10 +44,10 @@ android {

proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

packagingOptions {
exclude 'META-INF/services/org.xmlpull.v1.XmlPullParserFactory'
}
packagingOptions {
exclude 'META-INF/services/org.xmlpull.v1.XmlPullParserFactory'
}

signingConfigs {
Expand All @@ -60,44 +61,74 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
abortOnError false
}


// Build an instant app zip of our single APK. This saves having to create a feature module, an
// instant app module, and a traditional application module just to get an aab and instant zip.
applicationVariants.all { variant ->
variant.outputs.all { output ->
if (output.outputFile.name.endsWith('.apk')) {
def zipInstant = tasks.create("zipInstant${variant.name.capitalize()}", Zip) {
from(output.outputFile)
archiveName = "instant-${output.name}.zip"
destinationDir = output.outputFile.parentFile
}
zipInstant.dependsOn(output.assemble)
tasks.getByName('assemble').dependsOn(zipInstant)
}
}
}

}

def excludeAnnotations = {
exclude group: 'com.android.support', module: 'support-annotations'
}

dependencies {
compile "com.android.support:appcompat-v7:${deps.supportLib}"
compile "org.jetbrains.kotlin:kotlin-stdlib:$deps.kotlin"
implementation "com.android.support:appcompat-v7:${deps.supportLib}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$deps.kotlin"

// Ads/Crash
compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
compile "com.google.firebase:firebase-core:${deps.firebase}"
compile "com.google.firebase:firebase-ads:${deps.firebase}"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation "com.google.firebase:firebase-core:${deps.firebase}", {
exclude group: 'com.android.support'
}
implementation "com.google.firebase:firebase-ads:${deps.firebase}", {
exclude group: 'com.android.support'
}

testCompile 'junit:junit:4.12'
testCompile "org.jetbrains.kotlin:kotlin-stdlib:$deps.kotlin"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$deps.kotlin"
testImplementation 'junit:junit:4.12'
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$deps.kotlin"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$deps.kotlin"

androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1', excludeAnnotations
androidTestCompile 'com.android.support.test:runner:1.0.1', excludeAnnotations
androidTestCompile 'com.android.support.test:rules:1.0.1', excludeAnnotations
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2', excludeAnnotations
androidTestImplementation 'com.android.support.test:runner:1.0.2', excludeAnnotations
androidTestImplementation 'com.android.support.test:rules:1.0.2', excludeAnnotations

androidTestCompile 'com.squareup.spoon:spoon-client:1.7.1'
androidTestCompile 'com.jraska:falcon-spoon-compat:1.0.4', {
//androidTestImplementation 'com.squareup.spoon:spoon-client:1.7.1'
androidTestImplementation "com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT" // For Spoon snapshot, until 2.0.0 is released
androidTestImplementation 'com.jraska:falcon-spoon-compat:2.0.1', {
exclude group: 'com.squareup.spoon', module: 'spoon-client'
}
}

jacoco {
toolVersion = deps.jacoco
}

spoon {
debug = true
codeCoverage = true
grantAllPermissions = true
noAnimations = true
grantAll = true
}




apply plugin: 'com.google.gms.google-services'
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
@@ -1,5 +1,5 @@
-optimizations code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
-optimizationpasses 5
-optimizationpasses 10
-allowaccessmodification

# Crashlytics
Expand Down
Expand Up @@ -12,7 +12,7 @@ import org.junit.runner.RunWith
class EarActivityTest {

@Rule @JvmField
var activityRule: ActivityTestRule<EarActivity> = ActivityTestRule(EarActivity::class.java)
var activityRule = ActivityTestRule(EarActivity::class.java)

fun test_isPlaying(index: Int) = withEarRobot(activityRule.activity) {
click(index)
Expand Down
Expand Up @@ -7,13 +7,19 @@ import android.media.AudioManager
import android.support.test.espresso.Espresso.onView
import android.support.test.espresso.action.ViewActions
import android.support.test.espresso.matcher.ViewMatchers.withText
import com.jraska.falcon.FalconSpoon
import com.jraska.falcon.FalconSpoonRule
import org.hamcrest.Matchers
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule



class EarRobot(val activity: Activity) {

@Rule
val falconSpoonRule = FalconSpoonRule()

val audioService by lazy { activity.getSystemService(Context.AUDIO_SERVICE) as AudioManager }

init {
Expand All @@ -22,18 +28,18 @@ class EarRobot(val activity: Activity) {
}

fun click(buttonIndex: Int) {
FalconSpoon.screenshot(activity, "before-click-$buttonIndex")
falconSpoonRule.screenshot(activity, "before-click-$buttonIndex")
onView(withText(Matchers.startsWith("$buttonIndex"))).perform(ViewActions.click())
FalconSpoon.screenshot(activity, "after-click-$buttonIndex")
falconSpoonRule.screenshot(activity, "after-click-$buttonIndex")
}

fun checkIsPlaying() {
FalconSpoon.screenshot(activity, "isPLaying")
falconSpoonRule.screenshot(activity, "isPLaying")
assertTrue(audioService.isMusicActive)
}

fun checkIsNotPlaying() {
FalconSpoon.screenshot(activity, "checkIsNotPlaying")
falconSpoonRule.screenshot(activity, "checkIsNotPlaying")
assertFalse(audioService.isMusicActive)
}

Expand Down
42 changes: 0 additions & 42 deletions app/src/debug/google-services.json

This file was deleted.

51 changes: 30 additions & 21 deletions app/src/main/AndroidManifest.xml
@@ -1,30 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.makingiants.android.banjotuner">
xmlns:tools="http://schemas.android.com/tools"
package="com.makingiants.android.banjotuner"
android:targetSandboxVersion="2"
tools:targetApi="27">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--
Sandbox version 2 is required for instant apps. Normally this is added by default by the instant
plugin, but since we are creating the instant zip of our single APK manually, it must be
explicitly specified.
-->

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<activity
android:name=".EarActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<activity
android:name=".EarActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Expand Up @@ -45,6 +45,7 @@ class EarActivity : AppCompatActivity(), View.OnClickListener {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_ear_ads)

Fabric.with(Fabric.Builder(this)
.kits(Crashlytics())
Expand All @@ -53,8 +54,6 @@ class EarActivity : AppCompatActivity(), View.OnClickListener {

firebaseAnalytics.logEvent("screenview", Bundle().apply { putString("name", "ear") })

setContentView(R.layout.activity_ear_ads)

soundsRadioGroup.setOnCheckedChangeListener { radioGroup, i ->
(0 until radioGroup.childCount)
.map { radioGroup.getChildAt(it) as ToggleButton }
Expand Down Expand Up @@ -98,7 +97,7 @@ class EarActivity : AppCompatActivity(), View.OnClickListener {
}
}

fun handleAnimation(button: Button, shouldShow: Boolean = false) {
private fun handleAnimation(button: Button, shouldShow: Boolean = false) {
if (shouldShow) {
ViewCompat.setElevation(button, elevationPixels)
button.startAnimation(clickAnimation)
Expand Down
28 changes: 21 additions & 7 deletions build.gradle
Expand Up @@ -4,26 +4,40 @@ buildscript {
repositories {
jcenter()
mavenCentral()

// Crashlytics
maven { url 'https://maven.fabric.io/public' }

// For Spoon snapshot
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }

google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3' // because 2.2.3 and 2.3.0+ breaks jacoco support
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$deps.kotlin"

// Firebase
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.25.1'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'

// Extras
classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
//classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.2'
classpath "com.jaredsburrows:gradle-spoon-plugin:1.4.0"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
}
}

allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' } // Crashlytics
maven { url "https://maven.google.com" }

// Crashlytics
maven { url 'https://maven.fabric.io/public' }

// For Spoon snapshot
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }

google()
}
}

0 comments on commit c914bda

Please sign in to comment.