From 14bbad65d0c3c321d092f0e9205e0b57df283a4a Mon Sep 17 00:00:00 2001 From: Prem Suman Date: Thu, 27 Dec 2018 13:56:10 +0530 Subject: [PATCH] Bug fixes, Refactoring, Optimizations --- .../com/prembros/facilis/SelectionActivity.kt | 2 +- .../cardwithlist/CardWithListAdapter.kt | 11 ++++- .../cardwithlist/CardWithListFragment.kt | 16 ++++++- .../facilis/plaincard/PlainCardFragment.kt | 6 +++ .../main/res/layout/activity_selection.xml | 3 +- .../res/layout/fragment_card_with_list.xml | 9 ++-- .../main/res/layout/fragment_plain_card.xml | 4 +- app/src/main/res/layout/item_card_list.xml | 48 ++++++++++++++----- app/src/main/res/values/colors.xml | 5 -- app/src/main/res/values/strings.xml | 3 +- app/src/main/res/values/styles.xml | 7 +-- .../com/prembros/facilis/util/ViewUtil.kt | 18 ++++--- 12 files changed, 91 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/com/prembros/facilis/SelectionActivity.kt b/app/src/main/java/com/prembros/facilis/SelectionActivity.kt index 29b3d83..c3019d6 100644 --- a/app/src/main/java/com/prembros/facilis/SelectionActivity.kt +++ b/app/src/main/java/com/prembros/facilis/SelectionActivity.kt @@ -16,7 +16,7 @@ class SelectionActivity : BaseCardActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_selection) - cardWithListBtn.onReducingClick { pushFragment(CardWithListFragment()) } + cardWithListBtn.onReducingClick { pushFragment(CardWithListFragment.newInstance(true)) } listOfCardsBtn.onReducingClick { pushFragment(ListOfCardsContainerFragment()) } diff --git a/app/src/main/java/com/prembros/facilis/cardwithlist/CardWithListAdapter.kt b/app/src/main/java/com/prembros/facilis/cardwithlist/CardWithListAdapter.kt index 9306c3b..43f064d 100644 --- a/app/src/main/java/com/prembros/facilis/cardwithlist/CardWithListAdapter.kt +++ b/app/src/main/java/com/prembros/facilis/cardwithlist/CardWithListAdapter.kt @@ -2,12 +2,14 @@ package com.prembros.facilis.cardwithlist import android.view.* import androidx.recyclerview.widget.RecyclerView +import com.prembros.facilis.activity.BaseCardActivity import com.prembros.facilis.sample.R import com.prembros.facilis.util.* import kotlinx.android.synthetic.main.item_card_list.view.* import org.jetbrains.anko.toast +import kotlin.random.Random -class CardWithListAdapter : RecyclerView.Adapter() { +class CardWithListAdapter(private val activity: BaseCardActivity) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardWithListViewHolder = CardWithListViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_card_list, parent, false)) @@ -16,10 +18,15 @@ class CardWithListAdapter : RecyclerView.Adapter @@ -50,7 +51,7 @@ @@ -11,8 +10,7 @@ + android:layout_centerInParent="true"> - + android:orientation="vertical" + android:paddingTop="20dp" + android:paddingBottom="20dp"> + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3467515..f737b58 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,10 +1,5 @@ - #008577 - #00574B - #D81B60 - #19555555 - #FFFFFF #b3ffffff #000000 #E10C1B diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 76f1be0..ff1fb92 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,9 +16,10 @@ This is a sample plain card fragment You can swipe down from anywhere inside to dismiss this card Card Item %1$d - This is a card fragment with a recyclerView + This is a card fragment with a recyclerView, index %1$d It contains a basic implementation of recyclerView, you can swipe down form the top to dismiss this fragment. It contains an implementation of horizontal ViewPager, which has cards as children.\n\nYou can swipe down from the top of any card to dismiss all. This is a sample blur popup You can swipe down from the top of any card to dismiss all.\nOr you can click outside, on the blurred area to dismiss this popup. + Click to open another Card with list diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 0c73581..1415021 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -3,10 +3,11 @@