content: package com.sixteenplusfour.android.flipsidecamera.ui;
  
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.net.Uri;
  import android.support.v4.content.ContextCompat;
  import android.view.MenuItem;
  
  import com.danielstone.materialaboutlibrary.ConvenienceBuilder;
  import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
  import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem;
  import com.danielstone.materialaboutlibrary.items.MaterialAboutItemOnClickListener;
  import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem;
  import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
  import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
  import com.mikepenz.community_material_typeface_library.CommunityMaterial;
  import com.mikepenz.google_material_typeface_library.GoogleMaterial;
  import com.mikepenz.iconics.IconicsDrawable;
  import com.sixteenplusfour.android.flipsidecamera.R;
  
  import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
  
  /**
   * Created by andy.barber on 15/03/2017.
   */
  
  public class AboutActivity extends MaterialAboutActivity {
  
      public static Intent createIntent(Context context) {
          Intent intent = new Intent(context, AboutActivity.class);
          return intent;
      }
  
      @Override
      protected MaterialAboutList getMaterialAboutList(Context context) {
          return createMaterialAboutList(this, R.color.primary);
      }
  
      @Override
      protected CharSequence getActivityTitle() {
          return getString(R.string.mal_title_about);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
              case android.R.id.home:
                  finish();
                  return true;
              default:
                  return false;
          }
      }
  
      @Override
      protected void attachBaseContext(Context newBase) {
          super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
      }
  
      public MaterialAboutList createMaterialAboutList(final Context c, final int colorIcon) {
          MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();
  
          // Add items to card
  
          appCardBuilder.addItem(new MaterialAboutTitleItem.Builder()
                  .text(getString(R.string.app_name))
                  .icon(R.mipmap.ic_launcher)
                  .build());
  
          try {
              appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                      new IconicsDrawable(c)
                              .icon(GoogleMaterial.Icon.gmd_info_outline)
                              .color(ContextCompat.getColor(c, colorIcon))
                              .sizeDp(18),
                      "Version",
                      false));
  
          } catch (PackageManager.NameNotFoundException e) {
              e.printStackTrace();
          }
  
          appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
                  .text("Licenses")
                  .icon(new IconicsDrawable(c)
                          .icon(GoogleMaterial.Icon.gmd_book)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18))
                  .setOnClickListener(new MaterialAboutItemOnClickListener() {
                      @Override
                      public void onClick(boolean longClick) {
                          startActivity(AboutLicenseActivity.createIntent(getApplicationContext()));
                      }
                  })
                  .build());
  
          appCardBuilder.addItem(new MaterialAboutActionItem.Builder()
                  .text("Fork on GitHub")
                  .icon(new IconicsDrawable(c)
                          .icon(CommunityMaterial.Icon.cmd_github_circle)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18))
                  .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(getString(R.string.github_link))))
                  .build());
  
          appCardBuilder.addItem(ConvenienceBuilder.createRateActionItem(c,
                  new IconicsDrawable(c)
                          .icon(CommunityMaterial.Icon.cmd_star)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18),
                  "Rate this app",
                  null
          ));
  
          MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
          authorCardBuilder.title("Author");
  
          authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
                  .text("Andy Barber")
                  .subText("United Kingdom")
                  .icon(new IconicsDrawable(c)
                          .icon(GoogleMaterial.Icon.gmd_person)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18))
                  .build());
  
          authorCardBuilder.addItem(new MaterialAboutActionItem.Builder()
                  .text("Twitter")
                  .icon(new IconicsDrawable(c)
                          .icon(CommunityMaterial.Icon.cmd_twitter)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18))
                  .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(getString(R.string.twitter_link))))
                  .build());
  
          authorCardBuilder.addItem(ConvenienceBuilder.createWebsiteActionItem(c,
                  new IconicsDrawable(c)
                          .icon(CommunityMaterial.Icon.cmd_earth)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18),
                  "Visit Website",
                  true,
                  Uri.parse("http://www.barbuzz.co.uk")));
  
          MaterialAboutCard.Builder privacyCardBuilder = new MaterialAboutCard.Builder();
          privacyCardBuilder.addItem(new MaterialAboutActionItem.Builder()
                  .text("Privacy Policy")
                  .icon(new IconicsDrawable(c)
                          .icon(CommunityMaterial.Icon.cmd_file_document)
                          .color(ContextCompat.getColor(c, colorIcon))
                          .sizeDp(18))
                  .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(getString(R.string.privacy_policy_link))))
                  .build());
  
          return new MaterialAboutList(
                  appCardBuilder.build(),
                  authorCardBuilder.build(),
                  privacyCardBuilder.build());
      }
  }
  