Example usage for android.view.animation Animation RESTART

List of usage examples for android.view.animation Animation RESTART

Introduction

In this page you can find the example usage for android.view.animation Animation RESTART.

Prototype

int RESTART

To view the source code for android.view.animation Animation RESTART.

Click Source Link

Document

When the animation reaches the end and the repeat count is INFINTE_REPEAT or a positive value, the animation restarts from the beginning.

Usage

From source file:com.canyinghao.canrefresh.classic.RotateRefreshView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    ivRotate = (ImageView) findViewById(R.id.ivRotate);

    ivRotate.setScaleType(ScaleType.MATRIX);

    mRotateAnimation.setInterpolator(new LinearInterpolator());
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);

}

From source file:com.pwned.steamfriends.views.TwitterStream.java

@Override
public void onCreate(Bundle savedInstanceState) {
    setMyTheme();/*from   w  ww .  j  av a2 s  .  c om*/
    super.onCreate(savedInstanceState);
    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start(Constants.UACODE, 20, this);
    tracker.trackPageView("/TwitterStream");

    mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mManager.cancel(APP_ID);

    setContentView(R.layout.twitter);
    m_streams = new ArrayList<Stream>();
    this.m_adapter = new TwitterStreamAdapter(this, R.layout.row, m_streams);
    setListAdapter(this.m_adapter);

    viewStream = new Thread() {
        @Override
        public void run() {
            getStream();
        }
    };

    Animation a = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    a.setRepeatMode(Animation.RESTART);
    a.setRepeatCount(Animation.INFINITE);
    a.setDuration(750);

    a.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.anim.linear_interpolator));
    ivLoad = (ImageView) findViewById(R.id.loading_spinner);
    ivLoad.startAnimation(a);

    Thread thread = new Thread(null, viewStream, "SpecialsBackground");
    thread.start();
    //m_ProgressDialog = ProgressDialog.show(TwitterStream.this,"","Loading Twitter Stream...", true);

    steamHeader = (ImageView) findViewById(R.id.headerimage);
    steamHeader.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Constants.HEADER_URL));
            startActivity(myIntent);
        }
    });
}

From source file:com.jiubai.jiubaijz.zxing.activity.CaptureActivity.java

private void initView() {
    Window window = getWindow();/*from www  .j a v a 2s.co  m*/
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.activity_capture);

    ButterKnife.bind(this);

    mInactivityTimer = new InactivityTimer(this);
    mBeepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    mScanLineImageView.startAnimation(animation);
}

From source file:pl.wasat.smarthma.customviews.EntryItemView.java

private void titleAnimation() {
    String title = this.entry.getTitle().replaceFirst("urn:ogc:def:", "");
    if (title.length() < 30) {
        tvEntryTitle.setText(title);/*  ww w.  j a  v  a2  s  .  c  om*/
        return;
    }

    int stopAnimPos = -1000;
    int startAnimPos = 20;
    int duration = 30000;

    Animation animation = new TranslateAnimation(startAnimPos, stopAnimPos, 0, 0);
    animation.setDuration(duration);
    animation.setRepeatMode(Animation.RESTART);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setAnimationListener(this);

    tvEntryTitle.setText(title);
    tvEntryTitle.measure(0, 0);
    tvEntryTitle.setAnimation(animation);
}

From source file:com.chiemy.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Window window = getWindow();//from  w ww. ja  va  2s.co m
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(getLayoutId());

    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);

    //inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    getWindow().getDecorView().post(new Runnable() {
        @Override
        public void run() {
            TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
                    Animation.RELATIVE_TO_PARENT, 0.9f);
            animation.setDuration(4500);
            animation.setRepeatCount(-1);
            animation.setRepeatMode(Animation.RESTART);
            scanLine.startAnimation(animation);
        }
    });

    redecodeHandler = new Handler();
    redecodeRunnable = new RedecodeRunnable(this);
}

From source file:com.melvin.share.zxing.activity.CaptureActivity.java

@Override
protected void initView() {
    Window window = getWindow();// ww w.j a  v a 2  s . c o m
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    initWindow();
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    initToolbar(toolbar);
    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);

    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}

From source file:com.dtr.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Window window = getWindow();/*  ww w  .  j a  v a2 s.co m*/
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_qr_scan);

    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);
    mFlash = (ImageView) findViewById(R.id.capture_flash);
    mFlash.setOnClickListener(this);

    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}

