From f85834bfdff5dd15ab6e54ff5a80b04d94e9b808 Mon Sep 17 00:00:00 2001 From: Govind Dixit <32304546+GOVINDDIXIT@users.noreply.github.com> Date: Wed, 9 Jan 2019 17:19:28 +0530 Subject: [PATCH 1/7] fix: toast to snackbar --- .../general/attendees/AttendeeFragment.kt | 13 +- app/src/main/res/layout/fragment_attendee.xml | 613 +++++++++--------- 2 files changed, 319 insertions(+), 307 deletions(-) diff --git a/app/src/main/java/org/fossasia/openevent/general/attendees/AttendeeFragment.kt b/app/src/main/java/org/fossasia/openevent/general/attendees/AttendeeFragment.kt index 07845150e2..a06c8c8908 100644 --- a/app/src/main/java/org/fossasia/openevent/general/attendees/AttendeeFragment.kt +++ b/app/src/main/java/org/fossasia/openevent/general/attendees/AttendeeFragment.kt @@ -16,7 +16,6 @@ import android.view.ViewGroup import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.EditText -import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.view.isVisible import androidx.fragment.app.Fragment @@ -24,6 +23,7 @@ import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.navigation.Navigation.findNavController +import com.google.android.material.snackbar.Snackbar import com.google.android.material.textfield.TextInputLayout import com.stripe.android.Stripe import com.stripe.android.TokenCallback @@ -37,6 +37,7 @@ import kotlinx.android.synthetic.main.fragment_attendee.firstName import kotlinx.android.synthetic.main.fragment_attendee.helloUser import kotlinx.android.synthetic.main.fragment_attendee.lastName import kotlinx.android.synthetic.main.fragment_attendee.postalCode +import kotlinx.android.synthetic.main.fragment_attendee.view.attendeeCoordinatorLayout import kotlinx.android.synthetic.main.fragment_attendee.view.accept import kotlinx.android.synthetic.main.fragment_attendee.view.amount import kotlinx.android.synthetic.main.fragment_attendee.view.attendeeInformation @@ -272,7 +273,7 @@ class AttendeeFragment : Fragment() { attendeeViewModel.message .nonNull() .observe(this, Observer { - Toast.makeText(context, it, Toast.LENGTH_LONG).show() + Snackbar.make(rootView.attendeeCoordinatorLayout, it, Snackbar.LENGTH_LONG).show() }) attendeeViewModel.progress @@ -419,7 +420,9 @@ class AttendeeFragment : Fragment() { val validDetails: Boolean? = card.validateCard() if (validDetails != null && !validDetails) - Toast.makeText(context, "Invalid card data", Toast.LENGTH_LONG).show() + Snackbar.make( + rootView.attendeeCoordinatorLayout, "Invalid card data", Snackbar.LENGTH_SHORT + ).show() else Stripe(requireContext()) .createToken(card, API_KEY, object : TokenCallback { @@ -430,7 +433,9 @@ class AttendeeFragment : Fragment() { } override fun onError(error: Exception) { - Toast.makeText(context, error.localizedMessage.toString(), Toast.LENGTH_LONG).show() + Snackbar.make( + rootView.attendeeCoordinatorLayout, error.localizedMessage.toString(), Snackbar.LENGTH_LONG + ).show() } }) } diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index 18de60dc83..7ad2b28eb5 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -5,287 +5,192 @@ android:layout_height="match_parent" android:background="@android:color/white"> - - - - - + android:layout_height="wrap_content"> + android:layout_height="match_parent" + android:background="@android:color/white" + android:orientation="vertical" + android:padding="@dimen/padding_payment" + tools:context="org.fossasia.openevent.general.attendees.AttendeeFragment"> + tools:text="FOSSASIA summit" /> - - - - - + tools:text="May 24 - May 25" /> + android:padding="@dimen/padding_medium"> - - + android:textStyle="bold" + tools:text="Total: $200.0 -" /> + tools:text="10 items" /> + tools:text=" (View)" /> - - + android:orientation="vertical" + android:visibility="gone"> - - - - - - - - - - - - + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/layout_margin_medium" + android:weightSum="5"> - + - + - + - + + - - + android:layout_height="wrap_content" /> - - - - + android:background="@drawable/border" + android:gravity="center" + android:orientation="horizontal" + android:padding="@dimen/layout_margin_medium"> - + - - + + - + android:layout_marginTop="@dimen/layout_margin_extra_large" + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/padding_medium"> - - - - + android:layout_weight="2" + android:textSize="@dimen/text_size_large" + tools:text="Hello user" /> - + android:text="@string/not_you" + android:textSize="@dimen/text_size_large" + tools:text="Not you? " /> - + - + + android:orientation="vertical"> @@ -296,155 +201,257 @@ android:layout_marginTop="@dimen/padding_medium"> + android:hint="@string/first_name" + android:inputType="text" /> - + + + + + + + + + + + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium" + android:visibility="gone"> + + + + android:layout_marginTop="@dimen/layout_margin_medium" + android:orientation="vertical"> - - + android:layout_marginBottom="@dimen/layout_margin_medium" + android:text="@string/other_information" + android:textColor="@color/black" + android:textSize="@dimen/heading_text_size" + android:visibility="gone" /> - + + + + android:orientation="vertical" + android:visibility="gone"> - + + + + + + + + + + android:gravity="center" + android:orientation="horizontal"> + + + android:orientation="horizontal"> - + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/padding_extra_small"> + + + + + + + + + + + + - - + - + + - - + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium"> - + + + + + android:layout_marginTop="@dimen/layout_margin_moderate" /> - - + - - - + android:elevation="@dimen/card_elevation" + android:visibility="gone" /> + - - From 48a743e3561e0b891ca883b02ceb949d4bccf3de Mon Sep 17 00:00:00 2001 From: Govind Dixit <32304546+GOVINDDIXIT@users.noreply.github.com> Date: Fri, 11 Jan 2019 01:39:27 +0530 Subject: [PATCH 2/7] fix: toast to snackbar --- app/src/main/res/layout/fragment_attendee.xml | 613 +++++++++--------- 1 file changed, 306 insertions(+), 307 deletions(-) diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index 7ad2b28eb5..cc5e8d8640 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -10,187 +10,287 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + + + + + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginTop="@dimen/layout_margin_extra_large" + android:background="@drawable/filled_border" + android:gravity="center" + android:orientation="horizontal" + android:padding="@dimen/padding_medium"> + tools:text="Total: $200.0 -" /> + tools:text="10 items" /> + + + + + + android:padding="@dimen/layout_margin_medium" + android:weightSum="5"> + tools:text="Item" /> + tools:text="Price" /> + tools:text="Qty" /> + + + + + android:background="@drawable/border" + android:gravity="center" + android:orientation="horizontal" + android:padding="@dimen/layout_margin_medium"> - + android:text="@string/all_fees" + android:textSize="@dimen/text_size_large" /> - + + - + - + - - + - + - + + + + + + + + + android:hint="@string/first_name" + android:inputType="text" /> + - + - - + + - + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium"> - + android:hint="@string/email" + android:inputType="textEmailAddress" /> + - + + + android:hint="Country" /> + + + - + android:layout_marginBottom="@dimen/layout_margin_medium" + android:text="@string/other_information" + android:textColor="@color/black" + android:textSize="@dimen/heading_text_size" + android:visibility="gone" /> + + + + + android:orientation="vertical" + android:visibility="gone"> @@ -201,257 +301,156 @@ android:layout_marginTop="@dimen/padding_medium"> - - - - - + android:hint="@string/card_number" /> - - - - - - - - - + android:layout_marginBottom="@dimen/layout_margin_medium" + android:layout_marginTop="@dimen/layout_margin_large" + android:text="@string/card_type" + android:textSize="@dimen/text_size_large" /> + android:layout_weight="1" + android:background="@drawable/filled_border" + android:gravity="center" + android:orientation="horizontal"> - + android:layout_weight="0.8" + android:gravity="center" + android:textSize="@dimen/text_size_large" /> - + + - + - - - - - - - - - + android:orientation="horizontal"> + android:orientation="horizontal" + android:padding="@dimen/padding_extra_small"> - - + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/padding_extra_small"> - - - - - - - - - - - - - + android:layout_marginLeft="@dimen/layout_margin_medium" + android:textSize="@dimen/text_size_large" /> + - + - - + - - - - - - - + android:hint="@string/cvc" /> + - + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium"> + + + - + + + android:layout_margin="@dimen/layout_margin_large" + android:backgroundTint="@color/colorAccent" + android:enabled="false" + android:padding="@dimen/padding_medium" + android:text="@string/register" + android:textColor="@android:color/white" /> - + + + From e59d901b1707403dc08a1b7db6dd10433547203b Mon Sep 17 00:00:00 2001 From: Govind Dixit <32304546+GOVINDDIXIT@users.noreply.github.com> Date: Fri, 11 Jan 2019 12:22:54 +0530 Subject: [PATCH 3/7] fix: toast to snackbar --- app/src/main/res/layout/fragment_attendee.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index cc5e8d8640..d3fe7b99a8 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -10,7 +10,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - + From 2f1046bc03e44a2470ab67f6bd4e76739a9acefb Mon Sep 17 00:00:00 2001 From: Govind Dixit <32304546+GOVINDDIXIT@users.noreply.github.com> Date: Fri, 11 Jan 2019 17:05:21 +0530 Subject: [PATCH 4/7] fix: toast to snackbar --- app/src/main/res/layout/fragment_attendee.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index d3fe7b99a8..a74a40fedb 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -10,7 +10,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - + From 387d5c300555e1dd676b268c2630a66ed67e3742 Mon Sep 17 00:00:00 2001 From: Govind Dixit <32304546+GOVINDDIXIT@users.noreply.github.com> Date: Fri, 11 Jan 2019 19:57:41 +0530 Subject: [PATCH 5/7] fix: toast to snackbar --- app/src/main/res/layout/fragment_attendee.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index a74a40fedb..09156118d4 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -11,12 +11,12 @@ android:layout_height="wrap_content"> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/white" + android:orientation="vertical" + android:padding="@dimen/padding_payment" + tools:context="org.fossasia.openevent.general.attendees.AttendeeFragment"> Date: Fri, 11 Jan 2019 22:08:00 +0530 Subject: [PATCH 6/7] fix: toast to snackbar --- app/src/main/res/layout/fragment_attendee.xml | 602 +++++++++--------- 1 file changed, 301 insertions(+), 301 deletions(-) diff --git a/app/src/main/res/layout/fragment_attendee.xml b/app/src/main/res/layout/fragment_attendee.xml index 09156118d4..5ea3426bde 100644 --- a/app/src/main/res/layout/fragment_attendee.xml +++ b/app/src/main/res/layout/fragment_attendee.xml @@ -18,279 +18,179 @@ android:padding="@dimen/padding_payment" tools:context="org.fossasia.openevent.general.attendees.AttendeeFragment"> - - - - - - + tools:text="FOSSASIA summit" /> - - - - - + tools:text="May 24 - May 25" /> + android:padding="@dimen/padding_medium"> - - + android:textStyle="bold" + tools:text="Total: $200.0 -" /> + tools:text="10 items" /> + tools:text=" (View)" /> - - + android:orientation="vertical" + android:visibility="gone"> - - - - - - - - - - - - + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/layout_margin_medium" + android:weightSum="5"> - + - + - + - + + - - - - + android:layout_height="wrap_content" /> - - + android:background="@drawable/border" + android:gravity="center" + android:orientation="horizontal" + android:padding="@dimen/layout_margin_medium"> - + - - + + - + android:layout_marginTop="@dimen/layout_margin_extra_large" + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/padding_medium"> - - - - + android:layout_weight="2" + android:textSize="@dimen/text_size_large" + tools:text="Hello user" /> - + android:text="@string/not_you" + android:textSize="@dimen/text_size_large" + tools:text="Not you? " /> - + - + + android:orientation="vertical"> @@ -301,156 +201,256 @@ android:layout_marginTop="@dimen/padding_medium"> + android:hint="@string/first_name" + android:inputType="text" /> - + + + + + + + + + + + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium" + android:visibility="gone"> + + + + android:layout_marginTop="@dimen/layout_margin_medium" + android:orientation="vertical"> - - + android:layout_marginBottom="@dimen/layout_margin_medium" + android:text="@string/other_information" + android:textColor="@color/black" + android:textSize="@dimen/heading_text_size" + android:visibility="gone" /> - + + + + android:orientation="vertical" + android:visibility="gone"> - + + + + + + + + + + android:gravity="center" + android:orientation="horizontal"> + + + android:orientation="horizontal"> - + android:background="@drawable/filled_border" + android:orientation="horizontal" + android:padding="@dimen/padding_extra_small"> + + + + + + + + + + + + - - + - + + - - + android:layout_marginBottom="@dimen/padding_medium" + android:layout_marginTop="@dimen/padding_medium"> - + + + + + android:layout_marginTop="@dimen/layout_margin_moderate" /> - - + - - - - - - + android:elevation="@dimen/card_elevation" + android:visibility="gone" /> From fdba281d1503c40c2fce133a8954420181d2463c Mon Sep 17 00:00:00 2001 From: Govind Dixit Date: Fri, 11 Jan 2019 22:27:31 +0530 Subject: [PATCH 7/7] Update fragment_attendee.xml