This is port t-rex game for Android. Open in WebView.
- Add jitpack in your root build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add dependency. Library have three types:
dependencies {
implementation 'com.github.LionZXY.T-Rex-Android:trex-library:1.0.0' // For only trex view
// With progress bar: implementation 'com.github.LionZXY.T-Rex-Android:trex-progress:1.0.0'
// Full offline: implementation 'com.github.LionZXY.T-Rex-Android:trex-offline:1.0.0'
}
TRexGameView |
TRexProgressView |
TRexOfflineView |
Simple | With progress bar | Offline view +47kb |
- Add View or Activity in project
Just open activity:
TRexPlayActivity.open(this)
Or for offline view:
TRexOfflineActivity.open(this)
Use view inside xml:
<com.lionzxy.trex_progress.TRexProgressView
android:id="@+id/trex"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Or create programmable:
val view = TRexProgressView(baseContext)
[Optional] Subscribe on progress:
trex.addProgressListener {
Toast.makeText(baseContext, "Progress: $it", Toast.LENGTH_LONG).show()
}
[Optional] Force refresh:
trex.refresh()
[Optional] Set up custom url:
trex.setUrl("https://github.com/LionZXY/t-rex-runner/archive/minify.zip")