package com.airbnb.lottie.samples;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.airbnb.lottie.LottieAnimationView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ListFragment extends Fragment {

  static ListFragment newInstance() {
    return new ListFragment();
  }

  @BindView(R.id.container) ViewGroup container;
  @BindView(R.id.recycler_view) RecyclerView recyclerView;
  @BindView(R.id.animation_view) LottieAnimationView animationView;

  private final FileAdapter adapter = new FileAdapter();

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_list, container, false);
    ButterKnife.bind(this, view);

    recyclerView.setAdapter(adapter);

    return view;
  }

  @Override
  public void onStart() {
    super.onStart();
    animationView.setProgress(0f);
    animationView.playAnimation();
  }

  @Override
  public void onStop() {
    super.onStop();
    animationView.cancelAnimation();
  }

  private void onViewerClicked() {
    showFragment(AnimationFragment.newInstance());
  }

  private void onTypographyClicked() {
    startActivity(new Intent(getContext(), FontActivity.class));
  }

  private void onAppIntroPagerClicked() {
    startActivity(new Intent(getContext(), AppIntroActivity.class));
  }

  private void showFragment(Fragment fragment) {
    getFragmentManager().beginTransaction()
        .addToBackStack(null)
        .setCustomAnimations(R.anim.slide_in_right, R.anim.hold, R.anim.hold, R.anim.slide_out_right)
        .remove(this)
        .replace(R.id.content_2, fragment)
        .commit();
  }

  private void onFontClicked() {
    startActivity(new Intent(getContext(), FontActivity.class));
  }

  final class FileAdapter extends RecyclerView.Adapter<StringViewHolder> {
    private static final String TAG_VIEWER = "viewer";
    private static final String TAG_TYPOGRAPHY = "typography";
    private static final String TAG_APP_INTRO = "app_intro";

    @Override
    public StringViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      return new StringViewHolder(parent);
    }

    @Override
    public void onBindViewHolder(StringViewHolder holder, int position) {
      switch (position) {
        case 0:
          holder.bind("Animation Viewer", TAG_VIEWER);
          break;
        case 1:
          holder.bind("Animated Typography", TAG_TYPOGRAPHY);
          break;
        case 2:
          holder.bind("Animated App Tutorial", TAG_APP_INTRO);
          break;
      }
    }

    @Override
    public int getItemCount() {
      return 3;
    }
  }

  final class StringViewHolder extends RecyclerView.ViewHolder {

    @BindView(R.id.title) TextView titleView;

    StringViewHolder(ViewGroup parent) {
      super(LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_file, parent, false));
      ButterKnife.bind(this, itemView);
    }

    void bind(String title, String tag) {
      titleView.setText(title);
      itemView.setTag(tag);

      itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          if (FileAdapter.TAG_VIEWER.equals(v.getTag())) {
            onViewerClicked();
          } else if (FileAdapter.TAG_TYPOGRAPHY.equals(v.getTag())) {
            onTypographyClicked();
          } else if (FileAdapter.TAG_APP_INTRO.equals(v.getTag())) {
            onAppIntroPagerClicked();
          }
        }
      });
    }
  }
}

@@ -56,24 +56,48 @@
 ent.Intent;%0A
+import android.net.Uri;%0A
 import andro
@@ -106,24 +106,24 @@
 .os.Bundle;%0A
-
 import andro
@@ -1690,32 +1690,206 @@
 y.class));%0A  %7D%0A%0A
+  private void onOpenLottieFilesClicked() %7B%0A    Intent i = new Intent(Intent.ACTION_VIEW);%0A    i.setData(Uri.parse(%22http://www.lottiefiles.com%22));%0A    startActivity(i);%0A  %7D%0A%0A
   private void s
@@ -2200,103 +2200,8 @@
 ate 
-void onFontClicked() %7B%0A    startActivity(new Intent(getContext(), FontActivity.class));%0A  %7D%0A%0A  
 fina
@@ -2447,16 +2447,93 @@
 _intro%22;
+%0A    private static final String TAG_OPEN_LOTTIE_FILES = %22open_lottie_files%22;
 %0A%0A    @O
@@ -3060,24 +3060,127 @@
      break;%0A
+        case 3:%0A          holder.bind(%22Open lottiefiles.com%22, TAG_OPEN_LOTTIE_FILES);%0A          break;%0A
       %7D%0A    
@@ -3241,17 +3241,17 @@
  return 
-3
+4
 ;%0A    %7D%0A
@@ -4039,32 +4039,32 @@
 (v.getTag())) %7B%0A
-
             onAp
@@ -4077,32 +4077,149 @@
 PagerClicked();%0A
+          %7D else if (FileAdapter.TAG_OPEN_LOTTIE_FILES.equals(v.getTag())) %7B%0A            onOpenLottieFilesClicked();%0A
           %7D%0A    

Add a link to open lottiefiles from the main screen