// Path: app/src/main/java/org/theotech/ceaselessandroid/util/AnalyticsUtils.java
// public class AnalyticsUtils {
// 
//     private static final String TAG = AnalyticsUtils.class.getSimpleName();
// 
//     public static void sendScreenViewHit(Activity activity, String name) {
//         Log.v(TAG, "Setting screen name: " + name);
//         FirebaseAnalytics.getInstance(activity).setCurrentScreen(activity, name, null /* class override */);
//     }
// 
//     public static void sendEventWithCategoryAndValue(Activity activity, String category, String action, String label, Long value) {
//         final Bundle params = new Bundle();
//         params.putString("category", category);
//         params.putString("action", action);
//         params.putString("label", label);
//         params.putLong("value", value);
//         FirebaseAnalytics.getInstance(activity).logEvent("ga_event", params);
//     }
// 
//     public static void sendEventWithCategory(Activity activity, String category, String action, String label) {
//         final Bundle params = new Bundle();
//         params.putString("category", category);
//         params.putString("action", action);
//         params.putString("label", label);
//         FirebaseAnalytics.getInstance(activity).logEvent("ga_event", params);
//     }
// }


import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import org.theotech.ceaselessandroid.R;
import org.theotech.ceaselessandroid.util.AnalyticsUtils;
import butterknife.BindView;
import butterknife.ButterKnife;
    }

    public void startEmailIntent() {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL, new String[]{"ceaseless@theotech.org"});

        // TODO localize
        i.putExtra(Intent.EXTRA_SUBJECT, "Ceaseless for Android Feedback");
        i.putExtra(Intent.EXTRA_TEXT, "Feedback for Ceaseless Android app: \n");

        try {
            startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(getActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }
    }

    public void startWebIntent(String url) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        try {
            startActivity(browserIntent);
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(getActivity(), "Unable to open web browser.", Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
// Path: app/src/main/java/org/theotech/ceaselessandroid/util/AnalyticsUtils.java
// public class AnalyticsUtils {
// 
//     private static final String TAG = AnalyticsUtils.class.getSimpleName();
// 
//     public static void sendScreenViewHit(Activity activity, String name) {
//         Log.v(TAG, "Setting screen name: " + name);
//         FirebaseAnalytics.getInstance(activity).setCurrentScreen(activity, name, null /* class override */);
//     }
// 
//     public static void sendEventWithCategoryAndValue(Activity activity, String category, String action, String label, Long value) {
//         final Bundle params = new Bundle();
//         params.putString("category", category);
//         params.putString("action", action);
//         params.putString("label", label);
//         params.putLong("value", value);
//         FirebaseAnalytics.getInstance(activity).logEvent("ga_event", params);
//     }
// 
//     public static void sendEventWithCategory(Activity activity, String category, String action, String label) {
//         final Bundle params = new Bundle();
//         params.putString("category", category);
//         params.putString("action", action);
//         params.putString("label", label);
//         FirebaseAnalytics.getInstance(activity).logEvent("ga_event", params);
//     }
// }


// Path: app/src/main/java/org/theotech/ceaselessandroid/fragment/ContactUsFragment.java
import android.app.Fragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import org.theotech.ceaselessandroid.R;
import org.theotech.ceaselessandroid.util.AnalyticsUtils;
import butterknife.BindView;
import butterknife.ButterKnife;

    }

    public void startEmailIntent() {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL, new String[]{"ceaseless@theotech.org"});

        // TODO localize
        i.putExtra(Intent.EXTRA_SUBJECT, "Ceaseless for Android Feedback");
        i.putExtra(Intent.EXTRA_TEXT, "Feedback for Ceaseless Android app: \n");

        try {
            startActivity(Intent.createChooser(i, "Send mail..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(getActivity(), "There are no email clients installed.", Toast.LENGTH_SHORT).show();
        }
    }

    public void startWebIntent(String url) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        try {
            startActivity(browserIntent);
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(getActivity(), "Unable to open web browser.", Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        AnalyticsUtils.sendScreenViewHit(this.getActivity(), "ContactUsScreen");