Skip to content

Commit 868bf34

Browse files
refactor: remove the use of material icons (#122)
* refactor: remove the use of material icons from library * refactor: add license header to xml res icons
1 parent 101b288 commit 868bf34

File tree

14 files changed

+83
-40
lines changed

14 files changed

+83
-40
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454

5555
## Features
5656

57-
- Displays clear cardinal directions with both magnetic north and true north.
58-
- Live GPS location tracking on OpenStreetMap.
59-
- Shows magnetic field strength in µT.
60-
- Sensor fusion for improved accuracy (accelerometer, magnetometer, gyroscope).
57+
- Displays clear cardinal directions with both **magnetic north** and **true north**.
58+
- Live **GPS location tracking** on _OpenStreetMap_.
59+
- Shows magnetic field strength in **µT**.
60+
- Sensor fusion for improved accuracy (_accelerometer_, _magnetometer_, _gyroscope_).
6161
- Light and dark theme support controlled via Settings.
6262
- Keeps screen on during navigation.
6363
- Landscape orientation support.
@@ -127,4 +127,4 @@ MBCompass is Free Software: you can use, study, share, and improve it at your wi
127127
See more information [here](https://github.com/MubarakNative/MBCompass/blob/main/LICENSE).
128128

129129
### Artwork License:
130-
Compass rose : [MBCompass rose](https://github.com/MubarakNative/MBCompass/blob/main/app/src/main/res/drawable/mbcompass_rose.xml) © 2025 by Mubarak Basha is licensed under CC BY-SA 4.0
130+
Compass rose : [MBCompass rose](https://github.com/MubarakNative/MBCompass/blob/main/app/src/main/res/drawable/mbcompass_rose.xml) © 2025 by Mubarak Basha is licensed under **CC BY-SA 4.0**

app/src/main/java/com/mubarak/mbcompass/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import androidx.compose.runtime.mutableStateOf
1515
import androidx.compose.runtime.setValue
1616
import androidx.core.view.WindowCompat
1717
import androidx.fragment.app.FragmentActivity
18-
import androidx.hilt.navigation.compose.hiltViewModel
18+
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
1919
import androidx.lifecycle.Lifecycle
2020
import androidx.lifecycle.compose.collectAsStateWithLifecycle
2121
import androidx.lifecycle.lifecycleScope

app/src/main/java/com/mubarak/mbcompass/ui/compass/CompassApp.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ import androidx.compose.foundation.layout.size
3030
import androidx.compose.foundation.layout.width
3131
import androidx.compose.foundation.rememberScrollState
3232
import androidx.compose.foundation.verticalScroll
33-
import androidx.compose.material.icons.Icons
34-
import androidx.compose.material.icons.filled.Settings
3533
import androidx.compose.material3.AlertDialog
3634
import androidx.compose.material3.Button
3735
import androidx.compose.material3.CircularProgressIndicator
3836
import androidx.compose.material3.ExperimentalMaterial3Api
3937
import androidx.compose.material3.Icon
4038
import androidx.compose.material3.IconButton
39+
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
4140
import androidx.compose.material3.MaterialTheme
4241
import androidx.compose.material3.Scaffold
4342
import androidx.compose.material3.SmallFloatingActionButton
@@ -67,8 +66,6 @@ import androidx.compose.ui.text.font.FontWeight
6766
import androidx.compose.ui.unit.dp
6867
import androidx.core.content.ContextCompat
6968
import androidx.core.location.LocationManagerCompat
70-
import androidx.core.text.HtmlCompat
71-
import androidx.hilt.navigation.compose.hiltViewModel
7269
import androidx.lifecycle.Lifecycle
7370
import androidx.lifecycle.LifecycleEventObserver
7471
import androidx.lifecycle.LifecycleOwner
@@ -90,7 +87,7 @@ import kotlin.math.roundToInt
9087
fun CompassApp(
9188
sensorViewModel: SensorViewModel = viewModel(),
9289
mainViewModel: MainViewModel = viewModel(),
93-
settingsViewModel: SettingsViewModel = hiltViewModel(),
90+
settingsViewModel: SettingsViewModel = hiltViewModel<SettingsViewModel>(),
9491
navigateToMap: () -> Unit,
9592
navigateToSettings: () -> Unit
9693
) {
@@ -158,7 +155,7 @@ fun CompassApp(
158155
}
159156
IconButton(onClick = navigateToSettings) {
160157
Icon(
161-
imageVector = Icons.Filled.Settings,
158+
painterResource(R.drawable.settings_24px),
162159
contentDescription = stringResource(R.string.settings_content_description)
163160
)
164161
}
@@ -261,7 +258,7 @@ fun MBCompass(
261258
)
262259

263260
Text(
264-
text = context.getString(R.string.magnetic_strength,strengthRounded),
261+
text = stringResource(R.string.magnetic_strength,strengthRounded),
265262
style = MaterialTheme.typography.bodyMedium,
266263
modifier = Modifier.padding(top = 8.dp)
267264
)

app/src/main/java/com/mubarak/mbcompass/ui/location/MapFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ class MapFragment : Fragment() {
3939
private var myLocationOverlay: MyLocationNewOverlay? = null
4040

4141
private val requestPermissionLauncher =
42-
registerForActivityResult(ActivityResultContracts.RequestPermission(), { isGranted ->
42+
registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted ->
4343
if (isGranted) {
4444
enableLocationOverlay()
4545
} else {
4646
Toast.makeText(requireContext(), R.string.permission_rationale, Toast.LENGTH_SHORT)
4747
.show()
4848
}
49-
})
49+
}
5050

5151
override fun onCreateView(
5252
inflater: LayoutInflater, container: ViewGroup?,

app/src/main/java/com/mubarak/mbcompass/ui/location/UserLocation.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@ package com.mubarak.mbcompass.ui.location
44

55
import androidx.activity.compose.LocalActivity
66
import androidx.compose.foundation.layout.padding
7-
import androidx.compose.material.icons.Icons
8-
import androidx.compose.material.icons.automirrored.filled.ArrowBack
97
import androidx.compose.material3.ExperimentalMaterial3Api
108
import androidx.compose.material3.Icon
119
import androidx.compose.material3.IconButton
12-
import androidx.compose.material3.MaterialTheme
1310
import androidx.compose.material3.Scaffold
1411
import androidx.compose.material3.Text
1512
import androidx.compose.material3.TopAppBar
16-
import androidx.compose.material3.TopAppBarDefaults
1713
import androidx.compose.runtime.Composable
1814
import androidx.compose.ui.Modifier
15+
import androidx.compose.ui.res.painterResource
1916
import androidx.compose.ui.res.stringResource
2017
import androidx.compose.ui.viewinterop.AndroidViewBinding
2118
import androidx.fragment.app.FragmentActivity
@@ -38,7 +35,7 @@ fun UserLocation(
3835
navigationIcon = {
3936
IconButton(onClick = navigateUp) {
4037
Icon(
41-
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
38+
painterResource(R.drawable.arrow_back_24px),
4239
contentDescription = stringResource(R.string.nav_back)
4340
)
4441
}

app/src/main/java/com/mubarak/mbcompass/ui/settings/SettingsScreen.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState
2929
import androidx.compose.foundation.rememberScrollState
3030
import androidx.compose.foundation.shape.RoundedCornerShape
3131
import androidx.compose.foundation.verticalScroll
32-
import androidx.compose.material.icons.Icons
33-
import androidx.compose.material.icons.automirrored.filled.ArrowBack
34-
import androidx.compose.material.icons.filled.Check
3532
import androidx.compose.material3.AlertDialog
3633
import androidx.compose.material3.ExperimentalMaterial3Api
3734
import androidx.compose.material3.Icon
@@ -65,7 +62,7 @@ import androidx.compose.ui.res.stringResource
6562
import androidx.compose.ui.tooling.preview.Preview
6663
import androidx.compose.ui.unit.dp
6764
import androidx.core.net.toUri
68-
import androidx.hilt.navigation.compose.hiltViewModel
65+
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
6966
import androidx.lifecycle.compose.collectAsStateWithLifecycle
7067
import com.mubarak.mbcompass.R
7168
import com.mubarak.mbcompass.ui.theme.MBCompassTheme
@@ -133,7 +130,7 @@ fun SettingsScreen(
133130
TopAppBar(title = { Text(stringResource(R.string.settings)) }, navigationIcon = {
134131
IconButton(onClick = onBackClicked) {
135132
Icon(
136-
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
133+
painterResource(R.drawable.arrow_back_24px),
137134
contentDescription = stringResource(R.string.nav_back)
138135
)
139136
}
@@ -333,7 +330,7 @@ fun SettingsItem(
333330
thumbContent = if (checked) {
334331
{
335332
Icon(
336-
imageVector = Icons.Filled.Check,
333+
painterResource(R.drawable.code_icon24px),
337334
contentDescription = null,
338335
modifier = Modifier.size(SwitchDefaults.IconSize),
339336
)

app/src/main/java/com/mubarak/mbcompass/utils/Const.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object Const {
1212
const val APP_PAGE = "https://github.com/CompassMB/MBCompass"
1313
const val LICENSE_PAGE = "https://www.gnu.org/licenses/gpl-3.0.txt"
1414
const val SUPPORT_PAGE = "https://compassmb.github.io/MBCompass-site/donate.html"
15-
const val AUTHOR_EMAIL = "dev.mubarakbasha@gmail.com"
15+
const val AUTHOR_EMAIL = "dev.mubarakbasha@proton.me"
1616
}
1717

1818

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- SPDX-License-Identifier: GPL-3.0-or-later-->
2+
3+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:width="24dp"
5+
android:height="24dp"
6+
android:viewportWidth="960"
7+
android:viewportHeight="960"
8+
android:tint="#000000"
9+
android:autoMirrored="true">
10+
<path
11+
android:fillColor="@android:color/white"
12+
android:pathData="M313,520L537,744L480,800L160,480L480,160L537,216L313,440L800,440L800,520L313,520Z"/>
13+
</vector>

app/src/main/res/drawable/fab_bg.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- SPDX-License-Identifier: GPL-3.0-or-later-->
2+
13
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
24
android:color="#25DFF4">
35
<item android:id="@android:id/mask">
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">
2-
3-
<path android:fillColor="@android:color/white" android:pathData="M640,520L474,358Q443,328 421.5,291.5Q400,255 400,212Q400,157 438.5,118.5Q477,80 532,80Q564,80 592,93.5Q620,107 640,130Q660,107 688,93.5Q716,80 748,80Q803,80 841.5,118.5Q880,157 880,212Q880,255 859,291.5Q838,328 807,358L640,520ZM640,408L749,301Q768,282 784,260.5Q800,239 800,212Q800,190 785,175Q770,160 748,160Q734,160 721.5,165.5Q709,171 700,182L640,254L580,182Q571,171 558.5,165.5Q546,160 532,160Q510,160 495,175Q480,190 480,212Q480,239 496,260.5Q512,282 531,301L640,408ZM280,740L558,816L796,742Q791,733 781.5,726.5Q772,720 760,720L558,720Q531,720 515,718Q499,716 482,710L389,679L411,601L492,628Q509,633 532,636Q555,639 600,640L600,640Q600,640 600,640Q600,640 600,640Q600,629 593.5,619Q587,609 578,606L344,520Q344,520 344,520Q344,520 344,520L280,520L280,740ZM40,880L40,440L344,440Q351,440 358,441.5Q365,443 371,445L606,532Q639,544 659.5,574Q680,604 680,640L760,640Q810,640 845,673Q880,706 880,760L880,800L560,900L280,822L280,822L280,880L40,880ZM120,800L200,800L200,520L120,520L120,800ZM640,254L640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254L640,254L640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Z"/>
4-
1+
<!-- SPDX-License-Identifier: GPL-3.0-or-later-->
2+
3+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:width="24dp"
5+
android:height="24dp"
6+
android:tint="#000000"
7+
android:viewportWidth="960"
8+
android:viewportHeight="960">
9+
10+
<path
11+
android:fillColor="@android:color/white"
12+
android:pathData="M640,520L474,358Q443,328 421.5,291.5Q400,255 400,212Q400,157 438.5,118.5Q477,80 532,80Q564,80 592,93.5Q620,107 640,130Q660,107 688,93.5Q716,80 748,80Q803,80 841.5,118.5Q880,157 880,212Q880,255 859,291.5Q838,328 807,358L640,520ZM640,408L749,301Q768,282 784,260.5Q800,239 800,212Q800,190 785,175Q770,160 748,160Q734,160 721.5,165.5Q709,171 700,182L640,254L580,182Q571,171 558.5,165.5Q546,160 532,160Q510,160 495,175Q480,190 480,212Q480,239 496,260.5Q512,282 531,301L640,408ZM280,740L558,816L796,742Q791,733 781.5,726.5Q772,720 760,720L558,720Q531,720 515,718Q499,716 482,710L389,679L411,601L492,628Q509,633 532,636Q555,639 600,640L600,640Q600,640 600,640Q600,640 600,640Q600,629 593.5,619Q587,609 578,606L344,520Q344,520 344,520Q344,520 344,520L280,520L280,740ZM40,880L40,440L344,440Q351,440 358,441.5Q365,443 371,445L606,532Q639,544 659.5,574Q680,604 680,640L760,640Q810,640 845,673Q880,706 880,760L880,800L560,900L280,822L280,822L280,880L40,880ZM120,800L200,800L200,520L120,520L120,800ZM640,254L640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254L640,254L640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Q640,254 640,254Z" />
13+
514
</vector>

0 commit comments

Comments
 (0)