Skip to content

Commit

Permalink
1. Updated library
Browse files Browse the repository at this point in the history
2. Created jetpack compose app

Signed-off-by: Rajesh Hadiya <[email protected]>
  • Loading branch information
hadiyarajesh committed Jun 15, 2022
1 parent bc4c5a1 commit 8caede7
Show file tree
Hide file tree
Showing 62 changed files with 1,313 additions and 73 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 20 additions & 10 deletions Flower/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ plugins {
}

android {
compileSdk = 31
namespace = "com.hadiyarajesh.flower"
compileSdk = 32
buildToolsVersion = "30.0.3"

defaultConfig {
minSdk = 21
targetSdk = 30
targetSdk = 32

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles(
Expand All @@ -19,7 +20,7 @@ android {

buildTypes {
getByName("release") {
isMinifyEnabled = true
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -37,12 +38,8 @@ android {
}
}

tasks.register("sourceJar", Jar::class) {

}

dependencies {
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.core:core-ktx:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1")
implementation("com.squareup.retrofit2:retrofit:2.9.0")

Expand All @@ -51,8 +48,21 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}

tasks.register("sourceJar", Jar::class) {
}

val PUBLISH_GROUP_ID by extra("io.github.hadiyarajesh")
val PUBLISH_VERSION by extra("2.0.1")
val PUBLISH_VERSION by extra("2.0.3")
val PUBLISH_ARTIFACT_ID by extra("flower")
val PUBLISH_DESCRIPTION by extra("Flower is an Android library that makes networking and database caching easy. It enables developers to fetch network resources and use them as is OR combine them with local database at single place with fault tolerant architecture.")
val PUBLISH_URL by extra("https://github.com/hadiyarajesh/flower")
val PUBLISH_LICENSE_NAME by extra("MIT License")
val PUBLISH_LICENSE_URL by extra("https://github.com/hadiyarajesh/flower/blob/master/LICENSE")
val PUBLISH_DEVELOPER_ID by extra("hadiyarajesh")
val PUBLISH_DEVELOPER_NAME by extra("Rajesh Hadiya")
val PUBLISH_DEVELOPER_EMAIL by extra("[email protected]")
val PUBLISH_SCM_CONNECTION by extra("scm:git:github.com/hadiyarajesh/flower.git")
val PUBLISH_SCM_DEVELOPER_CONNECTION by extra("scm:git:ssh://github.com/hadiyarajesh/flower.git")
val PUBLISH_SCM_URL by extra("https://github.com/hadiyarajesh/flower")

apply(from = "${rootDir}/scripts/publish-module.gradle")
apply(from = "${rootDir}/scripts/publish-module.gradle")
2 changes: 1 addition & 1 deletion Flower/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<manifest package="com.hadiyarajesh.flower" />
<manifest />
23 changes: 13 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//val kotlin_version: String by extra
plugins {
id("com.android.application")
id("kotlin-android")
Expand All @@ -7,13 +6,14 @@ plugins {
}

android {
compileSdk = 31
namespace = "com.hadiyarajesh.flowersample"
compileSdk = 32
buildToolsVersion = "30.0.3"

defaultConfig {
applicationId = "com.hadiyarajesh.flowersample"
minSdk = 21
targetSdk = 30
targetSdk = 32
versionCode = 1
versionName = "1.0"

Expand Down Expand Up @@ -62,24 +62,27 @@ object LibVersion {
}

dependencies {
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("com.google.android.material:material:1.5.0")
implementation("androidx.core:core-ktx:1.8.0")
implementation("androidx.appcompat:appcompat:1.4.2")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.android.material:material:1.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${LibVersion.lifecycleVersion}")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:${LibVersion.lifecycleVersion}")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${LibVersion.lifecycleVersion}")
implementation("com.google.dagger:hilt-android:${rootProject.extra["hiltVersion"]}")
kapt("com.google.dagger:hilt-android-compiler:${rootProject.extra["hiltVersion"]}")

implementation("androidx.room:room-ktx:${LibVersion.roomVersion}")
kapt("androidx.room:room-compiler:${LibVersion.roomVersion}")

implementation("com.squareup.retrofit2:converter-moshi:${LibVersion.retrofitVersion}")

implementation("com.squareup.moshi:moshi:${LibVersion.moshiVersion}")
kapt("com.squareup.moshi:moshi-kotlin-codegen:${LibVersion.moshiVersion}")
implementation("com.google.dagger:hilt-android:${rootProject.extra["hiltVersion"]}")
kapt("com.google.dagger:hilt-android-compiler:${rootProject.extra["hiltVersion"]}")

implementation(project(":Flower"))

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
}
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hadiyarajesh.flowersample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
25 changes: 11 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("com.android.application") version "7.2.1" apply false
id("org.jetbrains.kotlin.android") version "1.6.10" apply false
}

buildscript {
val hiltVersion by extra("2.40")
val hiltVersion by extra("2.42")
val compose_ui_version by extra("1.1.1")

repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:7.1.3")
classpath("com.android.tools.build:gradle:7.2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("com.google.dagger:hilt-android-gradle-plugin:$hiltVersion")

Expand All @@ -16,19 +24,8 @@ buildscript {
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}

apply(from = "${rootDir}/scripts/publish-root.gradle")
apply(from = "${rootDir}/scripts/publish-root.gradle")
1 change: 1 addition & 0 deletions compose-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
109 changes: 109 additions & 0 deletions compose-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("dagger.hilt.android.plugin")
kotlin("kapt")
}

android {
namespace = "com.hadiyarajesh.compose_app"
compileSdk = 32

defaultConfig {
applicationId = "com.hadiyarajesh.compose_app"
minSdk = 21
targetSdk = 32
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}

javaCompileOptions {
annotationProcessorOptions {
arguments += mapOf(
"room.schemaLocation" to "$projectDir/schemas",
"room.incremental" to "true",
"room.expandProjection" to "true"
)
}
}
}

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"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.1.1"
}
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

object LibVersion {
const val composeVersion = "1.2.0-beta03"
const val roomVersion = "2.4.2"
const val retrofitVersion = "2.9.0"
const val moshiVersion = "1.13.0"
const val accompanistVersion = "0.24.10-beta"
}

dependencies {
implementation("androidx.core:core-ktx:1.8.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.1")
implementation("androidx.activity:activity-compose:1.4.0")
implementation("androidx.compose.ui:ui:${LibVersion.composeVersion}")
implementation("androidx.compose.ui:ui-tooling-preview:${LibVersion.composeVersion}")
implementation("androidx.compose.material:material:${LibVersion.composeVersion}")
implementation("androidx.navigation:navigation-compose:2.4.2")
implementation("androidx.paging:paging-compose:1.0.0-alpha15")

implementation("androidx.hilt:hilt-navigation-compose:1.0.0")
implementation("com.google.dagger:hilt-android:${rootProject.extra["hiltVersion"]}")
kapt("com.google.dagger:hilt-android-compiler:${rootProject.extra["hiltVersion"]}")

implementation("androidx.room:room-ktx:${LibVersion.roomVersion}")
implementation("androidx.room:room-paging:${LibVersion.roomVersion}")
kapt("androidx.room:room-compiler:${LibVersion.roomVersion}")

implementation("io.coil-kt:coil-compose:2.0.0")

implementation("com.squareup.retrofit2:retrofit:${LibVersion.retrofitVersion}")
implementation("com.squareup.retrofit2:converter-moshi:${LibVersion.retrofitVersion}")
implementation("com.squareup.okhttp3:logging-interceptor:4.9.3")

implementation("com.squareup.moshi:moshi:${LibVersion.moshiVersion}")
kapt("com.squareup.moshi:moshi-kotlin-codegen:${LibVersion.moshiVersion}")

implementation("com.google.accompanist:accompanist-swiperefresh:${LibVersion.accompanistVersion}")

implementation(project(":Flower"))

testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:${rootProject.extra["compose_ui_version"]}")
debugImplementation("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_ui_version"]}")
debugImplementation("androidx.compose.ui:ui-test-manifest:${rootProject.extra["compose_ui_version"]}")
}
21 changes: 21 additions & 0 deletions compose-app/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.hadiyarajesh.compose_app

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.hadiyarajesh.compose_app", appContext.packageName)
}
}
Loading

0 comments on commit 8caede7

Please sign in to comment.