Example usage for android.animation StateListAnimator addState

List of usage examples for android.animation StateListAnimator addState

Introduction

In this page you can find the example usage for android.animation StateListAnimator addState.

Prototype

public void addState(int[] specs, Animator animator) 

Source Link

Document

Associates the given animator with the provided drawable state specs so that it will be run when the View's drawable state matches the specs.

Usage

From source file:com.b44t.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_MessengerProj);
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (AndroidUtilities.isTablet()) {
        setContentView(R.layout.intro_layout_tablet);
    } else {//  ww  w .  ja  v a  2  s  . c o  m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4,
                R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 };
        titles = new int[] { R.string.Intro7Headline, R.string.Intro6Headline, R.string.Intro5Headline,
                R.string.Intro4Headline, R.string.Intro3Headline, R.string.Intro2Headline,
                R.string.Intro1Headline };
        messages = new int[] { R.string.Intro7Message, R.string.Intro6Message, R.string.Intro5Message,
                R.string.Intro4Message, R.string.Intro3Message, R.string.Intro2Message,
                R.string.Intro1Message };
    } else {
        icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4,
                R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 };
        titles = new int[] { R.string.Intro1Headline, R.string.Intro2Headline, R.string.Intro3Headline,
                R.string.Intro4Headline, R.string.Intro5Headline, R.string.Intro6Headline,
                R.string.Intro7Headline };
        messages = new int[] { R.string.Intro1Message, R.string.Intro2Message, R.string.Intro3Message,
                R.string.Intro4Message, R.string.Intro5Message, R.string.Intro6Message,
                R.string.Intro7Message };
    }
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging)
            .toUpperCase(Locale.getDefault()));
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            startActivity(intent2);
            finish();
        }
    });

    justCreated = true;
}

From source file:ir.irani.telecam.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);/*from  w  w w  . j a  v a  2s.c  om*/
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (AndroidUtilities.isTablet()) {
        setContentView(R.layout.intro_layout_tablet);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4,
                R.drawable.intro3, R.drawable.intro2, R.drawable.intro1, };
        titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title,
                R.string.Page3Title, R.string.Page2Title, R.string.Page1Title };
        messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message,
                R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message };
    } else {
        icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4,
                R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 };
        titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title,
                R.string.Page5Title, R.string.Page6Title, R.string.Page7Title };
        messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message,
                R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message };
    }
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    startMessagingButton
            .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase());
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            startActivity(intent2);
            finish();
        }
    });
    if (BuildVars.DEBUG_VERSION) {
        startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                ConnectionsManager.getInstance().switchBackend();
                return true;
            }
        });
    }

    justCreated = true;
}

From source file:kr.wdream.ui.IntroActivity.java

private void initView() {
    viewPager = (ViewPager) findViewById(kr.wdream.storyshop.R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(kr.wdream.storyshop.R.id.start_messaging_button);
    startMessagingButton.setText(LocaleController
            .getString("StartMessaging", kr.wdream.storyshop.R.string.StartMessaging).toUpperCase());
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));//  ww  w.j a va 2 s .  c o m
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(kr.wdream.storyshop.R.id.icon_image1);
    topImage2 = (ImageView) findViewById(kr.wdream.storyshop.R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(kr.wdream.storyshop.R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            kr.wdream.storyshop.R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            kr.wdream.storyshop.R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            Log.d(LOG_TAG, "startActivity(LaunchActivity), fromIntro : " + true);
            startActivity(intent2);
            finish();
        }
    });
    if (BuildVars.DEBUG_VERSION) {
        startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                ConnectionsManager.getInstance().switchBackend();
                return true;
            }
        });
    }

    justCreated = true;
}

