<commit_before>package net.peterd.zombierun.activity;

import com.google.ads.AdSenseSpec;
import com.google.ads.GoogleAdView;
import com.google.ads.AdSenseSpec.AdType;

import net.peterd.zombierun.R;
import net.peterd.zombierun.constants.ApplicationConstants;
import net.peterd.zombierun.game.GameSettings;
import net.peterd.zombierun.util.GeoCalculationUtil;
import net.peterd.zombierun.util.Log;
import android.app.Activity;
import android.os.Handler;
import android.widget.Spinner;

public class Util {

  public static GameSettings handleGameSettings(Activity activity,
      boolean startingMultiplayerGame) {
    Spinner zombieSpeedSpinner = (Spinner) activity.findViewById(R.id.spinner_zombie_speed);
    int indexOfSpeed = zombieSpeedSpinner.getSelectedItemPosition();
    double zombieSpeedMph = Double.parseDouble(
        activity.getResources().getStringArray(
            R.array.zombie_speeds_average_speed_mph)[indexOfSpeed]);
    double zombieSpeed = GeoCalculationUtil.milesPerHourToMetersPerSecond(zombieSpeedMph);
    
    Spinner zombieCountSpinner = (Spinner) activity.findViewById(R.id.spinner_zombie_count);
    int indexOfDensity = zombieCountSpinner.getSelectedItemPosition();
    double averageDistanceBetweenZombiesMeters = Double.parseDouble(
        activity.getResources().getStringArray(
            R.array.zombie_counts_average_distance_between_zombie_meters)[indexOfDensity]);
    double zombieDensity =
        GeoCalculationUtil.itemPerDistanceToItemsPerSquareKilometer(
            averageDistanceBetweenZombiesMeters);
    
    return new GameSettings(zombieDensity, zombieSpeed, startingMultiplayerGame);
  }
  
  public static void configureAds(final Activity activity) {
    Log.i("ZombieRun.Util", "Adsense Ads Keywords: " + activity.getString(R.string.adsense_keywords));
    final GoogleAdView adView = 
        (GoogleAdView) activity.findViewById(R.id.adview);
    new Handler().post(new Runnable() {
        public void run() {
          AdSenseSpec adSenseSpec = 
              new AdSenseSpec(activity.getString(R.string.adsense_pub_id))
                  .setCompanyName(
                      activity.getString(R.string.adsense_company_name))
                  .setAppName(activity.getString(R.string.app_name))
                  .setKeywords(activity.getString(R.string.adsense_keywords))
                  .setChannel(activity.getString(R.string.adsense_channel))
                  .setAdType(AdType.TEXT_IMAGE)
                  .setWebEquivalentUrl(activity.getString(R.string.about_url))
                  .setAdTestEnabled(ApplicationConstants.testing());<commit_msg>Log adsense keywords to debug<commit_after>package net.peterd.zombierun.activity;

import com.google.ads.AdSenseSpec;
import com.google.ads.GoogleAdView;
import com.google.ads.AdSenseSpec.AdType;

import net.peterd.zombierun.R;
import net.peterd.zombierun.constants.ApplicationConstants;
import net.peterd.zombierun.game.GameSettings;
import net.peterd.zombierun.util.GeoCalculationUtil;
import net.peterd.zombierun.util.Log;
import android.app.Activity;
import android.os.Handler;
import android.widget.Spinner;

public class Util {

  public static GameSettings handleGameSettings(Activity activity,
      boolean startingMultiplayerGame) {
    Spinner zombieSpeedSpinner = (Spinner) activity.findViewById(R.id.spinner_zombie_speed);
    int indexOfSpeed = zombieSpeedSpinner.getSelectedItemPosition();
    double zombieSpeedMph = Double.parseDouble(
        activity.getResources().getStringArray(
            R.array.zombie_speeds_average_speed_mph)[indexOfSpeed]);
    double zombieSpeed = GeoCalculationUtil.milesPerHourToMetersPerSecond(zombieSpeedMph);
    
    Spinner zombieCountSpinner = (Spinner) activity.findViewById(R.id.spinner_zombie_count);
    int indexOfDensity = zombieCountSpinner.getSelectedItemPosition();
    double averageDistanceBetweenZombiesMeters = Double.parseDouble(
        activity.getResources().getStringArray(
            R.array.zombie_counts_average_distance_between_zombie_meters)[indexOfDensity]);
    double zombieDensity =
        GeoCalculationUtil.itemPerDistanceToItemsPerSquareKilometer(
            averageDistanceBetweenZombiesMeters);
    
    return new GameSettings(zombieDensity, zombieSpeed, startingMultiplayerGame);
  }
  
  public static void configureAds(final Activity activity) {
    if (Log.loggingEnabled()) {
      Log.d("ZombieRun.Util", 
          "Adsense Ads Keywords: " + activity.getString(R.string.adsense_keywords));
    }
    final GoogleAdView adView = 
        (GoogleAdView) activity.findViewById(R.id.adview);
    new Handler().post(new Runnable() {
        public void run() {
          AdSenseSpec adSenseSpec = 
              new AdSenseSpec(activity.getString(R.string.adsense_pub_id))
                  .setCompanyName(
                      activity.getString(R.string.adsense_company_name))
                  .setAppName(activity.getString(R.string.app_name))
                  .setKeywords(activity.getString(R.string.adsense_keywords))
                  .setChannel(activity.getString(R.string.adsense_channel))
                  .setAdType(AdType.TEXT_IMAGE)
                  .setWebEquivalentUrl(activity.getString(R.string.about_url))
                  .setAdTestEnabled(ApplicationConstants.testing());
{'fraction_non_alphanumeric': 0.08783148391950348, 'fraction_numerical': 0.0, 'mean_word_length': 3.769506726457399, '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': '6884144', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1544, 'n_words': 213}