Example usage for android.support.v4.view ViewPager setVisibility

List of usage examples for android.support.v4.view ViewPager setVisibility

Introduction

In this page you can find the example usage for android.support.v4.view ViewPager setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.mediatek.contacts.activities.ActivitiesUtils.java

public static void setAllFramgmentShow(View contactsUnavailableView,
        DefaultContactBrowseListFragment allFragment, Activity activity, ViewPager tabPager,
        ContactsUnavailableFragment contactsUnavailableFragment, Integer providerStatus) {

    boolean isNeedShow = showContactsUnavailableView(contactsUnavailableView, contactsUnavailableFragment,
            providerStatus);/*from w  ww  .  ja  va2  s . co m*/

    boolean isUsingTwoPanes = PhoneCapabilityTester.isUsingTwoPanes(activity);
    Log.i(TAG, "[setAllFramgmentShow]isNeedShow = " + isNeedShow + ",isUsingTwoPanes = " + isUsingTwoPanes);
    if (isNeedShow) {
        if (null != allFragment) {
            // mTabPager only exists while 1-pane thus the code should be
            // modified for 2-panes
            if (isUsingTwoPanes && tabPager != null) {
                tabPager.setVisibility(View.VISIBLE);
            }
            allFragment.setEnabled(true);
            allFragment.closeWaitCursor();
            if (!isUsingTwoPanes && tabPager != null) {
                allFragment.setProfileHeader();
            }
        } else {
            Log.e(TAG, "[setAllFramgmentShow]mAllFragment is null");
        }
        isNeedShow = false;
    } else {
        if (!isUsingTwoPanes && tabPager != null) {
            tabPager.setVisibility(View.GONE);
        }
    }
}

From source file:com.marcosedo.lagramola.HelpFragment.java

private void lostVisibility() {
    TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tabLayout);
    tabLayout.setVisibility(View.VISIBLE);
    ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.viewPager);
    viewPager.setVisibility(View.VISIBLE);
    FrameLayout outTabContent = (FrameLayout) getActivity().findViewById(R.id.outTabContent);
    outTabContent.setVisibility(View.GONE);
}

From source file:com.marcosedo.lagramola.HelpFragment.java

private void getVisibility() {
    TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tabLayout);
    tabLayout.setVisibility(View.GONE);
    ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.viewPager);
    viewPager.setVisibility(View.GONE);
    FrameLayout outTabContent = (FrameLayout) getActivity().findViewById(R.id.outTabContent);
    outTabContent.setVisibility(View.VISIBLE);
}

From source file:org.worshipsongs.activity.CustomYoutubeBoxActivity.java

@NonNull
private ViewPager getViewPager(SongContentLandScapeViewerPageAdapter songContentLandScapeViewerPageAdapter) {
    ViewPager pager = (ViewPager) findViewById(R.id.view_pager);
    pager.setAdapter(songContentLandScapeViewerPageAdapter);
    pager.setVisibility(isLandScape() ? View.VISIBLE : View.GONE);
    return pager;
}

From source file:com.marcosedo.lagramola.MainActivity.java

private void getVisibilityOnTabs() {
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
    tabLayout.setVisibility(View.VISIBLE);
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
    viewPager.setVisibility(View.VISIBLE);
    FrameLayout outTabContent = (FrameLayout) findViewById(R.id.outTabContent);
    outTabContent.setVisibility(View.GONE);
}

From source file:org.glucosio.android.activity.MainActivity.java

public void checkIfEmptyLayout() {
    LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.activity_main_empty_layout);
    ViewPager pager = (ViewPager) findViewById(R.id.activity_main_pager);

    if (presenter.isdbEmpty()) {
        pager.setVisibility(View.GONE);
        tabLayout.setVisibility(View.GONE);
        emptyLayout.setVisibility(View.VISIBLE);

        bottomSheetAddDialogView = getLayoutInflater().inflate(R.layout.fragment_add_bottom_dialog_disabled,
                null);//from  ww w .j  a v  a  2 s.co m

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (getResources().getConfiguration().orientation == 1) {
                // If Portrait choose vertical curved line
                ImageView arrow = (ImageView) findViewById(R.id.activity_main_arrow);
                arrow.setBackground(getResources().getDrawable(R.drawable.curved_line_vertical));
            } else {
                // Else choose horizontal one
                ImageView arrow = (ImageView) findViewById(R.id.activity_main_arrow);
                arrow.setBackground((getResources().getDrawable(R.drawable.curved_line_horizontal)));
            }
        }
    } else {
        pager.setVisibility(View.VISIBLE);
        emptyLayout.setVisibility(View.GONE);
        bottomSheetAddDialogView = getLayoutInflater().inflate(R.layout.fragment_add_bottom_dialog, null);
    }
}

