Skip to content

sansets/CardListItem

Repository files navigation

CardListItem

Custom list item with CardView

alt text

alt text

alt text

alt text

alt text

Getting Started

Installing

Step 1. Add the JitPack repository in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.sandisetiawan444:CardListItem:1.0.1'
}

Include the CardListItem widget in your layout

<com.cardlistitem.cardlistitemlibrary.CardListItem
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    app:cardCornerRadius="10dp"
    app:cardUseCompatPadding="true"
    app:contentShortDescription="Short description"
    app:contentTitle="Title"
    app:headerTitle="Name"
    app:timestampt="1 hour ago" />

Views

There are several views you can access:

Method Description
headerToolbar android.support.v7.widget.Toolbar. Contains headerImageView and headerTitleTextView
headerImageView CircleImageView
headerTitleTextView TextView. headerToolbar will disappear if not set
contentImageView SquareImageView
contentTitleTextview This TextView will disappear if not set
contentShortDescriptionTextView This TextView will disappear if not set
contentTextLayout LinearLayout
timestamptTextView This TextView will disappear if not set

Methods & Attributes

Method & Attribute Description
headerImageSrc Get or set headerImageView image resource
headerTitle Get or set headerTitleTextView text value
contentImageSrc Get or set contentImageView resource
contentImageVisibility Set visibiliy of contentImageView. If set to gone, the image will disappear
contentTitle Get or set contentTitleTextview text value
contentShortDescription Get or set contentShortDescriptionTextView text value. Maximum of two lines of text
timestampt Get or set timestamptTextView text value

License

Copyright 2018 Sandi Setiawan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.