Results of some experiments to determine which Activity lifecycle methods get called in certain situations.
Launch:
- activity.onCreate()
- activity.onStart()
- activity.onResume()
- activity.onWindowFocusChanged(true)
| public class ParallaxPageTransformer implements ViewPager.PageTransformer { | |
| public void transformPage(View view, float position) { | |
| int pageWidth = view.getWidth(); | |
| if (position < -1) { // [-Infinity,-1) | |
| // This page is way off-screen to the left. | |
| view.setAlpha(1); |
| public void transformPage(View view, float position) { | |
| int pageWidth = view.getWidth(); | |
| if (position < -1) { // [-Infinity,-1) | |
| // This page is way off-screen to the left. | |
| view.setAlpha(0); | |
| } else if (position <= 1) { // [-1,1] | |
| package com.github.manuelpeinado.toolbartest; | |
| import android.graphics.Color; | |
| import android.graphics.drawable.Drawable; | |
| import android.os.Bundle; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.support.v7.widget.Toolbar; | |
| import android.view.Menu; | |
| import android.view.View; |
| #!/usr/bin/env bash | |
| # I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
| # well, so I wrote my own script to do the simple job of converting package names. | |
| # | |
| # You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
| # | |
| # It'll run faster on a clean build because then there are fewer files to scan over. | |
| # | |
| # Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |