This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onResourcesRequest(requestParams: ResourcesRequest): ListenableFuture<Resources> = | |
| Futures.immediateFuture( | |
| Resources.builder() | |
| .setVersion(RESOURCES_VERSION) | |
| .build() | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Layout.builder().setRoot( | |
| when (requestParams.state.lastClickableId) { | |
| DEFAULT_LAYOUT_ID -> tappableLayout("Tap to go back", ALTERNATE_LAYOUT_ID) | |
| else -> tappableLayout("Tap here to swap", DEFAULT_LAYOUT_ID) | |
| } | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun tappableLayout(text: String, id: String): LayoutElement = | |
| Text.builder() | |
| .setText(text) | |
| .setModifiers( | |
| Modifiers.builder() | |
| .setClickable( | |
| Clickable.builder() | |
| .setId(id) | |
| .setOnClick(LoadAction.builder()) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private const val DEFAULT_LAYOUT_ID = "default" | |
| private const val ALTERNATE_LAYOUT_ID = "alternate" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <service | |
| android:name=".MainTileService" | |
| android:label="@string/app_name" | |
| android:description="@string/app_name" | |
| android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER" | |
| android:exported="false"> | |
| <intent-filter> | |
| <action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" /> | |
| </intent-filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onTileRequest(requestParams: TileRequest): ListenableFuture<Tile> = | |
| Futures.immediateFuture( | |
| Tile.builder() | |
| .setResourcesVersion(RESOURCES_VERSION) | |
| .setTimeline( | |
| Timeline.builder().addTimelineEntry( | |
| TimelineEntry.builder().setLayout( | |
| Layout.builder().setRoot( | |
| Text.builder().setText("Test Tile") | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private lateinit var tileClient: TileClient | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| val rootLayout = findViewById<FrameLayout>(R.id.tile_container) | |
| tileClient = TileClient( | |
| context = this, | |
| component = ComponentName(this, MainTileService::class.java), | |
| parentView = rootLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/tile_container" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // required for Futures | |
| implementation "com.google.guava:guava:30.1.1-android" | |
| // Use to implement support for wear tiles | |
| implementation "androidx.wear.tiles:tiles:1.0.0-alpha05" | |
| // Use to preview wear tiles in your own app | |
| debugImplementation "androidx.wear.tiles:tiles-renderer:1.0.0-alpha05" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports.DOMAINS = (stage) => { | |
| return { | |
| dev: ["dev1.test.com", "dev2.test.com"], | |
| prod: ["prod1.test.com", "prod2.test.com"] | |
| }[stage] | |
| } |
NewerOlder