android.support.v7.widget.RecyclerView.ItemDecoration的实例源码

项目:Jockey    文件:QueueFragment.java   
private void setupRecyclerView() {
    Drawable shadow = ContextCompat.getDrawable(getContext(),R.drawable.list_drag_shadow);

    ItemDecoration background = new DragBackgroundDecoration(R.id.song_drag_root);
    ItemDecoration divider = new DragDividerDecoration(getContext(),true,R.id.instance_blank);
    ItemDecoration dragShadow = new DragDropDecoration((NinePatchDrawable) shadow);

    mRecyclerView.addItemDecoration(background);
    mRecyclerView.addItemDecoration(divider);
    mRecyclerView.addItemDecoration(dragShadow);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

    boolean portrait = getResources().getConfiguration().orientation != ORIENTATION_LANDSCAPE;
    boolean tablet = getResources().getConfiguration().smallestScreenWidthDp >= 600;
    if (portrait || !tablet) {
        // Add an inner shadow at the top of the list
        mRecyclerView.addItemDecoration(new InsetDecoration(
                ContextCompat.getDrawable(getContext(),R.drawable.inset_top_shadow),(int) getResources().getDimension(R.dimen.inset_top_shadow_height),Gravity.TOP));
    } else {
        // Add an inner shadow at the bottom of the list
        mRecyclerView.addItemDecoration(new InsetDecoration(
                ContextCompat.getDrawable(getContext(),R.drawable.inset_bottom_shadow),getResources().getDimensionPixelSize(R.dimen.inset_bottom_shadow_height),Gravity.BOTTOM));
    }
}
项目:Jockey    文件:PlaylistViewModel.java   
@Bindable
public ItemDecoration[] getItemDecorations() {
    NinePatchDrawable dragShadow = (NinePatchDrawable) ContextCompat.getDrawable(
            getContext(),R.drawable.list_drag_shadow);

    return new ItemDecoration[] {
            new DragBackgroundDecoration(R.id.song_drag_root),new DragDividerDecoration(R.id.song_drag_root,getContext(),R.id.empty_layout),new DragDropDecoration(dragShadow)
    };
}
项目:Jockey    文件:ArtistViewModel.java   
@Bindable
public ItemDecoration[] getItemDecorations() {
    return new ItemDecoration[] {
            new BackgroundDecoration(R.id.loading_frame,R.id.artist_bio_card,R.id.relatedCard),new DividerDecoration(getContext(),R.id.album_view,R.id.subheader_frame,R.id.relatedCard,new GridSpacingDecoration(
                    (int) getResources().getDimension(R.dimen.grid_margin),mAlbumColumnCount,mAlbumSection.getTypeId()),new GridSpacingDecoration(
                    (int) getResources().getDimension(R.dimen.card_margin),mRelatedColumnCount,mRelatedArtistSection.getTypeId())
    };
}
项目:Jockey    文件:GenreViewModel.java   
@Bindable
public ItemDecoration[] getItemDecorations() {
    return new ItemDecoration[] {
            new BackgroundDecoration(),R.id.empty_layout)
    };
}
项目:Jockey    文件:RecyclerViewBindingAdapters.java   
@BindingAdapter("itemDecorations")
public static void setItemDecorations(RecyclerView recyclerView,ItemDecoration... decor) {
    for (ItemDecoration decoration : decor) {
        recyclerView.addItemDecoration(decoration);
    }
}
项目:FloodInfo    文件:BaseListActivity.java   
/**
 * Implement this with the ItemDecoration of your choice.
 *
 * if you don't want decoration,@return null
 * else @return ItemDecoration
 */
protected abstract ItemDecoration getItemDecoration();
项目:FloodInfo    文件:NewsActivity.java   
/**
 * Implement this with the ItemDecoration of your choice.
 *
 * if you don't want decoration,@return null
 * else @return ItemDecoration
 */
@Override protected ItemDecoration getItemDecoration() {
  return new DividerDecoration(this,DividerDecoration.VERTICAL_LIST);
}
项目:FloodInfo    文件:ContactsActivity.java   
/**
 * Implement this with the ItemDecoration of your choice.
 *
 * if you don't want decoration,DividerDecoration.VERTICAL_LIST);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


com.google.gson.internal.bind.ArrayTypeAdapter的实例源码
com.google.gson.JsonSyntaxException的实例源码
com.google.gson.JsonDeserializer的实例源码
com.google.gson.internal.ConstructorConstructor的实例源码
com.google.gson.JsonPrimitive的实例源码
com.google.gson.LongSerializationPolicy的实例源码
com.google.gson.internal.GsonInternalAccess的实例源码
com.google.gson.JsonIOException的实例源码
com.google.gson.internal.StringMap的实例源码
com.google.gson.JsonObject的实例源码
com.google.gson.internal.bind.TimeTypeAdapter的实例源码
com.google.gson.FieldAttributes的实例源码
com.google.gson.internal.bind.TreeTypeAdapter的实例源码
com.google.gson.internal.LinkedHashTreeMap的实例源码
com.google.gson.TypeAdapterFactory的实例源码
com.google.gson.JsonSerializer的实例源码
com.google.gson.FieldNamingPolicy的实例源码
com.google.gson.JsonElement的实例源码
com.google.gson.internal.JsonReaderInternalAccess的实例源码
com.google.gson.TypeAdapter的实例源码