[android] Added progress bar to inapp button to fix progress displaying on subs button while clicking on inapp button

This commit is contained in:
Александр Зацепин 2019-07-03 19:29:07 +03:00 committed by yoksnod
parent f71724a18b
commit 51bcb2894b
2 changed files with 27 additions and 15 deletions

View file

@ -51,22 +51,34 @@
android:layout_height="match_parent"
tools:text="BUY FOR $1.99"/>
<ProgressBar
android:id="@+id/progress"
android:id="@+id/subs_progress"
android:layout_width="@dimen/primary_button_min_height"
android:layout_height="@dimen/primary_button_min_height"
android:layout_gravity="center"
android:visibility="visible"
tools:visibility="visible"/>
</FrameLayout>
<TextView
android:id="@+id/buy_inapp_btn"
android:textAppearance="?android:textAppearance"
android:background="?clickableBackground"
<FrameLayout
android:id="@+id/buy_inap_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_half_plus_eight"
android:textColor="?colorAccent"
android:gravity="center"
android:textAllCaps="true"/>
android:layout_height="wrap_content">
<TextView
android:id="@+id/buy_inapp_btn"
android:textAppearance="?android:textAppearance"
android:background="?clickableBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_half_plus_eight"
android:textColor="?colorAccent"
android:gravity="center"
android:textAllCaps="true"/>
<ProgressBar
android:id="@+id/inapp_progress"
android:layout_width="@dimen/primary_button_min_height"
android:layout_height="@dimen/primary_button_min_height"
android:layout_gravity="center"
android:visibility="visible"
tools:visibility="visible"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>

View file

@ -121,21 +121,21 @@ enum BookmarkPaymentState
@Override
void activate(@NonNull BookmarkPaymentFragment fragment)
{
UiUtils.hide(fragment.getViewOrThrow(), R.id.progress);
UiUtils.hide(fragment.getViewOrThrow(), R.id.subs_progress);
fragment.updateSubsProductDetails();
}
};;
private static void showProgress(@NonNull BookmarkPaymentFragment fragment)
{
UiUtils.show(fragment.getViewOrThrow(), R.id.progress);
UiUtils.hide(fragment.getViewOrThrow(), R.id.buy_subs_btn);
UiUtils.show(fragment.getViewOrThrow(), R.id.inapp_progress);
UiUtils.hide(fragment.getViewOrThrow(), R.id.buy_inapp_btn);
}
private static void hideProgress(@NonNull BookmarkPaymentFragment fragment)
{
UiUtils.hide(fragment.getViewOrThrow(), R.id.progress);
UiUtils.show(fragment.getViewOrThrow(), R.id.buy_subs_btn);
UiUtils.hide(fragment.getViewOrThrow(), R.id.inapp_progress);
UiUtils.show(fragment.getViewOrThrow(), R.id.buy_inapp_btn);
}
abstract void activate(@NonNull BookmarkPaymentFragment fragment);