Skip to content

Commit

Permalink
Merge branch 'feature/14-play-on-tv-no-androidx' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Entreco committed Aug 26, 2018
2 parents e164505 + 769c72a commit f29cf49
Show file tree
Hide file tree
Showing 323 changed files with 5,550 additions and 557 deletions.
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ cache:
- $HOME/.gradle/native #Cache library downloaded from the gradle dependency
env:
global:
- ANDROID_API=27
- EMULATOR_API=26
- ANDROID_BUILD_TOOLS=27.0.3
- ANDROID_API=28
- ANDROID_BUILD_TOOLS=28.0.2
- ADB_INSTALL_TIMEOUT=5
- secure: UH6Td9+MFk1nsYYMKN9t6/XcMmSZtB+L4sWMUmYBMaK1Q6YnGCnyHmU5RWkP+9a3AiZQ+n9XK+9TV+azMxJzyOoPMEzvBYtienvI1ZwTg+gqVOsMGG8TKubdgBfYQKm+mtdc3ctgucqjRg0yb4aUDp4CeNwwCuX1zuzIaAYp8IgRElkJzhJMeTcrCUWTBNk2F9ix0eRyOKOCIwgiAa6wNn1zMRvpbPh3esJ7CcnC0xesBtWriFtJDKFhPPWowPrWhGerLe3y5oNySqPpjxfBDIU9HPThNLNwBgp25Ww2c4Ib4Im0p59dPyKBU8mv3eoHvWtrSYW0bZQfKuJD6JsI0wg7Afx2hOxhPWw2evwjmhYWEfspSTUDUZIV/BhLhR2WbeZgAgd1gBh1ulxe79kne1FLsojVr+wZXA5Cn1TF2R4pnTj8EYLctbz/J1/sbcKwut6+I4z7FgbLDOEvaHTJZiscotR0ofML6OoYkKba8LznCES8RqYc3oyCKJvRD5oiVyHhMScAptMeignnPCGmhzm2evpclZfjoZ6vGyI/MgZML4as7WWz1FuiaNV+vJx6PyuNzBjYyNpKJ7O/G4yUT6EITrw3UPVCaSJr6eM3o8eAjy8XTkFsuRJ4iEhMAGiDRlvIlAMrUQyp8PxxvKB9YS6skFfAXXAUp59m/PLbRc0=
- secure: b9RwM5JGKpo0axCpeqDx9WZfZppiJWKF6d1zxTpO6cIiUmsgpL2GQy1fK/jHzKA1mlFIgq87pu11M696PqPJq7RadkeqlhKAq0zw8lBphg5Tn50wZUglusvIbMPC4VnsFLNeBd3elZIepglbh994sQxxpCpc8IF29x8cj//xrR6Z+EvyWYjnLgtbQjjdql6K0JRhGyTn+FXe5qLxmgu2lc4QL/RBcpnF+gpLrFfzBf/M/ruSyLjjpLZLCtzz90dAD/Ewb+sLvlfM0SUbXvFg+P2YoSo7rbDum+l45S6meIs6ygqcpb/3ByL9pSK3XEzrqLFQFggST8Puy8pHkwL8IVLuOtTPiO2HUtyzbTJLbEmupwEr6nXF2xtQE4vqgCNCLd63JxldRf3D2nrLG9OXJMlQRzkAfYtXj15tqyDfiLlCzIocfASsj/MF8XKzeR45+6GC9KLULpR0s1MdxYYhhb+Ss4sV8VElC3C4mlQiCA6G5AOJtPcnUshGNXbw3oWotJgY76IEJG2gSnb2SSI94VuXCI/39DLxXoTF1knixdaFJOO2QvBU2b8eZKrU4w1+rUrSfIMnBdn27hdqs+uKYNuJIwtMMCcrFtZmZnKjXcBwjgQdm51gWuMiJN5S8xM8turo23jL2Cak7rXn8RUmLHbhu3Jpl8iQzQOPFm1zmkg=
Expand All @@ -24,31 +23,32 @@ android:
- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS
- android-$ANDROID_API
- android-$EMULATOR_API_LEVEL
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL
licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
- android-googletv-license-.+
before_install:
- yes | sdkmanager "platforms;android-27"
- yes | sdkmanager "platform-tools" "platforms;android-28"
- openssl aes-256-cbc -K $encrypted_c5c67234e863_key -iv $encrypted_c5c67234e863_iv
-in android/DartsScorecard/scripts/dsc_keystore.enc -out android/DartsScorecard/scripts/dsc_keystore
-d
- openssl aes-256-cbc -K $encrypted_60401f83f63b_key -iv $encrypted_60401f83f63b_iv -in android/DartsScorecard/app/google-services.json.enc -out android/DartsScorecard/app/google-services.json -d

- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- echo -e "\n601085b94cd77f0b54ff86406957099ebe79c4d6" > "$ANDROID_HOME/licenses/android-googletv-license"
- echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > "$ANDROID_HOME/licenses/google-gdk-license"
- cd android/DartsScorecard/
- chmod +x gradlew
- ./gradlew dependencies || true
script:
- ./gradlew clean build checkDebug -PdisablePreDex --stacktrace
- ./gradlew clean build -PdisablePreDex --stacktrace
after_success:
- ./gradlew jacocoFullReport coveralls
before_deploy:
Expand All @@ -59,6 +59,7 @@ before_deploy:
- ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner sign --ks $HOME/dsc_keystore
--ks-key-alias Entreco --ks-pass pass:$storepass --key-pass pass:$keypass --in _${APP_NAME} --out $APP_NAME
- ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/apksigner verify $APP_NAME

deploy:
provider: releases
file:
Expand Down
41 changes: 29 additions & 12 deletions android/DartsScorecard/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'com.getkeepsafe.dexcount'
apply from: '../scripts/versioning.gradle'
apply from: '../scripts/coverage.gradle'
apply from: '../scripts/android_common.gradle'
apply from: '../scripts/versioning.gradle'

android {

def config = rootProject.extensions.getByName("ext")
defaultConfig {
applicationId "nl.entreco.dartsscorecard"
resValue "string", "version", "${config.versionName}"

ndk {abiFilters "armeabi", "armeabi-v7a", "x86", "mips"}
}
buildTypes {
debug {
Expand All @@ -22,34 +25,48 @@ android {
shrinkResources true
}
}
dataBinding {
enabled = true

sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation project(":shared")
implementation project(':domain')
implementation project(':data')


// Annotation Processing
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "android.arch.persistence.room:compiler:$room"
kapt "com.github.bumptech.glide:compiler:$glide"

// Implementation
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.android.support:appcompat-v7:$support"
implementation "com.android.support:design:$support"
implementation "com.android.support:appcompat-v7:$support"
implementation "com.android.support:leanback-v17:$support"
implementation "com.android.support.constraint:constraint-layout:$constraint"
implementation "com.google.firebase:firebase-ads:$firebase"
implementation "com.google.firebase:firebase-firestore:$firebase"
implementation "com.google.firebase:firebase-config:$firebase"
implementation "android.arch.lifecycle:extensions:$architecture"
implementation "com.google.firebase:firebase-ads:$fbAds"
implementation "com.google.firebase:firebase-core:$fbCore"
implementation "com.google.firebase:firebase-firestore:$fbStore"
implementation "com.google.firebase:firebase-config:$fbConfig"
implementation "com.google.firebase:firebase-database:$fbDatabase"
implementation "android.arch.persistence.room:runtime:$room"
implementation "com.github.yalantis:jellytoolbar:$jelly"
implementation "android.arch.lifecycle:extensions:$architecture"
implementation "com.google.code.gson:gson:$gson"
implementation "com.github.bumptech.glide:glide:$glide"
implementation "com.github.yalantis:jellytoolbar:$jelly"
implementation "de.hdodenhof:circleimageview:$circleImageView"
implementation "org.webrtc:google-webrtc:$webRtc"

implementation("com.crashlytics.sdk.android:crashlytics:$crash") {
transitive = true
}
Expand Down
Binary file modified android/DartsScorecard/app/google-services.json.enc
Binary file not shown.
11 changes: 5 additions & 6 deletions android/DartsScorecard/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,13 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keepattributes Signature
-keepattributes Signature,InnerClasses

# Crashlytics
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception

# Google Play Services
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-dontnote com.google.android.gms.**

# Okio
-dontwarn okio.**
-dontnote okio.**
Expand All @@ -49,3 +44,7 @@
**[] $VALUES;
public *;
}

# WebRtc
-keep class org.webrtc.** { *; }

Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions android/DartsScorecard/app/src/debug/res/values/keys.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- AdMob -->
<string name="app_id">ca-app-pub-3793327349392749~1846337901</string>
<string name="setup_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
<string name="stats_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
<string name="setup_interstitial_unit_id">ca-app-pub-3940256099942544/1033173712</string>
<string name="app_id" translatable="false">ca-app-pub-3793327349392749~1846337901</string>
<string name="setup_ad_unit_id" translatable="false">ca-app-pub-3940256099942544/6300978111</string>
<string name="stats_ad_unit_id" translatable="false">ca-app-pub-3940256099942544/6300978111</string>
<string name="setup_interstitial_unit_id" translatable="false">ca-app-pub-3940256099942544/1033173712</string>
</resources>
47 changes: 44 additions & 3 deletions android/DartsScorecard/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nl.entreco.dartsscorecard">

<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="false" />

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
android:name=".App"
android:allowBackup="true"
android:banner="@drawable/tv_promo"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down Expand Up @@ -43,14 +58,29 @@
</intent-filter>

</activity>
<activity
android:name=".tv.splash.SplashTvActivity"
android:banner="@drawable/tv_promo"
android:icon="@drawable/tv_promo"
android:label="@string/app_name"
android:logo="@drawable/tv_promo"
android:noHistory="true"
android:screenOrientation="landscape"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".launch.LaunchActivity" />
<activity android:name=".tv.launch.LaunchTvActivity" />
<activity
android:name=".beta.BetaActivity"
android:parentActivityName=".launch.LaunchActivity" />
<activity
android:name=".wtf.WtfActivity"
android:windowSoftInputMode="stateHidden"
android:parentActivityName=".launch.LaunchActivity" />
android:name=".faq.WtfActivity"
android:parentActivityName=".launch.LaunchActivity"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".setup.Setup01Activity"
android:parentActivityName=".launch.LaunchActivity" />
Expand All @@ -59,6 +89,7 @@
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".play.Play01Activity"
android:launchMode="singleTop"
android:parentActivityName=".launch.LaunchActivity" />
<activity
android:name=".profile.select.SelectProfileActivity"
Expand All @@ -76,6 +107,16 @@
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".streaming.StreamingService"
android:description="@string/streaming_service"
android:exported="true" />

<service
android:name=".streaming.ReceiverService"
android:description="@string/receiving_service"
android:exported="true" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package nl.entreco.dartsscorecard

import android.util.Log
import nl.entreco.domain.common.log.Logger
import nl.entreco.shared.log.Logger

/**
* Created by Entreco on 27/11/2017.
*/
internal class DscLogger(private val tag: String) : Logger {
internal class AppLogger(private val tag: String) : Logger {

companion object {
private var ENABLED = BuildConfig.DEBUG
Expand Down Expand Up @@ -89,6 +89,8 @@ internal class DscLogger(private val tag: String) : Logger {
}

private fun withArgs(message: String, args: Array<out String>): String {
return StringBuilder(message).append(SEPARATOR).apply { args.take(args.size - 1).forEach { append(it).append(SEPARATOR) }.apply { append(args.last()) } }.toString()
return StringBuilder(message).append(
SEPARATOR).apply { args.take(args.size - 1).forEach { append(it).append(
SEPARATOR) }.apply { append(args.last()) } }.toString()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package nl.entreco.dartsscorecard

import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.provider.Settings
import android.support.annotation.ColorRes
import android.support.v4.content.ContextCompat

fun Context.getColorCompat(@ColorRes color: Int) = ContextCompat.getColor(this, color)

fun Context.startAppSettings() {
Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).run {
addCategory(Intent.CATEGORY_DEFAULT)
data = Uri.parse("package:$packageName")
startActivity(this)
}
}

fun Context.checkIsPermissionGranted(permission: String) =
ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED

fun Context.areAllPermissionsGranted(
vararg permission: String) = permission.all { checkIsPermissionGranted(it) }
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import nl.entreco.dartsscorecard.base.BaseViewModel
import nl.entreco.dartsscorecard.di.viewmodel.ActivityScope
import nl.entreco.domain.ad.FetchPurchasedItemsResponse
import nl.entreco.domain.ad.FetchPurchasedItemsUsecase
import nl.entreco.domain.common.log.Logger
import nl.entreco.shared.log.Logger
import nl.entreco.domain.purchases.connect.ConnectToBillingUsecase
import java.util.concurrent.atomic.AtomicBoolean
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ArchiveJobService : JobService() {
}

private val app by lazy { application as App }
private val component by lazy { app.appComponent.plus(ServiceModule()) }
private val component by lazy { app.appComponent.plus(ServiceModule(this)) }
private val archiveStatsUsecase by lazy { component.plus(ArchiveModule()).archive() }

private val isWorking = AtomicBoolean(false)
Expand All @@ -38,7 +38,7 @@ class ArchiveJobService : JobService() {
private val notif by lazy {
NotificationCompat.Builder(baseContext, CHANNEL_ID)
.setOngoing(true)
.setContentTitle(getString(R.string.notif_title))
.setContentTitle(getString(R.string.archive_notif_title))
.setSmallIcon(R.drawable.ic_stat_name)
.setColor(Color.parseColor(NOTIF_COLOR))
.setBadgeIconType(R.mipmap.ic_launcher_foreground)
Expand All @@ -57,8 +57,8 @@ class ArchiveJobService : JobService() {

private fun registerChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val name = getString(R.string.channel_name)
val desc = getString(R.string.channel_description)
val name = getString(R.string.archive_channel_name)
val desc = getString(R.string.archive_channel_description)
val importance = NotificationManager.IMPORTANCE_LOW
val channel = NotificationChannel(CHANNEL_ID, name, importance)
channel.description = desc
Expand Down
Loading

0 comments on commit f29cf49

Please sign in to comment.