Skip to content

Commit

Permalink
ui update
Browse files Browse the repository at this point in the history
  • Loading branch information
surajsahani committed Dec 11, 2021
1 parent a6712fd commit 28f78ab
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 23 deletions.
5 changes: 3 additions & 2 deletions .idea/misc.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

16 changes: 15 additions & 1 deletion app/src/main/java/com/martialcoder/MapsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.BitmapDescriptor
import com.google.android.gms.maps.model.BitmapDescriptorFactory
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import com.martialcoder.api.TrucksDataService
import com.martialcoder.model.Data
import com.martialcoder.remotestate.R
import com.martialcoder.remotestate.databinding.ActivityMapsBinding
import com.martialcoder.repository.Repository
import com.martialcoder.viewmodel.MainViewModel

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

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_maps)

binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
val repo = Repository(TrucksDataService)
viewModel = ViewModelProvider(this, ViewModelFactory(repo)).get(MainViewModel::class.java)
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)



}

override fun onMapReady(googleMap: GoogleMap) {
Expand Down
57 changes: 49 additions & 8 deletions app/src/main/res/drawable/ic_baseline_map_24.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
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"/>
android:width="55.39dp"
android:height="55.39dp"
android:viewportWidth="55.39"
android:viewportHeight="55.39">
<path
android:pathData="M18,23.199l-15.744,-15.744l-2.256,0.501l0,43l2.099,-0.466l15.901,-15.902z"
android:fillColor="#4FBA6E"/>
<path
android:pathData="M9.372,48.874l8.628,-1.918l0,-6.711z"
android:fillColor="#48A0DC"/>
<path
android:pathData="M18,3.956l-11.116,2.47l11.116,11.116z"
android:fillColor="#4FBA6E"/>
<path
android:pathData="M49.449,3.14l-14.449,4.816l0,9.632z"
android:fillColor="#4FBA6E"/>
<path
android:pathData="M35,23.245l0,26.711l18,-7l0,-37.711z"
android:fillColor="#48A0DC"/>
<path
android:pathData="M26.523,26.065l8.477,-8.477l0,-9.632l-17,-4l0,13.586z"
android:fillColor="#4AA461"/>
<path
android:pathData="M18,23.199l0,11.389l5.695,-5.694z"
android:fillColor="#4AA461"/>
<path
android:pathData="M18,40.245l0,6.711l17,3l0,-26.711z"
android:fillColor="#51A2C9"/>
<path
android:pathData="M18,17.542l-11.116,-11.116l-4.628,1.029l15.744,15.744z"
android:fillColor="#F3D55A"/>
<path
android:pathData="M18,34.588l-15.901,15.902l7.273,-1.616l8.628,-8.629z"
android:fillColor="#F3D55A"/>
<path
android:pathData="M35,23.245l18,-18l0,-3.289l-3.551,1.184l-14.449,14.448z"
android:fillColor="#F3D55A"/>
<path
android:pathData="M26.523,26.065l-8.523,-8.523l0,5.657l5.695,5.695l-5.695,5.694l0,5.657l17,-17l0,-5.657z"
android:fillColor="#DCBD56"/>
<path
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"
android:fillColor="#FFFFFF"/>
<path
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"
android:fillColor="#556080"/>
<path
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"
android:fillColor="#8697CB"/>
</vector>
22 changes: 16 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
android:id="@+id/idToolbarUsers"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/white"
android:elevation="2dp"
android:backgroundTint="@color/TruckMap_PinkColor"
app:layout_constraintTop_toTopOf="parent">


Expand All @@ -19,8 +22,12 @@
android:layout_height="match_parent">

<TextView
android:id="@+id/appTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:text="Trucks"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
Expand All @@ -29,12 +36,14 @@

<ImageView
android:id="@+id/mapImg"
android:layout_width="20dp"
android:layout_height="20dp"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
</ImageView>
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:src="@drawable/ic_baseline_map_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>

Expand All @@ -45,6 +54,7 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="5"
tools:listitem="@layout/item_truck_view"
app:layout_constraintTop_toBottomOf="@id/idToolbarUsers"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
23 changes: 22 additions & 1 deletion app/src/main/res/layout/item_truck_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_10sdp"
android:background="@color/white"
android:layout_marginVertical="@dimen/_10sdp"
android:layout_marginHorizontal="@dimen/_10sdp"
app:cardCornerRadius="@dimen/_10sdp"
app:cardElevation="@dimen/_10sdp">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand All @@ -19,7 +25,10 @@
android:id="@+id/truckNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_12sdp"
android:textColor="@color/TruckMap_PinkColor2"
android:text="@{model.truckNumber}"
android:layout_marginStart="@dimen/_12sdp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</TextView>
Expand All @@ -28,6 +37,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stopped Since last 234 days"
android:layout_marginTop="@dimen/_3sdp"
android:layout_marginBottom="@dimen/_12sdp"
app:layout_constraintStart_toStartOf="@id/truckNo"
app:layout_constraintTop_toBottomOf="@id/truckNo"
app:layout_constraintBottom_toBottomOf="parent">
Expand All @@ -36,6 +47,10 @@
android:id="@+id/tructRunningStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_10sdp"
android:alpha="0.6"
android:textColor="@color/TruckMap_PinkColor2"
android:layout_marginEnd="@dimen/_5sdp"
android:text="45623"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
Expand All @@ -45,13 +60,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="k/m"
android:layout_marginTop="@dimen/_10sdp"
android:alpha="0.6"
android:layout_marginEnd="@dimen/_10sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tructRunningStatus">
</TextView>
<TextView
android:id="@+id/tructkmNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/_3sdp"
android:alpha="0.6"
android:textColor="@color/TruckMap_PinkColor2"
app:layout_constraintTop_toTopOf="@+id/truckkm"
app:layout_constraintEnd_toStartOf="@id/truckkm"
app:layout_constraintBottom_toBottomOf="@id/truckkm">
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="orange">#FE5A1D</color>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF0000</color>
<color name="purple_700">#DC143C</color>


<!--TruckMapColors-->
<color name="TruckMap_PinkColor">#FF0C44</color>
<color name="TruckMap_PinkColor2">#FF6F90</color>
<color name="TruckMap_TextColor">#2A2A2A</color>
<color name="TruckMap_Grey">#2A2A2A</color>
<color name="TruckMap_LightPink">#FFE7EC</color>
<color name="TruckMap_LightGrey">#f9f9f9</color>
<color name="app_text_color">#b3b4b8</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">RemoteState</string>
<string name="app_name">Truck</string>
</resources>
16 changes: 12 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.RemoteState" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<style name="Theme.RemoteState" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/TruckMap_PinkColor</item>
<item name="colorPrimaryVariant">@color/TruckMap_PinkColor</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

0 comments on commit 28f78ab

Please sign in to comment.