Example usage for android.view.animation BounceInterpolator BounceInterpolator

List of usage examples for android.view.animation BounceInterpolator BounceInterpolator

Introduction

In this page you can find the example usage for android.view.animation BounceInterpolator BounceInterpolator.

Prototype

public BounceInterpolator() 

Source Link

Usage

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Create dynamically an android animation for a coin or a bill droping into
 * the moneybox./*from   ww w .  j ava 2 s .c o  m*/
 * 
 * @param img
 *            ImageView to receive the animation
 * @param layout
 *            Layout that paint the image
 * @param curr
 *            Currency value of the image
 * @return Set of animations to apply to the image
 */
private AnimationSet createDropAnimation(ImageView img, View layout, CurrencyValueDef curr) {
    AnimationSet result;

    result = new AnimationSet(false);
    result.setFillAfter(true);

    // Fade in
    AlphaAnimation fadeIn;

    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setDuration(300);
    result.addAnimation(fadeIn);

    // drop
    TranslateAnimation drop;
    int bottom;

    bottom = Math.abs(layout.getHeight() - img.getLayoutParams().height);
    drop = new TranslateAnimation(1.0f, 1.0f, 1.0f, bottom);
    drop.setStartOffset(300);
    drop.setDuration(1500);

    if (curr.getType() == CurrencyValueDef.MoneyType.COIN) {
        drop.setInterpolator(new BounceInterpolator());
    } else {
        // drop.setInterpolator(new DecelerateInterpolator(0.7f));
        drop.setInterpolator(new AnticipateOvershootInterpolator());
    }

    result.addAnimation(drop);

    return result;
}

From source file:com.rowland.hashtrace.ui.fragments.SearchFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // The CursorAdapter will take data from a source and use it to populate the ListView it's attached to.
    mTweetListAdapter = new TweetListAdapter(getActivity(), null, 0);
    creator = new SwipeMenuCreator() {

        @Override//  ww  w .  ja  v a  2  s .c o  m
        public void create(SwipeMenu menu) {
            // create "share" item
            SwipeMenuItem shareItem = new SwipeMenuItem(getActivity().getApplicationContext());
            // set item background
            shareItem.setBackground(new ColorDrawable(Color.rgb(211, 214, 219)));
            // set item width
            shareItem.setWidth(Utility.convertDpToPixel(100, getResources().getDisplayMetrics()));
            // set icon resource
            shareItem.setIcon(R.drawable.selector_swipemenuitem_share);
            // set item title
            shareItem.setTitle("Share");
            // set item title fontsize
            shareItem.setTitleSize(18);
            // set item title font color
            shareItem.setTitleColor(Color.WHITE);
            // add to menu
            menu.addMenuItem(shareItem);

            // create "favour" item
            SwipeMenuItem favourItem = new SwipeMenuItem(getActivity().getApplicationContext());
            // set item background
            favourItem.setBackground(new ColorDrawable(Color.rgb(211, 214, 219)));
            // set item width
            favourItem.setWidth(Utility.convertDpToPixel(100, getResources().getDisplayMetrics()));
            // set icon resource
            favourItem.setIcon(R.drawable.selector_swipemenuitem_favorite);
            // set item title
            favourItem.setTitle("Like");
            // set item title fontsize
            favourItem.setTitleSize(18);
            // set item title font color
            favourItem.setTitleColor(Color.WHITE);
            // add to menu
            menu.addMenuItem(favourItem);
        }
    };

    View rootView = inflater.inflate(R.layout.fragment_search, container, false);

    //txtQuery = (TextView) rootView.findViewById(R.id.listview_tweet_empty);
    mListView = (SwipeMenuListView) rootView.findViewById(android.R.id.list);
    mListView.setAdapter(mTweetListAdapter);
    mListView.setMenuCreator(creator);
    mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            // Do the onItemLongClick action
            mListView.smoothOpenMenu(position);

            return true;
        }
    });
    mListView.setOnMenuItemClickListener(new SwipeMenuListView.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {
            switch (index) {
            case 0:
                // Share
                shareTweet();
                break;
            case 1:
                // Favourite
                favouriteTweet();
                break;
            }
            // false : close the menu; true : not close the menu
            return false;
        }
    });
    mListView.setCloseInterpolator(new BounceInterpolator());

    // If there's instance state, mine it for useful information.
    // The end-goal here is that the user never knows that turning their
    // device sideways does crazy lifecycle related things. It should
    // feel like some stuff stretched out, or magically appeared to take
    // advantage of room, but data or place in the app was never actually *lost*.
    if (savedInstanceState != null && savedInstanceState.containsKey(SELECTED_KEY)) {
        // The listview probably hasn't even been populated yet. Actually
        // perform the
        // swapout in onLoadFinished.
        mPosition = savedInstanceState.getInt(SELECTED_KEY);
    }

    return rootView;
}

