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

update SlidingMenu Mode from another Fragment #756

Open
cloudshooterhuman opened this issue Jul 18, 2016 · 0 comments
Open

update SlidingMenu Mode from another Fragment #756

cloudshooterhuman opened this issue Jul 18, 2016 · 0 comments

Comments

@cloudshooterhuman
Copy link

cloudshooterhuman commented Jul 18, 2016

Hi,

I have a SettingFragment that contains options to change app language, for example when I change language to french I must set the menu to the LEFT ;setMode(SlidingMenu.LEFT), and when I change it to arabic I must set the languague to the RIGHT setMode(SlidingMenu.RIGHT).

To achieve taht I use the observer pattern as following :

    MainActivity extends FragmentActivity {

    ....
    @Override
    public void propertyChange(PropertyChangeEvent event) {
        final String mLanguge = (String) event.getNewValue();

        Log.v("Langue",mLanguge );
        MainMenuActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if(mLanguge .equals(getResources().getString(R.string.params_arabe_key_pref)))
                    menu.setMode(SlidingMenu.RIGHT);
                else
                    menu.setMode(SlidingMenu.LEFT);

                // refresh the SlidingMenu
                menu.invalidate();
            }
        });
    }

(Note this methode is declared inside the MainActivity and it's called when the user change the app language)

@cloudshooterhuman cloudshooterhuman changed the title update SlidingMenu Mode inside non-UI Thread update SlidingMenu Mode from an other Fragment Jul 18, 2016
@cloudshooterhuman cloudshooterhuman changed the title update SlidingMenu Mode from an other Fragment update SlidingMenu Mode from another Fragment Jul 18, 2016
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

1 participant