From source file:net.bluehack.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);//from  ww w. jav a2  s .  c  om
    super.onCreate(savedInstanceState);
    Theme.loadRecources(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (AndroidUtilities.isTablet()) {
        setContentView(R.layout.intro_layout_tablet);
        View imageView = findViewById(R.id.background_image_intro);
        BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.catstile);
        drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        imageView.setBackgroundDrawable(drawable);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.intro_layout);
    }

    if (LocaleController.isRTL) {
        icons = new int[] { R.drawable.intro7, R.drawable.intro6, R.drawable.intro5, R.drawable.intro4,
                R.drawable.intro3, R.drawable.intro2, R.drawable.intro1 };
        titles = new int[] { R.string.Page7Title, R.string.Page6Title, R.string.Page5Title, R.string.Page4Title,
                R.string.Page3Title, R.string.Page2Title, R.string.Page1Title };
        messages = new int[] { R.string.Page7Message, R.string.Page6Message, R.string.Page5Message,
                R.string.Page4Message, R.string.Page3Message, R.string.Page2Message, R.string.Page1Message };
    } else {
        icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4,
                R.drawable.intro5, R.drawable.intro6, R.drawable.intro7 };
        titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title,
                R.string.Page5Title, R.string.Page6Title, R.string.Page7Title };
        messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message,
                R.string.Page4Message, R.string.Page5Message, R.string.Page6Message, R.string.Page7Message };
    }
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton
            .setText(LocaleController.getString("StartMessaging", R.string.StartMessaging).toUpperCase());
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                .setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator
                .ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                .setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int i) {

        }

        @Override
        public void onPageScrollStateChanged(int i) {
            if (i == ViewPager.SCROLL_STATE_IDLE || i == ViewPager.SCROLL_STATE_SETTLING) {
                if (lastPage != viewPager.getCurrentItem()) {
                    lastPage = viewPager.getCurrentItem();

                    final ImageView fadeoutImage;
                    final ImageView fadeinImage;
                    if (topImage1.getVisibility() == View.VISIBLE) {
                        fadeoutImage = topImage1;
                        fadeinImage = topImage2;

                    } else {
                        fadeoutImage = topImage2;
                        fadeinImage = topImage1;
                    }

                    fadeinImage.bringToFront();
                    fadeinImage.setImageResource(icons[lastPage]);
                    fadeinImage.clearAnimation();
                    fadeoutImage.clearAnimation();

                    Animation outAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_out);
                    outAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            fadeoutImage.setVisibility(View.GONE);
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    Animation inAnimation = AnimationUtils.loadAnimation(IntroActivity.this,
                            R.anim.icon_anim_fade_in);
                    inAnimation.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {
                            fadeinImage.setVisibility(View.VISIBLE);
                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });

                    fadeoutImage.startAnimation(outAnimation);
                    fadeinImage.startAnimation(inAnimation);
                }
            }
        }
    });

    startMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (startPressed) {
                return;
            }
            startPressed = true;
            Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
            intent2.putExtra("fromIntro", true);
            startActivity(intent2);
            finish();
        }
    });
    if (BuildVars.DEBUG_VERSION) {
        startMessagingButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                ConnectionsManager.getInstance().switchBackend();
                return true;
            }
        });
    }

    justCreated = true;
}

From source file:ticwear.design.widget.FloatingActionButtonAnimator.java

void setPressedTranslationZ(float translationZ) {

    StateListAnimator stateListAnimator = mView.getStateListAnimator();
    if (stateListAnimator == null) {
        stateListAnimator = new StateListAnimator();
    }/* ww w  . ja  v  a2  s  . c  om*/

    // Animate translationZ to our value when pressed or focused
    stateListAnimator.addState(PRESSED_ENABLED_STATE_SET,
            setupAnimator(ObjectAnimator.ofFloat(mView, "translationZ", translationZ)));
    stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET,
            setupAnimator(ObjectAnimator.ofFloat(mView, "translationZ", translationZ)));
    // Animate translationZ to 0 otherwise
    stateListAnimator.addState(EMPTY_STATE_SET,
            setupAnimator(ObjectAnimator.ofFloat(mView, "translationZ", 0f)));

    mView.setStateListAnimator(stateListAnimator);
}