From source file:com.rowland.hashtrace.ui.fragments.subfragment.FavouriteListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // The CursorAdapter will take data from a source and use it to populate the ListView it's attached to.
    mTweetFavListAdapter = new TweetFavListAdapter(getActivity(), null, 0);
    creator = new SwipeMenuCreator() {

        @Override/*from   w w w  .  j av  a  2s.c o  m*/
        public void create(SwipeMenu menu) {
            // create "share" item
            SwipeMenuItem shareItem = new SwipeMenuItem(getActivity().getApplicationContext());
            // set item background
            shareItem.setBackground(new ColorDrawable(Color.rgb(211, 214, 219)));
            // set item width
            shareItem.setWidth(Utility.convertDpToPixel(100, getResources().getDisplayMetrics()));
            // set icon resource
            shareItem.setIcon(R.drawable.selector_swipemenuitem_share);
            // set item title
            shareItem.setTitle("Share");
            // set item title fontsize
            shareItem.setTitleSize(18);
            // set item title font color
            shareItem.setTitleColor(Color.WHITE);
            // add to menu
            menu.addMenuItem(shareItem);

            // create "favour" item
            SwipeMenuItem favourItem = new SwipeMenuItem(getActivity().getApplicationContext());
            // set item background
            favourItem.setBackground(new ColorDrawable(Color.rgb(211, 214, 219)));
            // set item width
            favourItem.setWidth(Utility.convertDpToPixel(100, getResources().getDisplayMetrics()));
            // set icon resource
            favourItem.setIcon(R.drawable.selector_swipemenuitem_discard);
            // set item title
            favourItem.setTitle("Delete");
            // set item title fontsize
            favourItem.setTitleSize(18);
            // set item title font color
            favourItem.setTitleColor(Color.WHITE);
            // add to menu
            menu.addMenuItem(favourItem);
        }
    };

    View rootView = inflater.inflate(R.layout.fragment_tweetfav_list, container, false);

    mListView = (SwipeMenuListView) rootView.findViewById(android.R.id.list);
    mListView.setAdapter(mTweetFavListAdapter);
    mListView.setMenuCreator(creator);
    mListView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            // Do the onItemLongClick action
            mListView.smoothOpenMenu(position);

            return true;
        }
    });
    mListView.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {
            switch (index) {
            case 0:
                // Share
                shareTweet();
                break;
            case 1:
                // Favourite
                DeleteTweet();
                break;
            }
            // false : close the menu; true : not close the menu
            return false;
        }
    });
    mListView.setCloseInterpolator(new BounceInterpolator());

    // If there's instance state, mine it for useful information.
    // The end-goal here is that the user never knows that turning their
    // device sideways does crazy lifecycle related things. It should
    // feel like some stuff stretched out, or magically appeared to take
    // advantage of room, but data or place in the app was never actually *lost*.
    if (savedInstanceState != null && savedInstanceState.containsKey(SELECTED_KEY)) {
        // The listview probably hasn't even been populated yet. Actually
        // perform the
        // swapout in onLoadFinished.
        mPosition = savedInstanceState.getInt(SELECTED_KEY);
    }

    return rootView;
}

From source file:org.codeforafrica.citizenreporter.eNCA.widgets.SlidingTabLayout.java

