content: package com.fivehundredpx.greedo_layout_sample;
  
  import android.os.Build;
  import android.os.Bundle;
  import android.view.View;
  import android.view.WindowManager;
  import android.widget.ToggleButton;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.recyclerview.widget.RecyclerView;
  
  import com.fivehundredpx.greedolayout.GreedoLayoutManager;
  import com.fivehundredpx.greedolayout.GreedoSpacingItemDecoration;
  
  /**
   * Created by Julian Villella on 16-02-24.
   */
  public class SampleActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_sample);
  
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
              getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                      WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
          }
  
          PhotosAdapter photosAdapter = new PhotosAdapter(this);
          final GreedoLayoutManager layoutManager = new GreedoLayoutManager(photosAdapter);
          layoutManager.setMaxRowHeight(MeasUtils.dpToPx(150, this));
  
          RecyclerView recyclerView = (RecyclerView)findViewById(R.id.recycler_view);
          recyclerView.setLayoutManager(layoutManager);
          recyclerView.setAdapter(photosAdapter);
  
          int spacing = MeasUtils.dpToPx(4, this);
          recyclerView.addItemDecoration(new GreedoSpacingItemDecoration(spacing));
  
          findViewById(R.id.toggle_fixed_height).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  layoutManager.setFixedHeight(((ToggleButton) view).isChecked());
                  layoutManager.requestLayout();
              }
          });
      }
  }
  