This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<ViewGroup … | |
android:background="?attr/colorSurface"> |
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<!-- AndroidManifest.xml --> | |
<application … | |
android:theme="@style/Theme.Plaid"> | |
<activity … | |
android:theme="@style/Theme.Plaid.About"/> | |
<!-- layout/foo.xml --> |
This file contains 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
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
val lightPalette = object : ColorPalette { … } | |
val darkPalette = object : ColorPalette { … } | |
val view = MyView(if (isDarkTheme) darkPalette else lightPalette) |
This file contains 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
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
interface ColorPalette { | |
@ColorInt val colorPrimary | |
@ColorInt val colorSecondary | |
} | |
class MyView(colors: ColorPalette) { | |
fab.backgroundTint = colors.colorPrimary | |
} |
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<style name="Theme.Plaid" parent="…"> | |
<item name="colorPrimary">@color/teal_500</item> | |
<item name="colorSecondary">@color/pink_200</item> | |
<item name="android:windowBackground">@color/white</item> | |
</style> |
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<Button … | |
style="@style/Widget.Plaid.Button.InlineAction"/> |
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<Button … | |
android:gravity="center_horizontal" | |
android:textAppearance="@style/TextAppearance.CommentAuthor" | |
android:drawablePadding="@dimen/spacing_micro"/> |
This file contains 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
<!-- Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 --> | |
<style name="Widget.Plaid.Button.InlineAction" parent="…"> | |
<item name="android:gravity">center_horizontal</item> | |
<item name="android:textAppearance">@style/TextAppearance.CommentAuthor</item> | |
<item name="android:drawablePadding">@dimen/spacing_micro</item> | |
</style> |
This file contains 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
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
fun animateVisibility(view: View, visible: Boolean) { | |
val targetAlpha = if (visible) 1f else 0f | |
if (view.alpha == targetAlpha) return | |
view.visibility = View.VISIBLE | |
val spring = view.spring(SpringAnimation.ALPHA) | |
(view.getTag(R.id.tag_pending_end_listener) as? | |
DynamicAnimation.OnAnimationEndListener)?.let { |
This file contains 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
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
- val anim = view.animate().alpha(targetAlpha) | |
+ val spring = view.spring(SpringAnimation.ALPHA) | |
+ spring.animateToFinalPosition(targetAlpha) |