public void setBadge(int position, boolean isBadged) {
    final View badgeView = mTabStrip.findViewWithTag(makeBadgeTag(position));
    if (badgeView == null) {
        return;/*  w w w.  ja  v a  2 s . co m*/
    }
    boolean wasBadged = (badgeView.getVisibility() == View.VISIBLE);
    if (isBadged == wasBadged) {
        return;
    }

    float start = isBadged ? 0f : 1f;
    float end = isBadged ? 1f : 0f;

    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, start, end);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, start, end);
    ObjectAnimator animScale = ObjectAnimator.ofPropertyValuesHolder(badgeView, scaleX, scaleY);

    if (isBadged) {
        animScale.setInterpolator(new BounceInterpolator());
        animScale.setDuration(getContext().getResources().getInteger(android.R.integer.config_longAnimTime));
        animScale.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                badgeView.setVisibility(View.VISIBLE);
            }
        });
    } else {
        animScale.setInterpolator(new AccelerateInterpolator());
        animScale.setDuration(getContext().getResources().getInteger(android.R.integer.config_shortAnimTime));
        animScale.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                badgeView.setVisibility(View.GONE);
            }
        });
    }

    animScale.start();
}

From source file:me.tylerbwong.pokebase.gui.views.PokemonInfoView.java

private void loadChart(float[] data) {
    BarSet dataSet = new BarSet();
    float tempVal;
    for (int index = 0; index < data.length; index++) {
        tempVal = data[index];/* w  w w .  ja v a2s. co m*/
        dataSet.addBar(STATS[index], tempVal);
        stats[index].setText(String.valueOf(Math.round(tempVal)));
    }

    dataSet.setColor(ContextCompat.getColor(context, R.color.colorPrimary));
    barChart.addData(dataSet);
    barChart.setXAxis(false);
    barChart.setYAxis(false);
    barChart.setYLabels(AxisRenderer.LabelPosition.NONE);

    Animation animation = new Animation(1000);
    animation.setInterpolator(new BounceInterpolator());
    barChart.show(animation);
}

From source file:com.example.hellogooglemaps.MarkerDemoActivity.java

@Override
public boolean onMarkerClick(final Marker marker) {
    if (marker.equals(mPerth)) {
        // This causes the marker at Perth to bounce into position when it is clicked.
        final Handler handler = new Handler();
        final long start = SystemClock.uptimeMillis();
        final long duration = 1500;

        final Interpolator interpolator = new BounceInterpolator();

        handler.post(new Runnable() {
            @Override//  ww w .  j  a  v a  2 s  . c  o  m
            public void run() {
                long elapsed = SystemClock.uptimeMillis() - start;
                float t = Math.max(1 - interpolator.getInterpolation((float) elapsed / duration), 0);
                marker.setAnchor(0.5f, 1.0f + 2 * t);

                if (t > 0.0) {
                    // Post again 16ms later.
                    handler.postDelayed(this, 16);
                }
            }
        });
    } else if (marker.equals(mAdelaide)) {
        // This causes the marker at Adelaide to change color.
        marker.setIcon(BitmapDescriptorFactory.defaultMarker(new Random().nextFloat() * 360));
    }
    // We return false to indicate that we have not consumed the event and that we wish
    // for the default behavior to occur (which is for the camera to move such that the
    // marker is centered and for the marker's info window to open, if it has one).
    return false;
}

From source file:com.cyrilmottier.android.polaris2demo.MarkerDemoActivity.java

