9
9
import android .os .Build ;
10
10
import android .os .Bundle ;
11
11
import android .os .Handler ;
12
+ import android .support .annotation .ColorInt ;
12
13
import android .support .annotation .NonNull ;
13
14
import android .support .design .widget .FloatingActionButton ;
14
15
import android .support .v4 .app .ActivityCompat ;
26
27
27
28
import com .dm .material .dashboard .candybar .fragments .dialog .WallpaperSettingsFragment ;
28
29
import com .dm .material .dashboard .candybar .helpers .ViewHelper ;
30
+ import com .dm .material .dashboard .candybar .utils .Animator ;
29
31
import com .kogitune .activitytransition .ActivityTransition ;
30
32
import com .kogitune .activitytransition .ExitActivityTransition ;
31
33
import com .dm .material .dashboard .candybar .R ;
@@ -130,6 +132,9 @@ public void initWallpaperActivity(Bundle savedInstanceState, Intent intent) {
130
132
.duration (300 )
131
133
.start (savedInstanceState );
132
134
135
+ Animator .startAlphaAnimation (toolbar , 1000 , View .VISIBLE );
136
+ toolbar .setVisibility (View .VISIBLE );
137
+
133
138
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .LOLLIPOP && savedInstanceState == null ) {
134
139
Transition transition = getWindow ().getSharedElementEnterTransition ();
135
140
@@ -269,13 +274,8 @@ public void onLoadingStarted(String imageUri, View view) {
269
274
@ Override
270
275
public void onLoadingFailed (String imageUri , View view , FailReason failReason ) {
271
276
super .onLoadingFailed (imageUri , view , failReason );
272
- mAttacher .setScaleType (ImageView .ScaleType .CENTER_CROP );
273
- mProgress .setVisibility (View .GONE );
274
277
int text = ColorHelper .getTitleTextColor (CandyBarWallpaperActivity .this , mColor );
275
- mFab .setImageDrawable (DrawableHelper .getTintedDrawable (
276
- CandyBarWallpaperActivity .this , R .drawable .ic_fab_check , text ));
277
- mFab .show ();
278
- mFab .setVisibility (View .VISIBLE );
278
+ OnWallpaperLoaded (text );
279
279
}
280
280
281
281
@ Override
@@ -285,10 +285,6 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
285
285
setRequestedOrientation (ActivityInfo .SCREEN_ORIENTATION_PORTRAIT );
286
286
}
287
287
288
- mAttacher .setScaleType (ImageView .ScaleType .CENTER_CROP );
289
- mRunnable = null ;
290
- mHandler = null ;
291
- mProgress .setVisibility (View .GONE );
292
288
if (loadedImage != null ) {
293
289
Palette .from (loadedImage ).generate (palette -> {
294
290
int accent = ColorHelper .getAttributeColor (
@@ -299,14 +295,23 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
299
295
mFab .setBackgroundTintList (ColorHelper .getColorStateList (
300
296
android .R .attr .state_pressed ,
301
297
color , ColorHelper .getDarkerColor (color , 0.9f )));
302
- mFab .setImageDrawable (DrawableHelper .getTintedDrawable (
303
- CandyBarWallpaperActivity .this , R .drawable .ic_fab_check , text ));
304
- mFab .show ();
305
- mFab .setVisibility (View .VISIBLE );
298
+ OnWallpaperLoaded (text );
306
299
});
307
300
}
308
301
}
309
302
});
310
303
}
311
304
305
+ private void OnWallpaperLoaded (@ ColorInt int textColor ) {
306
+ mAttacher .setScaleType (ImageView .ScaleType .CENTER_CROP );
307
+ mProgress .setVisibility (View .GONE );
308
+ mRunnable = null ;
309
+ mHandler = null ;
310
+
311
+ mFab .setImageDrawable (DrawableHelper .getTintedDrawable (
312
+ CandyBarWallpaperActivity .this , R .drawable .ic_fab_check , textColor ));
313
+ mFab .show ();
314
+ mFab .setVisibility (View .VISIBLE );
315
+ }
316
+
312
317
}
0 commit comments