Skip to content

Commit

Permalink
avances en nuevas UI de compartir sismos #39
Browse files Browse the repository at this point in the history
Signed-off-by: figonzal1 <[email protected]>
  • Loading branch information
figonzal1 committed Jul 15, 2023
1 parent 4c2148d commit 6f4aa1f
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import android.os.Build
import android.view.View
import cl.figonzal.lastquakechile.R
import cl.figonzal.lastquakechile.core.utils.views.*
import cl.figonzal.lastquakechile.databinding.QuakeBottomSheetBinding
import cl.figonzal.lastquakechile.databinding.QuakeMapBottomSheetBinding
import cl.figonzal.lastquakechile.quake_feature.domain.model.Quake
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.Circle
Expand Down Expand Up @@ -169,7 +169,7 @@ fun Context.configMapType() = SharedPrefUtil(this).getData(

fun Context.setBottomSheetQuakeData(
quake: Quake,
binding: QuakeBottomSheetBinding
binding: QuakeMapBottomSheetBinding
) {

with(binding.sheetContent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import cl.figonzal.lastquakechile.core.utils.*
import cl.figonzal.lastquakechile.core.utils.views.*
import cl.figonzal.lastquakechile.databinding.ActivityQuakeDetailsBinding
import cl.figonzal.lastquakechile.quake_feature.domain.model.Quake
import cl.figonzal.lastquakechile.quake_feature.ui.dialog.ShareQuakeBottomSheetDialog
import com.google.android.gms.ads.*
import com.google.android.gms.ads.nativead.NativeAd
import com.google.android.gms.ads.nativead.NativeAdView
Expand Down Expand Up @@ -86,6 +87,7 @@ class QuakeDetailsActivity : AppCompatActivity(), OnMapReadyCallback {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> {
this?.getParcelable(QUAKE, Quake::class.java)
}

else -> this?.get(QUAKE) as Quake
}
isSnapshotRequest = this?.getBoolean(IS_SNAPSHOT_REQUEST_FROM_BOTTOM_SHEET) as Boolean
Expand Down Expand Up @@ -172,6 +174,7 @@ class QuakeDetailsActivity : AppCompatActivity(), OnMapReadyCallback {
null -> {
View.INVISIBLE
}

else -> {
nativeAd.starRating?.let {
(starRatingView as RatingBar).rating = it.toFloat()
Expand All @@ -191,6 +194,7 @@ class QuakeDetailsActivity : AppCompatActivity(), OnMapReadyCallback {
vc?.hasVideoContent() == true -> vc.videoLifecycleCallbacks =
object : VideoController.VideoLifecycleCallbacks() {
}

else -> {
//refreshAd()
}
Expand Down Expand Up @@ -335,15 +339,23 @@ class QuakeDetailsActivity : AppCompatActivity(), OnMapReadyCallback {
//Seteo de floating buttons
binding.fabShare.setOnClickListener { _ ->
Timber.d("Share button clicked")
this@QuakeDetailsActivity.makeSnapshot(p0, it)


val shareQuakeBottomSheetDialog = ShareQuakeBottomSheetDialog()
shareQuakeBottomSheetDialog.show(
supportFragmentManager,
"ShareQuakeBottomSheetDialog"
)

//[email protected](p0, it)
}

if (isSnapshotRequest == true) {
Timber.d("Snapshot request from bottomSheetDialog")

lifecycleScope.launch {
delay(1000)
this@QuakeDetailsActivity.makeSnapshot(p0, it)
//[email protected](p0, it)
}
}
}
Expand Down Expand Up @@ -422,6 +434,7 @@ class QuakeDetailsActivity : AppCompatActivity(), OnMapReadyCallback {
Timber.d("Home up clicked")
finish()
}

R.id.layers_menu -> {

googleMap?.let {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package cl.figonzal.lastquakechile.quake_feature.ui.dialog

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.content.res.ResourcesCompat
import cl.figonzal.lastquakechile.R
import cl.figonzal.lastquakechile.databinding.ShareQuakeBottomSheetBinding
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

class ShareQuakeBottomSheetDialog : BottomSheetDialogFragment() {


private var _binding: ShareQuakeBottomSheetBinding? = null
private val binding get() = _binding!!

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {

_binding = ShareQuakeBottomSheetBinding.inflate(layoutInflater, container, false)


binding.include1.tvTitle.text = "Agregar a historia"
binding.include2.tvTitle.text = "Tuitear"

binding.include1.ivIcon.setImageDrawable(
ResourcesCompat.getDrawable(
resources,
R.drawable.round_add_instagram_story,
requireContext().theme
)
)
binding.include2.ivIcon.setImageDrawable(
ResourcesCompat.getDrawable(
resources,
R.drawable.round_add_instagram_story,
requireContext().theme
)
)

binding.include1.root.setOnClickListener {
}


binding.include2.root.setOnClickListener {
}

return binding.root
}

}
14 changes: 14 additions & 0 deletions app/src/main/res/drawable/round_add_instagram_story.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000"
android:fillType="evenOdd"
android:pathData="M12,5.25C12.414,5.25 12.75,5.586 12.75,6V18C12.75,18.414 12.414,18.75 12,18.75C11.586,18.75 11.25,18.414 11.25,18V6C11.25,5.586 11.586,5.25 12,5.25Z" />
<path
android:fillColor="#000"
android:fillType="evenOdd"
android:pathData="M5.25,12C5.25,11.586 5.586,11.25 6,11.25H18C18.414,11.25 18.75,11.586 18.75,12 18.75,12.414 18.414,12.75 18,12.75H6C5.586,12.75 5.25,12.414 5.25,12zM10.226,2.128C10.33,2.529 10.088,2.938 9.687,3.041 9.191,3.169 8.71,3.337 8.25,3.541 7.871,3.71 7.428,3.539 7.26,3.16 7.092,2.782 7.262,2.339 7.641,2.171 8.177,1.933 8.735,1.737 9.313,1.589 9.714,1.485 10.123,1.727 10.226,2.128zM5.756,4.152C6.038,4.456 6.02,4.931 5.716,5.212 4.971,5.902 4.341,6.712 3.855,7.611 3.658,7.976 3.203,8.111 2.839,7.915 2.474,7.718 2.339,7.263 2.535,6.898 3.1,5.853 3.832,4.912 4.696,4.112 5,3.83 5.475,3.849 5.756,4.152zM2.256,9.619C2.665,9.686 2.941,10.073 2.874,10.481 2.792,10.975 2.75,11.482 2.75,12 2.75,12.518 2.792,13.025 2.874,13.519 2.941,13.927 2.665,14.313 2.256,14.381 1.847,14.448 1.461,14.172 1.394,13.763 1.299,13.189 1.25,12.6 1.25,12 1.25,11.4 1.299,10.811 1.394,10.237 1.461,9.828 1.847,9.552 2.256,9.619zM2.839,16.085C3.203,15.888 3.658,16.024 3.855,16.389 4.341,17.288 4.971,18.098 5.716,18.788 6.02,19.069 6.038,19.544 5.756,19.847 5.475,20.151 5,20.169 4.696,19.888 3.832,19.088 3.1,18.147 2.535,17.101 2.339,16.737 2.474,16.282 2.839,16.085zM7.26,20.839C7.428,20.461 7.871,20.29 8.25,20.458 8.71,20.663 9.191,20.831 9.687,20.958 10.088,21.062 10.33,21.471 10.226,21.872 10.123,22.273 9.714,22.514 9.313,22.411 8.735,22.263 8.177,22.067 7.641,21.829 7.262,21.661 7.092,21.218 7.26,20.839zM11.25,2C11.25,1.586 11.586,1.25 12,1.25 17.937,1.25 22.75,6.063 22.75,12 22.75,12.414 22.414,12.75 22,12.75 21.586,12.75 21.25,12.414 21.25,12 21.25,6.891 17.109,2.75 12,2.75 11.586,2.75 11.25,2.414 11.25,2zM21.468,15.313C21.848,15.479 22.021,15.921 21.855,16.3 20.197,20.095 16.409,22.75 12,22.75 11.586,22.75 11.25,22.414 11.25,22 11.25,21.586 11.586,21.25 12,21.25 15.792,21.25 19.053,18.968 20.481,15.7 20.646,15.32 21.089,15.147 21.468,15.313z" />
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_maps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<include
android:id="@+id/include"
layout="@layout/quake_bottom_sheet"
layout="@layout/quake_map_bottom_sheet"
app:layout_behavior="@string/bottom_sheet_behavior"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
58 changes: 58 additions & 0 deletions app/src/main/res/layout/share_quake_bottom_sheet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/corner_radius_32dp"
android:paddingEnd="@dimen/corner_radius_32dp"
android:paddingBottom="@dimen/corner_radius_32dp">

<View
android:id="@+id/swipe_line"
android:layout_width="25dp"
android:layout_height="4dp"
android:layout_marginTop="8dp"
android:background="@drawable/background_bottom_sheet"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/corner_radius_16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swipe_line">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">


<include
android:id="@+id/include1"
layout="@layout/share_quake_bottom_sheet_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<include
android:id="@+id/include2"
layout="@layout/share_quake_bottom_sheet_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include1" />


</androidx.constraintlayout.widget.ConstraintLayout>

</com.google.android.material.card.MaterialCardView>

</androidx.constraintlayout.widget.ConstraintLayout>
46 changes: 46 additions & 0 deletions app/src/main/res/layout/share_quake_bottom_sheet_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackgroundBorderless">

<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/corner_radius_16dp"
android:textAppearance="?attr/textAppearanceBody1"
card_view:layout_constraintBottom_toBottomOf="parent"
card_view:layout_constraintEnd_toStartOf="@+id/iv_icon"
card_view:layout_constraintStart_toStartOf="parent"
card_view:layout_constraintTop_toTopOf="parent"
tools:text="Agregar a historia" />

<ImageView
android:id="@+id/iv_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/corner_radius_16dp"
android:contentDescription="Icon instagram storie"
android:src="@drawable/round_add_instagram_story"
card_view:layout_constraintBottom_toBottomOf="parent"
card_view:layout_constraintEnd_toEndOf="parent"
card_view:layout_constraintTop_toTopOf="parent" />

<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="0.5dp"
android:background="?attr/dividerHorizontal"
android:visibility="visible"
card_view:layout_constraintBottom_toBottomOf="parent"
card_view:layout_constraintEnd_toEndOf="parent"
card_view:layout_constraintStart_toStartOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 6f4aa1f

Please sign in to comment.