com.zhy.view.flowlayout.FlowLayout Java Examples
The following examples show how to use
com.zhy.view.flowlayout.FlowLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleFragment.java From FlowLayout with Apache License 2.0 | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final LayoutInflater mInflater = LayoutInflater.from(getActivity()); mFlowLayout = (TagFlowLayout) view.findViewById(R.id.id_flowlayout); mFlowLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "FlowLayout Clicked", Toast.LENGTH_SHORT).show(); } }); mFlowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) mInflater.inflate(R.layout.tv, mFlowLayout, false); tv.setText(s); return tv; } }); }
Example #2
Source File: SearchActivity.java From Yuan-WanAndroid with Apache License 2.0 | 6 votes |
@Override public void showSearchHotKeyFlow(List<HotKey> hotKeys) { mHotKeys = hotKeys; searchHotFlowLayout.setAdapter(new TagAdapter<HotKey>(mHotKeys) { @Override public View getView(FlowLayout parent, int position, HotKey hotKey) { TextView tv = (TextView) LayoutInflater.from(SearchActivity.this).inflate(R.layout.flow_layout_tv, parent, false); String name = hotKey.getName(); tv.setText(name); tv.setBackgroundColor(CommonUtils.randomTagColor()); return tv; } }); //标签点击事件 searchHotFlowLayout.setOnTagClickListener((view, position, parent) -> { toSearchArticlesActivity(mHotKeys.get(position).getName()); return true; }); }
Example #3
Source File: TextExpandActivity3.java From YCExpandView with Apache License 2.0 | 6 votes |
private void initView() { expand = findViewById(R.id.expand); llTagBtn = findViewById(R.id.ll_tag_btn); ivExpand = findViewById(R.id.iv_expand); flowLayout = findViewById(R.id.flow_layout); flowLayout.setMaxSelectCount(3); flowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { final LayoutInflater mInflater = LayoutInflater.from(parent.getContext()); TextView tv = (TextView) mInflater.inflate(R.layout.tv, flowLayout, false); tv.setText(s); return tv; } }); }
Example #4
Source File: LimitSelectedFragment.java From FlowLayout with Apache License 2.0 | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final LayoutInflater mInflater = LayoutInflater.from(getActivity()); mFlowLayout = (TagFlowLayout) view.findViewById(R.id.id_flowlayout); mFlowLayout.setMaxSelectCount(3); mFlowLayout.setAdapter(new TagAdapter<String>(mVals) { @Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) mInflater.inflate(R.layout.tv, mFlowLayout, false); tv.setText(s); return tv; } }); }
Example #5
Source File: SearchActivity.java From Interessant with Apache License 2.0 | 6 votes |
private void bindData() { tagLayout.setAdapter(new TagAdapter<String>(tags) { @Override public View getView(FlowLayout parent, int position, String tagName) { TextView tag = (TextView) LayoutInflater.from(SearchActivity.this) .inflate(R.layout.item_tag, parent, false); tag.setText(tagName); return tag; } }); tagLayout.setOnTagClickListener((view, position, parent) -> { startResultActivity(tags.get(position)); return true; }); }
Example #6
Source File: KonwledgeHierAdapter.java From WanAndroid with MIT License | 5 votes |
public KnowledgeHierViewHodler(View view) { super(view); secondaryArticleDirectoryList = new ArrayList<>(); title = view.findViewById(R.id.title); tagFlowLayout = view.findViewById(R.id.flowLayout_tags); tagFlowLayout.setAdapter(new TagAdapter<SecondaryArticleDirectory>(secondaryArticleDirectoryList) { @Override public View getView(FlowLayout parent, int position, SecondaryArticleDirectory o) { TextView tv = (TextView) LayoutInflater.from(view.getContext()).inflate(R.layout.item_flow_tags, tagFlowLayout, false); tv.setText(o.getName()); return tv; } }); }
Example #7
Source File: MyTagAdapter.java From LQRBiliBlili with MIT License | 5 votes |
@Override public View getView(FlowLayout parent, int position, Summary.DataBean.TagBean tagBean) { TextView tv = new TextView(parent.getContext()); int paddingTopAndBottom = 10; int paddingLeftAndRight = 25; tv.setPadding(paddingLeftAndRight, paddingTopAndBottom, paddingLeftAndRight, paddingTopAndBottom); tv.setText(tagBean.getTag_name()); tv.setTextSize(12); tv.setTextColor(ArmsUtils.getColor(parent.getContext(), R.color.text_title)); tv.setBackgroundResource(R.drawable.shape_tv_tag_video_detail); AutoUtils.auto(tv); return tv; }
Example #8
Source File: TingSearchActivity.java From AssistantBySDK with Apache License 2.0 | 5 votes |
@Override public boolean onTagClick(View view, int position, FlowLayout parent) { String keyword = ((TextView) view).getText().toString(); mTingSearchBox.setText(keyword); pageNum = 1; mSearchPresenter.goSearch(keyword, pageNum); return true; }
Example #9
Source File: FlowTagsAdapter.java From WanAndroid with Apache License 2.0 | 5 votes |
@Override public View getView(FlowLayout parent, int position, HotKey s) { if(s == null) return null; TextView textView = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.tv_flowlayout, mTagFlowLayout, false); textView.setText(s.getName()); return textView; }
Example #10
Source File: NavigationAdapter.java From Awesome-WanAndroid with Apache License 2.0 | 5 votes |
private void startNavigationPager(View view, int position1, FlowLayout parent2, List<FeedArticleData> mArticles) { ActivityOptions options = ActivityOptions.makeScaleUpAnimation(view, view.getWidth() / 2, view.getHeight() / 2, 0 , 0); JudgeUtils.startArticleDetailActivity(parent2.getContext(), options, mArticles.get(position1).getId(), mArticles.get(position1).getTitle(), mArticles.get(position1).getLink(), mArticles.get(position1).isCollect(), false, false); }
Example #11
Source File: NavigationAdapter.java From Awesome-WanAndroid with Apache License 2.0 | 5 votes |
@Override protected void convert(NavigationViewHolder helper, NavigationListData item) { if (!TextUtils.isEmpty(item.getName())) { helper.setText(R.id.item_navigation_tv, item.getName()); } TagFlowLayout mTagFlowLayout = helper.getView(R.id.item_navigation_flow_layout); List<FeedArticleData> mArticles = item.getArticles(); mTagFlowLayout.setAdapter(new TagAdapter<FeedArticleData>(mArticles) { @Override public View getView(FlowLayout parent, int position, FeedArticleData feedArticleData) { TextView tv = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.flow_layout_tv, mTagFlowLayout, false); if (feedArticleData == null) { return null; } String name = feedArticleData.getTitle(); tv.setPadding(CommonUtils.dp2px(10), CommonUtils.dp2px(10), CommonUtils.dp2px(10), CommonUtils.dp2px(10)); tv.setText(name); tv.setTextColor(CommonUtils.randomColor()); mTagFlowLayout.setOnTagClickListener((view, position1, parent1) -> { startNavigationPager(view, position1, parent, mArticles); return true; }); return tv; } }); }
Example #12
Source File: BangumiDetailsActivity.java From HeroVideo-master with Apache License 2.0 | 4 votes |
@SuppressLint("SetTextI18n") @Override public void finishTask() { //设置番剧封面 Glide.with(this) .load(result.getCover()) .centerCrop() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.bili_default_image_tv) .dontAnimate() .into(mBangumiPic); //设置背景高斯模糊图片 Glide.with(this) .load(result.getCover()) .bitmapTransform(new BlurTransformation(this)) .into(mBangumiBackgroundImage); //设置番剧标题 mBangumiTitle.setText(result.getTitle()); //设置番剧更新状态 if (result.getIs_finish().equals("0")) { mUpdateIndex.setText("更新至第" + result.getNewest_ep_index() + "话"); mBangumiUpdate.setText("连载中"); } else { mUpdateIndex.setText(result.getNewest_ep_index() + "话全"); mBangumiUpdate.setText("已完结" + result.getNewest_ep_index() + "话全"); } //设置番剧播放和追番数量 mBangumiPlay.setText("播放:" + NumberUtil.converString(Integer.valueOf(result.getPlay_count())) + " " + "追番:" + NumberUtil.converString(Integer.valueOf(result.getFavorites()))); //设置番剧简介 mBangumiIntroduction.setText(result.getEvaluate()); //设置评论数量 mBangumiCommentCount.setText("评论 第1话(" + mPageInfo.getAcount() + ")"); //设置标签布局 List<BangumiDetailsInfo.ResultBean.TagsBean> tags = result.getTags(); mTagsLayout.setAdapter(new TagAdapter<BangumiDetailsInfo.ResultBean.TagsBean>(tags) { @Override public View getView(FlowLayout parent, int position, BangumiDetailsInfo.ResultBean.TagsBean tagsBean) { TextView mTags = (TextView) LayoutInflater.from(BangumiDetailsActivity.this) .inflate(R.layout.layout_tags_item, parent, false); mTags.setText(tagsBean.getTag_name()); return mTags; } }); //设置番剧分季版本 initSeasonsRecycler(); //设置番剧选集 initSelectionRecycler(); //设置番剧推荐 initRecommendRecycler(); //设置番剧评论 initCommentRecycler(); //加载完毕隐藏进度条 hideProgressBar(); }
Example #13
Source File: TingSearchActivity.java From AssistantBySDK with Apache License 2.0 | 4 votes |
@Override public View getView(FlowLayout parent, int position, String s) { TextView tvTag = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_search_tag, parent, false); tvTag.setText(s); return tvTag; }
Example #14
Source File: TypeActivity.java From POCenter with MIT License | 4 votes |
@Override public View getView(FlowLayout parent, int position, String s) { TextView tv = (TextView) LayoutInflater.from(parent.getContext()).inflate(R.layout.view_type, parent, false); tv.setText(s); return tv; }
Example #15
Source File: BangumiDetailsActivity.java From HeroVideo-master with Apache License 2.0 | 4 votes |
@SuppressLint("SetTextI18n") @Override public void finishTask() { //设置番剧封面 Glide.with(this) .load(result.getCover()) .centerCrop() .diskCacheStrategy(DiskCacheStrategy.ALL) .placeholder(R.drawable.bili_default_image_tv) .dontAnimate() .into(mBangumiPic); //设置背景高斯模糊图片 Glide.with(this) .load(result.getCover()) .bitmapTransform(new BlurTransformation(this)) .into(mBangumiBackgroundImage); //设置番剧标题 mBangumiTitle.setText(result.getTitle()); //设置番剧更新状态 if (result.getIs_finish().equals("0")) { mUpdateIndex.setText("更新至第" + result.getNewest_ep_index() + "话"); mBangumiUpdate.setText("连载中"); } else { mUpdateIndex.setText(result.getNewest_ep_index() + "话全"); mBangumiUpdate.setText("已完结" + result.getNewest_ep_index() + "话全"); } //设置番剧播放和追番数量 mBangumiPlay.setText("播放:" + NumberUtil.converString(Integer.valueOf(result.getPlay_count())) + " " + "追番:" + NumberUtil.converString(Integer.valueOf(result.getFavorites()))); //设置番剧简介 mBangumiIntroduction.setText(result.getEvaluate()); //设置评论数量 mBangumiCommentCount.setText("评论 第1话(" + mPageInfo.getAcount() + ")"); //设置标签布局 List<BangumiDetailsInfo.ResultBean.TagsBean> tags = result.getTags(); mTagsLayout.setAdapter(new TagAdapter<BangumiDetailsInfo.ResultBean.TagsBean>(tags) { @Override public View getView(FlowLayout parent, int position, BangumiDetailsInfo.ResultBean.TagsBean tagsBean) { TextView mTags = (TextView) LayoutInflater.from(BangumiDetailsActivity.this) .inflate(R.layout.layout_tags_item, parent, false); mTags.setText(tagsBean.getTag_name()); return mTags; } }); //设置番剧分季版本 initSeasonsRecycler(); //设置番剧选集 initSelectionRecycler(); //设置番剧推荐 initRecommendRecycler(); //设置番剧评论 initCommentRecycler(); //加载完毕隐藏进度条 hideProgressBar(); }
Example #16
Source File: TopicDetailFragment.java From JReadHub with GNU General Public License v3.0 | 4 votes |
@Override public void bindData(TopicDetailBean topicBean, boolean isPullToRefresh) { this.mTopicBean = topicBean; mTxtTopicTitle.setText(mTopicBean.getTitle().trim()); if (null != mTopicBean.getFormattedPublishDate()) { mTxtTopicTime.setText(mTopicBean.getFormattedPublishDate().toLocalDate().toString() + " " + mTopicBean.getFormattedPublishDate().toLocalTime().toString().substring(0, 8)); } else { mTxtTopicTime.setVisibility(View.GONE); } if (TextUtils.isEmpty(mTopicBean.getSummary().trim())) { mTxtTopicDescription.setVisibility(View.GONE); } else { mTxtTopicDescription.setText(mTopicBean.getSummary().trim()); mTxtTopicDescription.setVisibility(View.VISIBLE); } mTitleContainer.removeAllViews(); if (mTopicBean.getNewsArray() == null || mTopicBean.getNewsArray().isEmpty()) { mTitleContainer.setVisibility(View.GONE); } else { mTitleContainer.setVisibility(View.VISIBLE); for (final TopicNewsBean topic : mTopicBean.getNewsArray()) { TextView textView = new TextView(getContext()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); textView.setLayoutParams(params); textView.setPadding(10, 16, 10, 16); textView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_topic_detail_ring, 0, 0, 0); textView.setCompoundDrawablePadding(15); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); /*textView.setTextColor(ContextCompat.getColor(getContext(), ResourceUtil.getResource(getActivity(), R.attr.readhubTextColorPrimary)));*/ textView.setTextColor(ContextCompat.getColor(getContext(), R.color.text_topic_detail_news_title)); //textView.setBackgroundResource(R.drawable.selector_btn_background); if (TextUtils.isEmpty(topic.getSiteName())) { textView.setText(topic.getTitle()); } else { SpannableString spannableTitle = SpannableString.valueOf(getContext().getString(R.string.title___site_name, topic.getTitle(), topic.getSiteName())); spannableTitle.setSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), R.color.text_topic_detail_news_author)), topic.getTitle().length(), topic.getTitle().length() + topic.getSiteName().length() + 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(spannableTitle); } textView.setOnClickListener(v -> { String url = null; if (!TextUtils.isEmpty(topic.getMobileUrl())) { url = topic.getMobileUrl(); } else { url = topic.getUrl(); } if (!TextUtils.isEmpty(url)) { RxBus.getInstance().post(new OpenWebSiteEvent(url, topic.getTitle())); } }); mTitleContainer.addView(textView); } } if (null != mTopicBean.getTimeline() && null != mTopicBean.getTimeline().getTopics() && 0 < mTopicBean.getTimeline().getTopics().size()) { mTimelineAdapter.addItems(mTopicBean.getTimeline().getTopics()); mTimelineContainer.setVisibility(View.VISIBLE); } else { mTimelineContainer.setVisibility(View.GONE); } if (!mTopicBean.getEntityEventTopics().isEmpty()) { mRelativeTopicContainer.setVisibility(View.VISIBLE); ArrayList<EntityEventTopicBean> entityEventTopics = mTopicBean.getEntityEventTopics(); mRelativeTopic.setAdapter(new TagAdapter<EntityEventTopicBean>(entityEventTopics) { @Override public View getView(FlowLayout parent, int position, EntityEventTopicBean entityEventTopicBean) { TextView item = (TextView) getLayoutInflater().inflate(R.layout.item_relevant_topic, mRelativeTopic, false); item.setText(entityEventTopicBean.getEntityName() + entityEventTopicBean.getEventTypeLabel()); return item; } }); mRelativeTopic.setOnTagClickListener((view, position, parent) -> { String topicId = String.valueOf(entityEventTopics.get(position).getEntityId()); long order = mTopicBean.getOrder(); RelevantTopicWindow window = new RelevantTopicWindow(getActivity(), topicId, order); window.showOnAnchor(view, RelativePopupWindow.VerticalPosition.ABOVE, RelativePopupWindow.HorizontalPosition.CENTER, true); setBackgroundAlpha(0.7f); window.setOnDismissListener(() -> { setBackgroundAlpha(1f); if (((TagView) view).isChecked()) { ((TagView) view).setChecked(false); } }); return true; }); } else { mRelativeTopicContainer.setVisibility(View.GONE); } }
Example #17
Source File: BatchExecutionActivity.java From SoloPi with Apache License 2.0 | 4 votes |
@Override public boolean onTagClick(View view, int position, FlowLayout parent) { currentCases.remove(position); updateExecutionTag(); return false; }
Example #18
Source File: ListViewTestFragment.java From FlowLayout with Apache License 2.0 | 4 votes |
@Override public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { initDatas(); mListView = (ListView) view.findViewById(R.id.id_listview); mListView.setAdapter(new CommonAdapter<List<String>>(getActivity(), R.layout.item_for_listview, mDatas) { Map<Integer, Set<Integer>> selectedMap = new HashMap<Integer, Set<Integer>>(); @Override public void convert(final ViewHolder viewHolder, List<String> strings) { TagFlowLayout tagFlowLayout = viewHolder.getView(R.id.id_tagflowlayout); TagAdapter<String> tagAdapter = new TagAdapter<String>(strings) { @Override public View getView(FlowLayout parent, int position, String o) { //can use viewholder TextView tv = (TextView) mInflater.inflate(R.layout.tv, parent, false); tv.setText(o); return tv; } }; tagFlowLayout.setAdapter(tagAdapter); //重置状态 tagAdapter.setSelectedList(selectedMap.get(viewHolder.getItemPosition())); tagFlowLayout.setOnSelectListener(new TagFlowLayout.OnSelectListener() { @Override public void onSelected(Set<Integer> selectPosSet) { selectedMap.put(viewHolder.getItemPosition(), selectPosSet); } }); } }); }