From source file:de.fahrgemeinschaft.util.SpinningZebraListFragment.java

@Override
public void onViewCreated(View layout, Bundle state) {
    super.onViewCreated(layout, state);
    layout.setOnClickListener(null);//from  w  ww.j a va 2s . c o  m
    setListAdapter(new CursorAdapter(getActivity(), null, 0) {

        @Override
        public int getCount() {
            if (spinningEnabled)
                return super.getCount() + 1;
            else
                return super.getCount();
        }

        @Override
        public int getViewTypeCount() {
            if (spinningEnabled)
                return 2;
            else
                return 1;
        }

        @Override
        public int getItemViewType(int position) {
            if (!spinningEnabled || position < getCount() - 1)
                return 0;
            else
                return 1;
        }

        @Override
        public View getView(int position, View v, ViewGroup parent) {
            if (!spinningEnabled || position < getCount() - 1)
                v = super.getView(position, v, parent);
            else {
                if (v == null) {
                    v = getLayoutInflater(null).inflate(R.layout.view_spinning_wheel, parent, false);
                }
                ((TextView) v.findViewById(R.id.small)).setText(smallText);
                ((TextView) v.findViewById(R.id.large)).setText(largeText);
                if (spinning && onScreen) {
                    v.findViewById(R.id.progress).startAnimation(rotate);
                } else if (onScreen) {
                    v.findViewById(R.id.progress).clearAnimation();
                }
            }
            if (position % 2 == 0) {
                v.setBackgroundColor(getResources().getColor(R.color.medium_green));
            } else {
                v.setBackgroundColor(getResources().getColor(R.color.almost_medium_green));
            }
            return v;
        }

        @Override
        public View newView(Context ctx, Cursor rides, ViewGroup parent) {
            return getLayoutInflater(null).inflate(R.layout.view_ride_list_entry, parent, false);
        }

        @Override
        public void bindView(View view, Context ctx, Cursor ride) {
            if (ride.getPosition() == ride.getCount())
                return;
            bindListItemView(view, ride);
        }
    });
    registerForContextMenu(getListView());
    rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(600);
    rotate.setRepeatMode(Animation.RESTART);
    rotate.setRepeatCount(Animation.INFINITE);
    stopSpinning(getString(R.string.search_continue));
    if (state != null) {
        code = state.getInt(ID);
        setSpinningEnabled(state.getBoolean(SPIN));
        uri = (Uri) (state.getParcelable(URI));
        getActivity().getSupportLoaderManager().initLoader(code, state, this);
    } else if (uri != null) {
        getActivity().getSupportLoaderManager().restartLoader(code, state, this);
    }
    getListView().requestFocus();
}

From source file:com.xys.libzxing.zxing.activity.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) //??
    != PackageManager.PERMISSION_GRANTED) {
        //??/*from ww  w . ja  v  a 2 s . co m*/
        ActivityCompat.requestPermissions(CaptureActivity.this, new String[] { Manifest.permission.CAMERA }, 1);
    }
    Window window = getWindow();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    m_oCaptureActivity = this;
    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);
    trunoff_on = (ImageView) findViewById(R.id.trunoff_on);
    trunoff_on.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (isOpen) {
                // ?
                cameraManager.offLight();
                isOpen = false;
            } else {
                //?
                cameraManager.openLight();
                isOpen = true;
            }
        }
    });
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
}

From source file:com.kuaichumen.whistle.admin.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Window window = getWindow();/*ww  w .java  2  s .com*/
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.activity_capture);
    getSupportActionBar().hide();
    CameraManager.init(getApplication());
    scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
    scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
    scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
    scanLine = (ImageView) findViewById(R.id.capture_scan_line);
    title = (TextView) findViewById(R.id.title);
    flashLight = (LinearLayout) findViewById(R.id.flash_light);
    ll_back = (LinearLayout) findViewById(R.id.ll_back);
    flash = (ImageView) findViewById(R.id.flash);
    flashLight.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            light();
        }
    });
    ll_back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
            Animation.RELATIVE_TO_PARENT, 0.9f);
    animation.setDuration(4500);
    animation.setRepeatCount(-1);
    animation.setRepeatMode(Animation.RESTART);
    scanLine.startAnimation(animation);
    EventBus.getDefault().register(this);
    InitData();
}