ShelfView

Additional

Language
Java
Version
N/A
Created
Feb 16, 2017
Updated
Sep 24, 2017
Owner
Adeyinka Adediji (tdscientist)
Contributor
Adeyinka Adediji (tdscientist)
1
Activity
Badge
Generate
Download
Source code
APK file

Promotion

ShelfView

Android custom view to display books on shelf (iOS version is available here)

How to use

build.gradleallprojects { repositories { maven { url 'https://jitpack.io' } } } dependencies { compile 'com.github.tdscientist:ShelfView:v1.0' }

Layout<com.tdscientist.shelfview.ShelfView android:id="@+id/shelfView" android:layout_width="match_parent" android:layout_height="match_parent" /> 

Activityimport com.tdscientist.shelfview.BookModel; import com.tdscientist.shelfview.ShelfView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity implements ShelfView.BookClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ShelfView shelfView = (ShelfView) findViewById(R.id.shelfView); shelfView.setOnBookClicked(this); ArrayList<BookModel> models = new ArrayList<>(); models.add(new BookModel("http://eurodroid.com/pics/beginning_android_book.jpg", "1", "Beginning Android")); shelfView.loadData(models, ShelfView.BOOK_SOURCE_URL); } @Override public void onBookClicked(int position, String bookId, String bookTitle) { // handle click events here //Toast.makeText(this, bookTitle, Toast.LENGTH_SHORT).show(); } }