Example usage for android.widget ImageView startAnimation

List of usage examples for android.widget ImageView startAnimation

Introduction

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

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:free.yhc.netmbuddy.YTSearchFragment.java

protected void showLoadingLookAndFeel() {
    View loadingv = mRootv.findViewById(R.id.loading);
    if (View.VISIBLE == loadingv.getVisibility()) {
        eAssert(View.VISIBLE != mListv.getVisibility());
        return;/*  w  ww  .jav a 2 s  .c om*/
    }

    ImageView iv = (ImageView) loadingv.findViewById(R.id.loading_img);
    TextView tv = (TextView) loadingv.findViewById(R.id.loading_msg);
    tv.setText(R.string.loading);
    loadingv.setVisibility(View.VISIBLE);
    mRootv.findViewById(R.id.error_text).setVisibility(View.GONE);
    mListv.setVisibility(View.GONE);
    iv.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rotate));
}

From source file:it.gulch.linuxday.android.activities.MainActivity.java

private MenuItem enableRefreshAnimation(MenuItem refreshItem) {
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null);

    Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh);
    rotation.setRepeatCount(Animation.INFINITE);
    iv.startAnimation(rotation);

    return MenuItemCompat.setActionView(refreshItem, iv);
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Get a money from the moneybox making an animation.
 * //from   www  .  jav a  2s .c o  m
 * @param m
 *            Movement to be got
 */
public void getMovement(Movement m) {
    ImageView money;

    money = findMovementImage(m);
    if (money != null) {
        AnimationSet moneyGet;
        moneyGet = createGetAnimation(money, findLayout());

        money.startAnimation(moneyGet);
    }
}

From source file:com.cachirulop.moneybox.fragment.MoneyboxFragment.java

/**
 * Delete a movement from the moneybox making an animation.
 * // www.  j a v  a2 s .  c  o  m
 * @param m
 *            Movement to be deleted.
 */
public void deleteMovement(Movement m) {
    ImageView money;

    money = findMovementImage(m);
    if (money != null) {
        AnimationSet moneyDelete;

        moneyDelete = createDeleteAnimation(money, findLayout());

        money.startAnimation(moneyDelete);
    }
}

From source file:com.wenwen.chatuidemo.activity.NewFragment.java

private void iniVariable() {
    // TODO Auto-generated method stub
    viewDefault = getActivity().getLayoutInflater().inflate(R.layout.layout_0, null);
    // ???//www. j  a  va 2 s. c o m
    hotview = getActivity().getLayoutInflater().inflate(R.layout.layout_1, null);
    childview = getActivity().getLayoutInflater().inflate(R.layout.layout_2, null);
    bothsexview = getActivity().getLayoutInflater().inflate(R.layout.layout_3, null);
    feelview = getActivity().getLayoutInflater().inflate(R.layout.layout_4, null);
    hotListView = (ListView) hotview.findViewById(R.id.news_list);

    // TODO Auto-generated method stub
    mViews = new ArrayList<View>();
    mViews.add(viewDefault);
    mViews.add(hotview);
    mViews.add(childview);
    mViews.add(bothsexview);
    mViews.add(feelview);
    mViewPager.setAdapter(new MyPagerAdapter());
    progressDialog = DialogUtil.createProgressDialog(getActivity(), "??...");

    ImageView img = (ImageView) progressDialog.findViewById(R.id.progress_img);
    Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.progress_anim);
    img.startAnimation(animation);
    progressDialog.show();
    Thread thread = new Thread(hostpotrun);
    thread.start();

}

From source file:org.videolan.vlc2.gui.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle("VLC " + getVersion(getActivity()));

    View v = inflater.inflate(R.layout.about, container, false);

    mTabHost = (TabHost) v.findViewById(android.R.id.tabhost);
    mFlingViewGroup = (FlingViewGroup) v.findViewById(R.id.fling_view_group);

    WebView t = (WebView) v.findViewById(R.id.webview);
    String revision = Util.readAsset("revision.txt", "Unknown revision");
    t.loadData(Util.readAsset("licence.htm", "").replace("!COMMITID!", revision), "text/html", "UTF8");

    TextView link = (TextView) v.findViewById(R.id.main_link);
    link.setText(Html.fromHtml(this.getString(R.string.about_link)));

    String builddate = Util.readAsset("builddate.txt", "Unknown");
    String builder = Util.readAsset("builder.txt", "unknown");

    TextView compiled = (TextView) v.findViewById(R.id.main_compiled);
    compiled.setText(builder + " (" + builddate + ")");
    TextView textview_rev = (TextView) v.findViewById(R.id.main_revision);
    textview_rev.setText(getResources().getString(R.string.revision) + " " + revision + " (" + builddate + ")");

    final ImageView logo = (ImageView) v.findViewById(R.id.logo);
    logo.setOnClickListener(new OnClickListener() {
        @Override/*from  ww  w. j ava2 s.  c o m*/
        public void onClick(View v) {
            AnimationSet anim = new AnimationSet(true);
            RotateAnimation rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);
            rotate.setDuration(800);
            rotate.setInterpolator(new DecelerateInterpolator());
            anim.addAnimation(rotate);
            logo.startAnimation(anim);
        }
    });

    mTabHost.setup();

    addNewTab(mTabHost, "about", getResources().getString(R.string.about));
    addNewTab(mTabHost, "licence", getResources().getString(R.string.licence));

    mTabHost.setCurrentTab(mCurrentTab);
    mFlingViewGroup.snapToScreen(mCurrentTab);

    mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            mCurrentTab = mTabHost.getCurrentTab();
            mFlingViewGroup.smoothScrollTo(mCurrentTab);
        }
    });

    mFlingViewGroup.setOnViewSwitchedListener(new FlingViewGroup.ViewSwitchListener() {
        @Override
        public void onSwitching(float progress) {
        }

        @Override
        public void onSwitched(int position) {
            mTabHost.setCurrentTab(position);
        }

        @Override
        public void onTouchDown() {
        }

        @Override
        public void onTouchUp() {
        }

        @Override
        public void onTouchClick() {
        }

        @Override
        public void onBackSwitched() {
            MainActivity activity = (MainActivity) getActivity();
            activity.popSecondaryFragment();
        }
    });

    return v;
}

