3
3
import android .Manifest ;
4
4
import android .animation .Animator ;
5
5
import android .animation .AnimatorListenerAdapter ;
6
+ import android .content .Context ;
6
7
import android .graphics .Bitmap ;
7
8
import android .os .Build ;
8
9
import android .os .Bundle ;
@@ -85,6 +86,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
85
86
@ Override
86
87
public void onResume () {
87
88
super .onResume ();
89
+ if (getActivity () == null || getContext () == null ) return ;
88
90
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP ) {
89
91
getActivity ().getWindow ().setNavigationBarColor (ContextCompat .getColor (getContext (), R .color .background_700 ));
90
92
}
@@ -164,6 +166,8 @@ public boolean onResourceReady(T resource, Object model, Target<T> target, DataS
164
166
}
165
167
166
168
protected void onDrawPage () {
169
+ if (!isActive ()) return ;
170
+ final Context context = getContext ();
167
171
Logger .d ("PhotoViewFragment::onDrawPage() - nickname:" + senderNickname );
168
172
final ImageView ivPhoto = binding .ivPhoto ;
169
173
final ImageView ivDelete = binding .ivDelete ;
@@ -174,7 +178,7 @@ protected void onDrawPage() {
174
178
final String url = this .url ;
175
179
176
180
tvTitle .setText (senderNickname );
177
- tvCreatedAt .setText (DateUtils .formatTime (getContext () , this .createdAt ));
181
+ tvCreatedAt .setText (DateUtils .formatTime (context , this .createdAt ));
178
182
loading .setVisibility (View .VISIBLE );
179
183
180
184
if (mimeType .toLowerCase ().contains (StringSet .gif )) {
0 commit comments