@Override
public boolean onMarkerClick(final Marker marker) {
    // This causes the marker at Perth to bounce into position when it is clicked.
    if (marker.equals(mPerth)) {
        final Handler handler = new Handler();
        final long start = SystemClock.uptimeMillis();
        Projection proj = mMap.getProjection();
        Point startPoint = proj.toScreenLocation(PERTH);
        startPoint.offset(0, -100);/*  w ww.j  a  va2  s .  co m*/
        final LatLng startLatLng = proj.fromScreenLocation(startPoint);
        final long duration = 1500;

        final Interpolator interpolator = new BounceInterpolator();

        handler.post(new Runnable() {
            @Override
            public void run() {
                long elapsed = SystemClock.uptimeMillis() - start;
                float t = interpolator.getInterpolation((float) elapsed / duration);
                double lng = t * PERTH.longitude + (1 - t) * startLatLng.longitude;
                double lat = t * PERTH.latitude + (1 - t) * startLatLng.latitude;
                marker.setPosition(new LatLng(lat, lng));

                if (t < 1.0) {
                    // Post again 16ms later.
                    handler.postDelayed(this, 16);
                }
            }
        });
    }
    // We return false to indicate that we have not consumed the event and that we wish
    // for the default behavior to occur (which is for the camera to move such that the
    // marker is centered and for the marker's info window to open, if it has one).
    return false;
}

From source file:og.android.tether.MainActivity.java

