// Path: sherlock/src/main/java/com/singhajit/sherlock/crashes/activity/CrashActivity.java
// public class CrashActivity extends BaseActivity implements CrashActions {
//   public static final String CRASH_ID = "com.singhajit.sherlock.CRASH_ID";
//   private CrashViewModel viewModel = new CrashViewModel();
//   private CrashPresenter presenter;
// 
//   @Override
//   protected void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     Intent intent = getIntent();
//     int crashId = intent.getIntExtra(CRASH_ID, -1);
//     setContentView(R.layout.crash_activity);
// 
//     enableHomeButton((Toolbar) findViewById(R.id.toolbar));
//     setTitle(R.string.crash_report);
// 
//     presenter = new CrashPresenter(new SherlockDatabaseHelper(this), this);
//     presenter.render(crashId);
//   }
// 
//   @Override
//   public boolean onCreateOptionsMenu(Menu menu) {
//     getMenuInflater().inflate(R.menu.crash_menu, menu);
//     return true;
//   }
// 
//   @Override
//   public boolean onOptionsItemSelected(MenuItem item) {
//     if (item.getItemId() == R.id.share) {
//       presenter.shareCrashDetails(viewModel);
//       return true;
//     }
//     return super.onOptionsItemSelected(item);
//   }
// 
//   @Override
//   public void render(CrashViewModel viewModel) {
//     this.viewModel = viewModel;
//     TextView crashLocation = (TextView) findViewById(R.id.crash_location);
//     TextView crashReason = (TextView) findViewById(R.id.crash_reason);
//     TextView stackTrace = (TextView) findViewById(R.id.stacktrace);
// 
//     crashLocation.setText(viewModel.getExactLocationOfCrash());
//     crashReason.setText(viewModel.getReasonOfCrash());
//     stackTrace.setText(viewModel.getStackTrace());
// 
//     renderDeviceInfo(viewModel);
//   }
// 
//   @Override
//   public void openSendApplicationChooser(String crashDetails) {
//     Intent share = new Intent(Intent.ACTION_SEND);
//     share.setType("text/plain");
//     share.putExtra(Intent.EXTRA_TEXT, crashDetails);
// 
//     startActivity(Intent.createChooser(share, getString(R.string.share_dialog_message)));
//   }
// 
//   @Override
//   public void renderAppInfo(AppInfoViewModel viewModel) {
//     RecyclerView appInfoDetails = (RecyclerView) findViewById(R.id.app_info_details);
//     appInfoDetails.setAdapter(new AppInfoAdapter(viewModel));
//     appInfoDetails.setLayoutManager(new LinearLayoutManager(this));
//   }
// 
//   private void renderDeviceInfo(CrashViewModel viewModel) {
//     TextView deviceName = (TextView) findViewById(R.id.device_name);
//     TextView deviceBrand = (TextView) findViewById(R.id.device_brand);
//     TextView deviceAndroidVersion = (TextView) findViewById(R.id.device_android_version);
// 
//     deviceName.setText(viewModel.getDeviceName());
//     deviceBrand.setText(viewModel.getDeviceBrand());
//     deviceAndroidVersion.setText(viewModel.getDeviceAndroidApiVersion());
//   }
// }


import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.content.ContextCompat;
import com.singhajit.sherlock.R;
import com.singhajit.sherlock.crashes.activity.CrashActivity;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
package com.singhajit.sherlock.core.investigation;




public class CrashReporter {
  private final Context context;
  private String CHANNEL_ID = "com.singhajit.com.221B";

  public CrashReporter(Context context) {
    this.context = context;
  }

  public void report(CrashViewModel crashViewModel) {
    Notification notification = notification(crashViewModel);

    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      NotificationChannel channel = new NotificationChannel(
          CHANNEL_ID,
          "Sherlock",
          IMPORTANCE_DEFAULT
      );
      notificationManager.createNotificationChannel(channel);
    }

