Example usage for android.view.animation AlphaAnimation setRepeatMode

List of usage examples for android.view.animation AlphaAnimation setRepeatMode

Introduction

In this page you can find the example usage for android.view.animation AlphaAnimation setRepeatMode.

Prototype

public void setRepeatMode(int repeatMode) 

Source Link

Document

Defines what this animation should do when it reaches the end.

Usage

From source file:Main.java

public static AlphaAnimation fadeBackgroundAnimation() {
    AlphaAnimation alpha = new AlphaAnimation(0.5f, 0.2f);
    alpha.setRepeatCount(Animation.INFINITE);
    alpha.setRepeatMode(Animation.REVERSE);
    alpha.setDuration(1200);//from   w w  w  .j  a  v  a2 s. c o m
    alpha.setFillAfter(true);
    return alpha;
}

From source file:Main.java

public static void alphaAnimation(View v, float fromAlpha, float toAlpha, long durationMillis,
        boolean fillAfter) {
    AlphaAnimation animation = new AlphaAnimation(fromAlpha, toAlpha);
    animation.setDuration(durationMillis);
    animation.setFillAfter(fillAfter);//from   w w w. ja va 2  s.  co  m
    animation.setRepeatMode(Animation.REVERSE);
    v.startAnimation(animation);
}

From source file:com.actionbarsherlock.sample.styledactionbar.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // TODO handle clicking the app icon/logo
        return false;
    case R.id.menu_refresh:
        // switch to a progress animation
        item.setActionView(R.layout.indeterminate_progress_action);
        return true;
    case R.id.menu_both:
        // rotation animation of green fragment
        rotateLeftFrag();/*from   ww  w.  j a v  a  2  s  .c om*/
    case R.id.menu_text:
        // alpha animation of blue fragment
        if (IS_HONEYCOMB) {
            ObjectAnimatorAlpha.invoke(rightFrag.getView());
        } else {
            AlphaAnimation alpha = new AlphaAnimation(1f, 0f);
            alpha.setRepeatMode(Animation.REVERSE);
            alpha.setRepeatCount(1);
            alpha.setDuration(800);
            rightFrag.getView().startAnimation(alpha);
        }
        return true;
    case R.id.menu_logo:
        useLogo = !useLogo;
        item.setChecked(useLogo);
        getSupportActionBar().setDisplayUseLogoEnabled(useLogo);
        return true;
    case R.id.menu_up:
        showHomeUp = !showHomeUp;
        item.setChecked(showHomeUp);
        getSupportActionBar().setDisplayHomeAsUpEnabled(showHomeUp);
        return true;
    case R.id.menu_nav_tabs:
        item.setChecked(true);
        showTabsNav();
        return true;
    case R.id.menu_nav_label:
        item.setChecked(true);
        showStandardNav();
        return true;
    case R.id.menu_nav_drop_down:
        item.setChecked(true);
        showDropDownNav();
        return true;
    case R.id.menu_bak_none:
        item.setChecked(true);
        getSupportActionBar().setBackgroundDrawable(null);
        return true;
    case R.id.menu_bak_gradient:
        item.setChecked(true);
        getSupportActionBar()
                .setBackgroundDrawable(getResources().getDrawable(R.drawable.ad_action_bar_gradient_bak));
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:com.carver.paul.truesight.Ui.CounterPicker.CounterPickerFragment.java

/**
 * Shows the loading text and pulses it. Ensures everything else is hidden
 */// w w  w.  j  ava 2 s  . c o m
protected void startLoadingAnimation() {
    mLoadingText.setVisibility(View.VISIBLE);
    mLoadingText.setAlpha(1f);

    AlphaAnimation pulseAlphaAnimation = new AlphaAnimation(0.2f, 1f);
    pulseAlphaAnimation.setDuration(300);
    pulseAlphaAnimation.setRepeatCount(Animation.INFINITE);
    pulseAlphaAnimation.setRepeatMode(Animation.REVERSE);
    mLoadingText.startAnimation(pulseAlphaAnimation);
}

From source file:com.kunze.androidlocaltodo.TaskActivityFragment.java

