rifki_cs29

FavouritesItem

Jul 6th, 2020
832
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.rifki.kotlin.mygithubfinal.helper
  2.  
  3. import android.database.Cursor
  4. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.FavouriteColumns.Companion.AVATAR
  5. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.FavouriteColumns.Companion.DATE
  6. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.FavouriteColumns.Companion.URL
  7. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.FavouriteColumns.Companion.USERNAME
  8. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.FavouriteColumns.Companion._ID
  9. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.getColumnInt
  10. import com.rifki.kotlin.mygithubfinal.db.DatabaseContract.getColumnString
  11.  
  12. class FavouritesItem (cursor: Cursor?) {
  13.     var id : Int? = 0
  14.     var username: String? = null
  15.     var avatar: String? = null
  16.     var url: String? = null
  17.     var date: String? = null
  18.  
  19.     init {
  20.         id = getColumnInt(cursor, _ID)
  21.         username = getColumnString(cursor, USERNAME)
  22.         avatar = getColumnString(cursor, AVATAR)
  23.         url = getColumnString(cursor, URL)
  24.         date = getColumnString(cursor, DATE)
  25.     }
  26.  
  27.     override fun toString(): String {
  28.         return """FavouritesItem{id = '$id',username = '$username',avatar = '$avatar',url = '$url'}"""
  29.     }
  30. }
RAW Paste Data