    notificationManager.notify(crashViewModel.getIdentifier(), notification);
  }

  private Notification notification(CrashViewModel crashViewModel) {
// Path: sherlock/src/main/java/com/singhajit/sherlock/crashes/activity/CrashActivity.java
// public class CrashActivity extends BaseActivity implements CrashActions {
//   public static final String CRASH_ID = "com.singhajit.sherlock.CRASH_ID";
//   private CrashViewModel viewModel = new CrashViewModel();
//   private CrashPresenter presenter;
// 
//   @Override
//   protected void onCreate(Bundle savedInstanceState) {
//     super.onCreate(savedInstanceState);
//     Intent intent = getIntent();
//     int crashId = intent.getIntExtra(CRASH_ID, -1);
//     setContentView(R.layout.crash_activity);
// 
//     enableHomeButton((Toolbar) findViewById(R.id.toolbar));
//     setTitle(R.string.crash_report);
// 
//     presenter = new CrashPresenter(new SherlockDatabaseHelper(this), this);
//     presenter.render(crashId);
//   }
// 
//   @Override
//   public boolean onCreateOptionsMenu(Menu menu) {
//     getMenuInflater().inflate(R.menu.crash_menu, menu);
//     return true;
//   }
// 
//   @Override
//   public boolean onOptionsItemSelected(MenuItem item) {
//     if (item.getItemId() == R.id.share) {
//       presenter.shareCrashDetails(viewModel);
//       return true;
//     }
//     return super.onOptionsItemSelected(item);
//   }
// 
//   @Override
//   public void render(CrashViewModel viewModel) {
//     this.viewModel = viewModel;
//     TextView crashLocation = (TextView) findViewById(R.id.crash_location);
//     TextView crashReason = (TextView) findViewById(R.id.crash_reason);
//     TextView stackTrace = (TextView) findViewById(R.id.stacktrace);
// 
//     crashLocation.setText(viewModel.getExactLocationOfCrash());
//     crashReason.setText(viewModel.getReasonOfCrash());
//     stackTrace.setText(viewModel.getStackTrace());
// 
//     renderDeviceInfo(viewModel);
//   }
// 
//   @Override
//   public void openSendApplicationChooser(String crashDetails) {
//     Intent share = new Intent(Intent.ACTION_SEND);
//     share.setType("text/plain");
//     share.putExtra(Intent.EXTRA_TEXT, crashDetails);
// 
//     startActivity(Intent.createChooser(share, getString(R.string.share_dialog_message)));
//   }
// 
//   @Override
//   public void renderAppInfo(AppInfoViewModel viewModel) {
//     RecyclerView appInfoDetails = (RecyclerView) findViewById(R.id.app_info_details);
//     appInfoDetails.setAdapter(new AppInfoAdapter(viewModel));
//     appInfoDetails.setLayoutManager(new LinearLayoutManager(this));
//   }
// 
//   private void renderDeviceInfo(CrashViewModel viewModel) {
//     TextView deviceName = (TextView) findViewById(R.id.device_name);
//     TextView deviceBrand = (TextView) findViewById(R.id.device_brand);
//     TextView deviceAndroidVersion = (TextView) findViewById(R.id.device_android_version);
// 
//     deviceName.setText(viewModel.getDeviceName());
//     deviceBrand.setText(viewModel.getDeviceBrand());
//     deviceAndroidVersion.setText(viewModel.getDeviceAndroidApiVersion());
//   }
// }


// Path: sherlock/src/main/java/com/singhajit/sherlock/core/investigation/CrashReporter.java
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.content.ContextCompat;
import com.singhajit.sherlock.R;
import com.singhajit.sherlock.crashes.activity.CrashActivity;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;

package com.singhajit.sherlock.core.investigation;




public class CrashReporter {
  private final Context context;
  private String CHANNEL_ID = "com.singhajit.com.221B";

  public CrashReporter(Context context) {
    this.context = context;
  }

  public void report(CrashViewModel crashViewModel) {
    Notification notification = notification(crashViewModel);

    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
      NotificationChannel channel = new NotificationChannel(
          CHANNEL_ID,
          "Sherlock",
          IMPORTANCE_DEFAULT
      );
      notificationManager.createNotificationChannel(channel);
    }

    notificationManager.notify(crashViewModel.getIdentifier(), notification);
  }

  private Notification notification(CrashViewModel crashViewModel) {
    Intent crashActivityIntent = new Intent(context, CrashActivity.class);