Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 28f78ab

Browse files
committed
ui update
1 parent a6712fd commit 28f78ab

File tree

9 files changed

+137
-23
lines changed

9 files changed

+137
-23
lines changed

.idea/misc.xml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/martialcoder/MapsActivity.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ import android.os.Bundle
77
import android.widget.Toast
88
import androidx.appcompat.app.AppCompatActivity
99
import androidx.core.content.ContextCompat
10+
import androidx.lifecycle.ViewModelProvider
1011
import com.google.android.gms.maps.CameraUpdateFactory
1112
import com.google.android.gms.maps.GoogleMap
1213
import com.google.android.gms.maps.OnMapReadyCallback
14+
import com.google.android.gms.maps.SupportMapFragment
1315
import com.google.android.gms.maps.model.BitmapDescriptor
1416
import com.google.android.gms.maps.model.BitmapDescriptorFactory
1517
import com.google.android.gms.maps.model.LatLng
1618
import com.google.android.gms.maps.model.MarkerOptions
19+
import com.martialcoder.api.TrucksDataService
1720
import com.martialcoder.model.Data
1821
import com.martialcoder.remotestate.R
1922
import com.martialcoder.remotestate.databinding.ActivityMapsBinding
23+
import com.martialcoder.repository.Repository
2024
import com.martialcoder.viewmodel.MainViewModel
2125

