Skip to content

The t-rex runner game in Android Library (Google Chrome dino)

Notifications You must be signed in to change notification settings

LionZXY/T-Rex-Android

Repository files navigation

T-Rex Game for Android (Google Chrome dino)

This is port t-rex game for Android. Open in WebView.

Get started

  1. Add jitpack in your root build.gradle
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
  1. 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
  1. Add View or Activity in project

Activity

Just open activity:

TRexPlayActivity.open(this)

Or for offline view:

TRexOfflineActivity.open(this)

View

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")