This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce FAB animations on answer submission
Using animated-vector drawables and a CheckableFab to allow for an icon exchanging animation.
- Loading branch information
1 parent
084a872
commit cd465dd
Showing
22 changed files
with
518 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/google/samples/apps/topeka/helper/TransitionHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/google/samples/apps/topeka/widget/AvatarView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/google/samples/apps/topeka/widget/fab/CheckableFab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright 2015 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.samples.apps.topeka.widget.fab; | ||
|
||
import com.google.samples.apps.topeka.R; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.widget.Checkable; | ||
|
||
public class CheckableFab extends FloatingActionButton implements Checkable { | ||
|
||
private static final int[] CHECKED = {android.R.attr.state_checked}; | ||
|
||
private boolean mIsChecked = true; | ||
|
||
|
||
public CheckableFab(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public CheckableFab(Context context, AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public CheckableFab(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
setImageResource(R.drawable.answer_quiz_fab); | ||
} | ||
|
||
@Override | ||
public int[] onCreateDrawableState(int extraSpace) { | ||
final int[] drawableState = super.onCreateDrawableState(++extraSpace); | ||
if (mIsChecked) { | ||
mergeDrawableStates(drawableState, CHECKED); | ||
} | ||
return drawableState; | ||
} | ||
|
||
@Override | ||
public void setChecked(boolean checked) { | ||
if (mIsChecked == checked) { | ||
return; | ||
} | ||
mIsChecked = checked; | ||
refreshDrawableState(); | ||
} | ||
|
||
@Override | ||
public boolean isChecked() { | ||
return mIsChecked; | ||
} | ||
|
||
@Override | ||
public void toggle() { | ||
setChecked(!mIsChecked); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright 2015 Google Inc. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
<objectAnimator | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:propertyName="pathData" | ||
android:valueFrom="@string/path_cross_line_2" | ||
android:valueTo="@string/path_tick_line_2" | ||
android:duration="@integer/duration" | ||
android:interpolator="@android:interpolator/fast_out_slow_in" | ||
android:valueType="pathType" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright 2015 Google Inc. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
<objectAnimator | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:propertyName="rotation" | ||
android:valueFrom="0" | ||
android:valueTo="180" | ||
android:duration="@integer/duration" | ||
android:interpolator="@android:interpolator/fast_out_slow_in" /> |
Oops, something went wrong.