2226
class MapsActivity : AppCompatActivity(), OnMapReadyCallback {
@@ -27,7 +31,17 @@ class MapsActivity : AppCompatActivity(), OnMapReadyCallback {
2731

2832
override fun onCreate(savedInstanceState: Bundle?) {
2933
super.onCreate(savedInstanceState)
30-
setContentView(R.layout.activity_maps)
34+
35+
binding = ActivityMapsBinding.inflate(layoutInflater)
36+
setContentView(binding.root)
37+
val repo = Repository(TrucksDataService)
38+
viewModel = ViewModelProvider(this, ViewModelFactory(repo)).get(MainViewModel::class.java)
39+
val mapFragment = supportFragmentManager
40+
.findFragmentById(R.id.map) as SupportMapFragment
41+
mapFragment.getMapAsync(this)
42+
43+
44+
3145
}
3246

3347
override fun onMapReady(googleMap: GoogleMap) {
Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="24dp"
3-
android:height="24dp"
4-
android:viewportWidth="24"
5-
android:viewportHeight="24"
6-
android:tint="?attr/colorControlNormal">
7-
<path
8-
android:fillColor="@android:color/white"
9-
android:pathData="M20.5,3l-0.16,0.03L15,5.1 9,3 3.36,4.9c-0.21,0.07 -0.36,0.25 -0.36,0.48V20.5c0,0.28 0.22,0.5 0.5,0.5l0.16,-0.03L9,18.9l6,2.1 5.64,-1.9c0.21,-0.07 0.36,-0.25 0.36,-0.48V3.5c0,-0.28 -0.22,-0.5 -0.5,-0.5zM15,19l-6,-2.11V5l6,2.11V19z"/>
2+
android:width="55.39dp"
3+
android:height="55.39dp"
4+
android:viewportWidth="55.39"
5+
android:viewportHeight="55.39">
6+
<path
7+
android:pathData="M18,23.199l-15.744,-15.744l-2.256,0.501l0,43l2.099,-0.466l15.901,-15.902z"
8+
android:fillColor="#4FBA6E"/>
9+
<path
10+
android:pathData="M9.372,48.874l8.628,-1.918l0,-6.711z"
11+
android:fillColor="#48A0DC"/>
12+
<path
13+
android:pathData="M18,3.956l-11.116,2.47l11.116,11.116z"
14+
android:fillColor="#4FBA6E"/>
15+
<path
16+
android:pathData="M49.449,3.14l-14.449,4.816l0,9.632z"
17+
android:fillColor="#4FBA6E"/>
18+
<path
19+
android:pathData="M35,23.245l0,26.711l18,-7l0,-37.711z"
20+
android:fillColor="#48A0DC"/>
21+
<path
22+
android:pathData="M26.523,26.065l8.477,-8.477l0,-9.632l-17,-4l0,13.586z"
23+
android:fillColor="#4AA461"/>
24+
<path
25+
android:pathData="M18,23.199l0,11.389l5.695,-5.694z"
26+
android:fillColor="#4AA461"/>
27+
<path
28+
android:pathData="M18,40.245l0,6.711l17,3l0,-26.711z"
29+
android:fillColor="#51A2C9"/>
30+
<path
31+
android:pathData="M18,17.542l-11.116,-11.116l-4.628,1.029l15.744,15.744z"
32+
android:fillColor="#F3D55A"/>
33+
<path
34+
android:pathData="M18,34.588l-15.901,15.902l7.273,-1.616l8.628,-8.629z"
35+
android:fillColor="#F3D55A"/>
36+
<path
37+
android:pathData="M35,23.245l18,-18l0,-3.289l-3.551,1.184l-14.449,14.448z"
38+
android:fillColor="#F3D55A"/>
39+
<path
40+
android:pathData="M26.523,26.065l-8.523,-8.523l0,5.657l5.695,5.695l-5.695,5.694l0,5.657l17,-17l0,-5.657z"
41+
android:fillColor="#DCBD56"/>
42+
<path
43+
android:pathData="M54.195,44.113l-0.107,0.163c-7.121,10.876 -18.773,10.876 -25.893,0l0,0l0.107,-0.163C35.422,33.237 47.074,33.237 54.195,44.113L54.195,44.113z"
44+
android:fillColor="#FFFFFF"/>
45+
<path
46+
android:pathData="M40.958,41.831m-5.909,0a5.909,5.909 0,1 1,11.818 0a5.909,5.909 0,1 1,-11.818 0"
47+
android:fillColor="#556080"/>
48+
<path
49+
android:pathData="M41.142,53.434c-5.254,0 -10.148,-3.058 -13.783,-8.609L27,44.277l0.465,-0.711c3.635,-5.552 8.53,-8.609 13.784,-8.609c5.253,0 10.148,3.057 13.783,8.609l0.358,0.547l-0.465,0.711C51.29,50.376 46.395,53.434 41.142,53.434zM29.398,44.272c3.206,4.624 7.356,7.161 11.744,7.161c4.436,0 8.63,-2.594 11.85,-7.317c-3.206,-4.624 -7.356,-7.161 -11.743,-7.161C36.812,36.956 32.618,39.55 29.398,44.272z"
50+
android:fillColor="#8697CB"/>
1051
</vector>

app/src/main/res/layout/activity_main.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
android:id="@+id/idToolbarUsers"
1212
android:layout_width="match_parent"
1313
android:layout_height="?attr/actionBarSize"
14+
android:background="@android:color/white"
15+
android:elevation="2dp"
16+
android:backgroundTint="@color/TruckMap_PinkColor"
1417
app:layout_constraintTop_toTopOf="parent">
1518

1619

@@ -19,8 +22,12 @@
1922
android:layout_height="match_parent">
2023

2124
<TextView
25+
android:id="@+id/appTitle"
2226
android:layout_width="wrap_content"
2327
android:layout_height="wrap_content"
28+
android:layout_marginStart="5dp"
29+
android:text="Trucks"
30+
android:textColor="@color/white"
2431
app:layout_constraintBottom_toBottomOf="parent"
2532
app:layout_constraintStart_toStartOf="parent"
2633
app:layout_constraintTop_toTopOf="parent">
@@ -29,12 +36,14 @@
2936

3037
<ImageView
3138
android:id="@+id/mapImg"
32-
android:layout_width="20dp"
33-
android:layout_height="20dp"
34-
app:layout_constraintEnd_toStartOf="parent"
35-
app:layout_constraintTop_toTopOf="parent"
36-
app:layout_constraintBottom_toBottomOf="parent">
37-
</ImageView>
39+
android:layout_width="30dp"
40+
android:layout_height="30dp"
41+
android:layout_marginTop="5dp"
42+
android:layout_marginEnd="20dp"
43+
android:src="@drawable/ic_baseline_map_24"
44+
app:layout_constraintEnd_toEndOf="parent"
45+
app:layout_constraintBottom_toBottomOf="parent"
46+
app:layout_constraintTop_toTopOf="parent" />
3847
</androidx.constraintlayout.widget.ConstraintLayout>
3948
</androidx.appcompat.widget.Toolbar>
4049

@@ -45,6 +54,7 @@
4554
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
4655
tools:itemCount="5"
4756
tools:listitem="@layout/item_truck_view"
57+
app:layout_constraintTop_toBottomOf="@id/idToolbarUsers"
4858
app:layout_constraintBottom_toBottomOf="parent"/>
4959
</androidx.constraintlayout.widget.ConstraintLayout>
5060
</layout>

app/src/main/res/layout/item_truck_view.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
<androidx.cardview.widget.CardView
1111
android:layout_width="match_parent"
12-
android:layout_height="wrap_content">
12+
android:layout_height="wrap_content"
13+
android:layout_marginTop="@dimen/_10sdp"
14+
android:background="@color/white"
15+
android:layout_marginVertical="@dimen/_10sdp"
16+
android:layout_marginHorizontal="@dimen/_10sdp"
17+
app:cardCornerRadius="@dimen/_10sdp"
18+
app:cardElevation="@dimen/_10sdp">
1319

1420
<androidx.constraintlayout.widget.ConstraintLayout
1521
android:layout_width="match_parent"
@@ -19,7 +25,10 @@
1925
android:id="@+id/truckNo"
2026
android:layout_width="wrap_content"
2127
android:layout_height="wrap_content"
28+
android:layout_marginTop="@dimen/_12sdp"
29+
android:textColor="@color/TruckMap_PinkColor2"
2230
android:text="@{model.truckNumber}"
31+
android:layout_marginStart="@dimen/_12sdp"
2332
app:layout_constraintStart_toStartOf="parent"
2433
app:layout_constraintTop_toTopOf="parent">
2534
</TextView>
@@ -28,6 +37,8 @@
2837
android:layout_width="wrap_content"
2938
android:layout_height="wrap_content"
3039
android:text="Stopped Since last 234 days"
40+
android:layout_marginTop="@dimen/_3sdp"
41+
android:layout_marginBottom="@dimen/_12sdp"
3142
app:layout_constraintStart_toStartOf="@id/truckNo"
3243
app:layout_constraintTop_toBottomOf="@id/truckNo"
3344
app:layout_constraintBottom_toBottomOf="parent">
@@ -36,6 +47,10 @@
3647
android:id="@+id/tructRunningStatus"
3748
android:layout_width="wrap_content"
3849
android:layout_height="wrap_content"
50+
android:layout_marginTop="@dimen/_10sdp"
51+
android:alpha="0.6"
52+
android:textColor="@color/TruckMap_PinkColor2"
53+
android:layout_marginEnd="@dimen/_5sdp"
3954
android:text="45623"
4055
app:layout_constraintEnd_toEndOf="parent"
4156
app:layout_constraintTop_toTopOf="parent">
@@ -45,13 +60,19 @@
4560
android:layout_width="wrap_content"
4661
android:layout_height="wrap_content"
4762
android:text="k/m"
63+
android:layout_marginTop="@dimen/_10sdp"
64+
android:alpha="0.6"
65+
android:layout_marginEnd="@dimen/_10sdp"
4866
app:layout_constraintEnd_toEndOf="parent"
4967
app:layout_constraintTop_toBottomOf="@id/tructRunningStatus">
5068
</TextView>
5169
<TextView
5270
android:id="@+id/tructkmNo"
5371
android:layout_width="wrap_content"
5472
android:layout_height="wrap_content"
73+
android:layout_marginEnd="@dimen/_3sdp"
74+
android:alpha="0.6"
75+
android:textColor="@color/TruckMap_PinkColor2"
5576
app:layout_constraintTop_toTopOf="@+id/truckkm"
5677
app:layout_constraintEnd_toStartOf="@id/truckkm"
5778
app:layout_constraintBottom_toBottomOf="@id/truckkm">

app/src/main/res/values/colors.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,17 @@
88
<color name="black">#FF000000</color>
99
<color name="white">#FFFFFFFF</color>
1010
<color name="orange">#FE5A1D</color>
11+
<color name="purple_200">#FFBB86FC</color>
12+
<color name="purple_500">#FF0000</color>
13+
<color name="purple_700">#DC143C</color>
14+
15+
16+
<!--TruckMapColors-->
17+
<color name="TruckMap_PinkColor">#FF0C44</color>
18+
<color name="TruckMap_PinkColor2">#FF6F90</color>
19+
<color name="TruckMap_TextColor">#2A2A2A</color>
20+
<color name="TruckMap_Grey">#2A2A2A</color>
21+
<color name="TruckMap_LightPink">#FFE7EC</color>
22+
<color name="TruckMap_LightGrey">#f9f9f9</color>
23+
<color name="app_text_color">#b3b4b8</color>
1124
</resources>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">RemoteState</string>
2+
<string name="app_name">Truck</string>
33
</resources>

app/src/main/res/values/styles.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<!-- Base application theme. -->
3-
<style name="Theme.RemoteState" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
4-
<item name="colorPrimary">@color/colorPrimary</item>
5-
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
6-
<item name="colorAccent">@color/colorAccent</item>
3+
<style name="Theme.RemoteState" parent="Theme.MaterialComponents.Light.NoActionBar">
4+
<!-- Primary brand color. -->
5+
<item name="colorPrimary">@color/TruckMap_PinkColor</item>
6+
<item name="colorPrimaryVariant">@color/TruckMap_PinkColor</item>
7+
<item name="colorOnPrimary">@color/white</item>
8+
<!-- Secondary brand color. -->
9+
<item name="colorSecondary">@color/teal_200</item>
10+
<item name="colorSecondaryVariant">@color/teal_700</item>
11+
<item name="colorOnSecondary">@color/black</item>
12+
<!-- Status bar color. -->
13+
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
14+
<!-- Customize your theme here. -->
715
</style>
816
</resources>

0 commit comments

Comments
 (0)