Skip to content

Commit

Permalink
Merge pull request #150 from pknu-wap/#147/feature/tgyuu/MedicineInfo…
Browse files Browse the repository at this point in the history
…TopBar

#147 add MedicineInfo TopBar Logic
  • Loading branch information
tgyuuAn authored Jun 8, 2023
2 parents 0b19193 + 32551d3 commit f119451
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Bar @JvmOverloads constructor(
const val WHITE = 1
const val HOME_BLUE = 2
const val HOME_WHITE = 3
const val MEDICINE_INFO = 4
}

lateinit var backButton: ImageView
Expand Down Expand Up @@ -85,6 +86,12 @@ class Bar @JvmOverloads constructor(
logo.setImageResource(com.android.mediproject.core.common.R.drawable.medilenz_original_logo)
logo.visibility = View.VISIBLE
}

MEDICINE_INFO -> {
bar.setBackgroundColor(ContextCompat.getColor(context, R.color.purple))
title.setTextColor(ContextCompat.getColor(context, R.color.white))
backButton.setImageResource(R.drawable.left_arrow)
}
}

typedArray.recycle()
Expand Down
1 change: 1 addition & 0 deletions core/ui/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<enum name="white" value="1" />
<enum name="home_blue" value="2" />
<enum name="home_white" value="3" />
<enum name="medicine_info" value="4" />
</attr>
</declare-styleable>

Expand Down
1 change: 1 addition & 0 deletions core/ui/src/main/res/values/color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<color name="black">#000000</color>
<color name="nonmembers">#EAFDFC</color>
<color name="login">#73CBDE</color>
<color name="purple">#6200EE</color>
<color name="background_header_on_top">#22A7CC</color>
<color name="background_search_ai_button">#1969E8</color>
<color name="default_ripple_color">?attr/colorControlHighlight</color>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class MedicineInfoFragment : BaseFragment<FragmentMedicineInfoBinding, MedicineI
// smoothly hide medicinePrimaryInfoViewgroup when collapsing toolbar
topAppBar.addOnOffsetChangedListener { appBarLayout, verticalOffset ->
medicineInfoBar.alpha = 1.0f + (verticalOffset.toFloat() / appBarLayout.totalScrollRange.toFloat())
medicineInfoBar2.alpha = -(verticalOffset.toFloat() / appBarLayout.totalScrollRange.toFloat())

// 스크롤 할 때 마다 medicinePrimaryInfoViewgroup의 투명도 조정
medicinePrimaryInfoViewgroup.alpha = 1.0f + (verticalOffset.toFloat() / appBarLayout.totalScrollRange.toFloat()).apply {
if (this == -1.0f) {
Expand Down Expand Up @@ -122,6 +124,15 @@ class MedicineInfoFragment : BaseFragment<FragmentMedicineInfoBinding, MedicineI
)
)
)

systemBarStyler.changeMode(
topViews = listOf(
SystemBarStyler.ChangeView(
medicineInfoBar2,
SystemBarStyler.SpacingType.PADDING
)
)
)
}


Expand Down
12 changes: 12 additions & 0 deletions feature/medicine/src/main/res/layout/fragment_medicine_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@
app:setTheme="white"
app:title="의약품 정보" />

<com.android.mediproject.core.ui.base.view.Bar
android:id="@+id/medicineInfoBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:alpha="0"
android:backgroundTint="@color/design_default_color_on_primary"
app:showBackButton="true"
app:setTheme="medicine_info"
app:title="의약품 정보" />

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/rootLayout"
android:layout_width="match_parent"
Expand Down

0 comments on commit f119451

Please sign in to comment.