-
Notifications
You must be signed in to change notification settings - Fork 0
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
お気に入り画面のアイテムタブの作成 一個前のプルリクはクローズしました #29
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
f6ca085
アイテムタブ用のEntityを定義した
nemo-855 64b481d
favorite_item_description作成
nemo-855 358dbc8
FavoriteItemFragmentで無駄にbindingをFragmentのメンバ変数にしていたところを修正
nemo-855 af3345e
FavoriteItemFragmentでGroupieAdapterとGridLayoutManager.SpanSizeLookupの…
nemo-855 8a1abb6
FavoriteItemFragmentでGridLayoutのRecyclerViewを表示する処理実装
nemo-855 1dc0358
FavoriteItemFragmentでリストに表示するようのモデルクラスを定義して、ランダムなリストを作る関数を作成
nemo-855 ac44925
favorite_item_descriptionのレイアウトを整えた
nemo-855 dfe2375
FavoriteItemDiscriptionで画像表示の処理実装
nemo-855 4dcdadb
favorite_item_descriptionで画像サイズ修正
nemo-855 5d04552
FavoriteItemFragmentでアイテムのリストを取得する導線を修正
nemo-855 0923e29
FavoriteItemFragmentにAndroidEntryPointをつけた
nemo-855 1ec1d72
FavoriteItemCellの引数名を修正した
nemo-855 37155e1
BrandItem変数名修正
nemo-855 37d7029
fragment_favorite_new_itemの内部をRecyclerViewのみにした
nemo-855 97f1b5c
fragment_favoriteの不要なlayout_behavior削除
nemo-855 6391295
fragment_favorite coordinatorLayout周りの高さ修正
nemo-855 d93a7cc
favorite_new_item_item_cellの不要なmargin削除
nemo-855 3d10f3b
FavoriteItemCellで動的に左右のmarginをつけるようにした
nemo-855 70f6e7c
FavoriteItemFragmentでSpanSize指定部分のマジックナンバー回避
nemo-855 ac509cd
FavoriteItemFragmentで商品の情報をAPIから取ってきた前提に書き換えた
nemo-855 40a4425
CustomGridSpanSieLookupにadapterを直接渡すことでadapterのitemListの変更に対応できるようにした
nemo-855 f74c575
CustomGridSpanSieLookupのRecyclerViewにgridlayoutmanagerを渡すタイミング変更
nemo-855 b5cb6eb
favorite_new_item_item_cellのmarginの付け方修正
nemo-855 c6be146
CustomGroupieAdapter内部のdefaltのリスト生成ロジック修正
nemo-855 b577624
FavoriteFragmentのEntityのprefixとディレクトリ構造を整理した
nemo-855 58fadfa
FavoriteFragmentのEntityにFavoriteItemModelを継承させてspanSizeを定義した
nemo-855 2c49fe5
ディレクトリ構造の修正によるパッケージ名修正
nemo-855 c35914a
DisplayClothsDataにhasDiscountPercentとhasCouponPriceを定義した
nemo-855 181878c
FavoriteItemFragmentのCustomGroupieAdapter fun updateList内部のロジックをupdat…
nemo-855 9ce90f3
FavoriteItemCellで動的に左右のmarginをつけるようにした
nemo-855 2f90c75
favorite_new_item_item_cell margin修正
nemo-855 1f605f8
feat:Toolbarの作成
iroha-168 c750832
chore:コードレビュー指摘事項修正
iroha-168 581dcb0
add bindind adapter
Naoki-Hidaka 5969c30
to private
Naoki-Hidaka 1b99071
FavoriteItemDiscriptionのTextViewをDataBinding対応
nemo-855 550a35d
FavoriteItemDescriptionでカスタムのBindingAdapterを適用できるところに適用
nemo-855 b38c8c3
FavoriteItemFragmentのModelにspanSizeを持たせる方法をabstract class → interface…
nemo-855 84463d3
FavoriteItemViewModel fetchDisplayClothsListアイテム生成ロジック修正
nemo-855 902419b
issameas hassamecontentの実装
nemo-855 90f1ed1
CustomGridSpanSizeLookupでadapter itemList -> getItemに変更
nemo-855 8a5086b
merge main into create_favorite_item_tab
nemo-855 336ec4e
Apply ktlint Format
36a89c8
SpanSizeInterface -> HasSpanSizeItem
nemo-855 34fa3b2
hasSameContentAsのロジック修正
nemo-855 ec3021e
FavoriteItemDescriptionのisSameAs修正
nemo-855 67c674d
CustomGridSpanSizeLookupのgetSpanSize修正
nemo-855 da4e5d4
Merge branch 'create_favorite_item' of https://github.com/iroha-168/A…
nemo-855 0cd6bf9
rename directory entity -> uiModel
nemo-855 64146bf
FavoriteItemDescriptionのisSameAs修正
nemo-855 4ece3cf
FavoriteItemDescriptionViewModelを廃止してFavoriteItemDescriptionにidを持たせた(…
nemo-855 6c97dbd
FavoriteItemDiscription -> FavoriteItemDescription
nemo-855 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
...com/nemo/androiduitraining/view/fragment/favorite/uiModel/item/FavoriteItemDescription.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,31 @@ | ||
package com.nemo.androiduitraining.view.fragment.favorite.uiModel.item | ||
|
||
import android.view.View | ||
import com.nemo.androiduitraining.R | ||
import com.nemo.androiduitraining.databinding.FavoriteItemDescriptionBinding | ||
import com.nemo.androiduitraining.viewModel.favorite.FavoriteItemViewModel | ||
import com.xwray.groupie.Item | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
class FavoriteItemDescription( | ||
val displayData: FavoriteItemViewModel.DisplayClothsData | ||
) : BindableItem<FavoriteItemDescriptionBinding>(), HasSpanSizeItem { | ||
override val spanSize = 1 | ||
override fun bind(viewBinding: FavoriteItemDescriptionBinding, position: Int) { | ||
viewBinding.displayClothsData = displayData | ||
} | ||
|
||
override fun getLayout() = R.layout.favorite_item_description | ||
|
||
override fun initializeViewBinding(view: View): FavoriteItemDescriptionBinding { | ||
return FavoriteItemDescriptionBinding.bind(view) | ||
} | ||
|
||
override fun isSameAs(other: Item<*>): Boolean { | ||
return (other as? FavoriteItemDescription)?.displayData == this.displayData | ||
} | ||
|
||
override fun hasSameContentAs(other: Item<*>): Boolean { | ||
return (other as? FavoriteItemDescription)?.displayData?.id == this.displayData.id | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...java/com/nemo/androiduitraining/view/fragment/favorite/uiModel/item/FavoriteItemNoItem.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,28 @@ | ||
package com.nemo.androiduitraining.view.fragment.favorite.uiModel.item | ||
|
||
import android.view.View | ||
import com.nemo.androiduitraining.R | ||
import com.nemo.androiduitraining.databinding.FavoriteItemNoItemRegisteredBinding | ||
import com.xwray.groupie.Item | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
class FavoriteItemNoItem : BindableItem<FavoriteItemNoItemRegisteredBinding>(), HasSpanSizeItem { | ||
override val spanSize = 3 | ||
override fun bind(viewBinding: FavoriteItemNoItemRegisteredBinding, position: Int) { | ||
} | ||
|
||
override fun getLayout() = R.layout.favorite_item_no_item_registered | ||
|
||
override fun initializeViewBinding(view: View): FavoriteItemNoItemRegisteredBinding { | ||
return FavoriteItemNoItemRegisteredBinding.bind(view) | ||
} | ||
|
||
/**現状FavoriteItemNoItemは一つしか表示しないので classが等しければ更新は不要*/ | ||
override fun isSameAs(other: Item<*>): Boolean { | ||
return other is FavoriteItemNoItem | ||
} | ||
|
||
override fun hasSameContentAs(other: Item<*>): Boolean { | ||
return isSameAs(other) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.../com/nemo/androiduitraining/view/fragment/favorite/uiModel/item/FavoriteItemNowPopular.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,27 @@ | ||
package com.nemo.androiduitraining.view.fragment.favorite.uiModel.item | ||
|
||
import android.view.View | ||
import com.nemo.androiduitraining.R | ||
import com.nemo.androiduitraining.databinding.FavoriteItemNowPopularBinding | ||
import com.xwray.groupie.Item | ||
import com.xwray.groupie.viewbinding.BindableItem | ||
|
||
class FavoriteItemNowPopular : BindableItem<FavoriteItemNowPopularBinding>(), HasSpanSizeItem { | ||
override val spanSize = 3 | ||
override fun bind(viewBinding: FavoriteItemNowPopularBinding, position: Int) { | ||
} | ||
|
||
override fun getLayout() = R.layout.favorite_item_now_popular | ||
|
||
override fun initializeViewBinding(view: View): FavoriteItemNowPopularBinding { | ||
return FavoriteItemNowPopularBinding.bind(view) | ||
} | ||
|
||
override fun isSameAs(other: Item<*>): Boolean { | ||
return other is FavoriteItemNowPopular | ||
} | ||
|
||
override fun hasSameContentAs(other: Item<*>): Boolean { | ||
return isSameAs(other) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...in/java/com/nemo/androiduitraining/view/fragment/favorite/uiModel/item/HasSpanSizeItem.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,5 @@ | ||
package com.nemo.androiduitraining.view.fragment.favorite.uiModel.item | ||
|
||
interface HasSpanSizeItem { | ||
val spanSize: Int | ||
} |
4 changes: 2 additions & 2 deletions
4
...gment/favorite/entity/FavoriteItemCell.kt → ...te/uiModel/newItem/FavoriteNewItemCell.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
4 changes: 2 additions & 2 deletions
4
...orite/entity/FavoriteNoBrandRegistered.kt → ...ite/uiModel/newItem/FavoriteNewNoBrand.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
4 changes: 2 additions & 2 deletions
4
...ent/favorite/entity/FavoriteNowPopular.kt → .../uiModel/newItem/FavoriteNewNowPopular.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
88 changes: 88 additions & 0 deletions
88
app/src/main/java/com/nemo/androiduitraining/viewModel/favorite/FavoriteItemViewModel.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,88 @@ | ||
package com.nemo.androiduitraining.viewModel.favorite | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import java.util.* | ||
import javax.inject.Inject | ||
import kotlin.random.Random | ||
|
||
@HiltViewModel | ||
class FavoriteItemViewModel @Inject constructor() : ViewModel() { | ||
private val _clothsLD = MutableLiveData<List<DisplayClothsData>>() | ||
val clothsLD: LiveData<List<DisplayClothsData>> | ||
get() = _clothsLD | ||
|
||
fun fetchDisplayClothsList() { | ||
val displayList = mutableListOf<DisplayClothsData>() | ||
|
||
for (i in 0..29) { | ||
val data = when (Random.nextInt(4)) { | ||
0 -> fullData | ||
1 -> missPercentData | ||
2 -> missCouponData | ||
else -> missBothData | ||
} | ||
displayList.add(data) | ||
} | ||
|
||
_clothsLD.postValue(displayList) | ||
} | ||
|
||
private val fullData = DisplayClothsData( | ||
id = UUID.randomUUID().toString(), | ||
itemImage = "https://shop.adidas.jp/photo/GN/GN3458/z-GN3458-on_model-standard_view.jpg", | ||
discountPercent = 50, | ||
couponPrice = 300, | ||
itemName = "アディパン", | ||
itemGenre = "いかつい", | ||
itemPrice = 3000 | ||
) | ||
|
||
private val missPercentData = DisplayClothsData( | ||
id = UUID.randomUUID().toString(), | ||
itemImage = "https://shop.adidas.jp/photo/GN/GN3458/z-GN3458-on_model-standard_view.jpg", | ||
discountPercent = null, | ||
couponPrice = 300, | ||
itemName = "アディパン", | ||
itemGenre = "いかつい", | ||
itemPrice = 3000 | ||
) | ||
|
||
private val missCouponData = DisplayClothsData( | ||
id = UUID.randomUUID().toString(), | ||
itemImage = "https://shop.adidas.jp/photo/GN/GN3458/z-GN3458-on_model-standard_view.jpg", | ||
discountPercent = 50, | ||
couponPrice = null, | ||
itemName = "アディパン", | ||
itemGenre = "いかつい", | ||
itemPrice = 3000 | ||
) | ||
|
||
private val missBothData = DisplayClothsData( | ||
id = UUID.randomUUID().toString(), | ||
itemImage = "https://shop.adidas.jp/photo/GN/GN3458/z-GN3458-on_model-standard_view.jpg", | ||
discountPercent = null, | ||
couponPrice = null, | ||
itemName = "アディパン", | ||
itemGenre = "いかつい", | ||
itemPrice = 3000 | ||
) | ||
|
||
data class DisplayClothsData( | ||
val id: String, | ||
val itemImage: String, | ||
val discountPercent: Int?, | ||
val couponPrice: Int?, | ||
val itemName: String, | ||
val itemGenre: String, | ||
val itemPrice: Int | ||
) { | ||
fun hasDiscountPercent() = discountPercent != null | ||
fun hasCouponPrice() = couponPrice != null | ||
fun makePriceText(price: Int) = "¥$price" | ||
fun makeCouponPrice(couponPrice: Int?) = "¥${couponPrice}クーポン" | ||
fun makeCouponDiscountPercent(discountPercent: Int?) = "$discountPercent%OFF" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これはなくせそう