Java Code Examples for com.hippo.easyrecyclerview.LinearDividerItemDecoration
The following examples show how to use
com.hippo.easyrecyclerview.LinearDividerItemDecoration.
These examples are extracted from open source projects.
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 Project: MHViewer Author: axlecho File: GalleryInfoScene.java License: Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Nullable @Override public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.scene_gallery_info, container, false); Context context = getContext2(); AssertUtils.assertNotNull(context); mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view); InfoAdapter adapter = new InfoAdapter(); mRecyclerView.setAdapter(adapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setPadding(context.getResources().getDimensionPixelOffset(R.dimen.keyline_margin)); mRecyclerView.addItemDecoration(decoration); mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); mRecyclerView.setClipToPadding(false); mRecyclerView.setHasFixedSize(true); mRecyclerView.setOnItemClickListener(this); return view; }
Example #2
Source Project: EhViewer Author: seven332 File: GalleryInfoScene.java License: Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Nullable @Override public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.scene_gallery_info, container, false); Context context = getContext2(); AssertUtils.assertNotNull(context); mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view); InfoAdapter adapter = new InfoAdapter(); mRecyclerView.setAdapter(adapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setPadding(context.getResources().getDimensionPixelOffset(R.dimen.keyline_margin)); mRecyclerView.addItemDecoration(decoration); mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); mRecyclerView.setClipToPadding(false); mRecyclerView.setHasFixedSize(true); mRecyclerView.setOnItemClickListener(this); return view; }
Example #3
Source Project: MHViewer Author: axlecho File: HostsActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); hosts = EhApplication.getHosts(this); data = hosts.getAll(); setContentView(R.layout.activity_hosts); setNavigationIcon(R.drawable.v_arrow_left_dark_x24); recyclerView = findViewById(R.id.recycler_view); tip = findViewById(R.id.tip); FloatingActionButton fab = findViewById(R.id.fab); adapter = new HostsAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(this, R.attr.dividerColor), LayoutUtils.dp2pix(this, 1)); decoration.setShowLastDivider(true); recyclerView.addItemDecoration(decoration); recyclerView.setSelector(Ripple.generateRippleDrawable(this, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); recyclerView.setHasFixedSize(true); recyclerView.setOnItemClickListener(this); recyclerView.setPadding( recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), recyclerView.getPaddingBottom() + getResources().getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab)); fab.setOnClickListener(this); recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE); tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE); }
Example #4
Source Project: MHViewer Author: axlecho File: PluginsActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); data = MHPluginManager.Companion.getINSTANCE().plugins(); setContentView(R.layout.activity_plugins); setNavigationIcon(R.drawable.v_arrow_left_dark_x24); recyclerView = findViewById(R.id.recycler_view); tip = findViewById(R.id.tip); FloatingActionButton fab = findViewById(R.id.fab); adapter = new PluginsAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(this, R.attr.dividerColor), LayoutUtils.dp2pix(this, 1)); decoration.setShowLastDivider(true); recyclerView.addItemDecoration(decoration); recyclerView.setSelector(Ripple.generateRippleDrawable(this, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); recyclerView.setHasFixedSize(true); recyclerView.setOnItemClickListener(this); recyclerView.setPadding( recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), recyclerView.getPaddingBottom() + getResources().getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab)); fab.setOnClickListener(this); recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE); tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE); }
Example #5
Source Project: EhViewer Author: seven332 File: HostsActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); hosts = EhApplication.getHosts(this); data = hosts.getAll(); setContentView(R.layout.activity_hosts); setNavigationIcon(R.drawable.v_arrow_left_dark_x24); recyclerView = findViewById(R.id.recycler_view); tip = findViewById(R.id.tip); FloatingActionButton fab = findViewById(R.id.fab); adapter = new HostsAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(this, R.attr.dividerColor), LayoutUtils.dp2pix(this, 1)); decoration.setShowLastDivider(true); recyclerView.addItemDecoration(decoration); recyclerView.setSelector(Ripple.generateRippleDrawable(this, !AttrResources.getAttrBoolean(this, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); recyclerView.setHasFixedSize(true); recyclerView.setOnItemClickListener(this); recyclerView.setPadding( recyclerView.getPaddingLeft(), recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), recyclerView.getPaddingBottom() + getResources().getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab)); fab.setOnClickListener(this); recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE); tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE); }
Example #6
Source Project: MHViewer Author: axlecho File: GalleryCommentsScene.java License: Apache License 2.0 | 4 votes |
@Nullable @Override public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.scene_gallery_comments, container, false); mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view); TextView tip = (TextView) ViewUtils.$$(view, R.id.tip); mEditPanel = ViewUtils.$$(view, R.id.edit_panel); mSendImage = (ImageView) ViewUtils.$$(mEditPanel, R.id.send); mEditText = (EditText) ViewUtils.$$(mEditPanel, R.id.edit_text); mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout); mFab = (FloatingActionButton) ViewUtils.$$(view, R.id.fab); Context context = getContext2(); AssertUtils.assertNotNull(context); Resources resources = context.getResources(); int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab); Drawable drawable = DrawableManager.getVectorDrawable(context, R.drawable.big_sad_pandroid); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); tip.setCompoundDrawables(null, drawable, null, null); mAdapter = new CommentAdapter(); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setShowLastDivider(true); mRecyclerView.addItemDecoration(decoration); mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); mRecyclerView.setHasFixedSize(true); mRecyclerView.setOnItemClickListener(this); mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop(), mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom() + paddingBottomFab); // Cancel change animator RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator(); if (itemAnimator instanceof DefaultItemAnimator) { ((DefaultItemAnimator) itemAnimator).setSupportsChangeAnimations(false); } mSendImage.setOnClickListener(this); mFab.setOnClickListener(this); addAboveSnackView(mEditPanel); addAboveSnackView(mFabLayout); mViewTransition = new ViewTransition(mRecyclerView, tip); updateView(false); return view; }
Example #7
Source Project: MHViewer Author: axlecho File: GalleryCommentsScene.java License: Apache License 2.0 | 4 votes |
@SuppressLint("InflateParams") public void showVoteStatusDialog(Context context, String voteStatus) { String[] temp = StringUtils.split(voteStatus, ','); final int length = temp.length; final String[] userArray = new String[length]; final String[] voteArray = new String[length]; for (int i = 0; i < length; i++) { String str = StringUtils.trim(temp[i]); int index = str.lastIndexOf(' '); if (index < 0) { Log.d(TAG, "Something wrong happened about vote state"); userArray[i] = str; voteArray[i] = ""; } else { userArray[i] = StringUtils.trim(str.substring(0, index)); voteArray[i] = StringUtils.trim(str.substring(index + 1)); } } AlertDialog.Builder builder = new AlertDialog.Builder(context); context = builder.getContext(); final LayoutInflater inflater = LayoutInflater.from(context); EasyRecyclerView rv = (EasyRecyclerView) inflater.inflate(R.layout.dialog_recycler_view, null); rv.setAdapter(new RecyclerView.Adapter<InfoHolder>() { @Override public InfoHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new InfoHolder(inflater.inflate(R.layout.item_drawer_favorites, parent, false)); } @Override public void onBindViewHolder(InfoHolder holder, int position) { holder.key.setText(userArray[position]); holder.value.setText(voteArray[position]); } @Override public int getItemCount() { return length; } }); rv.setLayoutManager(new LinearLayoutManager(context)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setPadding(ResourcesUtils.getAttrDimensionPixelOffset(context, R.attr.dialogPreferredPadding)); rv.addItemDecoration(decoration); rv.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); rv.setClipToPadding(false); builder.setView(rv).show(); }
Example #8
Source Project: EhViewer Author: seven332 File: GalleryCommentsScene.java License: Apache License 2.0 | 4 votes |
@Nullable @Override public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.scene_gallery_comments, container, false); mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view); TextView tip = (TextView) ViewUtils.$$(view, R.id.tip); mEditPanel = ViewUtils.$$(view, R.id.edit_panel); mSendImage = (ImageView) ViewUtils.$$(mEditPanel, R.id.send); mEditText = (EditText) ViewUtils.$$(mEditPanel, R.id.edit_text); mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout); mFab = (FloatingActionButton) ViewUtils.$$(view, R.id.fab); Context context = getContext2(); AssertUtils.assertNotNull(context); Resources resources = context.getResources(); int paddingBottomFab = resources.getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab); Drawable drawable = DrawableManager.getVectorDrawable(context, R.drawable.big_sad_pandroid); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); tip.setCompoundDrawables(null, drawable, null, null); mSendDrawable = DrawableManager.getVectorDrawable(context, R.drawable.v_send_dark_x24); mPencilDrawable = DrawableManager.getVectorDrawable(context, R.drawable.v_pencil_dark_x24); mAdapter = new CommentAdapter(); mRecyclerView.setAdapter(mAdapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setShowLastDivider(true); mRecyclerView.addItemDecoration(decoration); mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); mRecyclerView.setHasFixedSize(true); mRecyclerView.setOnItemClickListener(this); mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop(), mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom() + paddingBottomFab); // Cancel change animator RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator(); if (itemAnimator instanceof DefaultItemAnimator) { ((DefaultItemAnimator) itemAnimator).setSupportsChangeAnimations(false); } mSendImage.setOnClickListener(this); mFab.setOnClickListener(this); addAboveSnackView(mEditPanel); addAboveSnackView(mFabLayout); mViewTransition = new ViewTransition(mRecyclerView, tip); updateView(false); return view; }
Example #9
Source Project: EhViewer Author: seven332 File: GalleryCommentsScene.java License: Apache License 2.0 | 4 votes |
@SuppressLint("InflateParams") public void showVoteStatusDialog(Context context, String voteStatus) { String[] temp = StringUtils.split(voteStatus, ','); final int length = temp.length; final String[] userArray = new String[length]; final String[] voteArray = new String[length]; for (int i = 0; i < length; i++) { String str = StringUtils.trim(temp[i]); int index = str.lastIndexOf(' '); if (index < 0) { Log.d(TAG, "Something wrong happened about vote state"); userArray[i] = str; voteArray[i] = ""; } else { userArray[i] = StringUtils.trim(str.substring(0, index)); voteArray[i] = StringUtils.trim(str.substring(index + 1)); } } AlertDialog.Builder builder = new AlertDialog.Builder(context); context = builder.getContext(); final LayoutInflater inflater = LayoutInflater.from(context); EasyRecyclerView rv = (EasyRecyclerView) inflater.inflate(R.layout.dialog_recycler_view, null); rv.setAdapter(new RecyclerView.Adapter<InfoHolder>() { @Override public InfoHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new InfoHolder(inflater.inflate(R.layout.item_drawer_favorites, parent, false)); } @Override public void onBindViewHolder(InfoHolder holder, int position) { holder.key.setText(userArray[position]); holder.value.setText(voteArray[position]); } @Override public int getItemCount() { return length; } }); rv.setLayoutManager(new LinearLayoutManager(context)); LinearDividerItemDecoration decoration = new LinearDividerItemDecoration( LinearDividerItemDecoration.VERTICAL, AttrResources.getAttrColor(context, R.attr.dividerColor), LayoutUtils.dp2pix(context, 1)); decoration.setPadding(ResourcesUtils.getAttrDimensionPixelOffset(context, R.attr.dialogPreferredPadding)); rv.addItemDecoration(decoration); rv.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT))); rv.setClipToPadding(false); builder.setView(rv).show(); }