Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class ShopItem constructor(
val samples: List<String> = listOf(),
val order : Int = 0,
val version_number : Int = 0,
val cards : Int = 0,
@Exclude
var type : String = "",
@Exclude
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.magnitudestudios.GameFace.bases.BaseFragment
import com.magnitudestudios.GameFace.databinding.FragmentPackDetailsBinding
import com.magnitudestudios.GameFace.network.DownloadSinglePack
import com.magnitudestudios.GameFace.pojo.Shop.ShopItem
import com.magnitudestudios.GameFace.repository.ShopRepository
import com.magnitudestudios.GameFace.ui.main.MainViewModel

class CardPackDetailsFragment : BaseFragment() {
Expand Down Expand Up @@ -54,6 +55,18 @@ class CardPackDetailsFragment : BaseFragment() {
}
bind.purchaseBtn.isEnabled = mainViewModel.user.value?.data?.money!! >= packItem.price

val installed = ShopRepository.getLocalPacks(requireContext()).map { it.id }.contains(packItem.id)
if (installed) {
bind.purchaseBtn.isEnabled = false
bind.purchaseBtn.text = getString(string.installed_key_card_details)
} else {
if (packItem.price == 0 ) {
bind.price.text = getString(string.free_price)
bind.purchaseBtn.text = getString(string.download_btn)
} else {
bind.price.text = packItem.price.toString()
}
}
bind.packImage.apply {
transitionName = imageTransition
Glide.with(this).load(imageTransition).into(this)
Expand All @@ -64,16 +77,13 @@ class CardPackDetailsFragment : BaseFragment() {
""
}
bind.description.text = packItem.description
if (packItem.price == 0) {
bind.price.text = getString(string.free_price)
bind.purchaseBtn.text = getString(string.download_btn)
} else {
bind.price.text = packItem.price.toString()
}

bind.purchaseBtn.setOnClickListener {
purchaseAndDownload()
}

bind.cards.text = packItem.cards.toString()
bind.installs.text = packItem.installs.toString()
}

private fun purchaseAndDownload() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<path android:fillColor="@android:color/white" android:pathData="M12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8s-8,-3.59 -8,-8S7.59,4 12,4M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2L12,2zM13,12l0,-4h-2l0,4H8l4,4l4,-4H13z"/>
<!--
~ Copyright (c) 2020 - Magnitude Studios - All Rights Reserved
~ Unauthorized copying of this file, via any medium is prohibited
~ All software is proprietary and confidential
~
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="@dimen/icon_size" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="@dimen/icon_size">
<path android:fillColor="@color/lightGray" android:pathData="M12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8s-8,-3.59 -8,-8S7.59,4 12,4M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2L12,2zM13,12l0,-4h-2l0,4H8l4,4l4,-4H13z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="@dimen/icon_size" android:tint="#FFFFFF" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="@dimen/icon_size">
<path android:fillColor="@android:color/white" android:pathData="M12,4c4.41,0 8,3.59 8,8s-3.59,8 -8,8s-8,-3.59 -8,-8S7.59,4 12,4M12,2C6.48,2 2,6.48 2,12c0,5.52 4.48,10 10,10c5.52,0 10,-4.48 10,-10C22,6.48 17.52,2 12,2L12,2zM13,12l0,-4h-2l0,4H8l4,4l4,-4H13z"/>
</vector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_playing_cards.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
~ Copyright (c) 2020 - Magnitude Studios - All Rights Reserved
~ Unauthorized copying of this file, via any medium is prohibited
~ All software is proprietary and confidential
~
-->

<vector android:height="30dp" android:viewportHeight="512.013"
android:viewportWidth="512.013" android:width="30dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/lightGray" android:pathData="m466.558,32.135 l-177.477,-31.294c-29.865,-5.265 -58.448,14.747 -63.715,44.614l-4.221,23.937c-2.102,0.311 -4.199,0.731 -6.282,1.289l-174.074,46.643c-14.19,3.802 -26.051,12.903 -33.396,25.625 -7.345,12.723 -9.297,27.545 -5.494,41.735l76.778,286.539c3.802,14.19 12.903,26.051 25.626,33.396 8.475,4.893 17.879,7.392 27.41,7.392 4.777,0 9.587,-0.628 14.325,-1.898l174.074,-46.643c14.19,-3.802 26.051,-12.903 33.396,-25.625 2.182,-3.78 3.876,-7.747 5.097,-11.826l37.34,6.584c3.217,0.567 6.417,0.841 9.577,0.841 26.174,0 49.439,-18.806 54.138,-45.455l51.511,-292.139c5.267,-29.866 -14.747,-58.448 -44.613,-63.715zM330.024,403.875c1.728,6.45 0.841,13.188 -2.498,18.971s-8.73,9.919 -15.18,11.648l-174.074,46.643c-6.45,1.73 -13.187,0.842 -18.97,-2.498 -5.783,-3.339 -9.92,-8.73 -11.648,-15.18l-76.778,-286.539c-1.728,-6.45 -0.841,-13.188 2.498,-18.971s8.73,-9.919 15.18,-11.648l174.074,-46.643c2.154,-0.577 4.34,-0.863 6.511,-0.863 4.332,0 8.607,1.136 12.459,3.36 5.783,3.339 9.92,8.73 11.648,15.18zM299.979,175.837c0.11,-0.857 0.225,-1.713 0.375,-2.563 1.619,-9.18 9.631,-15.657 18.648,-15.657 1.088,0 2.192,0.094 3.299,0.29 6.979,1.231 12.645,6.206 14.783,12.984 1.683,5.333 6.193,9.287 11.7,10.258 5.51,0.972 11.098,-1.202 14.503,-5.637 4.328,-5.638 11.352,-8.375 18.333,-7.145 4.983,0.879 9.326,3.646 12.229,7.791s4.017,9.172 3.139,14.156c-5.966,33.835 -44.1,62.627 -63.052,75.05 -4.754,-6.366 -11.032,-15.431 -16.927,-25.971zM481.627,90.641 L430.115,382.781c-2.394,13.576 -15.387,22.669 -28.962,20.279l-42.288,-7.456 -25.663,-95.775c1.521,-0.283 3.019,-0.805 4.436,-1.578 3.198,-1.743 78.427,-43.373 88.893,-102.728 4.687,-26.578 -13.124,-52.014 -39.702,-56.7 -10.978,-1.935 -21.996,-0.078 -31.455,4.953 -7.168,-7.963 -16.885,-13.477 -27.864,-15.413 -12.873,-2.271 -25.863,0.609 -36.573,8.108 -0.428,0.3 -0.841,0.616 -1.258,0.927l-7.456,-27.827c-3.802,-14.19 -12.903,-26.051 -25.626,-33.396 -1.852,-1.069 -3.752,-2.01 -5.684,-2.849l3.996,-22.662c2.394,-13.575 15.387,-22.672 28.961,-20.279l177.477,31.294c13.577,2.394 22.674,15.386 20.28,28.962z"/>
<path android:fillColor="@color/lightGray" android:pathData="m193.598,387.707c2.771,2.438 6.304,3.738 9.909,3.738 1.295,0 2.6,-0.168 3.881,-0.511 4.847,-1.299 8.724,-4.935 10.329,-9.689l34.246,-101.401c1.936,-5.732 0.239,-12.065 -4.304,-16.062l-80.358,-70.693c-3.768,-3.314 -8.944,-4.526 -13.79,-3.227 -4.847,1.299 -8.724,4.935 -10.329,9.689l-34.246,101.401c-1.936,5.732 -0.239,12.066 4.304,16.062zM164.398,230.491 L220.344,279.708 196.502,350.305 140.556,301.087z"/>
</vector>
97 changes: 67 additions & 30 deletions app/src/main/res/layout/fragment_pack_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="175dp"
app:layout_constraintTop_toTopOf="parent"
app:shape_arc_height="25dp"
app:shape_arc_position="bottom"
app:layout_constraintTop_toTopOf="parent">
app:shape_arc_position="bottom">

<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"/>
android:background="@color/colorPrimary" />
</com.github.florent37.shapeofview.shapes.ArcView>

<TextView
Expand Down Expand Up @@ -74,50 +75,87 @@

<com.magnitudestudios.GameFace.views.MorphableButton
android:id="@+id/purchase_btn"
style="@style/primary_button_theme"
android:padding="@dimen/padding_large"
style="@style/signup_button"
android:layout_width="150dp"
android:textAlignment="center"
android:layout_height="wrap_content"
android:text="@string/purchase_btn"
android:layout_marginTop="@dimen/layout_margin_large"
android:layout_marginBottom="@dimen/layout_margin_large"
android:padding="@dimen/padding_large"
android:text="@string/purchase_btn"
android:textAlignment="center"
android:textSize="@dimen/text_size_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sampleQuestion" />

<LinearLayout
android:id="@+id/priceLayout"

<TextView
android:id="@+id/price"
style="@style/bold_text"
android:layout_width="wrap_content"
android:paddingStart="@dimen/padding_large"
android:paddingEnd="@dimen/padding_large"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="@+id/materialCardView"
app:layout_constraintStart_toStartOf="@+id/materialCardView"
app:layout_constraintTop_toBottomOf="@+id/materialCardView">
android:layout_marginTop="12dp"
android:layout_weight="1"
android:drawableEnd="@drawable/stacked_gp"
android:drawablePadding="@dimen/padding_medium"
android:gravity="end"
android:textColor="@color/md_grey_700"
android:textSize="@dimen/text_size_title"
app:layout_constraintEnd_toStartOf="@+id/installs"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/cards"
app:layout_constraintTop_toBottomOf="@id/materialCardView"
tools:text="200" />

<TextView
android:id="@+id/installs"
style="@style/bold_text"
android:layout_width="0dp"
android:layout_marginEnd="@dimen/layout_margin_medium"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableEnd="@drawable/baseline_arrow_circle_down_black_24dp"
android:drawablePadding="@dimen/padding_medium"
android:gravity="end"
android:textColor="@color/md_grey_700"
android:textSize="@dimen/text_size_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/price"
app:layout_constraintTop_toTopOf="@id/price"
tools:text="200" />

<TextView
android:id="@+id/cards"
style="@style/bold_text"
android:layout_width="0dp"
android:layout_marginStart="@dimen/layout_margin_medium"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableEnd="@drawable/ic_playing_cards"
android:drawablePadding="@dimen/padding_medium"
android:gravity="end"
android:textColor="@color/md_grey_700"
android:textSize="@dimen/text_size_title"
app:layout_constraintEnd_toStartOf="@+id/price"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/price"
tools:layout_editor_absoluteY="259dp"
tools:text="200" />

<TextView
android:id="@+id/price"
style="@style/bold_text"
android:textSize="@dimen/text_size_title"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/text_size_very_small"
android:layout_height="wrap_content"
android:gravity="end"
android:drawablePadding="@dimen/padding_medium"
android:drawableEnd="@drawable/stacked_gp"
android:textColor="@color/md_grey_700"
tools:text="200" />
</LinearLayout>
<LinearLayout
android:id="@+id/descriptionLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="@dimen/layout_margin_small"
android:layout_marginStart="@dimen/layout_margin_huge"
android:layout_marginTop="@dimen/layout_margin_small"
android:layout_marginEnd="@dimen/layout_margin_huge"
app:layout_constraintTop_toBottomOf="@+id/priceLayout">
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/price">

<TextView
android:id="@+id/descriptionTitle"
Expand All @@ -132,7 +170,6 @@
<TextView
android:id="@+id/description"
style="@style/small_text"
android:justificationMode="inter_word"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
Expand Down
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 @@ -144,6 +144,7 @@
<string name="stats_packs_title">Packs</string>
<string name="stats_games_won_title">Games Won</string>
<string name="_0">0</string>
<string name="installed_key_card_details">Installed</string>


</resources>