@Override
public void SwipedWhileDisabled() {
    AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
    animation.setDuration(50);/*from   w  w w  . j a va 2  s  . c o  m*/
    animation.setRepeatCount(5);
    animation.setRepeatMode(Animation.REVERSE);
    Button revertButton = (Button) getView().findViewById(R.id.revert_button);
    Button acceptButton = (Button) getView().findViewById(R.id.accept_button);
    revertButton.startAnimation(animation);
    acceptButton.startAnimation(animation);
}

From source file:com.pentacog.mctracker.ServerListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    RelativeLayout serverView = null;//  w ww . j  av  a2s  .  com
    ServerViewHolder holder = null;
    Server server = serverList.get(position);
    server.id = position;
    if (convertView == null) {
        serverView = (RelativeLayout) LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item,
                parent, false);
        holder = new ServerViewHolder((int) getItemId(position), serverView);
        serverView.setTag(holder);
    } else {
        serverView = (RelativeLayout) convertView;
        holder = (ServerViewHolder) serverView.getTag();
        holder.id = (int) getItemId(position);
    }

    //set server name
    holder.serverTitle.setText(server.name);
    //set server IP
    String serverName = server.address.toString();
    if (!serverName.startsWith("/")) {
        int index = serverName.lastIndexOf('/');
        if (index != -1) {
            String tempString;
            tempString = serverName.substring(index + 1);
            serverName = serverName.substring(0, index);
            serverName += " " + tempString;
        }
    } else {
        serverName = serverName.replace("/", "");
    }
    if (server.port != 25565)
        serverName += ":" + server.port;
    holder.serverIp.setText(serverName);

    //set fav icon
    if (server.favorite) {
        holder.favStar.setVisibility(View.VISIBLE);
    } else {
        holder.favStar.setVisibility(View.INVISIBLE);
    }

    if (!server.queried) {
        AlphaAnimation a = new AlphaAnimation(1.0f, 0.2f);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        a.setDuration(300);
        holder.statusBar.setBackgroundColor(Color.BLUE);
        holder.statusBar.startAnimation(a);

        //         holder.loading.setVisibility(View.VISIBLE);
        holder.playerCount.setText("" + server.playerCount + "/" + server.maxPlayers);
        holder.serverData.setText(R.string.loading);
        holder.playerCount.setVisibility(View.INVISIBLE);
        holder.ping.setVisibility(View.INVISIBLE);
        new ServerViewUpdater(serverView, server);
    } else {
        setupServerCell(server, holder);
    }

    return serverView;
}

From source file:com.duy.pascal.ui.debug.activities.DebugActivity.java

@WorkerThread
private void showPopupAt(final LineNumber lineNumber, final String msg) {
    mHandler.post(new Runnable() {
        @Override/*from   ww w  . j  a va 2  s . c  om*/
        public void run() {
            if (isFinishing())
                return;
            //get relative position of expression at edittext
            Point position = mCodeView.getDebugPosition(lineNumber.getLine(), lineNumber.getColumn(),
                    Gravity.TOP);
            DLog.d(TAG, "generate: " + position);
            dismissPopup();
            //create new popup
            PopupWindow window = new PopupWindow(DebugActivity.this);
            LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
            View container = inflater.inflate(R.layout.popup_expr_result, null);
            container.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
            int windowHeight = container.getMeasuredHeight();
            int windowWidth = container.getMeasuredWidth();

            window.setContentView(container);
            window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
            window.setTouchable(true);
            window.setSplitTouchEnabled(true);
            window.setOutsideTouchable(true);

            window.showAtLocation(mCodeView, Gravity.NO_GRAVITY, position.x - windowWidth / 3,
                    position.y + toolbar.getHeight() - windowHeight);

            TextView txtResult = container.findViewById(R.id.txt_result);
            txtResult.setText(msg);
            AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.5f);
            alphaAnimation.setDuration(1000);
            alphaAnimation.setRepeatMode(Animation.REVERSE);
            alphaAnimation.setRepeatCount(Animation.INFINITE);
            txtResult.startAnimation(alphaAnimation);
            DebugActivity.this.mPopupWindow = window;
        }
    });
}