Skip to content

Commit

Permalink
Fixed incorrect use of stable ids & improved return transition.
Browse files Browse the repository at this point in the history
Change-Id: I152416077ac45c0a422ab756934cac799b920e52
  • Loading branch information
nickbutcher committed Nov 5, 2015
1 parent 0773c12 commit d8ab53a
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 18 deletions.
6 changes: 0 additions & 6 deletions app/src/main/java/io/plaidapp/ui/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ private static class LibraryAdapter extends RecyclerView.Adapter<RecyclerView.Vi

public LibraryAdapter(Context context) {
circleCrop = new CircleTransform(context);
setHasStableIds(true);
}

@Override
Expand Down Expand Up @@ -243,11 +242,6 @@ public int getItemCount() {
return libs.length + 1; // + 1 for the static intro view
}

@Override
public long getItemId(int position) {
return position;
}

private void bindLibrary(final LibraryHolder holder, final Library lib) {
holder.name.setText(lib.name);
Glide.with(holder.image.getContext())
Expand Down
31 changes: 22 additions & 9 deletions app/src/main/res/layout/about_libs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,30 @@
limitations under the License.
-->

<android.support.v7.widget.RecyclerView
android:id="@+id/libs_list"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/spacing_normal"
android:clipToPadding="false"
android:background="@color/grey_200"
android:transitionGroup="false"
android:scrollbars="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:showIn="@layout/activity_about"/>
tools:showIn="@layout/activity_about">

<!-- we use a parallel view for the background rather than just setting a background on the
recycler view for a nicer return transition. i.e. we want the background to fade and the
list to slide out separately -->
<View
android:id="@+id/libs_list_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_200" />

<android.support.v7.widget.RecyclerView
android:id="@+id/libs_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/spacing_normal"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />

</FrameLayout>
47 changes: 47 additions & 0 deletions app/src/main/res/transition/about_return.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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.
-->

<transitionSet
xmlns:android="http://schemas.android.com/apk/res/android"
android:transitionOrdering="together"
android:interpolator="@android:interpolator/fast_out_linear_in">

<slide
android:slideEdge="top"
android:duration="400">
<targets>
<target android:excludeId="@android:id/navigationBarBackground" />
<target android:excludeId="@android:id/statusBarBackground" />
</targets>
</slide>

<fade
android:startDelay="200"
android:duration="200">
<targets>
<target android:targetId="@id/libs_list_background" />
</targets>
</fade>

<fade android:duration="400">
<targets>
<target android:targetId="@android:id/navigationBarBackground" />
<target android:targetId="@android:id/statusBarBackground" />
</targets>
</fade>

</transitionSet>
15 changes: 12 additions & 3 deletions app/src/main/res/transition/about_return_downward.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@
<transitionSet
xmlns:android="http://schemas.android.com/apk/res/android"
android:transitionOrdering="together"
android:duration="300"
android:interpolator="@android:interpolator/fast_out_linear_in">

<slide android:slideEdge="bottom">
<slide
android:slideEdge="bottom"
android:duration="400">
<targets>
<target android:excludeId="@android:id/navigationBarBackground" />
<target android:excludeId="@android:id/statusBarBackground" />
</targets>
</slide>

<fade android:duration="@android:integer/config_mediumAnimTime">
<fade
android:startDelay="200"
android:duration="200">
<targets>
<target android:targetId="@id/libs_list_background" />
</targets>
</fade>

<fade android:duration="400">
<targets>
<target android:targetId="@android:id/navigationBarBackground" />
<target android:targetId="@android:id/statusBarBackground" />
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@

<style name="Plaid.Translucent.About">
<item name="android:windowEnterTransition">@transition/about_enter</item>
<item name="android:windowReturnTransition">@transition/about_return</item>
</style>

<style name="SearchWindowAnimations">
Expand Down

0 comments on commit d8ab53a

Please sign in to comment.