Example usage for android.widget ImageView bringToFront

List of usage examples for android.widget ImageView bringToFront

Introduction

In this page you can find the example usage for android.widget ImageView bringToFront.

Prototype

public void bringToFront() 

Source Link

Document

Change the view's z order in the tree, so it's on top of other sibling views.

Usage

From source file:edu.ucsb.cs.cs185.inspirante.Inbox.InboxActivity.java

protected void startDetailDialog(int position) {
    Bundle arguments = new Bundle();
    arguments.putInt("CARD_INDEX", position);
    arguments.putString("FROM", "GRID");

    DetailBlurDialog fragment = new DetailBlurDialog();

    fragment.setArguments(arguments);/*from w ww  .  j a v a2  s . com*/
    FragmentManager ft = getSupportFragmentManager();

    fragment.show(ft, "dialog");

    Bitmap map = takeScreenShot(mInboxActivity);
    Bitmap fast = CardsFragment.BlurBuilder.blur(mInboxActivity, map);
    final Drawable draw = new BitmapDrawable(getResources(), fast);

    ImageView background = (ImageView) findViewById(R.id.activity_background);
    background.bringToFront();
    background.setScaleType(ImageView.ScaleType.FIT_XY);
    background.setImageDrawable(draw);
}

From source file:edu.ucsb.cs.cs185.inspirante.share.ShareActivity.java

protected void startDetailDialog(int position) {

    Bundle arguments = new Bundle();
    arguments.putString("FROM", "SINGLE_IMAGE");
    arguments.putString("URL", mCardImages.get(position).mUrl);
    arguments.putInt("TYPE", mCardImages.get(position).mType);
    DetailBlurDialog fragment = new DetailBlurDialog();

    fragment.setArguments(arguments);//from www.  j a  v  a 2  s.  c  o  m
    FragmentManager ft = getSupportFragmentManager();

    fragment.show(ft, "dialog");
    //TODO: move takeScreenShot method to somewhere else from CardsFragment

    Bitmap map = CardsFragment.takeScreenShot(this);
    Bitmap fast = CardsFragment.BlurBuilder.blur(getApplicationContext(), map);
    final Drawable draw = new BitmapDrawable(getResources(), fast);

    ImageView background = (ImageView) findViewById(R.id.activity_background);
    background.bringToFront();
    background.setScaleType(ImageView.ScaleType.FIT_XY);
    background.setImageDrawable(draw);

}

From source file:edu.ucsb.cs.cs185.inspirante.searchbyranking.SearchByRankingFragment.java

protected void startDetailDialog(Cards.CardImage cardImage) {

    Bundle arguments = new Bundle();
    arguments.putString("FROM", "SINGLE_IMAGE");
    arguments.putString("URL", cardImage.mUrl);
    arguments.putInt("TYPE", cardImage.mType);
    DetailBlurDialog fragment = new DetailBlurDialog();

    fragment.setArguments(arguments);// www  . ja va  2  s.c  o  m
    FragmentManager ft = getActivity().getSupportFragmentManager();

    fragment.show(ft, "dialog");
    //TODO: move takeScreenShot method to somewhere else from CardsFragment

    Bitmap map = CardsFragment.takeScreenShot(getActivity());
    Bitmap fast = CardsFragment.BlurBuilder.blur(getContext(), map);
    final Drawable draw = new BitmapDrawable(getResources(), fast);

    ImageView background = (ImageView) getActivity().findViewById(R.id.activity_background);
    background.bringToFront();
    background.setScaleType(ImageView.ScaleType.FIT_XY);
    background.setImageDrawable(draw);
}

From source file:edu.ucsb.cs.cs185.inspirante.collectiondetails.CollectionDetailsActivity.java

protected void startDetailDialog(int position) {
    Bundle arguments = new Bundle();
    arguments.putInt("CARD_INDEX", mCardIndex);
    arguments.putInt("IMAGE_INDEX", position);

    arguments.putString("FROM", "DETAILS");
    DetailBlurDialog fragment = new DetailBlurDialog();

    fragment.setArguments(arguments);//  www  .j a  v a  2 s.c om
    FragmentManager ft = this.getSupportFragmentManager();

    fragment.show(ft, "dialog");
    //TODO: move takeScreenShot method to somewhere else from CardsFragment

    Bitmap map = CardsFragment.takeScreenShot(this);
    Bitmap fast = CardsFragment.BlurBuilder.blur(getApplicationContext(), map);
    final Drawable draw = new BitmapDrawable(getResources(), fast);

    ImageView background = (ImageView) findViewById(R.id.activity_background);
    background.bringToFront();
    background.setScaleType(ImageView.ScaleType.FIT_XY);
    background.setImageDrawable(draw);
}

From source file:edu.ucsb.cs.cs185.inspirante.collections.CardsFragment.java

protected void startDetailDialog(int position) {
    Bundle arguments = new Bundle();
    arguments.putInt("CARD_INDEX", position);
    arguments.putString("FROM", "GRID");

    DetailBlurDialog fragment = new DetailBlurDialog();

    fragment.setArguments(arguments);//from  w ww.  j  a v a  2s  .  c om
    FragmentManager ft = getActivity().getSupportFragmentManager();

    fragment.show(ft, "dialog");

    Bitmap map = takeScreenShot(getActivity());
    Bitmap fast = BlurBuilder.blur(getContext(), map);
    final Drawable draw = new BitmapDrawable(getResources(), fast);

    ImageView background = (ImageView) getActivity().findViewById(R.id.activity_background);
    background.bringToFront();
    background.setScaleType(ImageView.ScaleType.FIT_XY);
    background.setImageDrawable(draw);
}

