-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12c17e5
commit 19f6f78
Showing
15 changed files
with
158 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
10 changes: 0 additions & 10 deletions
10
app/src/main/kotlin/id/shaderboi/koffie/ui/product/ProductActivity.kt
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
app/src/main/kotlin/id/shaderboi/koffie/ui/product/ProductFragment.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,55 @@ | ||
package id.shaderboi.koffie.ui.product | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.navigation.fragment.navArgs | ||
import com.google.android.material.bottomsheet.BottomSheetBehavior | ||
import com.google.android.material.bottomsheet.BottomSheetDialog | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
import com.squareup.picasso.Picasso | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import id.shaderboi.koffie.databinding.FragmentProductBinding | ||
import java.text.DecimalFormat | ||
import javax.inject.Inject | ||
|
||
@AndroidEntryPoint | ||
class ProductFragment : BottomSheetDialogFragment() { | ||
private var _binding: FragmentProductBinding? = null | ||
val binding get() = _binding!! | ||
|
||
val args by navArgs<ProductFragmentArgs>() | ||
|
||
@Inject | ||
lateinit var numberFormatter: DecimalFormat | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
_binding = FragmentProductBinding.inflate(inflater, container, false) | ||
|
||
setupView() | ||
|
||
return binding.root | ||
} | ||
|
||
private fun setupView() { | ||
binding.apply { | ||
(dialog as BottomSheetDialog?)?.let { bottomSheetDialog -> | ||
bottomSheetDialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED | ||
bottomSheetDialog.behavior.skipCollapsed = true | ||
} | ||
|
||
textViewName.text = args.product.name | ||
textViewPrice.text = numberFormatter.format(args.product.price) | ||
|
||
Picasso | ||
.get() | ||
.load(args.product.imageUrl) | ||
.into(imageViewProduct) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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"?> | ||
<LinearLayout xmlns:android="http:https://schemas.android.com/apk/res/android" | ||
xmlns:app="http:https://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http:https://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:divider="@drawable/divider16dp" | ||
android:orientation="vertical" | ||
android:paddingStart="10dp" | ||
android:paddingTop="5dp" | ||
android:paddingEnd="10dp" | ||
android:paddingBottom="5dp" | ||
android:showDividers="middle"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<ImageView | ||
android:id="@+id/imageViewProduct" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
app:layout_constraintDimensionRatio="H,1:1" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
tools:srcCompat="@tools:sample/backgrounds/scenic" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:divider="@drawable/divider8dp" | ||
android:gravity="center_vertical" | ||
android:orientation="vertical" | ||
android:showDividers="middle"> | ||
|
||
<TextView | ||
android:id="@+id/textViewName" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:textSize="24sp" | ||
android:textStyle="bold" | ||
tools:text="Kopi Susu" /> | ||
|
||
<TextView | ||
android:id="@+id/textViewPrice" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
tools:text="1.000.000" /> | ||
</LinearLayout> | ||
|
||
<Button | ||
android:id="@+id/buttonAddToCart" | ||
style="@style/Theme.Koffie.Button" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/add_to_cart" /> | ||
</LinearLayout> |
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
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