Skip to content

Commit

Permalink
Added a new module 'core:util' to store global constants, time util, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-chernysh committed Feb 17, 2024
1 parent f1f1f60 commit e29f04b
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/util/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions core/util/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "com.mobiledevpro.util"
compileSdk = 34

defaultConfig {
minSdk = 24

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.test.junit)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.espresso.core)
}
Empty file added core/util/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/util/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions core/util/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />
22 changes: 22 additions & 0 deletions core/util/src/main/kotlin/com/mobiledevpro/util/Constant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mobiledevpro.util/*
* Copyright 2023 | Dmitri Chernysh | https://mobile-dev.pro
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/


object Constant {
const val LOG_TAG_DEBUG = "app.debug"
}
13 changes: 13 additions & 0 deletions core/util/src/main/kotlin/com/mobiledevpro/util/TimeUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.mobiledevpro.util

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

object TimeUtil {

fun currentTimeStamp(): String = DateTimeFormatter.ofPattern(TIMESTAMP_PATTERN).let { format ->
LocalDateTime.now().format(format)
}
}

private const val TIMESTAMP_PATTERN = "yyyyMMdd_HHmmssSSS"
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ include(":feature:user_profile")
include(":feature:people_profile")
include(":feature:people")
include(":core:di")
include(":core:util")

0 comments on commit e29f04b

Please sign in to comment.