Skip to content

Toro V1 (deprecated)

Nam Nguyen Hoai edited this page Oct 16, 2016 · 1 revision

Welcome to Toro!

0. Prerequirement
  • From Android SDK level 16 (4.1)
1. Add Toro to your project
  • Add this to Project's top level build.gradle
allprojects {
	repositories {
		maven { url "https://jitpack.io" }
	}
}
  • Add this to dependencies
dependencies {
	compile 'com.github.eneim:Toro:1.0.0'
}
TL,DR: app module from this library comes with several good practice of this library. Please take a look.
2. Integrate Toro into your Application: see Toro starting guide
3. Register/Unregister a RecyclerView to get support from Toro: see Register/Unregister RecyclerView to Toro
4. Create ViewHolder to use with Toro: by default, just simply extend one of ToroVideoViewHolder, TextureVideoViewHolder or AbsVideoViewHolder. See ToroViewHolder for more information.
  • A sample ViewHolder's code (see Sample app for more):
public class DeadlySimpleToroVideoViewHolder extends ToroVideoViewHolder {

  public DeadlySimpleToroVideoViewHolder(View itemView) {
    super(itemView);
  }

  @Override protected ToroVideoView findVideoView(View itemView) {
    return (ToroVideoView) itemView.findViewById(R.id.video);
  }

  @Nullable @Override public String getVideoId() {
    return "my awesome video's id and its order: " + getAdapterPosition();
  }

  @Override public void bind(@Nullable Object object) {
    if (object != null && object instanceof SimpleVideoObject) {
      mVideoView.setVideoPath(((SimpleVideoObject) object).video);
    }
  }
}
5. Core concepts and components of Toro: see Wiki