/** Called when the activity is first created. */
@TargetApi(4)/*  w w w  .  java  2s  .c  o m*/
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d(MSG_TAG, "Calling onCreate()");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Init Application
    this.application = (TetherApplication) this.getApplication();
    MainActivity.setCurrent(this);

    // Init Table-Rows
    this.startTblRow = (TableRow) findViewById(R.id.startRow);
    this.stopTblRow = (TableRow) findViewById(R.id.stopRow);
    this.radioModeImage = (ImageView) findViewById(R.id.radioModeImage);
    this.progressBar = (ProgressBar) findViewById(R.id.progressBar);
    this.progressText = (TextView) findViewById(R.id.progressText);
    this.progressTitle = (TextView) findViewById(R.id.progressTitle);
    this.downloadUpdateLayout = (RelativeLayout) findViewById(R.id.layoutDownloadUpdate);
    this.batteryTemperatureLayout = (RelativeLayout) findViewById(R.id.layoutBatteryTemp);
    this.lockButtonCheckbox = (CheckBox) findViewById(R.id.lockButton);

    this.trafficRow = (RelativeLayout) findViewById(R.id.trafficRow);
    this.downloadText = (TextView) findViewById(R.id.trafficDown);
    this.uploadText = (TextView) findViewById(R.id.trafficUp);
    this.downloadRateText = (TextView) findViewById(R.id.trafficDownRate);
    this.uploadRateText = (TextView) findViewById(R.id.trafficUpRate);
    this.batteryTemperature = (TextView) findViewById(R.id.batteryTempText);

    // Define animation
    animation = new ScaleAnimation(0.9f, 1, 0.9f, 1, // From x, to x, from y, to y
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    animation.setDuration(600);
    animation.setFillAfter(true);
    animation.setStartOffset(0);
    animation.setRepeatCount(1);
    animation.setRepeatMode(Animation.REVERSE);

    if (this.application.startupCheckPerformed == false) {
        if (this.application.settings.getLong("install_timestamp", -1) == -1) {
            long t = System.currentTimeMillis() / 1000;
            this.application.preferenceEditor.putLong("install_timestamp", t);
        }
    }

    this.application.reportStats(-1, false);

    // open ad bar
    openAdBar();

    // Startup-Check
    if (this.application.startupCheckPerformed == false) {
        this.application.startupCheckPerformed = true;

        String regId = C2DMessaging.getRegistrationId(this);
        boolean registered = this.application.settings.getBoolean("c2dm_registered", false);
        if (!registered || regId == null || "".equals(regId)) {
            Log.d(MSG_TAG, "C2DM Registering");
            C2DMessaging.register(this, DeviceRegistrar.SENDER_ID);
        } else {
            Log.d(MSG_TAG, "C2DM already registered");
        }

        // Check if required kernel-features are enabled
        if (!this.application.coretask.isNetfilterSupported()) {
            this.openNoNetfilterDialog();
            this.application.accessControlSupported = false;
            this.application.whitelist.remove();
        } else {
            // Check if access-control-feature is supported by kernel
            if (!this.application.coretask.isAccessControlSupported()) {
                if (this.application.settings.getBoolean("warning_noaccesscontrol_displayed", false) == false) {
                    this.openNoAccessControlDialog();
                    this.application.preferenceEditor.putBoolean("warning_noaccesscontrol_displayed", true);
                    this.application.preferenceEditor.commit();
                }
                this.application.accessControlSupported = false;
                this.application.whitelist.remove();
            }
        }

        // Check if binaries need to be updated
        if (this.application.binariesExists() == false || this.application.coretask.filesetOutdated()) {
            if (this.application.coretask.hasRootPermission()) {
                this.application.installFiles();
            }
        }

        // Open donate-dialog
        this.openDonateDialog();

        // Check for updates
        this.application.checkForUpdate();
    }

    // Check root-permission, files
    if (!this.application.coretask.hasRootPermission())
        openLaunchedDialog(true);

    this.rssReader = new RSSReader(getApplicationContext(), TetherApplication.FORUM_RSS_URL);
    this.rssView = (ListView) findViewById(R.id.RSSView);
    this.rssAdapter = new ArrayAdapter<Spanned>(this, R.layout.rss_item);
    this.rssView.setAdapter(this.rssAdapter);
    this.rssView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Log.d(MSG_TAG, parent + ":" + view + ":" + position + ":" + id);
            MainActivity.this.application.statRSSClicks();
            String url = null;
            try {
                url = MainActivity.this.jsonRssArray.getJSONObject(position).getString("link");
            } catch (JSONException e) {
                url = TetherApplication.FORUM_URL;
            }
            url = tagURL(url, "android", "rss", "community");
            Intent viewRssLink = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url));
            try {
                startActivity(viewRssLink);
            } catch (ActivityNotFoundException e) {
                url = tagURL(TetherApplication.FORUM_URL, "android", "rss", "community");
                viewRssLink = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url));
                try {
                    startActivity(viewRssLink);
                } catch (ActivityNotFoundException e2) {
                    e2.printStackTrace();
                }
            }
        }
    });

    this.rssPanel = (Panel) findViewById(R.id.RSSPanel);
    this.rssPanel.setInterpolator(new BounceInterpolator());
    this.rssPanel.setOnPanelListener(new OnPanelListener() {
        public void onPanelClosed(Panel panel) {
            hideCommunityText(true);
            MainActivity.this.application.preferenceEditor.putBoolean("rss_closed", true).commit();
        }

        public void onPanelOpened(Panel panel) {
            hideCommunityText(false);
            MainActivity.this.application.preferenceEditor.putBoolean("rss_closed", false).commit();
        }
    });

    this.communityText = (TextView) findViewById(R.id.communityHeader);
    this.communityText.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            MainActivity.this.rssPanel.setOpen(!MainActivity.this.rssPanel.isOpen(), true);
        }
    });
    hideCommunityText(!this.rssPanel.isOpen());

    this.bottomButtonLayout = (LinearLayout) findViewById(R.id.bottomButtonLayout);
    ((Button) findViewById(R.id.anchorLinkButton)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            startGooglePlayMeshclient("nonroot_tether");
        }
    });
    ((Button) findViewById(R.id.configButton)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            startActivityForResult(new Intent(MainActivity.this, SetupActivity.class).setAction("FOO"), 33);
        }
    });

    // Start Button
    this.startBtn = (ImageView) findViewById(R.id.startTetherBtn);
    this.startBtnListener = new OnClickListener() {
        public void onClick(View v) {
            Log.d(MSG_TAG, "StartBtn pressed ...");
            new Thread(new Runnable() {
                public void run() {
                    Intent intent = new Intent(TetherService.INTENT_MANAGE);
                    intent.putExtra("state", TetherService.MANAGE_START);
                    Log.d(MSG_TAG, "SENDING MANAGE: " + intent);
                    MainActivity.this.sendBroadcast(intent);
                }
            }).start();
        }
    };

    this.startBtn.setOnClickListener(this.startBtnListener);

    // Stop Button
    this.stopBtn = (ImageView) findViewById(R.id.stopTetherBtn);
    this.stopBtnListener = new OnClickListener() {
        public void onClick(View v) {
            Log.d(MSG_TAG, "StopBtn pressed ...");
            if (MainActivity.this.lockBtn.isChecked()) {
                Log.d(MSG_TAG, "Tether was locked ...");
                MainActivity.this.application.displayToastMessage(getString(R.string.main_activity_locked));
                return;
            }

            new Thread(new Runnable() {
                public void run() {
                    Intent intent = new Intent(TetherService.INTENT_MANAGE);
                    intent.setAction(TetherService.INTENT_MANAGE);
                    intent.putExtra("state", TetherService.MANAGE_STOP);
                    Log.d(MSG_TAG, "Sending Intent: " + intent);
                    MainActivity.this.sendBroadcast(intent);
                }
            }).start();
        }
    };
    this.stopBtn.setOnClickListener(this.stopBtnListener);

    this.lockBtn = (CompoundButton) findViewById(R.id.lockButton);
    this.lockBtnListener = new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Log.d(MSG_TAG, "LockBtn pressed ...");
        }
    };
    this.lockBtn.setOnCheckedChangeListener(this.lockBtnListener);

    // Toggles between start and stop screen
    this.toggleStartStop();
}

