mirror of
https://github.com/shaulascr/ecommerce_serang.git
synced 2025-08-10 09:22:21 +00:00
fetch store product
This commit is contained in:
3
.idea/gradle.xml
generated
3
.idea/gradle.xml
generated
@ -6,14 +6,13 @@
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="gradleJvm" value="jbr-21" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -1,3 +1,5 @@
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
@ -84,3 +86,4 @@ dependencies {
|
||||
// kapt("androidx.hilt:hilt-compiler:1.0.0")
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.alya.ecommerce_serang.data.api.response
|
||||
|
||||
import com.alya.ecommerce_serang.data.api.dto.ProductsItem
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ViewStoreProductsResponse(
|
||||
|
||||
@field:SerializedName("message")
|
||||
val message: String? = null,
|
||||
|
||||
@field:SerializedName("products")
|
||||
val products: List<ProductsItem?>? = null
|
||||
)
|
@ -13,6 +13,7 @@ import com.alya.ecommerce_serang.data.api.response.ProfileResponse
|
||||
import com.alya.ecommerce_serang.data.api.response.RegisterResponse
|
||||
import com.alya.ecommerce_serang.data.api.response.ReviewProductResponse
|
||||
import com.alya.ecommerce_serang.data.api.response.StoreResponse
|
||||
import com.alya.ecommerce_serang.data.api.response.ViewStoreProductsResponse
|
||||
import retrofit2.Call
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
@ -64,4 +65,8 @@ interface ApiService {
|
||||
|
||||
@GET("mystore")
|
||||
suspend fun getStore (): Response<StoreResponse>
|
||||
|
||||
@GET("mystore/product") // Replace with actual endpoint
|
||||
suspend fun getStoreProduct(): Response<ViewStoreProductsResponse>
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.alya.ecommerce_serang.data.model
|
||||
|
||||
data class BalanceTransaction(
|
||||
val date: String,
|
||||
val balanceTransTitle: String,
|
||||
val balanceTransDesc: String,
|
||||
val balanceTransAmount: String,
|
||||
)
|
@ -79,6 +79,16 @@ class ProductRepository(private val apiService: ApiService) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun fetchMyStoreProducts(): List<ProductsItem> {
|
||||
val response = apiService.getStoreProduct()
|
||||
if (response.isSuccessful) {
|
||||
val responseBody = response.body()
|
||||
return responseBody?.products?.filterNotNull() ?: emptyList()
|
||||
} else {
|
||||
throw Exception("Failed to fetch store products: ${response.message()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// suspend fun fetchStoreDetail(storeId: Int): Store? {
|
||||
|
@ -4,10 +4,12 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.alya.ecommerce_serang.data.api.dto.ProductsItem
|
||||
import com.alya.ecommerce_serang.data.api.dto.Store
|
||||
import com.alya.ecommerce_serang.data.api.response.Product
|
||||
import com.alya.ecommerce_serang.data.api.response.ReviewsItem
|
||||
import com.alya.ecommerce_serang.data.repository.ProductRepository
|
||||
import com.alya.ecommerce_serang.data.repository.Result
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ProductViewModel(private val repository: ProductRepository) : ViewModel() {
|
||||
@ -21,6 +23,10 @@ class ProductViewModel(private val repository: ProductRepository) : ViewModel()
|
||||
private val _reviewProduct = MutableLiveData<List<ReviewsItem>>()
|
||||
val reviewProduct: LiveData<List<ReviewsItem>> get() = _reviewProduct
|
||||
|
||||
// For List of Products in My Store
|
||||
private val _productList = MutableLiveData<Result<List<ProductsItem>>>()
|
||||
val productList: LiveData<Result<List<ProductsItem>>> get() = _productList
|
||||
|
||||
fun loadProductDetail(productId: Int) {
|
||||
viewModelScope.launch {
|
||||
val result = repository.fetchProductDetail(productId)
|
||||
@ -34,11 +40,24 @@ class ProductViewModel(private val repository: ProductRepository) : ViewModel()
|
||||
_reviewProduct.value = reviews ?: emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fun loadStoreDetail(storeId: Int){
|
||||
fun loadMyStoreProducts() {
|
||||
viewModelScope.launch {
|
||||
_productList.value = Result.Loading
|
||||
try {
|
||||
val result = repository.fetchMyStoreProducts()
|
||||
_productList.value = Result.Success(result)
|
||||
} catch (e: Exception) {
|
||||
_productList.value = Result.Error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Optional: for store detail if you need it later
|
||||
// fun loadStoreDetail(storeId: Int) {
|
||||
// viewModelScope.launch {
|
||||
// val storeResult = repository.fetchStoreDetail(storeId)
|
||||
// _storeDetail.value = storeResult
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
package com.alya.ecommerce_serang.ui.profile.mystore.balance
|
||||
|
||||
import com.alya.ecommerce_serang.data.model.BalanceTransaction
|
||||
|
||||
/* class BalanceTransactionAdapter(private val balanceTransactionList: List<BalanceTransaction>) :
|
||||
RecyclerView.Adapter<BalanceTransactionAdapter.TransactionViewHolder>() {
|
||||
|
||||
|
@ -1,21 +1,86 @@
|
||||
package com.alya.ecommerce_serang.ui.profile.mystore.product
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.alya.ecommerce_serang.R
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alya.ecommerce_serang.data.api.retrofit.ApiConfig
|
||||
import com.alya.ecommerce_serang.data.repository.ProductRepository
|
||||
import com.alya.ecommerce_serang.data.repository.Result
|
||||
import com.alya.ecommerce_serang.databinding.ActivityProductBinding
|
||||
import com.alya.ecommerce_serang.ui.product.ProductViewModel
|
||||
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
||||
import com.alya.ecommerce_serang.utils.SessionManager
|
||||
|
||||
class ProductActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContentView(R.layout.activity_product)
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||
insets
|
||||
|
||||
private lateinit var binding: ActivityProductBinding
|
||||
private lateinit var sessionManager: SessionManager
|
||||
|
||||
private val viewModel: ProductViewModel by viewModels {
|
||||
BaseViewModelFactory {
|
||||
sessionManager = SessionManager(this)
|
||||
val apiService = ApiConfig.getApiService(sessionManager)
|
||||
val productRepository = ProductRepository(apiService)
|
||||
ProductViewModel(productRepository)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityProductBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
setupHeader()
|
||||
setupRecyclerView()
|
||||
|
||||
observeViewModel()
|
||||
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
viewModel.loadMyStoreProducts()
|
||||
|
||||
}
|
||||
|
||||
private fun observeViewModel() {
|
||||
viewModel.productList.observe(this) { result ->
|
||||
when (result) {
|
||||
is Result.Loading -> {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
}
|
||||
is Result.Success -> {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
val products = result.data
|
||||
binding.rvStoreProduct.adapter = ProductAdapter(products) {
|
||||
Toast.makeText(this, "Clicked: ${it.name}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
is Result.Error -> {
|
||||
binding.progressBar.visibility = View.GONE
|
||||
Toast.makeText(this, "Failed to load products: ${result.exception.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupHeader() {
|
||||
binding.header.headerTitle.text = "Produk Saya"
|
||||
binding.header.headerRightText.visibility = View.VISIBLE
|
||||
|
||||
binding.header.headerLeftIcon.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
binding.header.headerRightText.setOnClickListener {
|
||||
startActivity(Intent(this, AddProductActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
binding.rvStoreProduct.layoutManager = LinearLayoutManager(this)
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.alya.ecommerce_serang.ui.profile.mystore.product
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alya.ecommerce_serang.R
|
||||
import com.alya.ecommerce_serang.data.api.dto.ProductsItem
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
class ProductAdapter(
|
||||
private val products: List<ProductsItem>,
|
||||
private val onItemClick: (ProductsItem) -> Unit
|
||||
) : RecyclerView.Adapter<ProductAdapter.ProductViewHolder>() {
|
||||
|
||||
inner class ProductViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val ivProduct: ImageView = itemView.findViewById(R.id.iv_product)
|
||||
private val tvProductName: TextView = itemView.findViewById(R.id.tv_product_name)
|
||||
private val tvProductPrice: TextView = itemView.findViewById(R.id.tv_product_price)
|
||||
private val tvProductStock: TextView = itemView.findViewById(R.id.tv_product_stock)
|
||||
private val tvProductStatus: TextView = itemView.findViewById(R.id.tv_product_status)
|
||||
|
||||
fun bind(product: ProductsItem) {
|
||||
tvProductName.text = product.name
|
||||
tvProductPrice.text = "Rp${product.price}"
|
||||
tvProductStock.text = "Stok: ${product.stock}"
|
||||
tvProductStatus.text = product.status
|
||||
|
||||
// Change color depending on status
|
||||
tvProductStatus.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
itemView.context,
|
||||
if (product.status.equals("active", true))
|
||||
R.color.darkblue_500 else R.color.black_500
|
||||
)
|
||||
)
|
||||
|
||||
Glide.with(itemView.context)
|
||||
.load(product.image)
|
||||
.placeholder(R.drawable.placeholder_image)
|
||||
.into(ivProduct)
|
||||
|
||||
itemView.setOnClickListener {
|
||||
onItemClick(product)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProductViewHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_store_product, parent, false)
|
||||
return ProductViewHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = products.size
|
||||
|
||||
override fun onBindViewHolder(holder: ProductViewHolder, position: Int) {
|
||||
holder.bind(products[position])
|
||||
}
|
||||
}
|
6
app/src/main/res/drawable/bg_product_active.xml
Normal file
6
app/src/main/res/drawable/bg_product_active.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/blue_100" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
6
app/src/main/res/drawable/bg_product_inactive.xml
Normal file
6
app/src/main/res/drawable/bg_product_inactive.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/black_100" />
|
||||
<corners android:radius="3dp" />
|
||||
</shape>
|
BIN
app/src/main/res/drawable/ic_search.png
Normal file
BIN
app/src/main/res/drawable/ic_search.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 820 B |
@ -2,13 +2,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.profile.mystore.product.AddProductActivity">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -3,13 +3,16 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.profile.mystore.balance.BalanceActivity">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_balance"
|
||||
|
@ -2,13 +2,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.profile.mystore.balance.BalanceTopUpActivity"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,13 +2,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.profile.mystore.sells.payment.ClaimPaymentActivity">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,13 +2,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.profile.mystore.MyStoreActivity">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1,10 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.profile.mystore.product.ProductActivity">
|
||||
tools:context=".ui.profile.mystore.product.ProductActivity"
|
||||
android:orientation="vertical">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<!-- Search Bar -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/bg_text_field"
|
||||
android:paddingHorizontal="6dp"
|
||||
android:paddingVertical="10dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:src="@drawable/ic_search"
|
||||
android:contentDescription="Search Icon" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:hint="Cari produk Anda di sini..."
|
||||
android:inputType="text"
|
||||
style="@style/body_small"
|
||||
android:layout_marginStart="6dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/black_50"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/layout_product_menu"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_store_product"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical"
|
||||
tools:listitem="@layout/item_store_product" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
@ -2,13 +2,16 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.profile.mystore.sells.shipment.ShippingConfirmationActivity">
|
||||
|
||||
<include layout="@layout/header" />
|
||||
<include
|
||||
android:id="@+id/header"
|
||||
layout="@layout/header" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -2,6 +2,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
123
app/src/main/res/layout/item_store_product.xml
Normal file
123
app/src/main/res/layout/item_store_product.xml
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/horizontal_safe_area">
|
||||
|
||||
<!-- Top Section: Image + Info + Menu -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_product"
|
||||
android:layout_width="95dp"
|
||||
android:layout_height="70dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/placeholder_image"
|
||||
app:shapeAppearanceOverlay="@style/store_product_image"
|
||||
android:contentDescription="Product Image" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="13dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_product_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Jaket Pink Fuschia"
|
||||
style="@style/label_medium_prominent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_product_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Rp150.000"
|
||||
style="@style/label_medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_product_stock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Stok: 15"
|
||||
style="@style/label_medium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_product_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Aktif"
|
||||
style="@style/label_small"
|
||||
android:paddingHorizontal="4dp"
|
||||
android:textColor="@color/darkblue_500"
|
||||
android:background="@drawable/bg_product_active" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivMenu"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@drawable/ic_more_vertical"
|
||||
android:contentDescription="Menu"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<Button
|
||||
style="@style/button.small.secondary.medium"
|
||||
android:id="@+id/btn_change_price"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Ubah Harga" />
|
||||
|
||||
<Space
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<Button
|
||||
style="@style/button.small.secondary.medium"
|
||||
android:id="@+id/btn_change_stock"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="Ubah Stok" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Divider -->
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:background="@color/black_50"/>
|
||||
|
||||
</LinearLayout>
|
@ -293,4 +293,9 @@
|
||||
<item name="cornerSize">50%</item>
|
||||
</style>
|
||||
|
||||
<style name="store_product_image">
|
||||
<item name="cornerFamily">rounded</item>
|
||||
<item name="cornerSize">5dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.5.2"
|
||||
agp = "8.9.1"
|
||||
glide = "4.16.0"
|
||||
hiltAndroid = "2.51"
|
||||
hiltLifecycleViewmodel = "1.0.0-alpha03"
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
||||
#Wed Oct 16 14:37:43 ICT 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
Reference in New Issue
Block a user