Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xml parsing error while setting the animations #33

Closed
shrenikm opened this issue Jul 12, 2015 · 7 comments
Closed

xml parsing error while setting the animations #33

shrenikm opened this issue Jul 12, 2015 · 7 comments

Comments

@shrenikm
Copy link

Hi,

Its a great library that you've made. It helped a lot :)

But when I tried to set the animation to the button using :

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

it throws an error saying cannot resolve method setShowAnimation(android.content.res.xmlResourseParser)

I guess I'm not implementing it correctly. Any help would be appreciated.

(I'm using android api level 15)

@vbaidak
Copy link
Member

vbaidak commented Jul 12, 2015

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

@shrenikm
Copy link
Author

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);
    }
}

@vbaidak
Copy link
Member

vbaidak commented Jul 12, 2015

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

@shrenikm
Copy link
Author

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.

@vbaidak
Copy link
Member

vbaidak commented Jul 12, 2015

Post a stacktrace here please

@shrenikm
Copy link
Author

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

@vbaidak
Copy link
Member

vbaidak commented Jul 12, 2015

Great

@vbaidak vbaidak closed this as completed Jul 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants