Last active
March 14, 2018 21:11
-
-
Save WillyShakes/0f9ebf72a63d01df3dd685ebef19752c to your computer and use it in GitHub Desktop.
class for our Custom title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomTitleView extends RelativeLayout implements TitleViewAdapter.Provider { | |
private final TextView mTitleView; | |
private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() { | |
@Override | |
public View getSearchAffordanceView() { | |
return null; | |
} | |
@Override | |
public void setTitle(CharSequence titleText) { | |
CustomTitleView.this.setTitle(titleText); | |
} | |
@Override | |
public void setBadgeDrawable(Drawable drawable) { | |
//CustomTitleView.this.setBadgeDrawable(drawable); | |
} | |
@Override | |
public void setOnSearchClickedListener(OnClickListener listener) { | |
// mSearchOrbView.setOnClickListener(listener); | |
} | |
@Override | |
public void updateComponentsVisibility(int flags) { | |
} | |
private void updateBadgeVisibility(boolean visible) { | |
if (visible) { | |
mTitleView.setVisibility(View.VISIBLE); | |
} else { | |
mTitleView.setVisibility(View.GONE); | |
} | |
} | |
}; | |
public CustomTitleView(Context context) { | |
this(context, null); | |
} | |
//... | |
public void setTitle(CharSequence title) { | |
if (title != null) { | |
mTitleView.setText(title); | |
mTitleView.setVisibility(View.VISIBLE); | |
} | |
} | |
public void setBadgeDrawable(Drawable drawable) { | |
if (drawable != null) { | |
mTitleView.setVisibility(View.GONE); | |
} | |
} | |
@Override | |
public TitleViewAdapter getTitleViewAdapter() { | |
return mTitleViewAdapter; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment