refactor (home) : show account icon when no provider selected (#812)

Co-authored-by: Funny-Pen-7005 <Funny-Pen-7005>
This commit is contained in:
coxju 2023-12-14 00:53:30 +05:30 committed by GitHub
parent 3c152e04d1
commit 410cedc128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -280,9 +280,13 @@ class HomeParentItemAdapterPreview(
private var homeAccount: View? =
itemView.findViewById(R.id.home_preview_switch_account)
private var alternativeHomeAccount: View? =
itemView.findViewById(R.id.alternative_switch_account)
private var topPadding: View? = itemView.findViewById(R.id.home_padding)
private var alternativeAccountPadding: View? = itemView.findViewById(R.id.alternative_account_padding)
private val homeNonePadding: View = itemView.findViewById(R.id.home_none_padding)
private val previewCallback: ViewPager2.OnPageChangeCallback =
@ -482,6 +486,10 @@ class HomeParentItemAdapterPreview(
activity?.showAccountSelectLinear()
}
alternativeHomeAccount?.setOnClickListener {
activity?.showAccountSelectLinear()
}
(binding as? FragmentHomeHeadTvBinding)?.apply {
homePreviewChangeApi.setOnClickListener { view ->
view.context.selectHomepage(viewModel.repo?.name) { api ->
@ -563,6 +571,7 @@ class HomeParentItemAdapterPreview(
previewCallback.onPageSelected(0)
previewViewpager.isVisible = true
previewViewpagerText.isVisible = true
alternativeAccountPadding?.isVisible = false
//previewHeader.isVisible = true
}
}
@ -572,6 +581,7 @@ class HomeParentItemAdapterPreview(
previewViewpager.setCurrentItem(0, false)
previewViewpager.isVisible = false
previewViewpagerText.isVisible = false
alternativeAccountPadding?.isVisible = true
//previewHeader.isVisible = false
}
}

View File

@ -136,6 +136,25 @@
</FrameLayout>
<LinearLayout
android:id="@+id/alternative_account_padding"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="right"
android:orientation="horizontal">
<ImageView
android:id="@+id/alternative_switch_account"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginStart="-50dp"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/account"
android:padding="10dp"
android:src="@drawable/ic_outline_account_circle_24" />
</LinearLayout>
<LinearLayout
android:id="@+id/home_watch_holder"