From source file:com.myhexaville.iconanimations.gooey_fab.GooeyFab.java

void onElevationsChanged(final float elevation, final float pressedTranslationZ) {
    final StateListAnimator stateListAnimator = new StateListAnimator();

    // Animate elevation and translationZ to our values when pressed
    AnimatorSet set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(ObjectAnimator
            .ofFloat(this, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, set);

    // Same deal for when we're focused
    set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(ObjectAnimator
            .ofFloat(this, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, set);

    // Animate translationZ to 0 if not pressed
    set = new AnimatorSet();
    // Use an AnimatorSet to set a start delay since there is a bug with ValueAnimator that
    // prevents it from being cancelled properly when used with a StateListAnimator.
    AnimatorSet anim = new AnimatorSet();
    anim.play(ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, 0f).setDuration(PRESSED_ANIM_DURATION))
            .after(PRESSED_ANIM_DURATION);
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(anim);
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(ENABLED_STATE_SET, set);

    // Animate everything to 0 when disabled
    set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", 0f).setDuration(0))
            .with(ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, 0f).setDuration(0));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(EMPTY_STATE_SET, set);

    setStateListAnimator(stateListAnimator);
}

From source file:android.support.design.widget.FloatingActionButtonLollipop.java

@Override
void onElevationsChanged(final float elevation, final float pressedTranslationZ) {
    final int sdk = Build.VERSION.SDK_INT;
    if (sdk == 21) {
        // Animations produce NPE in version 21. Bluntly set the values instead (matching the
        // logic in the animations below).
        if (mView.isEnabled()) {
            mView.setElevation(elevation);
            if (mView.isFocused() || mView.isPressed()) {
                mView.setTranslationZ(pressedTranslationZ);
            } else {
                mView.setTranslationZ(0);
            }/*from  w w  w . ja  va  2  s.co m*/
        } else {
            mView.setElevation(0);
            mView.setTranslationZ(0);
        }
    } else {
        final StateListAnimator stateListAnimator = new StateListAnimator();

        // Animate elevation and translationZ to our values when pressed
        AnimatorSet set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0)).with(ObjectAnimator
                .ofFloat(mView, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, set);

        // Same deal for when we're focused
        set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0)).with(ObjectAnimator
                .ofFloat(mView, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, set);

        // Animate translationZ to 0 if not pressed
        set = new AnimatorSet();
        set.playSequentially(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0),
                // This is a no-op animation which exists here only for introducing the duration
                // because setting the delay (on the next animation) via "setDelay" or "after"
                // can trigger a NPE between android versions 22 and 24 (due to a framework
                // bug). The issue has been fixed in version 25.
                ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, mView.getTranslationZ())
                        .setDuration(PRESSED_ANIM_DELAY),
                ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, 0f).setDuration(PRESSED_ANIM_DURATION));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(ENABLED_STATE_SET, set);

        // Animate everything to 0 when disabled
        set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", 0f).setDuration(0))
                .with(ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, 0f).setDuration(0));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(EMPTY_STATE_SET, set);

        mView.setStateListAnimator(stateListAnimator);
    }

    if (mShadowViewDelegate.isCompatPaddingEnabled()) {
        updatePadding();
    }
}

From source file:com.commonsware.cwac.crossport.design.widget.FloatingActionButtonLollipop.java

@Override
void onElevationsChanged(final float elevation, final float pressedTranslationZ) {
    if (Build.VERSION.SDK_INT == 21) {
        // Animations produce NPE in version 21. Bluntly set the values instead (matching the
        // logic in the animations below).
        if (mView.isEnabled()) {
            mView.setElevation(elevation);
            if (mView.isFocused() || mView.isPressed()) {
                mView.setTranslationZ(pressedTranslationZ);
            } else {
                mView.setTranslationZ(0);
            }/*from ww  w  . j a v  a  2 s  . c  o  m*/
        } else {
            mView.setElevation(0);
            mView.setTranslationZ(0);
        }
    } else {
        final StateListAnimator stateListAnimator = new StateListAnimator();

        // Animate elevation and translationZ to our values when pressed
        AnimatorSet set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0)).with(ObjectAnimator
                .ofFloat(mView, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, set);

        // Same deal for when we're focused
        set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0)).with(ObjectAnimator
                .ofFloat(mView, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, set);

        // Animate translationZ to 0 if not pressed
        set = new AnimatorSet();
        List<Animator> animators = new ArrayList<>();
        animators.add(ObjectAnimator.ofFloat(mView, "elevation", elevation).setDuration(0));
        if (Build.VERSION.SDK_INT >= 22 && Build.VERSION.SDK_INT <= 24) {
            // This is a no-op animation which exists here only for introducing the duration
            // because setting the delay (on the next animation) via "setDelay" or "after"
            // can trigger a NPE between android versions 22 and 24 (due to a framework
            // bug). The issue has been fixed in version 25.
            animators.add(ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, mView.getTranslationZ())
                    .setDuration(PRESSED_ANIM_DELAY));
        }
        animators.add(ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, 0f).setDuration(PRESSED_ANIM_DURATION));
        set.playSequentially(animators.toArray(new ObjectAnimator[0]));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(ENABLED_STATE_SET, set);

        // Animate everything to 0 when disabled
        set = new AnimatorSet();
        set.play(ObjectAnimator.ofFloat(mView, "elevation", 0f).setDuration(0))
                .with(ObjectAnimator.ofFloat(mView, View.TRANSLATION_Z, 0f).setDuration(0));
        set.setInterpolator(ANIM_INTERPOLATOR);
        stateListAnimator.addState(EMPTY_STATE_SET, set);

        mView.setStateListAnimator(stateListAnimator);
    }

    if (mShadowViewDelegate.isCompatPaddingEnabled()) {
        updatePadding();
    }
}

From source file:com.myhexaville.iconanimations.gooey_fab.GooeyFabCompatImpl.java

@TargetApi(21)
void onElevationsChanged(final float elevation, final float pressedTranslationZ) {
    final StateListAnimator stateListAnimator = new StateListAnimator();

    // Animate elevation and translationZ to our values when pressed
    AnimatorSet set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(ObjectAnimator
            .ofFloat(this, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, set);

    // Same deal for when we're focused
    set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(ObjectAnimator
            .ofFloat(this, View.TRANSLATION_Z, pressedTranslationZ).setDuration(PRESSED_ANIM_DURATION));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, set);

    // Animate translationZ to 0 if not pressed
    set = new AnimatorSet();
    // Use an AnimatorSet to set a start delay since there is a bug with ValueAnimator that
    // prevents it from being cancelled properly when used with a StateListAnimator.
    AnimatorSet anim = new AnimatorSet();
    anim.play(ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, 0f).setDuration(PRESSED_ANIM_DURATION))
            .after(PRESSED_ANIM_DURATION);
    set.play(ObjectAnimator.ofFloat(this, "elevation", elevation).setDuration(0)).with(anim);
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(ENABLED_STATE_SET, set);

    // Animate everything to 0 when disabled
    set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(this, "elevation", 0f).setDuration(0))
            .with(ObjectAnimator.ofFloat(this, View.TRANSLATION_Z, 0f).setDuration(0));
    set.setInterpolator(ANIM_INTERPOLATOR);
    stateListAnimator.addState(EMPTY_STATE_SET, set);

    setStateListAnimator(stateListAnimator);
}

From source file:org.telegram.ui.ThemePreviewActivity.java