From source file:net.bither.fragment.hot.AddAddressHotHDMFragment.java

private void showFlash(ImageView iv) {
    ImageView[] ivs = new ImageView[] { ivHotLight, ivColdLight, ivServerLight };
    for (ImageView v : ivs) {
        if (v != iv) {
            v.clearAnimation();//  w w  w.j a va 2 s . com
            v.setVisibility(View.INVISIBLE);
        }
    }
    if (iv != null) {
        iv.setVisibility(View.VISIBLE);
        iv.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.hdm_keychain_add_one_part_flash));

    }
}

From source file:org.bwgz.quotation.activity.QuotationActivity.java

private void startLoadAnimation() {
    if (menu != null) {
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null);

        Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh);
        rotation.setRepeatCount(Animation.INFINITE);
        iv.startAnimation(rotation);

        MenuItem item = menu.findItem(R.id.actionbar_new);
        item.setActionView(iv);/*from w w w . j  a v  a2  s .  co  m*/
        item.setEnabled(false);
    }
}

From source file:com.wenwen.chatuidemo.activity.NewFragment.java

/**
 * ??//from   w w  w.  j  av a 2s. c  om
 */
public void loadSubPager(int position) {

    if (position == 2) { // 
        childListView = (ListView) childview.findViewById(R.id.news_list);
        // guoNeiListView.setDivider(null); //
        childListView.setOnScrollListener(new OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {

            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {

            }
        });
        progressDialog = DialogUtil.createProgressDialog(getActivity(), "??...");
        ImageView img = (ImageView) progressDialog.findViewById(R.id.progress_img);
        Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.progress_anim);
        img.startAnimation(animation);
        progressDialog.show();
        Thread thread = new Thread(childunnable);
        thread.start();
    } else if (position == 3) { // 
        bothsexListView = (ListView) bothsexview.findViewById(R.id.news_list);
        // guoJiListView.setDivider(null); //
        bothsexListView.setOnScrollListener(new OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {

            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {

            }
        });
        progressDialog = DialogUtil.createProgressDialog(getActivity(), "??...");
        ImageView img = (ImageView) progressDialog.findViewById(R.id.progress_img);
        Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.progress_anim);
        img.startAnimation(animation);
        progressDialog.show();
        Thread thread = new Thread(hotspot);
        thread.start();
    } else if (position == 4) { // 
        // junShiListView.setDivider(null); //
        feelListView = (ListView) feelview.findViewById(R.id.news_list);
        feelListView.setOnScrollListener(new OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                    int totalItemCount) {

            }
        });
        progressDialog = DialogUtil.createProgressDialog(getActivity(), "??...");
        ImageView img = (ImageView) progressDialog.findViewById(R.id.progress_img);
        Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.progress_anim);
        img.startAnimation(animation);
        progressDialog.show();
        Thread thread = new Thread(feelingsrung);
        thread.start();
    }
}

From source file:com.github.mobile.gauges.ui.ItemListFragment.java

private void showRefreshAnimation(MenuItem item) {
    hideRefreshAnimation();//ww  w. ja v  a  2  s .c  o m

    refreshItem = item;

    ImageView refreshActionView = (ImageView) getActivity().getLayoutInflater().inflate(layout.action_view,
            null);
    refreshActionView.setImageResource(drawable.ic_action_refresh);
    refreshItem.setActionView(refreshActionView);
    Animation animation = AnimationUtils.loadAnimation(getActivity(), anim.refresh);
    animation.setRepeatMode(RESTART);
    animation.setRepeatCount(INFINITE);
    refreshActionView.startAnimation(animation);
}