Skip to content

Commit

Permalink
visible
Browse files Browse the repository at this point in the history
  • Loading branch information
jrvansuita committed Feb 20, 2017
1 parent e97804a commit a9d135b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.vansuita.materialabout.util;

import android.view.View;

/**
* Created by jrvansuita on 20/02/17.
*/

public class VisibleUtil {

public static void handle(View v, String s) {
v.setVisibility(s == null || s.isEmpty() ? View.GONE : View.VISIBLE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.vansuita.materialabout.builder.AboutBuilder;
import com.vansuita.materialabout.builder.Item;
import com.vansuita.materialabout.util.RippleUtil;
import com.vansuita.materialabout.util.VisibleUtil;

/**
* Created by jrvansuita on 10/02/17.
Expand Down Expand Up @@ -90,12 +91,16 @@ private void bind() {
}

public void build(AboutBuilder bundle) {

tvName.setText(bundle.getName());
tvName.setVisibility(bundle.getName() == null || bundle.getName().isEmpty() ? GONE : VISIBLE);
VisibleUtil.handle(tvName, bundle.getName());

tvSubTitle.setText(bundle.getSubTitle());
tvSubTitle.setVisibility(bundle.getSubTitle() == null || bundle.getSubTitle().isEmpty() ? GONE : VISIBLE);
VisibleUtil.handle(tvSubTitle, bundle.getSubTitle());

tvBrief.setText(bundle.getBrief());
tvBrief.setVisibility(bundle.getBrief() == null || bundle.getBrief().isEmpty() ? GONE : VISIBLE);
VisibleUtil.handle(tvBrief, bundle.getBrief());

tvAppName.setText(bundle.getAppName());
tvAppTitle.setText(bundle.getAppTitle());

Expand All @@ -112,7 +117,7 @@ public void build(AboutBuilder bundle) {
if (bundle.getBackgroundColor() != 0)
cvHolder.setCardBackgroundColor(bundle.getBackgroundColor());

appHolder.setVisibility(bundle.getAppName() == null || bundle.getAppName().isEmpty() ? GONE : VISIBLE);
VisibleUtil.handle(appHolder, bundle.getAppName());

if (appHolder.getVisibility() == VISIBLE)
setDivider(bundle, appHolder);
Expand Down

0 comments on commit a9d135b

Please sign in to comment.