<commit_before>package github.nisrulz.projecteasydeviceinfo;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class SplashActivity extends AppCompatActivity {

  private final static String[] requestBasicPermissions = {
      Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE,
      Manifest.permission.GET_ACCOUNTS
  };

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    requestPermission();

    final Button btn_req = (Button) findViewById(R.id.btn_req);
    btn_req.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        requestPermission();
      }
    });
  }

  private void requestPermission() {
    RuntimePermissionUtil.requestPermission(this, requestBasicPermissions, 100);
  }

  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
      @NonNull int[] grantResults) {
    switch (requestCode) {
      case 100: {

        RuntimePermissionUtil.onRequestPermissionsResult(grantResults, new RPResultListener() {
          @Override
          public void onPermissionGranted() {
            // Reload Activity
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            finish();
          }

          @Override
          public void onPermissionDenied() {
            // do nothing
          }
        });
        break;
      }
    }
  }
}
<commit_msg>[*] refactored code for Splash Activity<commit_after>package github.nisrulz.projecteasydeviceinfo;

import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;

public class SplashActivity extends AppCompatActivity {

  private final static String[] requestBasicPermissions = {
      Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_PHONE_STATE,
      Manifest.permission.GET_ACCOUNTS
  };
  boolean launched = false;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setFullScreen(this);

    setContentView(R.layout.activity_splash);

    boolean hasFineLocation =
        RuntimePermissionUtil.checkPermissonGranted(this, Manifest.permission.ACCESS_FINE_LOCATION);
    boolean hasReadPhoneState =
        RuntimePermissionUtil.checkPermissonGranted(this, Manifest.permission.READ_PHONE_STATE);
    boolean hasGetAcc =
        RuntimePermissionUtil.checkPermissonGranted(this, Manifest.permission.GET_ACCOUNTS);

    if (hasFineLocation && hasGetAcc && hasReadPhoneState) {
      loadMainActivity();
    }
    else {
      RuntimePermissionUtil.requestPermission(SplashActivity.this, requestBasicPermissions, 100);
    }

    final Button btn_req = (Button) findViewById(R.id.btn_req);
    btn_req.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        RuntimePermissionUtil.requestPermission(SplashActivity.this, requestBasicPermissions, 100);
      }
    });
  }

  private void loadMainActivity() {

    // Reload Activity
    startActivity(new Intent(SplashActivity.this, MainActivity.class));
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    launched = true;
    finish();
  }

  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull final String[] permissions,
      @NonNull final int[] grantResults) {
    switch (requestCode) {
      case 100: {

        RuntimePermissionUtil.onRequestPermissionsResult(grantResults, new RPResultListener() {
          @Override
          public void onPermissionGranted() {
            if (grantResults[0] == PackageManager.PERMISSION_GRANTED
                && grantResults[1] == PackageManager.PERMISSION_GRANTED
                && grantResults[2] == PackageManager.PERMISSION_GRANTED
                && !launched) {
              loadMainActivity();
            }
          }

          @Override
          public void onPermissionDenied() {
            // do nothing
          }
        });
        break;
      }
    }
  }

  public static void setFullScreen(Activity activity) {
    // Call before calling setContentView();
    activity.getWindow()
        .setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }
}

{'fraction_non_alphanumeric': 0.08825927435792906, 'fraction_numerical': 0.0040766408479412965, 'mean_word_length': 3.330979699911739, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5109089', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1308, 'n_words': 245}