From source file:org.glucosio.android.activity.MainActivity.java

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

    GlucosioApplication application = (GlucosioApplication) getApplication();

    initPresenters(application);/*  w  w w .j  ava 2 s  .  co m*/
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    tabLayout = (TabLayout) findViewById(R.id.activity_main_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.activity_main_pager);

    if (toolbar != null) {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setElevation(0);
        getSupportActionBar().setTitle("");
        getSupportActionBar().setLogo(R.drawable.ic_logo);
    }

    homePagerAdapter = new HomePagerAdapter(getSupportFragmentManager(), getApplicationContext());

    viewPager.setAdapter(homePagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            super.onTabSelected(tab);
        }
    });

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

        @Override
        public void onPageSelected(int position) {
            if (position == 2) {
                hideFabAnimation();
                LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.activity_main_empty_layout);
                ViewPager pager = (ViewPager) findViewById(R.id.activity_main_pager);
                if (pager.getVisibility() == View.GONE) {
                    pager.setVisibility(View.VISIBLE);
                    emptyLayout.setVisibility(View.INVISIBLE);
                }
            } else {
                showFabAnimation();
                checkIfEmptyLayout();
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    FloatingActionButton fabAddReading = (FloatingActionButton) findViewById(
            R.id.activity_main_fab_add_reading);
    fabAddReading.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            bottomSheetAddDialog.show();
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    });

    bottomSheetAddDialog = new BottomSheetDialog(this);

    // Add Nav Drawer
    final PrimaryDrawerItem itemSettings = new PrimaryDrawerItem().withName(R.string.action_settings)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_settings_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemExport = new PrimaryDrawerItem().withName(R.string.sidebar_backup_export)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_backup_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemFeedback = new PrimaryDrawerItem().withName(R.string.menu_support)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_announcement_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemAbout = new PrimaryDrawerItem().withName(R.string.preferences_about_glucosio)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_info_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemInvite = new PrimaryDrawerItem().withName(R.string.action_invite)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_face_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemDonate = new PrimaryDrawerItem().withName(R.string.about_donate)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_favorite_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemA1C = new PrimaryDrawerItem().withName(R.string.activity_converter_title)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_calculator_a1c_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemReminders = new PrimaryDrawerItem().withName(R.string.activity_reminders_title)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_alarm_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);

    DrawerBuilder drawerBuilder = new DrawerBuilder().withActivity(this).withTranslucentStatusBar(false)
            .withToolbar(toolbar).withActionBarDrawerToggle(true)
            .withAccountHeader(new AccountHeaderBuilder().withActivity(this)
                    .withHeaderBackground(R.drawable.drawer_header).build())
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem.equals(itemSettings)) {
                        // Settings
                        openPreferences();
                    } else if (drawerItem.equals(itemAbout)) {
                        // About
                        startAboutActivity();
                    } else if (drawerItem.equals(itemFeedback)) {
                        // Feedback
                        openSupportDialog();
                    } else if (drawerItem.equals(itemInvite)) {
                        // Invite
                        showInviteDialog();
                    } else if (drawerItem.equals(itemExport)) {
                        // Export
                        startExportActivity();
                    } else if (drawerItem.equals(itemDonate)) {
                        // Donate
                        openDonateIntent();
                    } else if (drawerItem.equals(itemA1C)) {
                        openA1CCalculator();
                    } else if (drawerItem.equals(itemReminders)) {
                        openRemindersActivity();
                    }
                    return false;
                }
            });

    if (isPlayServicesAvailable()) {
        drawerBuilder.addDrawerItems(itemA1C, itemReminders, itemExport, itemSettings, itemFeedback, itemAbout,
                itemDonate, itemInvite).withSelectedItem(-1).build();
    } else {
        drawerBuilder.addDrawerItems(itemA1C, itemReminders, itemExport, itemSettings, itemFeedback, itemAbout,
                itemDonate).withSelectedItem(-1).build();
    }

    // Restore pager position
    Bundle b = getIntent().getExtras();
    if (b != null) {
        viewPager.setCurrentItem(b.getInt("pager"));
    }

    checkIfEmptyLayout();
    bottomSheetAddDialog.setContentView(bottomSheetAddDialogView);
    bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetAddDialogView.getParent());
    bottomSheetBehavior.setHideable(false);

    Analytics analytics = application.getAnalytics();
    Log.i("MainActivity", "Setting screen name: " + "main");
    analytics.reportScreen("Main Activity");
}

