Skip to content

Commit

Permalink
Merge pull request #1 from peterkrauz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
peterkrauz authored Oct 20, 2020
2 parents c7f6b11 + dbec91a commit 4003742
Show file tree
Hide file tree
Showing 167 changed files with 2,072 additions and 110 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
.idea
/buildSrc/build/
/buildSrc/build/*
*.jar
*.jar
.env
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Grimoire :crystal_ball: :open_book:
## What is this
Grimoire (pronounced **gruhm · waar**) is a hobby app that employs several Android modern technologies and best practices. <br>
It is currently a work in progress being slowly refined weekend by weekend, for usage on my not-so-regular tabletop RPG gaming sessions.

## Tech Stack


## Architecture
86 changes: 74 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'androidx.navigation.safeargs.kotlin'

id 'com.google.gms.google-services'
id 'com.google.firebase.appdistribution'
}

def firebaseBetaGroups = System.getenv("FIREBASE_TESTERS")
def firebaseBetaTesters = System.getenv("TESTER_GROUP_ALIAS")

android {
compileSdkVersion AndroidConfig.compileSdkVersion
Expand All @@ -12,26 +23,77 @@ android {
targetSdkVersion AndroidConfig.targetSdkVersion
versionCode AndroidConfig.versionCode
versionName AndroidConfig.versionName

testInstrumentationRunner AndroidConfig.testInstrumentationRunner
ext.betaDistributionGroupAliases = firebaseBetaGroups

javaCompileOptions {
annotationProcessorOptions {
arguments += [
"room.schemaLocation": "$projectDir/schemas".toString(),
"room.incremental": "true"
]
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "Grimoire"
firebaseAppDistribution {
releaseNotesFile = "releasenotes.txt"
}
}
beta {
initWith debug
applicationIdSuffix ".beta"
versionNameSuffix "-beta"
resValue "string", "app_name", "Grimoire Beta"
firebaseAppDistribution {
releaseNotesFile = "releasenotes.txt"
testers = firebaseBetaTesters
groups = firebaseBetaGroups
}
}
}

compileOptions {
sourceCompatibility = AndroidConfig.javaVersion
targetCompatibility = AndroidConfig.javaVersion
}
kotlinOptions {
jvmTarget = AndroidConfig.jvmTarget
}
}

kapt {
correctErrorTypes true
}

dependencies {
// implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation Kotlin.standardLibrary
implementation Android.coreKtx
implementation Android.appCompat
implementation Android.constraintLayout
implementation Material.material
implementation Navigation.navigationUi
implementation Navigation.navigationFragment
implementation Firebase.analytics
implementation Android.lifeCycleExtensions

implementation Hilt.android
implementation Hilt.viewModel
kapt Hilt.compiler
kapt Hilt.androidXCompiler

kapt Room.compiler

implementation project(ModulePaths.data)
implementation project(ModulePaths.domain)
implementation project(ModulePaths.common)
implementation project(ModulePaths.home)
implementation project(ModulePaths.tags)
implementation project(ModulePaths.notes)
implementation project(ModulePaths.characters)
}
69 changes: 69 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"project_info": {
"project_number": "471809376764",
"firebase_url": "https://grimoire-480b0.firebaseio.com",
"project_id": "grimoire-480b0",
"storage_bucket": "grimoire-480b0.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:471809376764:android:ef82e3596abba182903279",
"android_client_info": {
"package_name": "com.peterkrauz.grimoire"
}
},
"oauth_client": [
{
"client_id": "471809376764-r4fhgao995chl26pou0kb3feo3a8ed0k.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDtJzE-Oo1EIgmqZRCbgmig08_I1CvNse8"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "471809376764-r4fhgao995chl26pou0kb3feo3a8ed0k.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:471809376764:android:924a832c114f8689903279",
"android_client_info": {
"package_name": "com.peterkrauz.grimoire.beta"
}
},
"oauth_client": [
{
"client_id": "471809376764-r4fhgao995chl26pou0kb3feo3a8ed0k.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDtJzE-Oo1EIgmqZRCbgmig08_I1CvNse8"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "471809376764-r4fhgao995chl26pou0kb3feo3a8ed0k.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

This file was deleted.

3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
package="com.peterkrauz.grimoire">

<application
android:name=".GrimoireApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/Theme.Grimoire.Launcher">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.peterkrauz.grimoire

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class GrimoireApplication : Application()
33 changes: 32 additions & 1 deletion app/src/main/java/com/peterkrauz/grimoire/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
package com.peterkrauz.grimoire

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.observe
import androidx.navigation.fragment.findNavController
import androidx.navigation.ui.setupWithNavController
import com.peterkrauz.grimoire.common.MainViewModel
import com.peterkrauz.grimoire.common.extension.snackBar
import com.peterkrauz.grimoire.common.snackbar.SnackBarType
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.android.synthetic.main.activity_main.*

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

private val mainViewModel: MainViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.Theme_Grimoire)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setupView()
observeViewModel()
}

private fun setupView() {
bottomNavigationView.run {
setOnNavigationItemReselectedListener { Unit }
setupWithNavController(mainNavFragment.findNavController())
}
}

private fun observeViewModel() {
mainViewModel.arcCreatedLiveEvent.observe(this) { showArcCreatedSnackBar() }
}

private fun showArcCreatedSnackBar() {
snackBar(rootLayout, R.string.arc_created_success, SnackBarType.SUCCESS)
}
}
28 changes: 28 additions & 0 deletions app/src/main/java/com/peterkrauz/grimoire/hilt/ArcModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.peterkrauz.grimoire.hilt

import com.peterkrauz.grimoire.data.dao.ArcDao
import com.peterkrauz.grimoire.data.repository.ArcRepositoryImpl
import com.peterkrauz.grimoire.data.db.GrimoireDatabase
import com.peterkrauz.grimoire.domain.entity.ArcRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ApplicationComponent
import javax.inject.Singleton

@Module
@InstallIn(ApplicationComponent::class)
object ArcModule {

@Provides
@Singleton
fun provideArcRepository(dao: ArcDao): ArcRepository {
return ArcRepositoryImpl(dao)
}

@Provides
@Singleton
fun provideArcDao(database: GrimoireDatabase): ArcDao {
return database.arcDao()
}
}
23 changes: 23 additions & 0 deletions app/src/main/java/com/peterkrauz/grimoire/hilt/DatabaseModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.peterkrauz.grimoire.hilt

import android.app.Application
import androidx.room.Room
import com.peterkrauz.grimoire.data.db.GrimoireDatabase
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ApplicationComponent
import javax.inject.Singleton

@Module
@InstallIn(ApplicationComponent::class)
object DatabaseModule {

@Provides
@Singleton
fun provideGrimoireDatabase(app: Application): GrimoireDatabase {
return Room.databaseBuilder(app, GrimoireDatabase::class.java, "grimoire")
// .addMigrations(*MigrationHelper.getMigrations())
.build()
}
}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/selector_bottom_nav_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/colorAccent" />
<item android:color="@color/grey64" />
</selector>
Loading

0 comments on commit 4003742

Please sign in to comment.