Skip to content

Commit

Permalink
ui revamps
Browse files Browse the repository at this point in the history
  • Loading branch information
muindi.stephen committed Apr 11, 2024
1 parent 9bcbd68 commit a1a63fd
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.steve_md.smartmkulima.ui.fragments.main

import android.annotation.SuppressLint
import android.app.AlertDialog
import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -17,6 +18,7 @@ import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener
import com.steve_md.smartmkulima.R
import com.steve_md.smartmkulima.databinding.FragmentHomeDashboardBinding
import com.steve_md.smartmkulima.utils.DateFormat.getLastLoginDayAndDate
import com.steve_md.smartmkulima.utils.displaySnackBar
import com.steve_md.smartmkulima.utils.toast
import dagger.hilt.android.AndroidEntryPoint
Expand Down Expand Up @@ -116,6 +118,7 @@ class HomeDashboardFragment : Fragment() {
}


@SuppressLint("SetTextI18n")
private fun setUpBinding() {
binding.apply {
cardView1.setOnClickListener {
Expand All @@ -124,6 +127,8 @@ class HomeDashboardFragment : Fragment() {
cardView9.setOnClickListener {
// TODO()
}

textViewLastLoggedInTimeDate.text = "Last login: " +getLastLoginDayAndDate()
}
}
}
11 changes: 11 additions & 0 deletions app/src/main/java/com/steve_md/smartmkulima/utils/DateFormat.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.steve_md.smartmkulima.utils

import android.annotation.SuppressLint
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*

Expand All @@ -16,4 +18,13 @@ object DateFormat {
val date = Date(timestamp)
return timeFormat.format(date)
}

@SuppressLint("SimpleDateFormat")
fun getLastLoginDayAndDate(): String? {
val cal = Calendar.getInstance()
val sdf = SimpleDateFormat("EEE, MMM d, yyyy")
val dateformat = DateFormat.getDateInstance(DateFormat.MEDIUM)
return dateformat.format(cal.time)
}

}
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/custom_cell.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape= "rectangle" >
<solid android:color="@color/white"/>
<stroke android:width="1dp" android:color="@color/main_black"/>
</shape>
85 changes: 53 additions & 32 deletions app/src/main/res/layout/detail_cycle_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,61 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">


<TextView
android:id="@+id/textView75"
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="weeding"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:textSize="11sp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TableRow>

<androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/textView75"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="weeding"
android:padding="4dp"
android:layout_marginStart="8dp"
android:background="@drawable/custom_cell"
android:layout_marginTop="1dp"
android:textSize="11sp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView76"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:text="2024-04-08"
android:background="@drawable/custom_cell"
android:textSize="11sp"
android:padding="4dp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintBottom_toBottomOf="@+id/textView75"
app:layout_constraintStart_toEndOf="@+id/textView75"
app:layout_constraintTop_toTopOf="@+id/textView75" />

<TextView
android:id="@+id/textView77"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:text="2024-08-30"
android:background="@drawable/custom_cell"
android:textSize="11sp"
android:padding="4dp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintBottom_toBottomOf="@+id/textView76"
app:layout_constraintStart_toEndOf="@+id/textView76"
app:layout_constraintTop_toTopOf="@+id/textView76" />
</androidx.constraintlayout.widget.ConstraintLayout>
</TableRow>

</TableLayout>


<TextView
android:id="@+id/textView76"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="2024-04-08"
android:textSize="11sp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintBottom_toBottomOf="@+id/textView75"
app:layout_constraintStart_toEndOf="@+id/textView75"
app:layout_constraintTop_toTopOf="@+id/textView75" />

<TextView
android:id="@+id/textView77"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:text="2024-08-30"
android:textSize="11sp"
android:fontFamily="@font/montserrat_semibold"
app:layout_constraintBottom_toBottomOf="@+id/textView76"
app:layout_constraintStart_toEndOf="@+id/textView76"
app:layout_constraintTop_toTopOf="@+id/textView76" />
</androidx.constraintlayout.widget.ConstraintLayout>
6 changes: 4 additions & 2 deletions app/src/main/res/layout/fragment_auto_create_crop_cycle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="@drawable/rounded_corner"

