Created
February 11, 2017 15:01
-
-
Save d4rkc0de/ef8ac948840ebfae9a6c7609218e3140 to your computer and use it in GitHub Desktop.
scene transition
This file contains hidden or 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
package me.wangyuwei.signuptransition; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.transition.ChangeBounds; | |
import android.transition.Scene; | |
import android.transition.TransitionManager; | |
import android.view.animation.DecelerateInterpolator; | |
import android.widget.LinearLayout; | |
import android.widget.RelativeLayout; | |
public class MainActivity extends AppCompatActivity { | |
private Scene mSceneMain; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.scene_logging); | |
getFragmentManager().beginTransaction().replace(R.id.mainContainer, new Fragment2()).commit(); | |
RelativeLayout container = (RelativeLayout) findViewById(R.id.container); | |
mSceneMain = Scene.getSceneForLayout(container, R.layout.scene_main, this); | |
container.postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
TransitionManager.go(mSceneMain, new ChangeBounds().setDuration(500).setInterpolator(new DecelerateInterpolator())); | |
} | |
}, 1000); | |
} | |
} | |
// xml 1 | |
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<FrameLayout | |
android:id="@+id/mainContainer" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
</FrameLayout> | |
</RelativeLayout> | |
// xml 2 | |
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="match_parent" | |
android:background="#FFF" | |
android:layout_height="match_parent"> | |
<android.support.v7.widget.Toolbar | |
android:layout_width="match_parent" | |
android:layout_height="64.5dp" | |
android:background="#7277A5" | |
android:id="@+id/mainContainer" | |
android:layout_alignParentTop="true" | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:gravity="center"> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="match_parent" | |
android:gravity="center" | |
android:layout_gravity="left" | |
android:layout_centerHorizontal="true" | |
android:id="@+id/toolbar_back_button" | |
android:text="Retour" | |
android:textColor="#FFFFFF" | |
android:textSize="16sp" | |
android:onClick="onClick" | |
android:clickable="true"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:layout_centerHorizontal="true" | |
android:id="@+id/toolbar_title" | |
android:textColor="#FFFFFF" | |
android:textSize="16.5dp" | |
android:textStyle="bold" /> | |
</android.support.v7.widget.Toolbar> | |
<RelativeLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@id/mainContainer"> | |
<TextView | |
android:id="@+id/title_textView" | |
android:layout_width="match_parent" | |
android:layout_height="70dp" | |
android:text="Selectionnez au minimum 3 topics" | |
android:gravity="center" | |
android:textColor="#676767" | |
android:textSize="14sp" | |
android:visibility="invisible"/> | |
<ListView | |
android:id="@+id/listView" | |
android:dividerHeight="0.2dp" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@+id/title_textView"> | |
</ListView> | |
<LinearLayout | |
android:background="#7277A5" | |
android:id="@+id/theme_linearLayout" | |
android:layout_width="match_parent" | |
android:layout_height="80dp" | |
android:orientation="vertical" | |
android:layout_alignParentBottom="true" | |
android:gravity="center" | |
android:paddingRight="10dp" | |
android:paddingLeft="10dp" | |
android:visibility="invisible"> | |
<Button | |
android:id="@+id/startButton" | |
android:layout_width="match_parent" | |
android:layout_height="44.1dp" | |
android:text="C'EST PARTI" | |
android:textSize="12sp" | |
android:textColor="#FFFFFF"/> | |
</LinearLayout> | |
</RelativeLayout> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment