-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Joel-K-Muraguri/feature-certificates-list…
…-and-details-screen Implement certificates list and details screen with download alert di…
- Loading branch information
Showing
11 changed files
with
425 additions
and
10 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/peculiaruc/alc_mmsystem_mentor/components/CertificateDownloadDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.peculiaruc.alc_mmsystem_mentor.components | ||
|
||
import android.app.Dialog | ||
import android.graphics.Color | ||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.widget.Toast | ||
import androidx.appcompat.app.AlertDialog | ||
import androidx.fragment.app.DialogFragment | ||
import com.peculiaruc.alc_mmsystem_mentor.databinding.CertDownloadDialogBinding | ||
import com.peculiaruc.alc_mmsystem_mentor.databinding.ShareCustomDialogBinding | ||
|
||
class CertificateDownloadDialog : DialogFragment() { | ||
|
||
private lateinit var binding: CertDownloadDialogBinding | ||
|
||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | ||
binding = CertDownloadDialogBinding.inflate(LayoutInflater.from(context)) | ||
|
||
val builder = AlertDialog.Builder(requireActivity()) | ||
builder.setView(binding.root) | ||
|
||
binding.btnCertDownloadDialog.setOnClickListener { | ||
Toast.makeText(context, "Downloading...", Toast.LENGTH_SHORT).show() | ||
dismiss() | ||
} | ||
|
||
val dialog = builder.create() | ||
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) | ||
return dialog | ||
} | ||
|
||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/peculiaruc/alc_mmsystem_mentor/domain/CertificateItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.peculiaruc.alc_mmsystem_mentor.domain | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class CertificateItem( | ||
val id : Int, | ||
val title : String, | ||
val time : String, | ||
val certImage : Int, | ||
) : Parcelable |
44 changes: 44 additions & 0 deletions
44
...com/peculiaruc/alc_mmsystem_mentor/presentations/mainHome/adapters/CertificatesAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.peculiaruc.alc_mmsystem_mentor.presentations.mainHome.adapters | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.peculiaruc.alc_mmsystem_mentor.databinding.CertificateListItemBinding | ||
import com.peculiaruc.alc_mmsystem_mentor.domain.CertificateItem | ||
|
||
class CertificatesAdapter( | ||
private val certificatesList : List<CertificateItem>, | ||
private val listener: OnClickListener | ||
|
||
) : RecyclerView.Adapter<CertificatesAdapter.CertificateViewHolder>() { | ||
|
||
inner class CertificateViewHolder(val binding : CertificateListItemBinding) : RecyclerView.ViewHolder(binding.root){ | ||
fun bindItem(certificateItem: CertificateItem){ | ||
binding.tvCertTitle.text = certificateItem.title | ||
binding.ivCertLogo.setImageResource(certificateItem.certImage) | ||
|
||
binding.certificateItem.setOnClickListener { | ||
listener.onClick(certificateItem) | ||
} | ||
} | ||
|
||
} | ||
|
||
interface OnClickListener{ | ||
fun onClick(certificateItem: CertificateItem) | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CertificateViewHolder { | ||
val binding = CertificateListItemBinding.inflate(LayoutInflater.from(parent.context), parent,false) | ||
return CertificateViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: CertificateViewHolder, position: Int) { | ||
val programs = certificatesList[position] | ||
holder.bindItem(programs) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return certificatesList.size | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/download_dialog" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/mms_pry_11" | ||
android:padding="36dp"> | ||
|
||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="132dp" | ||
android:padding="16dp" | ||
android:text="Certificate Downloaded Successfully " | ||
android:textStyle="bold" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.407" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<ImageView | ||
android:id="@+id/iv_download_dialog" | ||
style="@style/MMCircleProfileView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:layout_marginTop="52dp" | ||
android:padding="16dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.456" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/textView" /> | ||
|
||
<Button | ||
android:id="@+id/btn_cert_download_dialog" | ||
style="@style/MMButton" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:layout_marginTop="44dp" | ||
android:text="Done" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.361" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/iv_download_dialog" | ||
app:layout_constraintVertical_bias="0.114" /> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.google.android.material.card.MaterialCardView 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:id="@+id/certificate_item" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:elevation="0dp" | ||
android:layout_marginHorizontal="16dp" | ||
app:cardElevation="0dp" | ||
app:shapeAppearanceOverlay="@style/ShapeAppearance.Material3.Corner.Small" | ||
app:strokeColor="@color/mm_outline"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="10dp"> | ||
|
||
<com.google.android.material.imageview.ShapeableImageView | ||
android:id="@+id/iv_cert_logo" | ||
android:layout_width="100dp" | ||
android:layout_height="70dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:srcCompat="@drawable/cert_ph" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/tv_cert_title" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:layout_marginStart="10dp" | ||
android:ellipsize="end" | ||
android:gravity="center|start" | ||
android:maxLines="2" | ||
android:textAllCaps="true" | ||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium" | ||
android:textColor="@color/mm_search_title_color" | ||
android:textStyle="bold" | ||
app:layout_constraintBottom_toBottomOf="@id/iv_cert_logo" | ||
app:layout_constraintEnd_toStartOf="@id/search_list_item_location" | ||
app:layout_constraintStart_toEndOf="@id/iv_cert_logo" | ||
app:layout_constraintTop_toTopOf="@id/iv_cert_logo" | ||
tools:text="GADS CLOuD 2022 - COMPLETION" /> | ||
|
||
<com.google.android.material.textview.MaterialTextView | ||
android:id="@+id/search_list_item_location" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginEnd="10dp" | ||
android:textColor="?colorPrimary" | ||
app:layout_constraintBottom_toBottomOf="@id/iv_cert_logo" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/tv_cert_title" | ||
android:text="" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</com.google.android.material.card.MaterialCardView> |
Oops, something went wrong.