-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): transition for shared elements
- Loading branch information
chetan-fueled
committed
Nov 21, 2017
1 parent
38f3cac
commit 2cf1804
Showing
9 changed files
with
267 additions
and
4 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
74 changes: 74 additions & 0 deletions
74
flowr/src/main/java/com/fueled/flowr/internal/TransitionConfig.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,74 @@ | ||
package com.fueled.flowr.internal; | ||
|
||
import android.os.Build; | ||
import android.support.annotation.RequiresApi; | ||
import android.transition.ChangeBounds; | ||
import android.transition.Explode; | ||
import android.transition.Fade; | ||
import android.transition.Slide; | ||
import android.transition.Transition; | ||
import android.view.Gravity; | ||
|
||
/** | ||
* Copyright (c) 2017 Fueled. All rights reserved. | ||
* | ||
* @author chetansachdeva on 21/11/17 | ||
*/ | ||
|
||
public class TransitionConfig { | ||
|
||
public Transition sharedElementEnter; | ||
public Transition sharedElementExit; | ||
public Transition enter; | ||
public Transition exit; | ||
|
||
private TransitionConfig(Builder builder) { | ||
sharedElementEnter = builder.sharedElementEnter; | ||
sharedElementExit = builder.sharedElementExit; | ||
enter = builder.enter; | ||
exit = builder.exit; | ||
} | ||
|
||
public static final class Builder { | ||
private Transition sharedElementEnter; | ||
private Transition sharedElementExit; | ||
private Transition enter; | ||
private Transition exit; | ||
|
||
public Builder() { | ||
} | ||
|
||
public Builder sharedElementEnter(Transition val) { | ||
sharedElementEnter = val; | ||
return this; | ||
} | ||
|
||
public Builder sharedElementExit(Transition val) { | ||
sharedElementExit = val; | ||
return this; | ||
} | ||
|
||
public Builder enter(Transition val) { | ||
enter = val; | ||
return this; | ||
} | ||
|
||
public Builder exit(Transition val) { | ||
exit = val; | ||
return this; | ||
} | ||
|
||
public TransitionConfig build() { | ||
return new TransitionConfig(this); | ||
} | ||
} | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) | ||
public static class Provider { | ||
public static Transition fade = new Fade(); | ||
public static Transition explode = new Explode(); | ||
public static Transition slideRight = new Slide(Gravity.RIGHT); | ||
public static Transition slideLeft = new Slide(Gravity.LEFT); | ||
public static Transition changeBounds = new ChangeBounds(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,12 +3,15 @@ | |
import android.view.View; | ||
|
||
import com.fueled.flowr.NavigationIconType; | ||
import com.fueled.flowr.annotations.DeepLink; | ||
import com.fueled.flowr.sample.core.AbstractFragment; | ||
|
||
/** | ||
* Created by [email protected] on 18/05/2017. | ||
* Copyright (c) 2017 Fueled. All rights reserved. | ||
*/ | ||
|
||
@DeepLink(value = {"/categories"}) | ||
public class CategoriesFragment extends AbstractFragment { | ||
|
||
@Override | ||
|
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
36 changes: 36 additions & 0 deletions
36
sample/src/main/java/com/fueled/flowr/sample/TransitionFragment.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,36 @@ | ||
package com.fueled.flowr.sample; | ||
|
||
import android.view.View; | ||
|
||
import com.fueled.flowr.NavigationIconType; | ||
import com.fueled.flowr.annotations.DeepLink; | ||
import com.fueled.flowr.sample.core.AbstractFragment; | ||
|
||
/** | ||
* Created by [email protected] on 18/05/2017. | ||
* Copyright (c) 2017 Fueled. All rights reserved. | ||
*/ | ||
|
||
@DeepLink(value = {"/transition"}) | ||
public class TransitionFragment extends AbstractFragment { | ||
|
||
@Override | ||
public int getLayoutId() { | ||
return R.layout.fragment_transition; | ||
} | ||
|
||
@Override | ||
protected void setupView(View view) { | ||
|
||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return "Transition Fragment"; | ||
} | ||
|
||
@Override | ||
public NavigationIconType getNavigationIconType() { | ||
return NavigationIconType.HAMBURGER; | ||
} | ||
} |
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,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#FFFFFF" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:text="@string/transition_message"/> | ||
|
||
<TextView | ||
android:id="@+id/flowr_text_view" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_horizontal" | ||
android:layout_marginTop="10dp" | ||
android:background="@color/colorPrimary" | ||
android:padding="8dp" | ||
android:text="@string/app_name" | ||
android:textColor="@color/white" | ||
android:textSize="20sp" | ||
android:transitionName="transitionText"/> | ||
|
||
</FrameLayout> |
Oops, something went wrong.