Coder Social home page Coder Social logo

Comments (7)

vbaidak avatar vbaidak commented on August 23, 2024

Hi,
There is nothing wrong with the code you are using:

actionButton.setShowAnimation(getResources().getAnimation(R.anim.fab_fade_in));
actionButton.setShowAnimation(ActionButton.Animations.FADE_IN);

and actually it works well in the demo application.

Please provide the full code example, which contains the ActionButton object instantiation, setting the animation type and forcing its playing.
Also, provide the version, which you are using

from fab.

shrenikm avatar shrenikm commented on August 23, 2024

I'm using android version 4.0.4

Heres the code:

package --------------------------;


import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.software.shell.fab.ActionButton;


public class MainActivity extends ActionBarActivity {

    ActionButton mActionButton;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mActionButton = (ActionButton)findViewById(R.id.action_button);
        mActionButton.setButtonColor(getResources().getColor(R.color.app_theme_blue));
        mActionButton.setButtonColorPressed(getResources().getColor(R.color.app_dark_theme_blue));

        // The error is caused in the following statement.

        mActionButton.setShowAnimation(getResources().getAnimation(R.anim.fab_fade_in));

        mActionButton.setShowAnimation(ActionButton.Animations.FADE_IN);



        mActionButton.playShowAnimation();


        // The following code is for the listview fragment. It works properly 

        if(findViewById(R.id.fragment_container)!=null)
        {
            if(savedInstanceState!=null)
            {
                return;
            }

            GeneralListFragment generalListFragment = new GeneralListFragment();

            generalListFragment.setArguments(getIntent().getExtras());

            getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, generalListFragment).commit();
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

from fab.

vbaidak avatar vbaidak commented on August 23, 2024

Why are you setting showAnimation twice? You can choose between either of these 2 methods that you are using

from fab.

shrenikm avatar shrenikm commented on August 23, 2024

You mean either

mActionButton.setShowAnimation(getResources().getAnimation(R.anim.fab_fade_in));

or

mActionButton.setShowAnimation(ActionButton.Animations.FADE_IN); ?

I tried running only mActionButton.setShowAnimation(ActionButton.Animations.FADE_IN);
but it didnt work.

from fab.

vbaidak avatar vbaidak commented on August 23, 2024

Post a stacktrace here please

from fab.

shrenikm avatar shrenikm commented on August 23, 2024

It's resolved now. I thought that the animation would take place automatically when I scrolled. Just realised that it works if I implement my scroll listeners. My bad.

Thanks :D

from fab.

vbaidak avatar vbaidak commented on August 23, 2024

Great

from fab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.