Skip to content

Commit

Permalink
refactor: Migrate instagram in a Gradle module.
Browse files Browse the repository at this point in the history
- Create :data module for fake data provider.
- Create :theme module for all compose template resources.
- Create :demos:instagram module for instagram demo app.

Issue Gurupreet#61
  • Loading branch information
GerardPaligot committed Jun 4, 2021
1 parent 2513784 commit 7493a39
Show file tree
Hide file tree
Showing 76 changed files with 147 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

7 changes: 7 additions & 0 deletions .idea/kotlinc.xml

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

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

android {

compileSdk = 30
compileSdk = Configuration.compileSdk

defaultConfig {
applicationId = "com.guru.composecookbook"
minSdk = 21
targetSdk = 30
minSdk = Configuration.minSdk
targetSdk = Configuration.compileSdk
versionCode = 1
versionName = "1.0"
multiDexEnabled = true
Expand Down Expand Up @@ -63,6 +62,9 @@ android {
}

dependencies {
implementation(project(":data"))
implementation(project(":theme"))
implementation(project(":demos:instagram"))

debugImplementation("org.jetbrains.kotlin:kotlin-reflect:${Dependencies.kotlin}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
import com.guru.composecookbook.MainActivity
import com.guru.composecookbook.MainAppContent
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.data.model.HomeScreenItems
import com.guru.composecookbook.theme.AppThemeState
import org.junit.Before
import org.junit.Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat
import com.guru.composecookbook.theme.ComposeCookBookTheme
import com.guru.composecookbook.theme.typography
import com.guru.composecookbook.ui.demoapps.gmail.home.GmailScreen
import com.guru.composecookbook.ui.demoapps.instagram.InstagramHome
import com.guru.composecookbook.instagram.InstagramHome
import com.guru.composecookbook.ui.demoapps.paint.PaintApp
import com.guru.composecookbook.ui.demoapps.twitter.TwitterHome
import com.guru.composecookbook.ui.demoapps.youtube.YoutubeHome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.guru.composecookbook.R
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.data.model.HomeScreenItems
import com.guru.composecookbook.theme.*
import com.guru.composecookbook.ui.home.advancelists.AdvanceListsActivity
import com.guru.composecookbook.ui.home.customfling.FlingListActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.theme.ComposeCookBookTheme
import com.guru.composecookbook.ui.demoapps.instagram.InstagramStories
import com.guru.composecookbook.ui.demoapps.instagram.StoryListItem
import com.guru.composecookbook.instagram.InstagramStories
import com.guru.composecookbook.instagram.StoryListItem
import com.guru.composecookbook.ui.utils.VerticalGrid

class ListViewActivity : ComponentActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.ui.demoapps.instagram.InstagramListItem
import com.guru.composecookbook.instagram.InstagramListItem
import com.guru.composecookbook.ui.home.lists.GridListView
import com.guru.composecookbook.ui.home.lists.VerticalListView

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.guru.composecookbook.ui.home

import com.google.common.truth.Truth.assertThat
import com.guru.composecookbook.data.DemoDataProvider
import com.guru.composecookbook.data.model.HomeScreenItems
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test

Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

buildscript {
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
Expand All @@ -14,7 +13,6 @@ buildscript {

allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
maven(url = "https://jitpack.io")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
object Configuration {
const val compileSdk = 30
const val minSdk = 21
}

object Dependencies {
const val compose = "1.0.0-beta07"
const val lifecycleViewModelCompose = "1.0.0-alpha05"
Expand Down
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
21 changes: 21 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id("com.android.library")
id("kotlin-android")
}

android {
compileSdk = Configuration.compileSdk

defaultConfig {
minSdk = Configuration.minSdk
targetSdk = Configuration.compileSdk
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
5 changes: 5 additions & 0 deletions data/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guru.composecookbook.data">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.guru.composecookbook.data

import com.guru.composecookbook.R
import com.guru.composecookbook.data.model.HomeScreenItems
import com.guru.composecookbook.data.model.Item
import com.guru.composecookbook.data.model.Tweet
import com.guru.composecookbook.ui.home.HomeScreenItems

object DemoDataProvider {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.guru.composecookbook.ui.home
package com.guru.composecookbook.data.model

sealed class HomeScreenItems {
object Dialogs : HomeScreenItems()
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions demos/instagram/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
37 changes: 37 additions & 0 deletions demos/instagram/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
id("com.android.library")
id("kotlin-android")
}

android {
compileSdk = Configuration.compileSdk

defaultConfig {
minSdk = Configuration.minSdk
targetSdk = Configuration.compileSdk
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = Dependencies.compose
}
}

dependencies {
implementation(project(":data"))
implementation(project(":theme"))
implementation("androidx.compose.ui:ui:${Dependencies.compose}")
implementation("androidx.compose.material:material:${Dependencies.compose}")
implementation("androidx.compose.ui:ui-tooling:${Dependencies.compose}")
}
5 changes: 5 additions & 0 deletions demos/instagram/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guru.composecookbook.instagram">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.guru.composecookbook.ui.demoapps.instagram
package com.guru.composecookbook.instagram

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -9,7 +9,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.guru.composecookbook.R
import com.guru.composecookbook.data.DemoDataProvider

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.guru.composecookbook.ui.demoapps.instagram
package com.guru.composecookbook.instagram

import FaIcons
import androidx.compose.foundation.Image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.guru.composecookbook.ui.demoapps.instagram
package com.guru.composecookbook.instagram

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
rootProject.name = "ComposeCookBook"
include(":app")
include(":demos:instagram")
include(":data")
include(":theme")
1 change: 1 addition & 0 deletions theme/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
35 changes: 35 additions & 0 deletions theme/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
id("com.android.library")
id("kotlin-android")
}

android {
compileSdk = Configuration.compileSdk

defaultConfig {
minSdk = Configuration.minSdk
targetSdk = Configuration.compileSdk
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = Dependencies.compose
}
}

dependencies {
api("com.github.Gurupreet:FontAwesomeCompose:${Dependencies.fontAwesomeCompose}")
implementation("androidx.compose.ui:ui:${Dependencies.compose}")
implementation("androidx.compose.material:material:${Dependencies.compose}")
}
5 changes: 5 additions & 0 deletions theme/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guru.composecookbook.theme">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7493a39

Please sign in to comment.