Skip to content

Instantly share code, notes, and snippets.

@unosk
Created May 4, 2015 12:54
Show Gist options
  • Save unosk/e96f3578dcb77d0b50a8 to your computer and use it in GitHub Desktop.
Save unosk/e96f3578dcb77d0b50a8 to your computer and use it in GitHub Desktop.
import android.view.View;
public class UiVisibilityHelper {
private View[] mViews;
public UiVisibilityHelper(View... views) {
mViews = views;
}
public void toggle() {
if (mViews[0].getVisibility() == View.GONE) {
show();
} else {
hide();
}
}
public void show() {
for (View view : mViews) {
view.setVisibility(View.VISIBLE);
}
}
public void hide() {
for (View view : mViews) {
view.setVisibility(View.GONE);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment