Skip to content

Commit

Permalink
Refactor- [:feature:location] Apply & Fix Detekt, Ktlint Rules (#2684)
Browse files Browse the repository at this point in the history
  • Loading branch information
niyajali authored Sep 1, 2024
1 parent b64a8bb commit 8ece092
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ fun RootNavGraph(
navController = navController
)

locationsNavGraph(
navController = navController
)
locationsNavGraph()

helpNavGraph(
findLocations = navController::navigateToLocationsScreen,
Expand Down
13 changes: 9 additions & 4 deletions feature/location/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifos.android.feature)
alias(libs.plugins.mifos.android.library.compose)
Expand All @@ -10,8 +19,4 @@ android {
dependencies {
// google maps
implementation(libs.google.map.compose)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.espresso.core)
}

This file was deleted.

9 changes: 9 additions & 0 deletions feature/location/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2024 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file,
You can obtain one at https://mozilla.org/MPL/2.0/.
See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.location

import androidx.compose.foundation.layout.Column
Expand All @@ -10,7 +19,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
Expand All @@ -19,23 +27,26 @@ import com.google.maps.android.compose.Marker
import com.google.maps.android.compose.MarkerState
import com.google.maps.android.compose.rememberCameraPositionState
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
import org.mifos.mobile.core.ui.utils.DevicePreviews

@Composable
fun LocationsScreen() {
internal fun LocationsScreen(
modifier: Modifier = Modifier,
) {
Column(
modifier = Modifier
modifier = modifier
.fillMaxSize()
.padding(16.dp)
.padding(16.dp),
) {
Text(
text = stringResource(id = R.string.mifos_initiative),
color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodyLarge
style = MaterialTheme.typography.bodyLarge,
)
Text(
text = stringResource(id = R.string.mifos_location),
color = MaterialTheme.colorScheme.onBackground,
style = MaterialTheme.typography.bodyMedium
style = MaterialTheme.typography.bodyMedium,
)

Spacer(modifier = Modifier.height(16.dp))
Expand All @@ -46,21 +57,22 @@ fun LocationsScreen() {
}

GoogleMap(
modifier = Modifier.fillMaxSize(), cameraPositionState = cameraPositionState
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
) {
Marker(
state = MarkerState(position = headquarterLatLng),
title = stringResource(id = R.string.mifos_initiative),
snippet = stringResource(id = R.string.mifos_location)
snippet = stringResource(id = R.string.mifos_location),
)
}
}
}

@Composable
@Preview(showSystemUi = true)
fun PreviewLocationsScreen() {
@DevicePreviews
private fun PreviewLocationsScreen() {
MifosMobileTheme {
LocationsScreen()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.location.navigation

import androidx.navigation.NavController
Expand All @@ -10,9 +19,7 @@ fun NavController.navigateToLocationsScreen() {
navigate(LocationsNavigation.LocationsScreen.route)
}

fun NavGraphBuilder.locationsNavGraph(
navController: NavController
) {
fun NavGraphBuilder.locationsNavGraph() {
navigation(
startDestination = LocationsNavigation.LocationsScreen.route,
route = LocationsNavigation.LocationsBase.route,
Expand All @@ -27,4 +34,4 @@ fun NavGraphBuilder.locationsScreenRoute() {
) {
LocationsScreen()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
*/
package org.mifos.mobile.feature.location.navigation

// Constants for Routes
Expand All @@ -8,4 +17,4 @@ const val LOCATIONS_SCREEN_ROUTE = "locations_screen_route"
sealed class LocationsNavigation(val route: String) {
data object LocationsBase : LocationsNavigation(route = LOCATIONS_NAVIGATION_ROUTE_BASE)
data object LocationsScreen : LocationsNavigation(route = LOCATIONS_SCREEN_ROUTE)
}
}
9 changes: 9 additions & 0 deletions feature/location/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2024 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file,
You can obtain one at https://mozilla.org/MPL/2.0/.
See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
-->
<resources>
<string name="mifos_initiative">Mifos Initiative</string>
<string name="mifos_location">Mifos Initiative , Seattle , Washington 98121</string>
Expand Down

This file was deleted.

0 comments on commit 8ece092

Please sign in to comment.