diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
index d611944d..d4ddb68c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -32,7 +32,6 @@ android {
buildTypes {
release {
minifyEnabled true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
@@ -52,6 +51,11 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') {
exclude module: 'espresso-idling-resource'
}
+ androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
+ exclude module: 'espresso-core'
+ exclude module: 'recyclerview-v7'
+ exclude module: 'support-v4'
+ }
androidTestCompile 'com.android.support.test:rules:0.4'
androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'org.hamcrest:hamcrest-core:1.3'
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
deleted file mode 100644
index bb65c6fe..00000000
--- a/app/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/app/src/androidTest/java/com/google/samples/apps/topeka/activity/CategorySelectionActivityTest.java b/app/src/androidTest/java/com/google/samples/apps/topeka/activity/CategorySelectionActivityTest.java
index e7395f04..248d914d 100644
--- a/app/src/androidTest/java/com/google/samples/apps/topeka/activity/CategorySelectionActivityTest.java
+++ b/app/src/androidTest/java/com/google/samples/apps/topeka/activity/CategorySelectionActivityTest.java
@@ -19,6 +19,7 @@
import android.content.Context;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
+import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
@@ -37,18 +38,15 @@
import java.util.List;
-import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.action.ViewActions.scrollTo;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static junit.framework.Assert.assertFalse;
-import static org.hamcrest.Matchers.allOf;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
@RunWith(AndroidJUnit4.class)
@LargeTest
@@ -80,11 +78,14 @@ public void loadCategories() {
}
@Test
- public void allCategories_areDisplayed() {
- for (Category category : mCategories) {
- onData(allOf(is(instanceOf(Category.class)), is(category)))
- .inAdapterView(withId(R.id.categories))
- .check(matches(isDisplayed()));
+ public void allCategories_areDisplayed() throws InterruptedException {
+ String categoryName;
+ for (int i = 0; i < mCategories.size(); i++) {
+ categoryName = mCategories.get(i).getName();
+ onView(withId(R.id.categories))
+ .perform(RecyclerViewActions.actionOnItemAtPosition(i, scrollTo()));
+ onView(withText(categoryName)).check(matches(isDisplayed()));
+
}
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4225553e..1c5ce141 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -25,6 +25,7 @@
android:theme="@style/Topeka">
int
. This type-specific subclass enables performance benefit by allowing
- * calls to a {@link #set(Object, Integer) set()} function that takes the primitive
- * int
type and avoids autoboxing and other overhead associated with the
- * Integer
class.
- *
- * @param int
.
- */
- public abstract void setValue(T object, int value);
-
- @Override
- final public void set(T object, Integer value) {
- //noinspection UnnecessaryUnboxing
- setValue(object, value.intValue());
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/google/samples/apps/topeka/activity/CategorySelectionActivity.java b/app/src/main/java/com/google/samples/apps/topeka/activity/CategorySelectionActivity.java
index c680c4cf..38b73a15 100644
--- a/app/src/main/java/com/google/samples/apps/topeka/activity/CategorySelectionActivity.java
+++ b/app/src/main/java/com/google/samples/apps/topeka/activity/CategorySelectionActivity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Google Inc.
+ * Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,12 +19,16 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
+import android.transition.TransitionInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -32,6 +36,7 @@
import com.google.samples.apps.topeka.R;
import com.google.samples.apps.topeka.fragment.CategorySelectionFragment;
+import com.google.samples.apps.topeka.helper.ApiLevelHelper;
import com.google.samples.apps.topeka.helper.PreferencesHelper;
import com.google.samples.apps.topeka.model.Player;
import com.google.samples.apps.topeka.persistence.TopekaDatabaseHelper;
@@ -73,6 +78,7 @@ protected void onCreate(Bundle savedInstanceState) {
} else {
setProgressBarVisibility(View.GONE);
}
+ supportPostponeEnterTransition();
}
@Override
@@ -100,6 +106,14 @@ public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.category_container);
+ if (fragment != null) {
+ fragment.onActivityResult(requestCode, resultCode, data);
+ }
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@@ -114,7 +128,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
private void signOut() {
PreferencesHelper.signOut(this);
TopekaDatabaseHelper.reset(this);
- SignInActivity.start(this, false, null);
+ if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
+ getWindow().setExitTransition(TransitionInflater.from(this)
+ .inflateTransition(R.transition.category_enter));
+ }
+ SignInActivity.start(this, false);
ActivityCompat.finishAfterTransition(this);
}
@@ -124,8 +142,13 @@ private String getDisplayName(Player player) {
}
private void attachCategoryGridFragment() {
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.quiz_container, CategorySelectionFragment.newInstance())
+ FragmentManager supportFragmentManager = getSupportFragmentManager();
+ Fragment fragment = supportFragmentManager.findFragmentById(R.id.category_container);
+ if (!(fragment instanceof CategorySelectionFragment)) {
+ fragment = CategorySelectionFragment.newInstance();
+ }
+ supportFragmentManager.beginTransaction()
+ .replace(R.id.category_container, fragment)
.commit();
setProgressBarVisibility(View.GONE);
}
diff --git a/app/src/main/java/com/google/samples/apps/topeka/activity/QuizActivity.java b/app/src/main/java/com/google/samples/apps/topeka/activity/QuizActivity.java
index f1f09310..6d961af6 100644
--- a/app/src/main/java/com/google/samples/apps/topeka/activity/QuizActivity.java
+++ b/app/src/main/java/com/google/samples/apps/topeka/activity/QuizActivity.java
@@ -18,10 +18,14 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ArgbEvaluator;
+import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
@@ -32,21 +36,28 @@
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
+import android.support.v4.view.animation.FastOutLinearInInterpolator;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.Window;
import android.view.animation.Interpolator;
+import android.widget.FrameLayout;
import android.widget.ImageView;
+import android.widget.TextView;
import com.google.samples.apps.topeka.R;
import com.google.samples.apps.topeka.fragment.QuizFragment;
import com.google.samples.apps.topeka.helper.ApiLevelHelper;
+import com.google.samples.apps.topeka.helper.ViewUtils;
import com.google.samples.apps.topeka.model.Category;
+import com.google.samples.apps.topeka.model.JsonAttributes;
import com.google.samples.apps.topeka.persistence.TopekaDatabaseHelper;
+import com.google.samples.apps.topeka.widget.TextSharedElementCallback;
+
+import java.util.List;
import static com.google.samples.apps.topeka.adapter.CategoryAdapter.DRAWABLE;
@@ -55,20 +66,21 @@ public class QuizActivity extends AppCompatActivity {
private static final String TAG = "QuizActivity";
private static final String IMAGE_CATEGORY = "image_category_";
private static final String STATE_IS_PLAYING = "isPlaying";
- private static final int UNDEFINED = -1;
private static final String FRAGMENT_TAG = "Quiz";
private Interpolator mInterpolator;
- private String mCategoryId;
+ private Category mCategory;
private QuizFragment mQuizFragment;
- private Toolbar mToolbar;
private FloatingActionButton mQuizFab;
private boolean mSavedStateIsPlaying;
private ImageView mIcon;
private Animator mCircularReveal;
+ private ObjectAnimator mColorChange;
private CountingIdlingResource mCountingIdlingResource;
+ private View mToolbarBack;
+
- private View.OnClickListener mOnClickListener = new View.OnClickListener() {
+ View.OnClickListener mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(final View v) {
switch (v.getId()) {
@@ -81,13 +93,9 @@ public void onClick(final View v) {
case R.id.quiz_done:
ActivityCompat.finishAfterTransition(QuizActivity.this);
break;
- case UNDEFINED:
- final CharSequence contentDescription = v.getContentDescription();
- if (contentDescription != null && contentDescription
- .equals(getString(R.string.up))) {
- onBackPressed();
- break;
- }
+ case R.id.back:
+ onBackPressed();
+ break;
default:
throw new UnsupportedOperationException(
"OnClick has not been implemented for " + getResources().
@@ -105,13 +113,45 @@ public static Intent getStartIntent(Context context, Category category) {
@Override
protected void onCreate(Bundle savedInstanceState) {
mCountingIdlingResource = new CountingIdlingResource("Quiz");
- mCategoryId = getIntent().getStringExtra(Category.TAG);
+ String categoryId = getIntent().getStringExtra(Category.TAG);
mInterpolator = new FastOutSlowInInterpolator();
if (null != savedInstanceState) {
mSavedStateIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING);
}
super.onCreate(savedInstanceState);
- populate(mCategoryId);
+ populate(categoryId);
+ int categoryNameTextSize = getResources()
+ .getDimensionPixelSize(R.dimen.category_item_text_size);
+ int paddingStart = getResources().getDimensionPixelSize(R.dimen.spacing_double);
+ final int startDelay = getResources().getInteger(R.integer.toolbar_transition_duration);
+ ActivityCompat.setEnterSharedElementCallback(this,
+ new TextSharedElementCallback(categoryNameTextSize, paddingStart) {
+ @Override
+ public void onSharedElementStart(Listint
.
+ */
+ public abstract void setValue(T object, int value);
+
+ @Override
+ final public void set(T object, Integer value) {
+ //noinspection UnnecessaryUnboxing
+ setValue(object, value.intValue());
+ }
+ }
+
+ public static abstract class FloatPropertyint
.
+ */
+ public abstract void setValue(T object, float value);
+
+ @Override
+ final public void set(T object, Float value) {
+ //noinspection UnnecessaryUnboxing
+ setValue(object, value.floatValue());
+ }
+ }
+
+ public static void setPaddingStart(TextView target, int paddingStart) {
+ ViewCompat.setPaddingRelative(target, paddingStart, target.getPaddingTop(),
+ ViewCompat.getPaddingEnd(target), target.getPaddingBottom());
+ }
+
+}
diff --git a/app/src/main/java/com/google/samples/apps/topeka/widget/OffsetDecoration.java b/app/src/main/java/com/google/samples/apps/topeka/widget/OffsetDecoration.java
new file mode 100644
index 00000000..473f8b72
--- /dev/null
+++ b/app/src/main/java/com/google/samples/apps/topeka/widget/OffsetDecoration.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * 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;
+
+import android.graphics.Rect;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+public class OffsetDecoration extends RecyclerView.ItemDecoration {
+
+ private final int mOffset;
+
+ public OffsetDecoration(int offset) {
+ mOffset = offset;
+ }
+
+ @Override
+ public void getItemOffsets(Rect outRect, View view,
+ RecyclerView parent, RecyclerView.State state) {
+ outRect.left = mOffset;
+ outRect.right = mOffset;
+ outRect.bottom = mOffset;
+ outRect.top = mOffset;
+ }
+}
diff --git a/app/src/main/java/com/google/samples/apps/topeka/widget/TextResizeTransition.java b/app/src/main/java/com/google/samples/apps/topeka/widget/TextResizeTransition.java
new file mode 100644
index 00000000..601b5428
--- /dev/null
+++ b/app/src/main/java/com/google/samples/apps/topeka/widget/TextResizeTransition.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * 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;
+
+import com.google.samples.apps.topeka.helper.ViewUtils;
+
+import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Build;
+import android.support.v4.view.ViewCompat;
+import android.transition.Transition;
+import android.transition.TransitionValues;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+/**
+ * A transition that resizes text of a TextView.
+ */
+@TargetApi(Build.VERSION_CODES.KITKAT)
+public class TextResizeTransition extends Transition {
+
+ private static final String PROPERTY_NAME_TEXT_RESIZE =
+ "com.google.samples.apps.topeka.widget:TextResizeTransition:textSize";
+ private static final String PROPERTY_NAME_PADDING_RESIZE =
+ "com.google.samples.apps.topeka.widget:TextResizeTransition:paddingStart";
+
+ private static final String[] TRANSITION_PROPERTIES = {PROPERTY_NAME_TEXT_RESIZE,
+ PROPERTY_NAME_PADDING_RESIZE };
+
+ public TextResizeTransition(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public void captureStartValues(TransitionValues transitionValues) {
+ captureValues(transitionValues);
+ }
+
+ @Override
+ public void captureEndValues(TransitionValues transitionValues) {
+ captureValues(transitionValues);
+ }
+
+ private void captureValues(TransitionValues transitionValues) {
+ if (!(transitionValues.view instanceof TextView)) {
+ throw new UnsupportedOperationException("Doesn't work on "
+ + transitionValues.view.getClass().getName());
+ }
+ TextView view = (TextView) transitionValues.view;
+ transitionValues.values.put(PROPERTY_NAME_TEXT_RESIZE, view.getTextSize());
+ transitionValues.values.put(PROPERTY_NAME_PADDING_RESIZE,
+ ViewCompat.getPaddingStart(view));
+ }
+
+ @Override
+ public String[] getTransitionProperties() {
+ return TRANSITION_PROPERTIES;
+ }
+
+ @Override
+ public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
+ TransitionValues endValues) {
+ if (startValues == null || endValues == null) {
+ return null;
+ }
+
+ float initialTextSize = (float) startValues.values.get(PROPERTY_NAME_TEXT_RESIZE);
+ float targetTextSize = (float) endValues.values.get(PROPERTY_NAME_TEXT_RESIZE);
+ TextView targetView = (TextView) endValues.view;
+ targetView.setTextSize(TypedValue.COMPLEX_UNIT_PX, initialTextSize);
+
+ int initialPaddingStart = (int) startValues.values.get(PROPERTY_NAME_PADDING_RESIZE);
+ int targetPaddingStart = (int) endValues.values.get(PROPERTY_NAME_PADDING_RESIZE);
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(
+ ObjectAnimator.ofFloat(targetView,
+ ViewUtils.PROPERTY_TEXT_SIZE,
+ initialTextSize,
+ targetTextSize),
+ ObjectAnimator.ofInt(targetView,
+ ViewUtils.PROPERTY_TEXT_PADDING_START,
+ initialPaddingStart,
+ targetPaddingStart));
+ return animatorSet;
+ }
+}
diff --git a/app/src/main/java/com/google/samples/apps/topeka/widget/TextSharedElementCallback.java b/app/src/main/java/com/google/samples/apps/topeka/widget/TextSharedElementCallback.java
new file mode 100644
index 00000000..407ce411
--- /dev/null
+++ b/app/src/main/java/com/google/samples/apps/topeka/widget/TextSharedElementCallback.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ *
+ * 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;
+
+import com.google.samples.apps.topeka.helper.ViewUtils;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.support.v4.app.SharedElementCallback;
+import android.util.TypedValue;
+import android.view.View;
+import android.widget.TextView;
+
+import java.util.List;
+
+/**
+ * This callback allows a shared TextView to resize text and start padding during transition.
+ */
+@TargetApi(Build.VERSION_CODES.LOLLIPOP)
+public class TextSharedElementCallback extends SharedElementCallback {
+
+ private final int mInitialPaddingStart;
+ private float mInitialTextSize;
+ private float mTargetViewTextSize;
+ private int mTargetViewPaddingStart;
+
+ public TextSharedElementCallback(float initialTextSize, int initialPaddingStart) {
+ mInitialTextSize = initialTextSize;
+ mInitialPaddingStart = initialPaddingStart;
+ }
+
+ @Override
+ public void onSharedElementStart(List
The type of {@link com.google.samples.apps.topeka.model.quiz.Quiz} you want to - * display. + * display. */ public abstract class AbsQuizViewextends FrameLayout { @@ -81,34 +80,12 @@ public abstract class AbsQuizViewextends FrameLayout { private Runnable mMoveOffScreenRunnable; private InputMethodManager mInputMethodManager; - private static final PropertyFOREGROUND_COLOR = - new IntProperty ("foregroundColor") { - - @Override - public void setValue(AbsQuizView layout, int value) { - if (layout.getForeground() instanceof ColorDrawable) { - ((ColorDrawable) layout.getForeground().mutate()).setColor(value); - } else { - layout.setForeground(new ColorDrawable(value)); - } - } - - @Override - public Integer get(AbsQuizView layout) { - if (layout.getForeground() instanceof ColorDrawable) { - return ((ColorDrawable) layout.getForeground()).getColor(); - } else { - return Color.TRANSPARENT; - } - } - }; - /** * Enables creation of views for quizzes. * - * @param context The context for this view. + * @param context The context for this view. * @param category The {@link Category} this view is running in. - * @param quiz The actual {@link Quiz} that is going to be displayed. + * @param quiz The actual {@link Quiz} that is going to be displayed. */ public AbsQuizView(Context context, Category category, Q quiz) { super(context); @@ -207,6 +184,7 @@ public void onClick(View v) { if (mInputMethodManager.isAcceptingText()) { mInputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0); } + mSubmitAnswer.setEnabled(false); } }); } @@ -334,7 +312,7 @@ private void resizeView() { // Animate X and Y scaling separately to allow different start delays. // object animators for x and y with different durations and then run them independently resizeViewProperty(View.SCALE_X, .5f, 200); - resizeViewProperty(View.SCALE_Y, .5f / widthHeightRatio, 250); + resizeViewProperty(View.SCALE_Y, .5f / widthHeightRatio, 300); } private void resizeViewProperty(Property property, @@ -358,7 +336,7 @@ protected void onDetachedFromWindow() { } private void animateForegroundColor(@ColorInt final int targetColor) { - ObjectAnimator animator = ObjectAnimator.ofInt(this, FOREGROUND_COLOR, + ObjectAnimator animator = ObjectAnimator.ofInt(this, ViewUtils.FOREGROUND_COLOR, Color.TRANSPARENT, targetColor); animator.setEvaluator(new ArgbEvaluator()); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY); diff --git a/app/src/main/res/animator-v21/cross_to_tick_line_1.xml b/app/src/main/res/animator-v21/cross_to_tick_line_1.xml index adf92a88..ae06ab94 100644 --- a/app/src/main/res/animator-v21/cross_to_tick_line_1.xml +++ b/app/src/main/res/animator-v21/cross_to_tick_line_1.xml @@ -19,6 +19,6 @@ android:propertyName="pathData" android:valueFrom="@string/path_cross_line_1" android:valueTo="@string/path_tick_line_1" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" android:valueType="pathType" /> diff --git a/app/src/main/res/animator-v21/cross_to_tick_line_2.xml b/app/src/main/res/animator-v21/cross_to_tick_line_2.xml index deb4a1d5..190036c5 100644 --- a/app/src/main/res/animator-v21/cross_to_tick_line_2.xml +++ b/app/src/main/res/animator-v21/cross_to_tick_line_2.xml @@ -19,6 +19,6 @@ android:propertyName="pathData" android:valueFrom="@string/path_cross_line_2" android:valueTo="@string/path_tick_line_2" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" android:valueType="pathType" /> diff --git a/app/src/main/res/animator-v21/rotate_cross_to_tick.xml b/app/src/main/res/animator-v21/rotate_cross_to_tick.xml index d73e2994..72f5c471 100644 --- a/app/src/main/res/animator-v21/rotate_cross_to_tick.xml +++ b/app/src/main/res/animator-v21/rotate_cross_to_tick.xml @@ -19,5 +19,5 @@ android:propertyName="rotation" android:valueFrom="-180" android:valueTo="0" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" /> diff --git a/app/src/main/res/animator-v21/rotate_tick_to_cross.xml b/app/src/main/res/animator-v21/rotate_tick_to_cross.xml index 437d5fa4..6904f936 100644 --- a/app/src/main/res/animator-v21/rotate_tick_to_cross.xml +++ b/app/src/main/res/animator-v21/rotate_tick_to_cross.xml @@ -19,5 +19,5 @@ android:propertyName="rotation" android:valueFrom="0" android:valueTo="180" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" /> diff --git a/app/src/main/res/animator-v21/tick_to_cross_line_1.xml b/app/src/main/res/animator-v21/tick_to_cross_line_1.xml index 96118cd3..96b25cd1 100644 --- a/app/src/main/res/animator-v21/tick_to_cross_line_1.xml +++ b/app/src/main/res/animator-v21/tick_to_cross_line_1.xml @@ -19,6 +19,6 @@ android:propertyName="pathData" android:valueFrom="@string/path_tick_line_1" android:valueTo="@string/path_cross_line_1" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" android:valueType="pathType" /> diff --git a/app/src/main/res/animator-v21/tick_to_cross_line_2.xml b/app/src/main/res/animator-v21/tick_to_cross_line_2.xml index 10cf1924..35094d7a 100644 --- a/app/src/main/res/animator-v21/tick_to_cross_line_2.xml +++ b/app/src/main/res/animator-v21/tick_to_cross_line_2.xml @@ -19,6 +19,6 @@ android:propertyName="pathData" android:valueFrom="@string/path_tick_line_2" android:valueTo="@string/path_cross_line_2" - android:duration="@integer/duration" + android:duration="@integer/tick_cross_duration" android:interpolator="@android:interpolator/fast_out_slow_in" android:valueType="pathType" /> diff --git a/app/src/main/res/drawable-v21/selector_categories.xml b/app/src/main/res/drawable-v21/selector_subtle.xml similarity index 100% rename from app/src/main/res/drawable-v21/selector_categories.xml rename to app/src/main/res/drawable-v21/selector_subtle.xml diff --git a/app/src/main/res/drawable/selector_categories.xml b/app/src/main/res/drawable/selector_subtle.xml similarity index 100% rename from app/src/main/res/drawable/selector_categories.xml rename to app/src/main/res/drawable/selector_subtle.xml diff --git a/app/src/main/res/layout-land/fragment_sign_in.xml b/app/src/main/res/layout-land/fragment_sign_in.xml index 6eb47355..0797fcce 100644 --- a/app/src/main/res/layout-land/fragment_sign_in.xml +++ b/app/src/main/res/layout-land/fragment_sign_in.xml @@ -15,8 +15,10 @@ --> diff --git a/app/src/main/res/layout/activity_category_selection.xml b/app/src/main/res/layout/activity_category_selection.xml index c5806842..85cc1ed4 100644 --- a/app/src/main/res/layout/activity_category_selection.xml +++ b/app/src/main/res/layout/activity_category_selection.xml @@ -18,6 +18,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/topeka_blank" + android:transitionGroup="false" android:orientation="vertical"> - - + + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/quiz_container" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - - + + android:layout_height="wrap_content"> +- - + + + android:layout_gravity="center"> + android:scaleY="0.7"/> + android:visibility="invisible"/> + android:transitionName="@string/transition_avatar"/> diff --git a/app/src/main/res/layout/activity_sign_in.xml b/app/src/main/res/layout/activity_sign_in.xml index 58c1230c..87d5372e 100644 --- a/app/src/main/res/layout/activity_sign_in.xml +++ b/app/src/main/res/layout/activity_sign_in.xml @@ -14,10 +14,12 @@ ~ limitations under the License. --> - diff --git a/app/src/main/res/layout/fragment_categories.xml b/app/src/main/res/layout/fragment_categories.xml index 584bb927..2f30e4d5 100644 --- a/app/src/main/res/layout/fragment_categories.xml +++ b/app/src/main/res/layout/fragment_categories.xml @@ -14,20 +14,16 @@ ~ limitations under the License. --> - + android:scrollbars="vertical" + app:layoutManager="android.support.v7.widget.GridLayoutManager" + android:transitionGroup="false" + app:spanCount="2" /> diff --git a/app/src/main/res/layout/fragment_quiz.xml b/app/src/main/res/layout/fragment_quiz.xml index 168c8ccb..f02d54aa 100644 --- a/app/src/main/res/layout/fragment_quiz.xml +++ b/app/src/main/res/layout/fragment_quiz.xml @@ -17,7 +17,8 @@ + android:orientation="vertical" + android:background="?android:attr/windowBackground"> diff --git a/app/src/main/res/layout/fragment_sign_in.xml b/app/src/main/res/layout/fragment_sign_in.xml index 4489179f..0b17107e 100644 --- a/app/src/main/res/layout/fragment_sign_in.xml +++ b/app/src/main/res/layout/fragment_sign_in.xml @@ -15,6 +15,7 @@ -->+ android:visibility="gone"/> + android:layout_weight="1"/> + android:progressTint="?android:colorAccent"/> + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorPrimary"/> @@ -34,20 +35,18 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" - android:orientation="vertical" - android:paddingEnd="@dimen/spacing_double" - android:paddingStart="@dimen/spacing_double"> + android:orientation="vertical"> \ No newline at end of file diff --git a/app/src/main/res/layout/sign_in_avatars.xml b/app/src/main/res/layout/sign_in_avatars.xml index 27f1dc39..b8aa0112 100644 --- a/app/src/main/res/layout/sign_in_avatars.xml +++ b/app/src/main/res/layout/sign_in_avatars.xml @@ -24,18 +24,23 @@diff --git a/app/src/main/res/layout/item_category.xml b/app/src/main/res/layout/item_category.xml index 9f8f753a..8efd8df0 100644 --- a/app/src/main/res/layout/item_category.xml +++ b/app/src/main/res/layout/item_category.xml @@ -14,23 +14,27 @@ ~ limitations under the License. --> - + \ No newline at end of file +- + android:text="@string/choose_avatar" + android:paddingEnd="@dimen/spacing_double" + android:paddingStart="@dimen/spacing_double" + android:clipToPadding="false" /> + android:verticalSpacing="@dimen/spacing_double" + android:paddingEnd="@dimen/spacing_double" + android:paddingStart="@dimen/spacing_double" + android:clipToPadding="false" /> \ No newline at end of file diff --git a/app/src/main/res/layout/sign_in_username.xml b/app/src/main/res/layout/sign_in_username.xml index 41a7a875..a46adb45 100644 --- a/app/src/main/res/layout/sign_in_username.xml +++ b/app/src/main/res/layout/sign_in_username.xml @@ -24,35 +24,54 @@ + android:text="@string/sign_in" + android:paddingEnd="@dimen/spacing_double" + android:paddingStart="@dimen/spacing_double" + android:clipToPadding="false" /> - + android:paddingEnd="@dimen/spacing_double" + android:paddingBottom="@dimen/spacing_micro" + android:clipToPadding="false" + android:transitionGroup="true"> + + - + android:paddingEnd="@dimen/spacing_double" + android:paddingBottom="@dimen/spacing_micro" + android:clipToPadding="false" + android:transitionGroup="true"> + + \ No newline at end of file diff --git a/app/src/main/res/transition/category_enter.xml b/app/src/main/res/transition/category_enter.xml index dbc1a273..fd4e24ca 100644 --- a/app/src/main/res/transition/category_enter.xml +++ b/app/src/main/res/transition/category_enter.xml @@ -15,9 +15,16 @@ --> - \ No newline at end of file +- - - - - + ++ ++ + + + + diff --git a/app/src/main/res/transition/category_exit.xml b/app/src/main/res/transition/category_exit.xml new file mode 100644 index 00000000..a67ba032 --- /dev/null +++ b/app/src/main/res/transition/category_exit.xml @@ -0,0 +1,30 @@ + + ++ ++ + diff --git a/app/src/main/res/transition/quiz_enter.xml b/app/src/main/res/transition/category_shared_enter.xml similarity index 88% rename from app/src/main/res/transition/quiz_enter.xml rename to app/src/main/res/transition/category_shared_enter.xml index 52eb8c02..42e7f1b7 100644 --- a/app/src/main/res/transition/quiz_enter.xml +++ b/app/src/main/res/transition/category_shared_enter.xml @@ -15,10 +15,7 @@ -->+ ++ ++ + + + ++ ++ - \ No newline at end of file diff --git a/app/src/main/res/transition/quiz_shared_enter.xml b/app/src/main/res/transition/quiz_shared_enter.xml new file mode 100644 index 00000000..e488c2d3 --- /dev/null +++ b/app/src/main/res/transition/quiz_shared_enter.xml @@ -0,0 +1,28 @@ + + +- - - + + + \ No newline at end of file diff --git a/app/src/main/res/transition/signin_enter.xml b/app/src/main/res/transition/signin_enter.xml new file mode 100644 index 00000000..078c31ea --- /dev/null +++ b/app/src/main/res/transition/signin_enter.xml @@ -0,0 +1,22 @@ + + ++ + + ++ ++ + \ No newline at end of file diff --git a/app/src/main/res/transition/signin_exit.xml b/app/src/main/res/transition/signin_exit.xml new file mode 100644 index 00000000..b446049c --- /dev/null +++ b/app/src/main/res/transition/signin_exit.xml @@ -0,0 +1,28 @@ + + ++ ++ + + diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index c0f2d5a0..13dcf8f4 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -1,4 +1,3 @@ -+ ++ ++ + ++ ++ + diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index f8bc9f76..b4b8ac2f 100644 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -20,4 +20,7 @@2dp 4dp 8dp 16dp @@ -32,4 +33,5 @@4dp 18sp +14sp - +
- +
- + \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 2416129d..7ee26920 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -28,7 +28,6 @@
- @color/topeka_primary_dark
- @color/text_dark
- @style/Topeka.CompoundButton.Radio
-- true
- @style/Topeka.CompoundButton
- @color/light_grey
- @color/light_grey
@@ -36,6 +35,7 @@ + + + diff --git a/app/src/main/res/values/tick_cross.xml b/app/src/main/res/values/tick_cross.xml index 785e81ad..1b49cba0 100644 --- a/app/src/main/res/values/tick_cross.xml +++ b/app/src/main/res/values/tick_cross.xml @@ -36,6 +36,6 @@@android:color/black -450 +450 diff --git a/app/src/main/res/values/transition_names.xml b/app/src/main/res/values/transition_names.xml index e028cb70..a4cdf229 100644 --- a/app/src/main/res/values/transition_names.xml +++ b/app/src/main/res/values/transition_names.xml @@ -16,6 +16,5 @@\ No newline at end of file diff --git a/app/src/main/res/values/transitions.xml b/app/src/main/res/values/transitions.xml new file mode 100644 index 00000000..1e70ce7e --- /dev/null +++ b/app/src/main/res/values/transitions.xml @@ -0,0 +1,20 @@ + + + + AvatarTransition -BackgroundTransition ToolbarTransition + \ No newline at end of file- 350
+