質問編集履歴
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,10 +8,8 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
application.classで取得したデータ[id](例えば[1])を、MainActicity内のstartColorAnimationへ送り、そのデータを元にstartColorAnimationのパターンを出し分けをしたいとかんがえております。
|
12
11
|
|
13
12
|
|
14
|
-
|
15
|
-
その場合、Animationは、シングルスレッドでしか操作できない為、マルチスレッドの場合、ハンドラーが必要と分かったのですが、ハンドラーを利用した
|
13
|
+
その場合、Animationは、シングルスレッドでしか操作できない為、マルチスレッドの場合、ハンドラーが必要と分かったのですが、ハンドラーを利用したAnimationのコントロール方法がわかりません。
|
16
14
|
|
17
15
|
どのように、handlerは記載すべきものなのでしょうか?
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,43 +15,3 @@
|
|
15
15
|
その場合、Animationは、シングルスレッドでしか操作できない為、マルチスレッドの場合、ハンドラーが必要と分かったのですが、ハンドラーを利用したstartColorAnimationのコントロール方法がわかりません。
|
16
16
|
|
17
17
|
どのように、handlerは記載すべきものなのでしょうか?
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
```lang-<ここに言語を入力>
|
22
|
-
|
23
|
-
public void startColorAnimation(int id){
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
if (id == mode) return;
|
28
|
-
|
29
|
-
if(COLOR_START.length <= id || COLOR_END.length <= id ) return;
|
30
|
-
|
31
|
-
Log.d("LOGTEST","ColorAnimation");
|
32
|
-
|
33
|
-
mode = id;
|
34
|
-
|
35
|
-
int colorStart = COLOR_START[id];
|
36
|
-
|
37
|
-
int colorEnd = COLOR_END[id];
|
38
|
-
|
39
|
-
int setDuration = PATTERN[id];
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
ValueAnimator colorAnim = ObjectAnimator.ofInt(image, "backgroundColor", colorStart, colorEnd);
|
44
|
-
|
45
|
-
colorAnim.setDuration(1000);
|
46
|
-
|
47
|
-
colorAnim.setEvaluator(new ArgbEvaluator());
|
48
|
-
|
49
|
-
colorAnim.setRepeatCount(1);
|
50
|
-
|
51
|
-
colorAnim.start();
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
57
|
-
```
|