Add more nullability info

This commit is contained in:
topjohnwu 2020-08-10 04:54:29 -07:00
parent 7b320b898f
commit 46865ac6f4
3 changed files with 11 additions and 3 deletions

View File

@ -105,13 +105,15 @@ public class IndeterminateCheckBox extends MaterialCheckBox implements Indetermi
}
}
@Override
@Nullable
@ViewDebug.ExportedProperty
public Boolean getState() {
return mIndeterminate ? null : isChecked();
}
@Override
public void setState(Boolean state) {
public void setState(@Nullable Boolean state) {
if (state != null) {
setChecked(state);
} else {

View File

@ -2,6 +2,8 @@ package com.topjohnwu.widget;
import android.widget.Checkable;
import androidx.annotation.Nullable;
/**
* Extension to Checkable interface with addition "indeterminate" state
* represented by <code>getState()</code>. Value meanings:
@ -11,6 +13,8 @@ import android.widget.Checkable;
*/
public interface IndeterminateCheckable extends Checkable {
void setState(Boolean state);
void setState(@Nullable Boolean state);
@Nullable
Boolean getState();
}

View File

@ -109,13 +109,15 @@ public class IndeterminateRadioButton extends MaterialRadioButton
}
@Override
@Nullable
@ViewDebug.ExportedProperty
public Boolean getState() {
return mIndeterminate ? null : isChecked();
}
@Override
public void setState(Boolean state) {
public void setState(@Nullable Boolean state) {
if (state != null) {
setChecked(state);
} else {