-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Diffs= 68d6cda32 feat: android nested text runs (#8126) Co-authored-by: Gordon <[email protected]>
- Loading branch information
1 parent
d8b5aad
commit baf7cb6
Showing
14 changed files
with
508 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c67b67083abe9d1448137122aeb76f20549ae89b | ||
68d6cda329f2252242dca46b92cb2bc552ee6bfa |
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
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
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
72 changes: 72 additions & 0 deletions
72
app/src/main/java/app/rive/runtime/example/NestedTextRunActivity.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package app.rive.runtime.example | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.View | ||
import android.widget.Button | ||
import android.widget.RadioButton | ||
import androidx.appcompat.app.AppCompatActivity | ||
import app.rive.runtime.kotlin.RiveAnimationView | ||
|
||
class NestedTextRunActivity : AppCompatActivity() { | ||
|
||
private val animationView by lazy(LazyThreadSafetyMode.NONE) { | ||
findViewById<RiveAnimationView>(R.id.nested_text_run) | ||
} | ||
|
||
fun onButtonClick(view: View) { | ||
if (view is Button) { | ||
when (view.id) { | ||
R.id.set_b1 -> { | ||
Log.d("nested-text-run", animationView.getTextRunValue("ArtboardBRun", "ArtboardB-1").toString()) | ||
animationView.setTextRunValue( | ||
textRunName = "ArtboardBRun", | ||
textValue = "ArtboardB-1 Updated", | ||
path = "ArtboardB-1" | ||
) | ||
Log.d("nested-text-run", animationView.getTextRunValue("ArtboardBRun", "ArtboardB-1").toString()) | ||
} | ||
R.id.set_b2 -> { | ||
animationView.setTextRunValue( | ||
"ArtboardBRun", | ||
"ArtboardB-2 Updated", | ||
"ArtboardB-2" | ||
) | ||
} | ||
R.id.set_b1_c1 -> { | ||
animationView.setTextRunValue( | ||
"ArtboardCRun", | ||
"ArtboardB-1/C-1 Updated", | ||
"ArtboardB-1/ArtboardC-1" | ||
) | ||
} | ||
R.id.set_b1_c2 -> { | ||
animationView.setTextRunValue( | ||
"ArtboardCRun", | ||
"ArtboardB-1/C-2 Updated", | ||
"ArtboardB-1/ArtboardC-2" | ||
) | ||
} | ||
R.id.set_b2_c1 -> { | ||
animationView.setTextRunValue( | ||
"ArtboardCRun", | ||
"ArtboardB-2/C-1 Updated", | ||
"ArtboardB-2/ArtboardC-1" | ||
) | ||
} | ||
R.id.set_b2_c2 -> { | ||
animationView.setTextRunValue( | ||
"ArtboardCRun", | ||
"ArtboardB-2/C-2 Updated", | ||
"ArtboardB-2/ArtboardC-2" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.nested_text_run) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
|
||
<LinearLayout | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
android:orientation="vertical" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<app.rive.runtime.kotlin.RiveAnimationView | ||
android:id="@+id/nested_text_run" | ||
android:layout_width="match_parent" | ||
android:layout_height="400dp" | ||
app:riveResource="@raw/runtime_nested_text_runs" | ||
app:riveArtboard="ArtboardA" | ||
app:riveStateMachine="State Machine 1" /> | ||
|
||
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
|
||
android:orientation="vertical"> | ||
|
||
<Button | ||
android:id="@+id/set_b1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B1" /> | ||
|
||
<Button | ||
android:id="@+id/set_b2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B2" /> | ||
|
||
<Button | ||
android:id="@+id/set_b1_c1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B1/C1" /> | ||
|
||
<Button | ||
android:id="@+id/set_b1_c2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B1/C2" /> | ||
|
||
<Button | ||
android:id="@+id/set_b2_c1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B2/C1" /> | ||
|
||
<Button | ||
android:id="@+id/set_b2_c2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:onClick="onButtonClick" | ||
android:textColor="@color/textColorPrimary" | ||
android:text="Set B2/C2" /> | ||
|
||
</RadioGroup> | ||
</LinearLayout> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
Binary file not shown.
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
Binary file not shown.
Oops, something went wrong.