From source file:org.medcada.android.activity.MainActivity.java

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

    GlucosioApplication application = (GlucosioApplication) getApplication();
    //startActivity(new Intent(this,PinCodeActivity.class));
    initPresenters(application);/*from  w  w  w .  j  av a 2s .  co m*/
    setContentView(R.layout.activity_main);
    showDebugDBAddressLogToast();
    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
    tabLayout = (TabLayout) findViewById(R.id.activity_main_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.activity_main_pager);

    if (toolbar != null) {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setElevation(0);
        getSupportActionBar().setTitle("assistBUD");
        getSupportActionBar().setLogo(R.drawable.ic_logo);
    }

    homePagerAdapter = new HomePagerAdapter(getSupportFragmentManager(), getApplicationContext());

    viewPager.setAdapter(homePagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPager) {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            super.onTabSelected(tab);
        }
    });

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

        @Override
        public void onPageSelected(int position) {
            if (position == 2) {
                hideFabAnimation();
                LinearLayout emptyLayout = (LinearLayout) findViewById(R.id.activity_main_empty_layout);
                ViewPager pager = (ViewPager) findViewById(R.id.activity_main_pager);
                if (pager.getVisibility() == View.GONE) {
                    pager.setVisibility(View.VISIBLE);
                    emptyLayout.setVisibility(View.INVISIBLE);
                }
            } else {
                showFabAnimation();
                checkIfEmptyLayout();
            }
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

    FloatingActionButton fabAddReading = (FloatingActionButton) findViewById(
            R.id.activity_main_fab_add_reading);
    fabAddReading.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            bottomSheetAddDialog.show();
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    });

    bottomSheetAddDialog = new BottomSheetDialog(this);

    // Add Nav Drawer
    final PrimaryDrawerItem itemSettings = new PrimaryDrawerItem().withName(R.string.action_settings)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_settings_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemExport = new PrimaryDrawerItem().withName(R.string.sidebar_backup_export)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_backup_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemFeedback = new PrimaryDrawerItem().withName(R.string.menu_support)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_announcement_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemAbout = new PrimaryDrawerItem().withName(R.string.preferences_about_glucosio)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_info_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemInvite = new PrimaryDrawerItem().withName(R.string.action_invite)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_face_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    //final PrimaryDrawerItem itemDonate = new PrimaryDrawerItem().withName(R.string.about_donate).withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_favorite_grey_24dp, null)).withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemA1C = new PrimaryDrawerItem().withName("Profile")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_person_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itememergency = new PrimaryDrawerItem().withName("Emergency")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_add_alert_black_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemmedications = new PrimaryDrawerItem().withName("Medications")
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_calculator_a1c_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);
    final PrimaryDrawerItem itemReminders = new PrimaryDrawerItem().withName(R.string.activity_reminders_title)
            .withIcon(VectorDrawableCompat.create(getResources(), R.drawable.ic_alarm_grey_24dp, null))
            .withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD);

    DrawerBuilder drawerBuilder = new DrawerBuilder().withActivity(this).withTranslucentStatusBar(false)
            .withToolbar(toolbar).withActionBarDrawerToggle(true)
            .withAccountHeader(new AccountHeaderBuilder().withActivity(this)

                    .withHeaderBackground(R.drawable.drawer_header).build())
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem.equals(itemSettings)) {
                        // Settings
                        openPreferences();
                    } else if (drawerItem.equals(itemAbout)) {
                        // About
                        startAboutActivity();
                    } else if (drawerItem.equals(itemFeedback)) {
                        // Feedback
                        openSupportDialog();
                    } else if (drawerItem.equals(itemInvite)) {
                        // Invite
                        showInviteDialog();
                    } else if (drawerItem.equals(itemExport)) {
                        // Export
                        startExportActivity();
                    }
                    //                        else if (drawerItem.equals(itemDonate)) {
                    //                            // Donate
                    //                            openDonateIntent();
                    //                        }

                    else if (drawerItem.equals(itemA1C)) {
                        startProfileActivity();
                    }

            else if (drawerItem.equals(itemmedications)) {
                        startMedicationActivity();
                    } else if (drawerItem.equals(itemReminders)) {
                        openRemindersActivity();
                    }
                    return false;
                }
            });

    if (isPlayServicesAvailable()) {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout,
                //itemDonate,
                itemInvite).withSelectedItem(-1).build();
    } else {
        drawerBuilder.addDrawerItems(itemA1C, itememergency, itemmedications, itemReminders, itemExport,
                itemSettings, itemFeedback, itemAbout
        // itemDonate
        ).withSelectedItem(-1).build();
    }

    // Restore pager position
    Bundle b = getIntent().getExtras();
    if (b != null) {
        viewPager.setCurrentItem(b.getInt("pager"));
    }

    checkIfEmptyLayout();
    bottomSheetAddDialog.setContentView(bottomSheetAddDialogView);
    bottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetAddDialogView.getParent());
    bottomSheetBehavior.setHideable(false);

    Analytics analytics = application.getAnalytics();
    Log.i("MainActivity", "Setting screen name: " + "main");
    analytics.reportScreen("Main Activity");
}

