package com.alorma.github.ui.actions;

import android.content.Context;
import android.content.Intent;
import com.alorma.github.R;

/**
 * Created by Bernat on 12/10/2015.
 */
public class ShareAction extends Action<Void> {

  private final Context context;
  private final String title;
  private final String url;

  public ShareAction(Context context, String title, String url) {
    this.context = context;
    this.title = title;
    this.url = url;
  }

  @Override
  public Action<Void> execute() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.putExtra(Intent.EXTRA_SUBJECT, title);
    intent.putExtra(Intent.EXTRA_TEXT, url);

    Intent chooser = Intent.createChooser(intent, context.getResources().getString(R.string.share_intent_title));
    context.startActivity(chooser);
    return this;
  }
}

@@ -122,16 +122,152 @@
 ithub.R;
+%0Aimport com.crashlytics.android.answers.Answers;%0Aimport com.crashlytics.android.answers.ShareEvent;%0Aimport io.fabric.sdk.android.Fabric;
 %0A%0A/**%0A *
@@ -870,16 +870,113 @@
  url);%0A%0A
+    if (Fabric.isInitialized()) %7B%0A      Answers.getInstance().logShare(new ShareEvent());%0A    %7D%0A%0A
     Inte

Add share Answers