Skip to content

Commit

Permalink
#21 spash screen - in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mjureczko committed Jan 1, 2024
1 parent a09d9d6 commit e2d89de
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 3 deletions.
9 changes: 9 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [facebookToken: FACEBOOK_TOKEN]
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
signingConfigs {
release {
storeFile file("../android.jks")
Expand Down Expand Up @@ -75,6 +78,10 @@ dependencies {
implementation 'androidx.fragment:fragment-ktx:1.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.mapbox.maps:android:10.8.1'
implementation 'com.facebook.android:facebook-share:latest.release'
Expand All @@ -95,6 +102,8 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation group: 'org.mockito', name: 'mockito-core', version: '4.4.0'
androidTestImplementation 'org.mockito:mockito-inline:2.13.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}

configurations {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
classicMode=true
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import pl.marianjureczko.poszukiwacz.activity.facebook.FacebookContract
import pl.marianjureczko.poszukiwacz.activity.facebook.FacebookInputData
import pl.marianjureczko.poszukiwacz.activity.facebook.FacebookOutputData
import pl.marianjureczko.poszukiwacz.model.TreasuresProgress
import java.util.Properties


abstract class ActivityWithAdsAndBackButton : AppCompatActivity(), SelectTreasureProgressDialog.Callback {
Expand All @@ -29,9 +30,12 @@ abstract class ActivityWithAdsAndBackButton : AppCompatActivity(), SelectTreasur

private lateinit var facebookLauncher: ActivityResultLauncher<FacebookInputData>
private val storageHelper: StorageHelper by lazy { StorageHelper(this) }
/** Initialized to be used by childs in onCreate()*/
protected val settings = Settings(assets)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

callbackManager = CallbackManager.Factory.create()
shareDialog = ShareDialog(this)

Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/pl/marianjureczko/poszukiwacz/shared/Settings.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pl.marianjureczko.poszukiwacz.shared

import android.content.res.AssetManager
import java.util.Properties

class Settings(assetManager: AssetManager) {
private val properties = Properties()

init {
properties.load(assetManager.open("config.properties"))
}

fun isClassicMode(): Boolean = properties.getProperty("classicMode").toBoolean()
}
Binary file added assets/classic/chest_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/classic/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
classicMode=true
Binary file added assets/kalinowice/chest_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/kalinowice/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
classicMode=false
32 changes: 29 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.6.20'
ext.compose_version = '1.5.4'
ext.configSrc = 'unknown'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.8.2.0"
Expand Down Expand Up @@ -37,6 +39,30 @@ allprojects {
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

tasks.register('copy_config') {
doFirst {
if (project.property('configSrc') == 'unknown') {
layout.getProjectDirectory().dir("assets").getAsFile().listFiles().each { println("\t - ${it.name}") }
} else {
println("Usage:")
println("\$ ./gradlew copy_config -PconfigSrc=DIR")
println("\twhere DIR is one of:")
}
}
}

tasks.register('copy_splash', Copy) {
from layout.getProjectDirectory().file("assets/${configSrc}/chest_splash.png")
into layout.getProjectDirectory().dir("app/src/main/res/drawable")
}

tasks.register('copy_properties', Copy) {
from layout.getProjectDirectory().file("assets/${configSrc}/config.properties")
into layout.getProjectDirectory().dir("app/src/main/assets")
}
copy_config.finalizedBy copy_splash
copy_config.finalizedBy copy_properties

0 comments on commit e2d89de

Please sign in to comment.