Skip to content

Commit

Permalink
Add CacheProvider in the example app
Browse files Browse the repository at this point in the history
  • Loading branch information
Mek101 committed Sep 15, 2022
1 parent 407c2db commit 129b4fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/src/main/java/com/kedia/opengraphpreview/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ import androidx.appcompat.app.AppCompatActivity
import com.kedia.ogparser.OpenGraphCallback
import com.kedia.ogparser.OpenGraphParser
import com.kedia.ogparser.OpenGraphResult
import com.kedia.ogparser.SharedPrefsCacheProvider
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(), OpenGraphCallback {

private val openGraphParser by lazy { OpenGraphParser(this, showNullOnEmpty = true) }
private val openGraphParser by lazy {
OpenGraphParser(
listener = this,
showNullOnEmpty = true,
cacheProvider = SharedPrefsCacheProvider(this)
)
}

private val LINKS_TO_TEST = mutableListOf(
"https://www.linkedin.com/posts/madhusmita-padhy_machinelearning-datascience-activity-6886390508722163712-yhQ0",
Expand Down Expand Up @@ -63,4 +70,4 @@ class MainActivity : AppCompatActivity(), OpenGraphCallback {
LINKS_TO_TEST.removeFirstOrNull()
}
}
}
}

0 comments on commit 129b4fd

Please sign in to comment.