Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[부나] 3, 4단계 쇼핑 장바구니 제출합니다. #45

Merged
merged 71 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
68fa7bb
refactor: 모호한 네이밍을 구체화
tmdgh1592 May 16, 2023
7dc0713
refactor: DataBindingUtil 대신 XxxBinding.inflate(LayoutInflater)를 사용하도…
tmdgh1592 May 16, 2023
346e185
refactor: Bundle, Intent Extension 파일 분리
tmdgh1592 May 16, 2023
7fd7393
refactor: fetchPrevious(), fetchNext() 메서드 제거
tmdgh1592 May 16, 2023
066946a
refactor: 의존성 주입 파일 구현
tmdgh1592 May 16, 2023
60f1b8c
refactor: Domain Repository 클래스명 변경
tmdgh1592 May 16, 2023
c3535de
refactor(BasketPresenterTest): test/ui 패키지로 이동
tmdgh1592 May 16, 2023
dd712ae
test(BasketPresenterTest): 함수 수행 결과값을 확인하도록 변경
tmdgh1592 May 16, 2023
45f4bd6
docs(README): 상태 관리 기능 목록 작성
tmdgh1592 May 17, 2023
b6eddbb
feat(CounterView): CounterView 커스텀 뷰 구현
tmdgh1592 May 17, 2023
bccc471
feat(Product): 선택된 개수 프로퍼티 추가
tmdgh1592 May 17, 2023
71cd8de
feat(Dao): SelectedCount 컬럼 추가
tmdgh1592 May 17, 2023
94cf6d3
feat: 홈 화면에서도 장바구니를 담는 기능 구현
tmdgh1592 May 18, 2023
b9b7c02
feat(ShoppingActivity): 장바구니 메뉴에 개수를 보여주는 기능 구현
tmdgh1592 May 18, 2023
ba89b37
fix(ShoppingPresenter): 더 보기 버튼이 동작하는 않는 버그 수정
tmdgh1592 May 18, 2023
c3b789c
feat(ProductDetailActivity): 마지막으로 본 상품으로 이어지는 화면 구현
tmdgh1592 May 18, 2023
e878428
fix(ProductCount): 장바구니 개수가 99개가 넘으면 99개만 보여주도록 변경
tmdgh1592 May 18, 2023
6f396b6
fix(view_counter): 더하기 버튼 백그라운드가 마이너스 배경으로 되어 있던 버그 수정
tmdgh1592 May 18, 2023
55802f5
feat(ProductCounterDialog): 숫자 카운팅 다이얼로그 구현
tmdgh1592 May 18, 2023
f3ac7ed
fix(ShoppingPresenter): 새로운 아이템은 장바구니에 안 담기는 버그 수정
tmdgh1592 May 19, 2023
6523ef9
chore: 안드로이드 testing 라이브러리 추가
tmdgh1592 May 19, 2023
63b91c1
feat: 장바구니 아이템에 체크박스와 카운터뷰 추가
tmdgh1592 May 19, 2023
fac98b0
fix(BasketDao): DetailActivity에서 상품 추가시, 수량이 제대로 추가되지 않는 버그 수정
tmdgh1592 May 19, 2023
09fea4f
feat(BasketActivity): 장바구니 아이템 체크 기능 구현
tmdgh1592 May 20, 2023
03202f3
feat(ShoppingPresenter): 장바구니 선택 개수 변경시 쇼핑 리스트 화면에도 반영되도록 변경
tmdgh1592 May 20, 2023
f61c180
feat(BasketActivity): 장바구니에서 선택된 제품을 주문하는 기능 구현
tmdgh1592 May 20, 2023
191c0ed
fix(BasketPresenter): 전체 선택시 모든 체크박스가 체크된 상태로 바뀌지 않는 버그 수정
tmdgh1592 May 20, 2023
24aa9d6
refactor(BasketActivity): 상품 전체 체크를 할 때, notifyDatasetChanged() 메서드 대…
tmdgh1592 May 20, 2023
6a10e7d
feat(ConcatAdapterBuilder): ConcatAdapterBuilder 구현
tmdgh1592 May 20, 2023
12e6556
refactor(ImageViewExtension): 파일명을 ImageViewExt 에서 ImageViewExtension…
tmdgh1592 May 20, 2023
06a7c05
refactor(RecyclerViewBindingAdapter): recyclerView bind listener 구현
tmdgh1592 May 20, 2023
a030858
refactor(ShoppingActivity): 장바구니 수량을 보여주는 기능을 UiProductCount 클래스로 이동
tmdgh1592 May 20, 2023
b732df2
refactor(ProductClickListener): 리스너 메서드명 변경
tmdgh1592 May 20, 2023
ae1d3ea
refactor(ShoppingPresenter): 중복 메서드를 하나로 묶고 일부 메서드명을 명확하게 파악할 수 있도록 변경
tmdgh1592 May 20, 2023
1809985
refactor(ProductDetailActivity): 사용하지 않은 인자 제거 및 코드 포맷팅
tmdgh1592 May 20, 2023
3ea5993
refactor(Contract.View): View interface가 presenter를 알지 못하도록 변경
tmdgh1592 May 20, 2023
387eb23
refactor(ProductCounterDialog): onPutInBasket() -> putInBasket()로 파라미…
tmdgh1592 May 20, 2023
0fff5ae
refactor(BasketActivity): notifyDataSetChanged() 메서드 호출 제거
tmdgh1592 May 20, 2023
70e17eb
refactor(BasketActivity): updateAllCheckedState() 메서드 제거
tmdgh1592 May 20, 2023
ade4452
refactor(TextViewBindingAdapter): 가격 포맷팅을 BindingAdapter를 통해 하도록 변경
tmdgh1592 May 21, 2023
d2d97e5
refactor(ContextExtension): 메세지를 보여주는 확장 함수 구현
tmdgh1592 May 21, 2023
14aee12
refactor(BasketPresenter): 메서드명 변경
tmdgh1592 May 21, 2023
a5685dd
refactor(DiffUtil): DiffUtil을 별도 object 파일로 분리
tmdgh1592 May 21, 2023
cd86d60
refactor(BasketAdapter): 장바구니 클릭 콜백 5개를 리스너 하나로 변경
tmdgh1592 May 21, 2023
d3667bd
fix(BasketPresenter): 페이지네이션 동작 안 하는 버그 수정
tmdgh1592 May 21, 2023
dfb3b6e
refactor(BasketPresenter): 중복 메서드 제거 및 코드 포맷팅
tmdgh1592 May 21, 2023
4c40f51
refactor: 사용하지 않는 클래스, 메서드 제거
tmdgh1592 May 21, 2023
6568c4b
refactor: Basket 네이밍을 Cart로 변경
tmdgh1592 May 21, 2023
d63e7a0
refactor: 도메인 모델을 model 패키지로 이동
tmdgh1592 May 21, 2023
be1475a
refactor: Page 클래스를 Pagination과 LoadMore로 분리
tmdgh1592 May 21, 2023
1878a3e
chore: OkHttp 라이브러리 추가
tmdgh1592 May 21, 2023
44014fe
feat(RecyclerViewBindingAdapter): 리사이클러뷰 애니메이터 null 처리
tmdgh1592 May 21, 2023
314fd4e
refactor(ShoppingPresenter): 상품 목록을 더미 데이터에서 받아오도록 변경
tmdgh1592 May 21, 2023
8600119
refactor(CartPresenter): 상품 목록을 더미 데이터에서 받아오도록 변경
tmdgh1592 May 22, 2023
e8a4958
feat(MockWebServer): 목 웹서버 환경 구
tmdgh1592 May 22, 2023
40c399d
refactor(Cart): loadUnit 인자 제거
tmdgh1592 May 22, 2023
3e6c946
fix(CartPresenter): 장바구니에 등록한 제품 삭제시 화면 갱신 안 되는 버그 수정
tmdgh1592 May 22, 2023
a97054c
test(LoadMoreTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
944a27b
test(PaginationTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
571a9a1
test(RecentProductTest): 최근 제품 목록을 반환하는 테스트 코드 작성
tmdgh1592 May 22, 2023
0145853
test(CartProductTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
3288e1a
test(ProductCountTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
3e115bb
refactor(ShoppingPresenter): fetchProduct 메서드 제거)
tmdgh1592 May 22, 2023
403def1
test(ShoppingPresenterTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
e239c47
test(CartPresenterTest): 테스트 코드 작성
tmdgh1592 May 22, 2023
eefdef5
test(ProductDetailPresenterTest): 테스트 코드가 깨지는 문제 해결
tmdgh1592 May 22, 2023
e054ba9
refactor(ProductDao): 더 이상 사용되지 않으므로 제거
tmdgh1592 May 22, 2023
5de60e8
refactor: 사용하지 않는 메서드 제거
tmdgh1592 May 22, 2023
c0cf947
refactor(ShoppingMockWebServer): 외부에서 baseUrl을 수정하지 못하도록 백킹 프로퍼티 사용
tmdgh1592 May 22, 2023
805a745
refactor(ProductCounterView): 3가지 부생성자 추가 구현
tmdgh1592 May 22, 2023
662c8e6
refactor(ProductCounterView): init 블럭 위치를 부생성자 위로 이동
tmdgh1592 May 22, 2023
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@
- 최근 본 상품을 조회할 수 있다.
- 상품 목록을 보여준다.
- 최근 본 상품이 있는 경우 상품 목록 상단에서 10개까지 확인할 수 있다.
- [ ] 상품 목록에서 장바구니에 담을 상품의 수를 선택할 수 있다. (B마트 UX 참고)
- [ ] 버튼을 누르면 장바구니에 상품이 추가됨과 동시에 수량 선택 버튼이 노출된다.
- [ ] 상품 목록의 상품 수가 변화하면 장바구니에도 반영되어야 한다.
- [ ] 장바구니의 상품 수가 변화하면 상품 목록에도 반영되어야 한다.
- [ ] 장바구니 화면에서 체크박스로 주문할 상품 범위를 조정할 수 있다.
- [ ] 전체 체크박스를 선택하면 해당 페이지 내의 상품들만 선택된다.
- [ ] 페이지가 바뀌어도 선택된 항목은 유지된다.
- [ ] 마지막으로 본 상품 1개를 상품 상세 페이지에서 확인할 수 있다.
- [ ] 마지막으로 본 상품을 선택했을 때는 마지막으로 본 상품이 보이지 않는다.
- [ ] 마지막으로 본 상품 페이지에서 뒤로 가기를 하면 상품 목록으로 이동한다.
8 changes: 8 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,12 @@ dependencies {

// concatAdapter
implementation("androidx.recyclerview:recyclerview:1.3.0")

// core-testing
testImplementation("androidx.arch.core:core-testing:2.2.0")

// OkHttp
implementation("com.squareup.okhttp3:okhttp:4.11.0")
implementation("com.squareup.okhttp3:mockwebserver:4.11.0")
testImplementation("com.squareup.okhttp3:mockwebserver:4.11.0")
}
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Shopping"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".ui.basket.BasketActivity"
android:name=".ui.cart.CartActivity"
android:exported="true" />
<activity
android:name=".ui.productdetail.ProductDetailActivity"
android:name=".ui.detail.ProductDetailActivity"
android:exported="false" />
<activity
android:name=".ui.shopping.ShoppingActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ package woowacourse.shopping.data.database
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import woowacourse.shopping.data.database.contract.BasketContract
import woowacourse.shopping.data.database.contract.CartContract
import woowacourse.shopping.data.database.contract.ProductContract
import woowacourse.shopping.data.database.contract.RecentProductContract

const val DATABASE_NAME = "ShoppingDatabase.db"
const val DATABASE_VERSION = 5
const val DATABASE_VERSION = 11

class ShoppingDatabase(context: Context) :
SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
override fun onCreate(db: SQLiteDatabase?) {
db?.execSQL(ProductContract.CREATE_TABLE_QUERY)
db?.execSQL(RecentProductContract.CREATE_TABLE_QUERY)
db?.execSQL(BasketContract.CREATE_TABLE_QUERY)
db?.execSQL(CartContract.CREATE_TABLE_QUERY)
}

override fun onUpgrade(db: SQLiteDatabase?, old: Int, new: Int) {
db?.execSQL(ProductContract.DELETE_TABLE_QUERY)
db?.execSQL(RecentProductContract.DELETE_TABLE_QUERY)
db?.execSQL(BasketContract.DELETE_TABLE_QUERY)
db?.execSQL(CartContract.DELETE_TABLE_QUERY)
onCreate(db)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package woowacourse.shopping.data.database.contract

object CartContract {
internal const val TABLE_NAME = "BASKET_TABLE"
internal const val CART_ID = "basket_id"
internal const val PRODUCT_ID = "product_id"
internal const val COLUMN_CREATED = "created"
internal const val COLUMN_COUNT = "count"
internal const val COLUMN_CHECKED = "checked"

internal val CREATE_TABLE_QUERY = """
CREATE TABLE IF NOT EXISTS $TABLE_NAME (
$CART_ID INTEGER PRIMARY KEY AUTOINCREMENT,
$PRODUCT_ID INTEGER,
$COLUMN_CREATED LONG,
$COLUMN_COUNT INTEGER,
$COLUMN_CHECKED INTEGER DEFAULT 1
)
""".trimIndent()

internal val DELETE_TABLE_QUERY = """
DROP TABLE IF EXISTS $TABLE_NAME
""".trimIndent()
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package woowacourse.shopping.data.database.dao.cart

import woowacourse.shopping.data.entity.CartEntity
import woowacourse.shopping.data.model.DataCart
import woowacourse.shopping.data.model.DataCartProduct
import woowacourse.shopping.data.model.DataPage
import woowacourse.shopping.data.model.Product

interface CartDao {
fun getCartEntitiesByPage(page: DataPage): List<CartEntity>
fun insert(product: Product, count: Int)
fun deleteByProductId(id: Int)
fun contains(product: Product): Boolean
fun count(product: Product): Int
fun getProductInCartSize(): Int
fun addProductCount(product: Product, count: Int)
fun minusProductCount(product: Product, count: Int)
fun update(cartProduct: DataCartProduct)
fun updateCount(product: Product, count: Int)
fun getCheckedProductCount(): Int
fun deleteCheckedProducts()
fun getAllCartEntity(): List<CartEntity>
fun getCartEntity(productId: Int): CartEntity
}
Loading