Flutter Engine
The Flutter Engine
DemoActivity.java
Go to the documentation of this file.
1package org.skia.skottie;
2
3import android.app.Activity;
4import android.os.Bundle;
5import android.view.View;
6import android.view.View.OnClickListener;
7import android.widget.Button;
8import android.widget.LinearLayout;
9import java.util.ArrayList;
10import java.util.List;
11
12public class DemoActivity extends Activity implements OnClickListener {
13 private List<SkottieView> skotties = new ArrayList<>();
14 private boolean playing = true;
15
16 @Override
17 protected void onCreate(Bundle savedInstanceState) {
18 super.onCreate(savedInstanceState);
19 setContentView(R.layout.demo_layout);
20
21 LinearLayout skottieContainer = findViewById(R.id.skottie_container);
22 for (int i = 0; i < skottieContainer.getChildCount(); i++) {
23 SkottieView s = (SkottieView)skottieContainer.getChildAt(i);
24 skotties.add(s);
25 s.play();
26 }
27
28 Button play = findViewById(R.id.play);
29 play.setOnClickListener(this);
30 Button reset = findViewById(R.id.reset);
31 reset.setOnClickListener(this);
32 }
33
34 @Override
35 public void onClick(View view) {
36 switch(view.getId()) {
37 case R.id.play:
38 for (SkottieView s : skotties) {
39 if (playing) {
40 s.pause();
41 } else {
42 s.play();
43 }
44 }
45 playing = !playing;
46 break;
47 case R.id.reset:
48 for (SkottieView s : skotties) {
49 s.seek(0f);
50 }
51 break;
52 }
53 }
54}
m reset()
void onCreate(Bundle savedInstanceState)
struct MyStruct s
#define R(r)