-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature/mypage_ui] add VIEW_TYPE_EMPTY (#89)
* [feat/store]: chore remove blank * [feat/mypage]: add ic_empty_feed.png * [feat/mypage]: UI remove profile bottom margin * [feat/mypage]: refactor adapter add Empty viewHolder * [feat/mypage]: add custom GridSpacingCustomDeco * [feat/mypage]: refactor to MultiViewType Rv * [feat/mypage]: chore align code style * [feat/mypage]: chore code style * [feat/mypage]: UI edit margin bottom to item_profile * [feat/mypage]: UI edit margin top to item_empty
- Loading branch information
1 parent
df319a5
commit 66e0b9b
Showing
13 changed files
with
104 additions
and
95 deletions.
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
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
34 changes: 34 additions & 0 deletions
34
...main/java/com/teampophory/pophory/feature/home/mypage/util/GridSpacingCustomDecoration.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,34 @@ | ||
package com.teampophory.pophory.feature.home.mypage.util | ||
|
||
import android.graphics.Rect | ||
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
|
||
class GridSpacingCustomDecoration(private val spanCount: Int, private val spacing: Int, private val includeEdge: Boolean) : RecyclerView.ItemDecoration() { | ||
|
||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { | ||
val position = parent.getChildAdapterPosition(view) -1 // item position | ||
val column = position % spanCount // item column | ||
|
||
// If it's the first item (position 0), skip decoration | ||
if (position == -1) { | ||
return | ||
} | ||
|
||
if (!includeEdge) { | ||
outRect.left = spacing - column * spacing / spanCount // spacing - column * ((1f / spanCount) * spacing) | ||
outRect.right = (column + 1) * spacing / spanCount // (column + 1) * ((1f / spanCount) * spacing) | ||
|
||
if (position < spanCount) { // top edge | ||
outRect.top = spacing | ||
} | ||
outRect.bottom = spacing // item bottom | ||
} else { | ||
outRect.left = column * spacing / spanCount // column * ((1f / spanCount) * spacing) | ||
outRect.right = spacing - (column + 1) * spacing / spanCount // spacing - (column + 1) * ((1f / spanCount) * spacing) | ||
if (position >= spanCount) { | ||
outRect.top = spacing // item top | ||
} | ||
} | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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"> | ||
|
||
<ImageView | ||
android:id="@+id/iv_mypage_feed_empty" | ||
android:layout_width="0dp" | ||
android:layout_height="180dp" | ||
android:layout_marginHorizontal="40dp" | ||
android:layout_marginTop="7dp" | ||
android:src="@drawable/ic_empty_feed" | ||
app:layout_constraintDimensionRatio="1:1" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_mypage_feed_empty" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="@string/mypage_feed_empty" | ||
android:textAppearance="?textAppearanceHeadlineSmall" | ||
android:textColor="?colorOnSurface50" | ||
android:textSize="18sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@id/iv_mypage_feed_empty" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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