From source file:com.example.com.benasque2014.mercurio.PuntosInfoFragment.java

private void addPoint(LatLng point) {
    if (markers == null)
        markers = new ArrayList<Marker>();
    if (points == null)
        points = new ArrayList<LatLng>();
    MarkerOptions marker = new MarkerOptions().position(point).title("Parada " + markers.size() + 1);

    final Marker mMarker = mMap.addMarker(marker);

    //if (markers.size()==0)
    //   Toast.makeText(getActivity(), "Haga click en un punto para eliminarlo", Toast.LENGTH_SHORT).show();

    markers.add(mMarker);// w w w. ja v  a  2 s.  com

    //mPage.getData().putParcelableArrayList(PuntosInfoPage.PUNTOS_DATA_KEY, (ArrayList<? extends Parcelable>) points);
    //mPage.notifyDataChanged();

    // This causes the marker at Perth to bounce into position when it is clicked.
    final Handler handler = new Handler();
    final long start = SystemClock.uptimeMillis();
    final long duration = 1500;

    final Interpolator interpolator = new BounceInterpolator();

    handler.post(new Runnable() {
        @Override
        public void run() {
            long elapsed = SystemClock.uptimeMillis() - start;
            float t = Math.max(1 - interpolator.getInterpolation((float) elapsed / duration), 0);
            mMarker.setAnchor(0.5f, 1.0f + 2 * t);

            if (t > 0.0) {
                // Post again 16ms later.
                handler.postDelayed(this, 16);
            }
        }
    });
    //TODO: si queremos aadir lineas entre los puntos
    //addLines();
}

From source file:crackerjack.education.Indijisites.StartUp.java

@Override
public boolean onMarkerClick(final Marker marker) {
    // This method makes the marker bounce when you click on it. It's not really needed, but it's a neat feature.
    // Will expand this if offered more time.
    if (marker.equals(mBrisbane)) {
        final Handler handler = new Handler();
        final long start = SystemClock.uptimeMillis();
        Projection proj = mMap.getProjection();
        Point startPoint = proj.toScreenLocation(BRISBANE);
        startPoint.offset(0, -100);/*  ww w. j a  va2 s . co m*/
        final LatLng startLatLng = proj.fromScreenLocation(startPoint);
        final long duration = 1500;

        final Interpolator interpolator = new BounceInterpolator();

        handler.post(new Runnable() {
            @Override
            public void run() {
                long elapsed = SystemClock.uptimeMillis() - start;
                float t = interpolator.getInterpolation((float) elapsed / duration);
                double lng = t * BRISBANE.longitude + (1 - t) * startLatLng.longitude; // This allows the marker to pinpoint if offscreen (I think =/)
                double lat = t * BRISBANE.latitude + (1 - t) * startLatLng.latitude;
                marker.setPosition(new LatLng(lat, lng));

                if (t < 1.0) {
                    // Post again 16ms later
                    handler.postDelayed(this, 16);
                }
            }
        });
    }
    //False is returned to indicate we have not consumed the event and that we wish
    //for the default behaviour to occur (move to marker location).
    return false;
}