From source file:org.gnucash.android.ui.transaction.TransactionsActivity.java

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

    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    mTitlePageIndicator = (TitlePageIndicator) findViewById(R.id.titles);
    mSectionHeaderTransactions = (TextView) findViewById(R.id.section_header_transactions);

    if (sLastTitleColor == -1) //if this is first launch of app. Previous launches would have set the color already
        sLastTitleColor = getResources().getColor(R.color.title_green);

    mAccountId = getIntent().getLongExtra(UxArgument.SELECTED_ACCOUNT_ID, -1);

    mAccountsDbAdapter = new AccountsDbAdapter(this);

    setupActionBarNavigation();// w  ww  . j a va2  s . c om

    if (getIntent().getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) {
        pager.setVisibility(View.GONE);
        mTitlePageIndicator.setVisibility(View.GONE);

        initializeCreateOrEditTransaction();
    } else { //load the transactions list
        mSectionHeaderTransactions.setVisibility(View.GONE);

        PagerAdapter pagerAdapter = new AccountViewPagerAdapter(getSupportFragmentManager());
        pager.setAdapter(pagerAdapter);
        mTitlePageIndicator.setViewPager(pager);

        pager.setCurrentItem(INDEX_TRANSACTIONS_FRAGMENT);
    }

    // done creating, activity now running
    mActivityRunning = true;
}

From source file:com.poloure.simplerss.AsyncNewTagAdapters.java

@Override
protected void onPostExecute(TreeMap<Long, FeedItem>[] result) {
    ViewPager pager = (ViewPager) m_activity.findViewById(R.id.viewpager);
    PagerAdapter pagerAdapter = pager.getAdapter();
    int pageCount = pagerAdapter.getCount();

    for (int i = 0; pageCount > i; i++) {
        // Get the tag page and skip ListViews that are null.
        ListFragmentTag fragment = FragmentFeeds.getViewPagerFragment(i);
        LinkedMapAdapter<Long, FeedItem> adapterTag = fragment.getListAdapter();
        ListViewFeeds listView = fragment.getListView();

        if (null == adapterTag) {
            fragment.setListAdapter(new AdapterFeedItems(m_activity, result[i]));
            listView.setSelectionOldestUnread(m_activity.getReadItemTimes());
        } else {/*w ww  . j a v  a2 s  .  c o m*/
            long topKeyBefore = 0L;
            int top = 0;

            // If there are items in the currently viewed page, save the position.
            boolean firstLoad = null == listView || 0 == listView.getCount();
            if (!firstLoad) {
                // Get the time of the top item.
                int topVisibleItem = listView.getFirstVisiblePosition();
                topKeyBefore = adapterTag.getKey(topVisibleItem);

                View v = listView.getChildAt(0);
                top = null == v ? 0 : v.getTop();
            }

            // Update the feedItems in the adapter.
            adapterTag.replaceAll(result[i]);

            // Now find the position of the item with the time timeBefore.
            if (firstLoad) {
                listView.setSelectionOldestUnread(m_activity.getReadItemTimes());
            } else {
                int newPos = adapterTag.indexOf(topKeyBefore);
                listView.setSelectionFromTop(newPos, top - listView.getPaddingTop());
            }
        }
    }

    // If the pager is invisible, use a fade in animation.
    if (View.VISIBLE != pager.getVisibility()) {
        pager.setVisibility(View.VISIBLE);
        AlphaAnimation animation = new AlphaAnimation(0.0F, 1.0F);
        animation.setDuration(300);
        pager.startAnimation(animation);
    }
}