質問編集履歴
4
画像の読み込み方法を変えた場合と、ImageViewでのテストを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,10 +24,6 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
![](http://i.giphy.com/3o6ZtpLFJfp6V4fdBK.gif)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
27
|
[エミュレータGIFリンク](http://i.giphy.com/3o6ZtpLFJfp6V4fdBK.gif)
|
32
28
|
|
33
29
|
|
@@ -36,10 +32,6 @@
|
|
36
32
|
|
37
33
|
|
38
34
|
|
39
|
-
![](http://i.giphy.com/l0HlVLzJrD4I2kQYE.gif)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
35
|
[実機GIFリンク](http://i.giphy.com/l0HlVLzJrD4I2kQYE.gif)
|
44
36
|
|
45
37
|
|
@@ -56,6 +48,224 @@
|
|
56
48
|
|
57
49
|
|
58
50
|
|
51
|
+
__字数制限のため[ImageViewでの画面遷移テスト]の項目と統合__
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
###該当のソースコード
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
[MainActivity.java](https://github.com/rild/android-activity-transition-test/blob/bug/animation/app/src/main/java/rimp/rild/com/android/android_activity_transition_test/MainActivity.java)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
どの部分を載せればばいいか判然としないので、githubにpushしたもののリンクを載せました。
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
元サイトでアニメーションを画面遷移につけるために紹介されていたのは以下のコードです。
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
```java
|
72
|
+
|
73
|
+
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
74
|
+
|
75
|
+
mActivity,
|
76
|
+
|
77
|
+
view.findViewById(R.id.row_image),
|
78
|
+
|
79
|
+
getString(R.string.trans_name) );
|
80
|
+
|
81
|
+
Article item = (Article) mImageAdapter.getItem(position);
|
82
|
+
|
83
|
+
Intent intent = new Intent(mActivity, ImageDetailActivity.class);
|
84
|
+
|
85
|
+
intent.putExtra(ImageDetailActivity.EXTRA_CONTENT, parser.toJson(item));
|
86
|
+
|
87
|
+
ActivityCompat.startActivity(mActivity, intent, options.toBundle());
|
88
|
+
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
###試したこと
|
94
|
+
|
95
|
+
まず、同様のトラブルが起きた例を探して、
|
96
|
+
|
97
|
+
[ActivityOptions.makeSceneTransitionAnimation doesn't seem to exist](http://stackoverflow.com/questions/24517620/activityoptions-makescenetransitionanimation-doesnt-seem-to-exist)
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
の記事を見つけ、
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
```
|
106
|
+
|
107
|
+
if (Build.VERSION.SDK_INT >= 21) {
|
108
|
+
|
109
|
+
///
|
110
|
+
|
111
|
+
getWindow().requestFeature(android.view.Window.FEATURE_CONTENT_TRANSITIONS);
|
112
|
+
|
113
|
+
Transition ts = new Slide(); //Slide(); //Explode();
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
ts.setDuration(1000);
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
getWindow().setEnterTransition(ts);
|
122
|
+
|
123
|
+
getWindow().setExitTransition(ts);
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
ChangeBounds bounds = new ChangeBounds();
|
128
|
+
|
129
|
+
bounds.setDuration(1000);
|
130
|
+
|
131
|
+
getWindow().setSharedElementEnterTransition(bounds);
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
のコードをAcitivityのonCreateに加えてみました。
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
画面スライドのアニメーションが入った時に、他のアニメーションをしている間拡大縮小アニメーションが(他のアニメーションが付いていたのではっきりしませんが...)ちゃんと起きている様だったので、「Durationの関係でうまくいっていないのではないか」と考えました
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
そこで、
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
[ActivityOptionsCompat.makeSceneTransitionAnimation with custom duration](http://stackoverflow.com/questions/35715144/activityoptionscompat-makescenetransitionanimation-with-custom-duration)
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
のサイトを参考にしてみましたが、根本的解決に至りませんでした。
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
#### 画像の読み込み方法を変更
|
160
|
+
|
161
|
+
GridViewに渡すAdapter内の処理を変更してみました。
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
```Java
|
166
|
+
|
167
|
+
imageView.setImageBitmap(...)
|
168
|
+
|
169
|
+
```
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
で画像を渡していたところを
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
```Java
|
178
|
+
|
179
|
+
Picasso.with(mContext).load(item.getResImageId()).centerCrop().resize(100, 100).into(imageView);
|
180
|
+
|
181
|
+
```
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
に変更してみましたが、画面遷移に影響はなさそうでした。
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
#### ImageViewでの画面遷移テスト
|
190
|
+
|
191
|
+
アドバイスをいただいたので、画像一枚でテストをしました。
|
192
|
+
|
193
|
+
GridViewの子としていたレイアウトファイル(layout/row_list.xml)を activity_main.xmlに
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```xml
|
198
|
+
|
199
|
+
<include layout="@layout/row_list"
|
200
|
+
|
201
|
+
android:layout_width="100dp"
|
202
|
+
|
203
|
+
android:layout_height="100dp"/>
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
のように設定しました。
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
エミュレータと実機でそれぞれ3回ずつ拡大縮小の画面遷移アニメーションをさせました。
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
GridViewの時と動作の様子やエラーログに大きな変化はなかったようでしたが、体感で実機でもうまく動作する場合が増えた気がしました。
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
##### ログと動作画面
|
220
|
+
|
221
|
+
すべてのエラーログは字数制限の都合で載せきれなかったのでGitHubレポジトリの[Wiki](https://github.com/rild/android-activity-transition-test/wiki/%E3%82%A8%E3%83%A9%E3%83%BC%E3%83%AD%E3%82%B0%E3%83%AA%E3%82%B9%E3%83%88)に
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
- エミュレータでのログ
|
226
|
+
|
227
|
+
- 実機でのログ
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
を転載しました。
|
232
|
+
|
233
|
+
###### エミュレータ
|
234
|
+
|
235
|
+
[エミュレータでの動作画面GIF](http://i.giphy.com/l3vR8aBtjfStxkobC.gif)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
```
|
240
|
+
|
241
|
+
E/Surface: getSlotFromBufferLocked: unknown buffer: 0xeb0b3240
|
242
|
+
|
243
|
+
```
|
244
|
+
|
245
|
+
エミュレータでのテストのみ、上のエラーメッセージが出ました。
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
###### 実機
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
[実機での動作画面GIF](http://i.giphy.com/3oz8xsWtMSYQBGQrC0.gif)
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
```
|
258
|
+
|
259
|
+
W/art: Suspending all threads took: 10.896ms
|
260
|
+
|
261
|
+
```
|
262
|
+
|
263
|
+
実機でのテストでは上の警告が出ました。
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
###### GridViewの場合との変化
|
268
|
+
|
59
269
|
```
|
60
270
|
|
61
271
|
E/ActivityThread: Performing stop of activity that is not resumed: {rimp.rild.com.android.android_activity_transition_test/rimp.rild.com.android.android_activity_transition_test.MainActivity}
|
@@ -86,156 +296,4 @@
|
|
86
296
|
|
87
297
|
```
|
88
298
|
|
89
|
-
|
90
|
-
|
91
|
-
が稀に出ました。こちらのエラーはGridViewに読み込む画像のサイズを大きくすると起きやすくなるみたいでした。
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
```
|
96
|
-
|
97
|
-
W/art: Suspending all threads took: 6.515ms
|
98
|
-
|
99
|
-
```
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
こちらの警告もたまに出ていました。
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
アニメーションがうまくいっている時も、行かない時も
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
```
|
112
|
-
|
113
|
-
09-02 06:11:47.843 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=true
|
114
|
-
|
115
|
-
09-02 06:11:48.356 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
116
|
-
|
117
|
-
09-02 06:11:48.400 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
118
|
-
|
119
|
-
09-02 06:11:48.840 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2785c3b6 time:216368574
|
120
|
-
|
121
|
-
09-02 06:15:26.074 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_launch_request id:rimp.rild.com.android.android_activity_transition_test time:216585808
|
122
|
-
|
123
|
-
09-02 06:15:26.517 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2e07c830 time:216586252
|
124
|
-
|
125
|
-
09-02 06:15:26.847 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=true
|
126
|
-
|
127
|
-
09-02 06:15:27.309 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
128
|
-
|
129
|
-
09-02 06:15:27.378 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
130
|
-
|
131
|
-
09-02 06:15:27.821 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2785c3b6 time:216587556
|
132
|
-
|
133
|
-
```
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
といったログが基本でした。
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
###該当のソースコード
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
[MainActivity.java](https://github.com/rild/android-activity-transition-test/blob/bug/animation/app/src/main/java/rimp/rild/com/android/android_activity_transition_test/MainActivity.java)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
どの部分を載せればばいいか判然としないので、githubにpushしたもののリンクを載せました。
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
元サイトでアニメーションを画面遷移につけるために紹介されていたのは以下のコードです。
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
```java
|
158
|
-
|
159
|
-
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
|
160
|
-
|
161
|
-
mActivity,
|
162
|
-
|
163
|
-
view.findViewById(R.id.row_image),
|
164
|
-
|
165
|
-
getString(R.string.trans_name) );
|
166
|
-
|
167
|
-
Article item = (Article) mImageAdapter.getItem(position);
|
168
|
-
|
169
|
-
Intent intent = new Intent(mActivity, ImageDetailActivity.class);
|
170
|
-
|
171
|
-
intent.putExtra(ImageDetailActivity.EXTRA_CONTENT, parser.toJson(item));
|
172
|
-
|
173
|
-
ActivityCompat.startActivity(mActivity, intent, options.toBundle());
|
174
|
-
|
175
|
-
```
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
###試したこと
|
180
|
-
|
181
|
-
まず、同様のトラブルが起きた例を探して、
|
182
|
-
|
183
|
-
[ActivityOptions.makeSceneTransitionAnimation doesn't seem to exist](http://stackoverflow.com/questions/24517620/activityoptions-makescenetransitionanimation-doesnt-seem-to-exist)
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
の記事を見つけ、
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
```
|
192
|
-
|
193
|
-
if (Build.VERSION.SDK_INT >= 21) {
|
194
|
-
|
195
|
-
///
|
196
|
-
|
197
|
-
getWindow().requestFeature(android.view.Window.FEATURE_CONTENT_TRANSITIONS);
|
198
|
-
|
199
|
-
Transition ts = new Slide(); //Slide(); //Explode();
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
ts.setDuration(1000);
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
getWindow().setEnterTransition(ts);
|
208
|
-
|
209
|
-
getWindow().setExitTransition(ts);
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
ChangeBounds bounds = new ChangeBounds();
|
214
|
-
|
215
|
-
bounds.setDuration(1000);
|
216
|
-
|
217
|
-
getWindow().setSharedElementEnterTransition(bounds);
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
```
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
のコードをAcitivityのonCreateに加えてみました。
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
画面スライドのアニメーションが入った時に、他のアニメーションをしている間拡大縮小アニメーションが(他のアニメーションが付いていたのではっきりしませんが...)ちゃんと起きている様だったので、「Durationの関係でうまくいっていないのではないか」と考えました
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
そこで、
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
[ActivityOptionsCompat.makeSceneTransitionAnimation with custom duration](http://stackoverflow.com/questions/35715144/activityoptionscompat-makescenetransitionanimation-with-custom-duration)
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
のサイトを参考にしてみましたが、根本的解決に至りませんでした。
|
299
|
+
GridViewに表示させる画像のサイズを大きくした時に出ていたエラーメッセージはImageViewの場合では確認できませんでした。
|
3
エラーログ追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,6 +52,92 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
+
#### エラーログ
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
E/ActivityThread: Performing stop of activity that is not resumed: {rimp.rild.com.android.android_activity_transition_test/rimp.rild.com.android.android_activity_transition_test.MainActivity}
|
62
|
+
|
63
|
+
java.lang.RuntimeException: Performing stop of activity that is not resumed: {rimp.rild.com.android.android_activity_transition_test/rimp.rild.com.android.android_activity_transition_test.MainActivity}
|
64
|
+
|
65
|
+
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3412)
|
66
|
+
|
67
|
+
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3493)
|
68
|
+
|
69
|
+
at android.app.ActivityThread.access$1100(ActivityThread.java:149)
|
70
|
+
|
71
|
+
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
|
72
|
+
|
73
|
+
at android.os.Handler.dispatchMessage(Handler.java:102)
|
74
|
+
|
75
|
+
at android.os.Looper.loop(Looper.java:211)
|
76
|
+
|
77
|
+
at android.app.ActivityThread.main(ActivityThread.java:5335)
|
78
|
+
|
79
|
+
at java.lang.reflect.Method.invoke(Native Method)
|
80
|
+
|
81
|
+
at java.lang.reflect.Method.invoke(Method.java:372)
|
82
|
+
|
83
|
+
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016)
|
84
|
+
|
85
|
+
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
が稀に出ました。こちらのエラーはGridViewに読み込む画像のサイズを大きくすると起きやすくなるみたいでした。
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
W/art: Suspending all threads took: 6.515ms
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
こちらの警告もたまに出ていました。
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
アニメーションがうまくいっている時も、行かない時も
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
09-02 06:11:47.843 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=true
|
114
|
+
|
115
|
+
09-02 06:11:48.356 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
116
|
+
|
117
|
+
09-02 06:11:48.400 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
118
|
+
|
119
|
+
09-02 06:11:48.840 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2785c3b6 time:216368574
|
120
|
+
|
121
|
+
09-02 06:15:26.074 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_launch_request id:rimp.rild.com.android.android_activity_transition_test time:216585808
|
122
|
+
|
123
|
+
09-02 06:15:26.517 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2e07c830 time:216586252
|
124
|
+
|
125
|
+
09-02 06:15:26.847 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=true
|
126
|
+
|
127
|
+
09-02 06:15:27.309 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
128
|
+
|
129
|
+
09-02 06:15:27.378 23116-23116/rimp.rild.com.android.android_activity_transition_test D/ViewRootImpl: changeCanvasOpacity: opaque=false
|
130
|
+
|
131
|
+
09-02 06:15:27.821 23116-23116/rimp.rild.com.android.android_activity_transition_test I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@2785c3b6 time:216587556
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
といったログが基本でした。
|
138
|
+
|
139
|
+
|
140
|
+
|
55
141
|
###該当のソースコード
|
56
142
|
|
57
143
|
|
2
GIFリンク作成
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,11 +28,19 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
[エミュレータGIFリンク](http://i.giphy.com/3o6ZtpLFJfp6V4fdBK.gif)
|
32
|
+
|
33
|
+
|
34
|
+
|
31
35
|
#### うまくいかない場合
|
32
36
|
|
33
37
|
|
34
38
|
|
35
39
|
![](http://i.giphy.com/l0HlVLzJrD4I2kQYE.gif)
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
[実機GIFリンク](http://i.giphy.com/l0HlVLzJrD4I2kQYE.gif)
|
36
44
|
|
37
45
|
|
38
46
|
|
1
gif画像の挿入
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,13 +22,17 @@
|
|
22
22
|
|
23
23
|
#### うまくいく場合
|
24
24
|
|
25
|
+
|
26
|
+
|
25
|
-
|
27
|
+
![](http://i.giphy.com/3o6ZtpLFJfp6V4fdBK.gif)
|
26
28
|
|
27
29
|
|
28
30
|
|
29
31
|
#### うまくいかない場合
|
30
32
|
|
33
|
+
|
34
|
+
|
31
|
-
|
35
|
+
![](http://i.giphy.com/l0HlVLzJrD4I2kQYE.gif)
|
32
36
|
|
33
37
|
|
34
38
|
|