Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
Improve status-bar color-animation
Browse files Browse the repository at this point in the history
During the transition back from QuizActivity to CategorySelectionActivity
there was a flicker which has been resolved.
  • Loading branch information
shchurov authored and keyboardsurfer committed Jul 2, 2015
1 parent 5c14309 commit 14a2fe2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onResume() {
private void startQuizActivityWithTransition(Activity activity, View toolbar,
Category category) {

final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity,
final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, false,
new Pair<>(toolbar, activity.getString(R.string.transition_toolbar)));
ActivityOptions sceneTransitionAnimation = ActivityOptions
.makeSceneTransitionAnimation(activity, pairs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
private void performSignInWithTransition(View v) {
final Activity activity = getActivity();

final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity,
final Pair[] pairs = TransitionHelper.createSafeTransitionParticipants(activity, true,
new Pair<>(v, activity.getString(R.string.transition_avatar)));
ActivityOptions activityOptions = ActivityOptions
.makeSceneTransitionAnimation(activity, pairs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ public class TransitionHelper {
* avoiding glitches with the system UI.
*
* @param activity The activity used as start for the transition.
* @param includeStatusBar If false, the status bar will not be added as the transition
* participant.
* @return All transition participants.
*/
public static Pair[] createSafeTransitionParticipants(@NonNull Activity activity,
@Nullable Pair... otherParticipants) {
boolean includeStatusBar, @Nullable Pair... otherParticipants) {
// Avoid system UI glitches as described here:
// https://plus.google.com/+AlexLockwood/posts/RPtwZ5nNebb
View decor = activity.getWindow().getDecorView();
View statusBar = decor.findViewById(android.R.id.statusBarBackground);
View statusBar = null;
if (includeStatusBar) {
statusBar = decor.findViewById(android.R.id.statusBarBackground);
}
View navBar = decor.findViewById(android.R.id.navigationBarBackground);

// Create pair of transition participants.
Expand Down

0 comments on commit 14a2fe2

Please sign in to comment.