-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
117 changed files
with
981 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
plugins { | ||
id("android-application-binary-plugin") | ||
alias(libs.plugins.newsfeed.android.applicationBinary) | ||
} | ||
|
||
android { | ||
defaultConfig { | ||
namespace = "com.gchristov.newsfeed" | ||
applicationId = "com.gchristov.newsfeed" | ||
versionCode = 1 | ||
versionName = "1.0" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(projects.multiplatform.common.di) | ||
// Multiplatform leaf modules | ||
implementation(projects.multiplatform.feed.feature) | ||
implementation(projects.multiplatform.post.feature) | ||
// Android leaf modules | ||
implementation(projects.android.common.design) | ||
// Feature modules | ||
implementation(projects.android.feed.feature) | ||
implementation(projects.android.post.feature) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
android/app/src/main/kotlin/com/gchristov/newsfeed/android/app/DependencyInjector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.gchristov.newsfeed.android.app | ||
|
||
import android.content.Context | ||
import com.gchristov.newsfeed.android.common.navigation.NavigationModule | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.AppContext | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.MplCommonKotlinModule | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyInjector | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyModule | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.register | ||
import com.gchristov.newsfeed.multiplatform.common.network.MplCommonNetworkModule | ||
import com.gchristov.newsfeed.multiplatform.common.persistence.MplCommonPersistenceModule | ||
import com.gchristov.newsfeed.multiplatform.feed.data.MplFeedDataModule | ||
import com.gchristov.newsfeed.multiplatform.feed.feature.MplFeedModule | ||
import com.gchristov.newsfeed.multiplatform.post.data.MplPostDataModule | ||
import com.gchristov.newsfeed.multiplatform.post.feature.MplPostModule | ||
|
||
/** | ||
* Initialises the dependency graph for Android. | ||
* | ||
* When making changes, consider also updating the multiplatform/umbrella module. | ||
*/ | ||
|
||
internal fun DependencyInjector.initialise(context: Context) { | ||
AppContext = context | ||
val modules = mutableListOf<DependencyModule>().apply { | ||
// Multiplatform modules | ||
add(MplCommonKotlinModule) | ||
add(MplCommonNetworkModule) | ||
add(MplCommonPersistenceModule) | ||
add(MplFeedModule) | ||
add(MplFeedDataModule) | ||
add(MplPostModule) | ||
add(MplPostDataModule) | ||
// Android modules | ||
add(NavigationModule) | ||
} | ||
register(modules) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import com.gchristov.newsfeed.gradleplugins.Deps | ||
|
||
plugins { | ||
id("android-module-plugin") | ||
id("android-compose-plugin") | ||
alias(libs.plugins.newsfeed.android.module) | ||
alias(libs.plugins.newsfeed.android.compose) | ||
} | ||
|
||
android { | ||
defaultConfig { | ||
namespace = "com.gchristov.newsfeed.android.common.compose" | ||
} | ||
} | ||
|
||
dependencies { | ||
api(Deps.Android.Compose.liveData) | ||
api(Deps.Android.Compose.compiler) | ||
api(Deps.Android.Compose.activity) | ||
api(Deps.Android.Compose.uiTooling) | ||
api(Deps.Android.Compose.foundation) | ||
api(Deps.Android.Compose.foundationLayout) | ||
api(Deps.Android.Compose.materialIcons) | ||
implementation(Deps.Android.Compose.material) | ||
implementation(Deps.Android.Compose.coil) | ||
implementation(Deps.Android.Compose.html) | ||
implementation(Deps.Android.Accompanist.swipeRefresh) | ||
api(libs.androidx.compose.liveData) | ||
api(libs.androidx.compose.compiler) | ||
api(libs.androidx.activityCompose) | ||
api(libs.androidx.compose.ui.tooling) | ||
api(libs.androidx.compose.foundation) | ||
api(libs.androidx.compose.foundation.layout) | ||
api(libs.androidx.compose.material.icons) | ||
implementation(libs.androidx.compose.material) | ||
implementation(libs.coil) | ||
implementation(libs.composeHtml) | ||
implementation(projects.android.common.design) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 21 additions & 6 deletions
27
.../src/main/kotlin/com/gchristov/newsfeed/android/common/compose/elements/AppPullRefresh.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
package com.gchristov.newsfeed.android.common.compose.elements | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.material.ExperimentalMaterialApi | ||
import androidx.compose.material.pullrefresh.PullRefreshIndicator | ||
import androidx.compose.material.pullrefresh.pullRefresh | ||
import androidx.compose.material.pullrefresh.rememberPullRefreshState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import com.google.accompanist.swiperefresh.SwipeRefresh | ||
import com.google.accompanist.swiperefresh.rememberSwipeRefreshState | ||
|
||
@OptIn(ExperimentalMaterialApi::class) | ||
@Composable | ||
fun AppPullRefresh( | ||
modifier: Modifier = Modifier, | ||
loading: Boolean, | ||
onRefresh: () -> Unit, | ||
content: @Composable () -> Unit, | ||
) { | ||
SwipeRefresh( | ||
modifier = modifier, | ||
state = rememberSwipeRefreshState(loading), | ||
val pullRefreshState = rememberPullRefreshState( | ||
refreshing = loading, | ||
onRefresh = onRefresh, | ||
content = content | ||
) | ||
|
||
Box( | ||
modifier = modifier.pullRefresh(pullRefreshState), | ||
contentAlignment = Alignment.TopCenter, | ||
) { | ||
content() | ||
|
||
PullRefreshIndicator( | ||
refreshing = loading, | ||
state = pullRefreshState, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
plugins { | ||
id("android-module-plugin") | ||
alias(libs.plugins.newsfeed.android.module) | ||
} | ||
|
||
android { | ||
defaultConfig { | ||
namespace = "com.gchristov.newsfeed.android.common.design" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
plugins { | ||
id("android-module-plugin") | ||
alias(libs.plugins.newsfeed.android.module) | ||
} | ||
|
||
android { | ||
defaultConfig { | ||
namespace = "com.gchristov.newsfeed.android.common.navigation" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(projects.multiplatform.common.di) | ||
implementation(projects.multiplatform.common.kotlin) | ||
} |
This file was deleted.
Oops, something went wrong.
9 changes: 3 additions & 6 deletions
9
...tion/src/main/kotlin/com/gchristov/newsfeed/android/common/navigation/NavigationModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
package com.gchristov.newsfeed.android.common.navigation | ||
|
||
import android.content.Context | ||
import com.gchristov.newsfeed.multiplatform.common.di.DiModule | ||
import com.gchristov.newsfeed.multiplatform.common.di.inject | ||
import com.gchristov.newsfeed.multiplatform.common.kotlin.di.DependencyModule | ||
import org.kodein.di.DI | ||
import org.kodein.di.bindFactory | ||
|
||
object NavigationModule : DiModule() { | ||
object NavigationModule : DependencyModule() { | ||
override fun name() = "common-navigation" | ||
|
||
override fun bindLocalDependencies(builder: DI.Builder) { | ||
override fun bindDependencies(builder: DI.Builder) { | ||
builder.apply { | ||
bindFactory<Context, Navigator> { context: Context -> | ||
RealNavigator(context = context) | ||
} | ||
} | ||
} | ||
|
||
fun injectNavigator(context: Context): Navigator = inject(arg = context) | ||
} |
Oops, something went wrong.