private void initSwitchers() { temperatureSwitcher = (TextSwitcher) findViewById(R.id.ts_temperature); temperatureSwitcher.setFactory(new TextViewFactory(R.style.TemperatureTextView, true)); temperatureSwitcher.setCurrentText(temperatures[0]); placeSwitcher = (TextSwitcher) findViewById(R.id.ts_place); placeSwitcher.setFactory(new TextViewFactory(R.style.PlaceTextView, false)); placeSwitcher.setCurrentText(places[0]); clockSwitcher = (TextSwitcher) findViewById(R.id.ts_clock); clockSwitcher.setFactory(new TextViewFactory(R.style.ClockTextView, false)); clockSwitcher.setCurrentText(times[0]); descriptionsSwitcher = (TextSwitcher) findViewById(R.id.ts_description); descriptionsSwitcher.setInAnimation(this, android.R.anim.fade_in); descriptionsSwitcher.setOutAnimation(this, android.R.anim.fade_out); descriptionsSwitcher.setFactory(new TextViewFactory(R.style.DescriptionTextView, false)); descriptionsSwitcher.setCurrentText(getString(descriptions[0])); mapSwitcher = (ImageSwitcher) findViewById(R.id.ts_map); mapSwitcher.setInAnimation(this, R.anim.fade_in); mapSwitcher.setOutAnimation(this, R.anim.fade_out); mapSwitcher.setFactory(new ImageViewFactory()); mapSwitcher.setImageResource(maps[0]); mapLoadListener = new DecodeBitmapTask.Listener() { @Override public void onPostExecuted(Bitmap bitmap) { ((ImageView)mapSwitcher.getNextView()).setImageBitmap(bitmap); mapSwitcher.showNext(); } }; }
@Override public void onPostExecuted(Bitmap bitmap) { ((ImageView)mapSwitcher.getNextView()).setImageBitmap(bitmap); mapSwitcher.showNext(); } };
ll.setOrientation( LinearLayout.VERTICAL ); setContentView( ll ); final ImageSwitcher is = new ImageSwitcher( this ); is.setOutAnimation( this, R.anim.fadeout ); is.setInAnimation( this, R.anim.fadein ); ImageView iv1 = new ImageView( this ); iv1.setImageResource( R.drawable.icon ); is.addView( iv1 ); is.showNext(); ll.addView( is ); is.addView( iv2 ); is.showNext();
imageSwitcher.setFactory(new ImageSwitcher.ViewFactory() { @Override public View makeView() { imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
/** * Left to Right */ private void SliderLeftToRight() { // get current index pictureIndex = pictureIndex == 0 ? itemCount - 1 : pictureIndex - 1; // set Animation switcherImage.setInAnimation(AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left)); switcherImage.setOutAnimation(AnimationUtils.loadAnimation(context, android.R.anim.slide_out_right)); // switch indicator // switcherImage.setImageResource(image[pictureIndex]); switchIndicator(pictureIndex); }
switcherImage = new ImageSwitcher(context); switcherImage.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); switcherImage.setFactory(this); switcherImage.setOnTouchListener(this); addView(switcherImage); indicatorContainer = new LinearLayout(context);
minusDrawable.mutate().setColorFilter(minusColor, PorterDuff.Mode.SRC_ATOP); requestId = EDIT_AMOUNT_REQUEST.incrementAndGet(); signSwitcher.setFactory(() -> { ImageView v = new ImageView(getContext()); v.setScaleType(ImageView.ScaleType.FIT_CENTER); return v; }); signSwitcher.setImageDrawable(minusDrawable); primary.setKeyListener(keyListener); primary.addTextChangedListener(textWatcher);
@Override public void onClick(View arg0) { if (idx == imagens.length) { idx = 0; // fim do array } imageSwitcher.setImageResource(imagens[idx++]); } });
/** * Right to Left */ private void SliderRightToLeft() { // get current index pictureIndex = pictureIndex == itemCount - 1 ? 0 : pictureIndex + 1; // set Animation // Custom the slide_out_left and slide_in_right switcherImage.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_in_right)); switcherImage.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.slide_out_left)); // switcherImage.setInAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_in)); // switcherImage.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); // switch indicator // switcherImage.setImageResource(image[pictureIndex]); switchIndicator(pictureIndex); }
/** * load the resource images * * @param pictureIndex index */ private void loadFileImage(int pictureIndex) { if (list != null && list.size() != 0) { switcherImage.setImageResource((Integer) list.get(pictureIndex)); } }