android:entries="@array/cycle_types"
android:paddingHorizontal="12dp"
android:paddingVertical="8dp"
Expand Down Expand Up @@ -93,6 +93,8 @@
android:background="@drawable/rounded_corner"
android:paddingHorizontal="12dp"
android:paddingVertical="8dp"
android:hint="Farm name"
android:fontFamily="@font/montserrat_medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cropCycleStartDay"
Expand Down Expand Up @@ -179,7 +181,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:textAlignment="textEnd"
android:text="View cycles"
android:text="View cycles >>"
android:textColor="@color/main"
android:fontFamily="@font/montserrat_bold"
android:layout_marginTop="8dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_crop_cycle_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
android:layout_marginStart="20dp"
android:fontFamily="@font/nunito_sans_semibold"
android:gravity="center"
android:text="Crop Cycles Available"
android:text="Farm Cycles Available"
android:textColor="#F1ECE7"
android:textSize="18sp" />
</LinearLayout>
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/res/layout/fragment_detailed_farm_cycle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Tasks"
android:layout_marginStart="8dp"
android:textStyle="bold"
android:layout_marginStart="2dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView78" />

Expand All @@ -93,7 +94,9 @@
android:layout_height="wrap_content"
android:fontFamily="@font/montserrat_bold"
android:text="TaskName"
android:padding="4dp"
android:textSize="11sp"
android:textStyle="bold"
android:layout_marginStart="2dp"
app:layout_constraintBottom_toBottomOf="@+id/textView79"
app:layout_constraintStart_toEndOf="@+id/textView79"
Expand All @@ -104,6 +107,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:padding="4dp"
android:textStyle="bold"
android:fontFamily="@font/montserrat_bold"
android:text="Start Date"
android:textSize="11sp"
Expand All @@ -116,6 +121,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End Date"
android:padding="4dp"
android:textStyle="bold"
android:textSize="11sp"
android:fontFamily="@font/montserrat_bold"
android:layout_marginStart="8dp"
Expand Down
22 changes: 19 additions & 3 deletions app/src/main/res/layout/fragment_home_dashboard.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_gray"
android:fillViewport="true"
android:fitsSystemWindows="true"
android:scrollbars="none"
tools:context=".ui.fragments.main.HomeDashboardFragment">

Expand All @@ -28,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="1dp"
android:layout_marginTop="22dp"
android:layout_marginEnd="60dp"
android:fontFamily="@font/montserrat_semibold"
android:text="What would you like to know??"
Expand Down Expand Up @@ -195,6 +197,7 @@
android:layout_height="248dp"
android:layout_marginTop="20dp"
app:cardCornerRadius="20dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/cardView"
app:layout_constraintStart_toStartOf="@+id/cardView"
Expand Down Expand Up @@ -256,6 +259,7 @@
android:layout_height="146dp"
android:layout_marginTop="20dp"
app:cardCornerRadius="20dp"
android:layout_marginBottom="16dp"
app:layout_constraintEnd_toEndOf="@+id/cardView8"
app:layout_constraintStart_toStartOf="@+id/cardView8"
app:layout_constraintTop_toBottomOf="@+id/cardView8"
Expand Down Expand Up @@ -292,5 +296,17 @@
app:layout_constraintTop_toTopOf="@+id/includeToolBar"
app:layout_constraintVertical_bias="0.54" />

<TextView
android:id="@+id/textViewLastLoggedInTimeDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="22dp"
android:text="@string/last_login_apr_10_2024"
android:textSize="12sp"
android:fontFamily="@font/montserrat_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/includeToolBar" />


</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<string name="or_view_available_crop_cycles">Or View available crop cycles ?</string>
<string name="block_a">Block A</string>
<string name="textview">TextView</string>
<string name="last_login_apr_10_2024">Last login: Apr 10, 2024</string>

<string-array name="cycle_types">
<item>Crop Cycle</item>
Expand Down

0 comments on commit a1a63fd

Please sign in to comment.