use of com.airbnb.lottie.LottieDrawable in project Rocket by mozilla-tw.
the class FirstrunPagerAdapter method getView.
private View getView(int position, ViewPager pager) {
final View view = LayoutInflater.from(context).inflate(R.layout.firstrun_page, pager, false);
final FirstrunPage page = pages[position];
final TextView titleView = (TextView) view.findViewById(R.id.title);
titleView.setText(page.title);
final TextView textView = (TextView) view.findViewById(R.id.text);
textView.setText(page.text);
final ImageView imageView = (ImageView) view.findViewById(R.id.image);
final LottieDrawable drawable = new LottieDrawable();
LottieComposition.Factory.fromAssetFileName(context, page.imageResource, new OnCompositionLoadedListener() {
@Override
public void onCompositionLoaded(@Nullable LottieComposition composition) {
drawable.setComposition(composition);
}
});
imageView.setImageDrawable(drawable);
final Button buttonView = (Button) view.findViewById(R.id.button);
buttonView.setOnClickListener(listener);
if (position == pages.length - 1) {
buttonView.setText(R.string.firstrun_close_button);
buttonView.setId(R.id.finish);
} else {
buttonView.setText(R.string.firstrun_next_button);
buttonView.setId(R.id.next);
}
if (position == TURBO_MODE_PAGE_INDEX) {
initForTurboModePage(context, view);
}
return view;
}
Aggregations