-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
I'm running the following code:
<com.github.abdularis.buttonprogress.DownloadButtonProgress
android:id="@+id/button_synchronize"
android:layout_width="32dp"
android:layout_height="32dp"
android:visibility="@{entry.canSynchronize() ? View.VISIBLE : View.GONE}"
app:buttonState="@{entry.synchronizationState}"
/>
and using data-binding to synchronize the button state and visibility.
I'm using the following databinding adapter:
public class DownloadButtonStateBindingAdapter {
@BindingAdapter("buttonState")
public static void setMyAttr(DownloadButtonProgress myInnerView, int value) {
switch (value) {
case DownloadButtonProgress.STATE_IDLE:
myInnerView.setIdle();
break;
case DownloadButtonProgress.STATE_INDETERMINATE:
myInnerView.setIndeterminate();
break;
case DownloadButtonProgress.STATE_DETERMINATE:
myInnerView.setDeterminate();
break;
case DownloadButtonProgress.STATE_FINISHED:
myInnerView.setFinish();
break;
default:
break;
}
}
}
unfortunately, the setIdle, ... methods do more than just setting the state.
public void setIdle() {
mCurrState = STATE_IDLE;
setVisibility(VISIBLE);
invalidate();
}
This forces me to reset the visibility after each setIdle call. Why are you setting the visibility here? Could you please remove that call?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels