Как я могу перейти к ImageViews в Android, чтобы они зависели друг от друга?
На работе у нас есть проблема с планированием производственных потоков, и я подумал об этом с помощью приложения для Android. Моя цель - переместить два изображения, которые зависят друг от друга. Первый шаг не был большой проблемой. Я переместил первый ImageView с рабочей станции 1 на рабочую станцию 2, а второй ImageView переместил на первую рабочую станцию. Но теперь наступает сложная часть, по крайней мере, для меня: ImageViews проводят определенное количество времени на рабочей станции, поэтому я хочу кодировать что-то вроде ImageView двумя движениями, только если выполняются два условия: 1. Если время ожидания истекло и 2 Первый ImageView завершил свой выход из рабочей станции.
Итак, вот мой код:
public void startProductionCBEV(View view) {
ImageView ftsTorsten = findViewById(R.id.fts_torsten);
ImageView ftsTorsten1 = findViewById(R.id.fts_torsten1);
// Move image with objectAnimator
ObjectAnimator animation
=ObjectAnimator.ofFloat(ftsTorsten,"translationY", 110f);
// animation duration
animation.setDuration(500);
ObjectAnimator animation1 = ObjectAnimator.ofFloat(ftsTorsten,
"translationX", 170f);
animation1.setStartDelay(10000);
animation1.setDuration(500);
...
// Making sure that each move is completed before the next one starts
AnimatorSet set = new AnimatorSet();
set.play(animation).before(animation1);
set.play(animation1).before(animation2);
set.play(animation2).before(animation3);
set.play(animation3).before(animation4);
...
set.start();
// Making sure that each move is completed before the next one starts
AnimatorSet set1 = new AnimatorSet();
if(animation1.isRunning()){
set1.play(animation100).before(animation99);
}
set1.play(animation99).before(animation98);
set1.play(animation98).before(animation97);
set1.play(animation97).before(animation96);
set1.play(animation96).before(animation95);
...
set1.start();
}
}
Спасибо уже всем, кто пытается помочь, это действительно сводит меня с ума.