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
public class MainActivity extends AppCompatActivity | |
{ | |
private static final long MOVE_DEFAULT_TIME = 1000; | |
private static final long FADE_DEFAULT_TIME = 300; | |
private FragmentManager mFragmentManager; | |
private Handler mDelayedTransactionHandler = new Handler(); | |
private Runnable mRunnable = this::performTransition; |
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
private void performTransition() | |
{ | |
if (isDestroyed()) | |
{ | |
return; | |
} | |
Fragment previousFragment = mFragmentManager.findFragmentById(R.id.fragment_container); | |
Fragment nextFragment = Fragment2.newInstance(); | |
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); |
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
private void performTransition() | |
{ | |
if (isDestroyed()) | |
{ | |
return; | |
} | |
Fragment previousFragment = mFragmentManager.findFragmentById(R.id.fragment_container); | |
Fragment nextFragment = Fragment2.newInstance(); | |
FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); |
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
public class Fragment2 extends Fragment | |
{ | |
@BindView(R.id.fragment2_logo) ImageView mLogo; | |
@BindView(R.id.fragment2_button) ImageButton mButton; | |
public Fragment2() | |
{ | |
// Required empty public constructor | |
} |
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
public class Fragment1 extends Fragment | |
{ | |
@BindView(R.id.fragment1_logo) ImageView mLogo; | |
public Fragment1() | |
{ | |
// Required empty public constructor | |
} | |
public static Fragment1 newInstance() |
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
public class MainActivity extends AppCompatActivity | |
{ | |
private static final long MOVE_DEFAULT_TIME = 1000; | |
private static final long FADE_DEFAULT_TIME = 300; | |
private FragmentManager mFragmentManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ |
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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<RelativeLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true"> | |
<ImageView |
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
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<RelativeLayout | |
android:layout_width="300dp" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true"> | |
<ImageView |
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
public class MainActivity extends AppCompatActivity | |
{ | |
private static final long MOVE_DEFAULT_TIME = 1000; | |
private static final long FADE_DEFAULT_TIME = 300; | |
private FragmentManager mFragmentManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ |
NewerOlder