@Override
public View createView(Context context) {
    page1 = new FrameLayout(context);
    ActionBarMenu menu = actionBar.createMenu();
    final ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true)
            .setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
                @Override//from   w w  w.j  a va  2s  . c  o m
                public void onSearchExpand() {

                }

                @Override
                public boolean canCollapseSearch() {
                    return true;
                }

                @Override
                public void onSearchCollapse() {

                }

                @Override
                public void onTextChanged(EditText editText) {

                }
            });
    item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));

    actionBar.setBackButtonDrawable(new MenuDrawable());
    actionBar.setAddToContainer(false);
    actionBar.setTitle(LocaleController.getString("ThemePreview", R.string.ThemePreview));

    page1 = new FrameLayout(context) {
        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            int widthSize = MeasureSpec.getSize(widthMeasureSpec);
            int heightSize = MeasureSpec.getSize(heightMeasureSpec);

            setMeasuredDimension(widthSize, heightSize);

            measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
            int actionBarHeight = actionBar.getMeasuredHeight();
            if (actionBar.getVisibility() == VISIBLE) {
                heightSize -= actionBarHeight;
            }
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
            layoutParams.topMargin = actionBarHeight;
            listView.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY));

            measureChildWithMargins(floatingButton, widthMeasureSpec, 0, heightMeasureSpec, 0);
        }

        @Override
        protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
            boolean result = super.drawChild(canvas, child, drawingTime);
            if (child == actionBar && parentLayout != null) {
                parentLayout.drawHeaderShadow(canvas,
                        actionBar.getVisibility() == VISIBLE ? actionBar.getMeasuredHeight() : 0);
            }
            return result;
        }
    };
    page1.addView(actionBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

    listView = new RecyclerListView(context);
    listView.setVerticalScrollBarEnabled(true);
    listView.setItemAnimator(null);
    listView.setLayoutAnimation(null);
    listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT
            : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
    page1.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT,
            Gravity.LEFT | Gravity.TOP));

    floatingButton = new ImageView(context);
    floatingButton.setScaleType(ImageView.ScaleType.CENTER);

    Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56),
            Theme.getColor(Theme.key_chats_actionBackground),
            Theme.getColor(Theme.key_chats_actionPressedBackground));
    if (Build.VERSION.SDK_INT < 21) {
        Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow).mutate();
        shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
        CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
        combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
        drawable = combinedDrawable;
    }
    floatingButton.setBackgroundDrawable(drawable);
    floatingButton.setColorFilter(
            new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
    floatingButton.setImageResource(R.drawable.floating_pencil);
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed },
                ObjectAnimator
                        .ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4))
                        .setDuration(200));
        animator.addState(new int[] {},
                ObjectAnimator
                        .ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2))
                        .setDuration(200));
        floatingButton.setStateListAnimator(animator);
        floatingButton.setOutlineProvider(new ViewOutlineProvider() {
            @SuppressLint("NewApi")
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
            }
        });
    }
    page1.addView(floatingButton,
            LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60,
                    Build.VERSION.SDK_INT >= 21 ? 56 : 60,
                    (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM,
                    LocaleController.isRTL ? 14 : 0, 0, LocaleController.isRTL ? 0 : 14, 14));

    dialogsAdapter = new DialogsAdapter(context);
    listView.setAdapter(dialogsAdapter);

    page2 = new SizeNotifierFrameLayout(context) {
        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            int widthSize = MeasureSpec.getSize(widthMeasureSpec);
            int heightSize = MeasureSpec.getSize(heightMeasureSpec);

            setMeasuredDimension(widthSize, heightSize);

            measureChildWithMargins(actionBar2, widthMeasureSpec, 0, heightMeasureSpec, 0);
            int actionBarHeight = actionBar2.getMeasuredHeight();
            if (actionBar2.getVisibility() == VISIBLE) {
                heightSize -= actionBarHeight;
            }
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView2.getLayoutParams();
            layoutParams.topMargin = actionBarHeight;
            listView2.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY),
                    MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY));
        }

        @Override
        protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
            boolean result = super.drawChild(canvas, child, drawingTime);
            if (child == actionBar2 && parentLayout != null) {
                parentLayout.drawHeaderShadow(canvas,
                        actionBar2.getVisibility() == VISIBLE ? actionBar2.getMeasuredHeight() : 0);
            }
            return result;
        }
    };
    page2.setBackgroundImage(Theme.getCachedWallpaper());

    actionBar2 = createActionBar(context);
    actionBar2.setBackButtonDrawable(new BackDrawable(false));
    actionBar2.setTitle("Reinhardt");
    actionBar2.setSubtitle(LocaleController.formatDateOnline(System.currentTimeMillis() / 1000 - 60 * 60));
    page2.addView(actionBar2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));

    listView2 = new RecyclerListView(context);
    listView2.setVerticalScrollBarEnabled(true);
    listView2.setItemAnimator(null);
    listView2.setLayoutAnimation(null);
    listView2.setPadding(0, AndroidUtilities.dp(4), 0, AndroidUtilities.dp(4));
    listView2.setClipToPadding(false);
    listView2.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, true));
    listView2.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT
            : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
    page2.addView(listView2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT,
            Gravity.LEFT | Gravity.TOP));

    messagesAdapter = new MessagesAdapter(context);
    listView2.setAdapter(messagesAdapter);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    final ViewPager viewPager = new ViewPager(context);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int position) {
            dotsContainer.invalidate();
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });
    viewPager.setAdapter(new PagerAdapter() {

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return object == view;
        }

        @Override
        public int getItemPosition(Object object) {
            return POSITION_UNCHANGED;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            View view = position == 0 ? page1 : page2;
            container.addView(view);
            return view;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public void unregisterDataSetObserver(DataSetObserver observer) {
            if (observer != null) {
                super.unregisterDataSetObserver(observer);
            }
        }
    });
    AndroidUtilities.setViewPagerEdgeEffectColor(viewPager, Theme.getColor(Theme.key_actionBarDefault));
    frameLayout.addView(viewPager, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
            LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, 48));

    View shadow = new View(context);
    shadow.setBackgroundResource(R.drawable.header_shadow_reverse);
    frameLayout.addView(shadow,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 48));

    FrameLayout bottomLayout = new FrameLayout(context);
    bottomLayout.setBackgroundColor(0xffffffff);
    frameLayout.addView(bottomLayout,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM));

    dotsContainer = new View(context) {

        private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

        @Override
        protected void onDraw(Canvas canvas) {
            int selected = viewPager.getCurrentItem();
            for (int a = 0; a < 2; a++) {
                paint.setColor(a == selected ? 0xff999999 : 0xffcccccc);
                canvas.drawCircle(AndroidUtilities.dp(3 + 15 * a), AndroidUtilities.dp(4),
                        AndroidUtilities.dp(3), paint);
            }
        }
    };
    bottomLayout.addView(dotsContainer, LayoutHelper.createFrame(22, 8, Gravity.CENTER));

    TextView cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setTextColor(0xff19a7e8);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(Theme.createSelectorDrawable(0x2f000000, 0));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
    cancelButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    bottomLayout.addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Theme.applyPreviousTheme();
            parentLayout.rebuildAllFragmentViews(false);
            finishFragment();
        }
    });

    TextView doneButton = new TextView(context);
    doneButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    doneButton.setTextColor(0xff19a7e8);
    doneButton.setGravity(Gravity.CENTER);
    doneButton.setBackgroundDrawable(Theme.createSelectorDrawable(0x2f000000, 0));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    doneButton.setText(LocaleController.getString("ApplyTheme", R.string.ApplyTheme).toUpperCase());
    doneButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    bottomLayout.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));
    doneButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            applied = true;
            parentLayout.rebuildAllFragmentViews(false);
            Theme.applyThemeFile(themeFile, applyingTheme.name, false);
            finishFragment();
        }
    });

    return fragmentView;
}