From source file:spinnersample.lalongooo.com.viewpager.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.intro_layout);

    icons = new int[] { R.drawable.app_overview_1_buy, R.drawable.app_overview_2_smartphone,
            R.drawable.app_overview_3_save_money, R.drawable.app_overview_4_coupons };
    messages = new int[] { R.string.app_overview_1st_item_text, R.string.app_overview_2nd_item_text,
            R.string.app_overview_3rd_item_text, R.string.app_overview_4th_item_text };
    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    startMessagingButton.setText(getString(R.string.StartMessaging));
    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, this),
                        AndroidUtilities.dp(4, this)).setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ",
                AndroidUtilities.dp(4, this), AndroidUtilities.dp(2, this)).setDuration(200));
        startMessagingButton.setStateListAnimator(animator);
    }/*  ww w. j  a  v  a 2s  .c  om*/
    topImage1 = (ImageView) findViewById(R.id.icon_image1);
    topImage2 = (ImageView) findViewById(R.id.icon_image2);
    indicator = (CirclePageIndicator) findViewById(R.id.indicator);

    topImage2.setVisibility(View.GONE);
    viewPager.setAdapter(new IntroAdapter());
    viewPager.setPageMargin(0);
    viewPager.setOffscreenPageLimit(1);
    indicator.setViewPager(viewPager);
    indicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

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

        @Override
        public void onPageSelected(int position) {

        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

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

From source file:vn.com.zinza.zinzamessenger.activity.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    mPrefManager = new PrefManager(this);
    if (!mPrefManager.isFirstTimeLaunch()) {
        launchHomeScreen();/*from ww w .j a  v a2s .  com*/
        finish();
    }
    setContentView(R.layout.intro_layout);

    mIcons = new int[] { R.drawable.zinza_icon, R.drawable.chat, R.drawable.search_friend,
            R.drawable.transfer_files };
    mMessages = new int[] { R.string.app_overview_1st_item_text, R.string.app_overview_2nd_item_text,
            R.string.app_overview_3rd_item_text, R.string.app_overview_4th_item_text };
    mViewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    mStartMessagingButton = (TextView) this.findViewById(R.id.start_messaging_button);
    mStartLogin = (TextView) this.findViewById(R.id.startLogin);
    mStartMessagingButton.setText(getString(R.string.StartMessaging));
    if (Build.VERSION.SDK_INT >= 21) {
        StateListAnimator animator = new StateListAnimator();
        animator.addState(new int[] { android.R.attr.state_pressed },
                ObjectAnimator.ofFloat(mStartMessagingButton, "translationZ", AndroidUtilities.dp(2, this),
                        AndroidUtilities.dp(4, this)).setDuration(200));
        animator.addState(new int[] {}, ObjectAnimator.ofFloat(mStartMessagingButton, "translationZ",
                AndroidUtilities.dp(4, this), AndroidUtilities.dp(2, this)).setDuration(200));
        mStartMessagingButton.setStateListAnimator(animator);
    }
    mTopImage1 = (ImageView) findViewById(R.id.icon_image1);
    mTopImage2 = (ImageView) findViewById(R.id.icon_image2);
    mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);

    mTopImage2.setVisibility(View.GONE);
    mViewPager.setAdapter(new IntroAdapter());
    mViewPager.setPageMargin(0);
    mViewPager.setOffscreenPageLimit(1);
    mIndicator.setViewPager(mViewPager);
    mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            if (mViewPager.getCurrentItem() == 3) {
                mStartLogin.setVisibility(View.VISIBLE);
                mStartMessagingButton.setVisibility(View.INVISIBLE);
            } else {
                mStartLogin.setVisibility(View.INVISIBLE);
                mStartMessagingButton.setVisibility(View.VISIBLE);
            }
            if (mLastPage != mViewPager.getCurrentItem()) {
                mLastPage = mViewPager.getCurrentItem();

                final ImageView fadeoutImage;
                final ImageView fadeinImage;
                if (mTopImage1.getVisibility() == View.VISIBLE) {
                    fadeoutImage = mTopImage1;
                    fadeinImage = mTopImage2;

                } else {
                    fadeoutImage = mTopImage2;
                    fadeinImage = mTopImage1;
                }

                fadeinImage.bringToFront();
                fadeinImage.setImageResource(mIcons[mLastPage]);
                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);
            }
        }

        @Override
        public void onPageSelected(int position) {

        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    mStartMessagingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mStartPressed) {
                return;
            }
            mStartPressed = true;
            launchHomeScreen();
        }
    });

    mStartLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            launchHomeScreen();
        }
    });

}

From source file:com.odt.kandani.View.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);//  www.j av  a 2 s  . c om
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_layout);

    icons = new int[] { R.drawable.intro1, R.drawable.intro2, R.drawable.intro3, R.drawable.intro4 };
    titles = new int[] { R.string.Page1Title, R.string.Page2Title, R.string.Page3Title, R.string.Page4Title };
    messages = new int[] { R.string.Page1Message, R.string.Page2Message, R.string.Page3Message,
            R.string.Page4Message };

    viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
    TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
    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.setOnPageChangeListener(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) {
            Intent intent = new Intent(IntroActivity.this, MainActivity.class);
            IntroActivity.this.startActivity(intent);
            overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
            IntroActivity.this.finish();
        }
    });

    justCreated = true;
}

From source file:org.mareatlantica.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);/* ww  w.j av a 2s. c o  m*/
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    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));
    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.setOnPageChangeListener(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:me.cpwc.nibblegram.ui.IntroActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.Theme_TMessages);/*from  ww w  . jav  a2 s.co  m*/
    super.onCreate(savedInstanceState);
    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.setText(LocaleController.getString("StartMessaging", R.string.StartMessaging));
    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.setOnPageChangeListener(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;
}