<commit_before>package au.com.codeka.warworlds.game;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import au.com.codeka.TimeInHours;
import au.com.codeka.warworlds.BaseActivity;
import au.com.codeka.warworlds.R;
import au.com.codeka.warworlds.api.ApiClient;
import au.com.codeka.warworlds.api.ApiException;
import au.com.codeka.warworlds.game.solarsystem.SolarSystemActivity;
import au.com.codeka.warworlds.model.EmpireManager;
import au.com.codeka.warworlds.model.MyEmpire;
import au.com.codeka.warworlds.model.SituationReport;
import au.com.codeka.warworlds.model.Sprite;
import au.com.codeka.warworlds.model.SpriteDrawable;
import au.com.codeka.warworlds.model.StarImageManager;
import au.com.codeka.warworlds.model.StarManager;
import au.com.codeka.warworlds.model.StarSummary;
import au.com.codeka.warworlds.model.protobuf.Messages;

public class SitrepActivity extends BaseActivity {
    private static Logger log = LoggerFactory.getLogger(SitrepActivity.class);
    private Context mContext = this;
    private SituationReportAdapter mSituationReportAdapter;

    private Map<String, StarSummary> mStarSummaries;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE); // remove the title bar

        mStarSummaries = new TreeMap<String, StarSummary>();
        mSituationReportAdapter = new SituationReportAdapter();
    }

    @Override
    public void onResume() {
        super.onResume();

        // clear all our notifications
        NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        nm.cancelAll();

        setContentView(R.layout.sitrep);

        MyEmpire empire = EmpireManager.getInstance().getEmpire();

        TextView empireName = (TextView) findViewById(R.id.empire_name);
        ImageView empireIcon = (ImageView) findViewById(R.id.empire_icon);

        empireName.setText(empire.getDisplayName());
        empireIcon.setImageBitmap(empire.getShield(this));

        final ListView reportItems = (ListView) findViewById(R.id.report_items);
        reportItems.setAdapter(mSituationReportAdapter);
        reportItems.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                SituationReport sitrep = mSituationReportAdapter.getSituationReport(position);

                Intent intent = new Intent(mContext, SolarSystemActivity.class);
                intent.putExtra("au.com.codeka.warworlds.StarKey", sitrep.getStarKey());

                SituationReport.MoveCompleteRecord mcr = sitrep.getMoveCompleteRecord();
                if (mcr != null) {
                    if (mcr.getScoutReportKey() != null &&
                        mcr.getScoutReportKey().length() > 0) {
                        // if there's a scout report, we'll want to show that
                        intent.putExtra("au.com.codeka.warworlds.ShowScoutReport", true);
                    }
                }<commit_msg>Fixed a bug in the situation report activity<commit_after>package au.com.codeka.warworlds.game;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import au.com.codeka.TimeInHours;
import au.com.codeka.warworlds.BaseActivity;
import au.com.codeka.warworlds.R;
import au.com.codeka.warworlds.api.ApiClient;
import au.com.codeka.warworlds.api.ApiException;
import au.com.codeka.warworlds.game.solarsystem.SolarSystemActivity;
import au.com.codeka.warworlds.model.EmpireManager;
import au.com.codeka.warworlds.model.MyEmpire;
import au.com.codeka.warworlds.model.SituationReport;
import au.com.codeka.warworlds.model.Sprite;
import au.com.codeka.warworlds.model.SpriteDrawable;
import au.com.codeka.warworlds.model.StarImageManager;
import au.com.codeka.warworlds.model.StarManager;
import au.com.codeka.warworlds.model.StarSummary;
import au.com.codeka.warworlds.model.protobuf.Messages;

public class SitrepActivity extends BaseActivity {
    private static Logger log = LoggerFactory.getLogger(SitrepActivity.class);
    private Context mContext = this;
    private SituationReportAdapter mSituationReportAdapter;

    private Map<String, StarSummary> mStarSummaries;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE); // remove the title bar

        mStarSummaries = new TreeMap<String, StarSummary>();
        mSituationReportAdapter = new SituationReportAdapter();
    }

    @Override
    public void onResume() {
        super.onResume();

        // clear all our notifications
        NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        nm.cancelAll();

        setContentView(R.layout.sitrep);

        MyEmpire empire = EmpireManager.getInstance().getEmpire();

        TextView empireName = (TextView) findViewById(R.id.empire_name);
        ImageView empireIcon = (ImageView) findViewById(R.id.empire_icon);

        if (empire != null) {
            // TODO: add an "empire updated" listener here!
            empireName.setText(empire.getDisplayName());
            empireIcon.setImageBitmap(empire.getShield(this));
        }

        final ListView reportItems = (ListView) findViewById(R.id.report_items);
        reportItems.setAdapter(mSituationReportAdapter);
        reportItems.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                SituationReport sitrep = mSituationReportAdapter.getSituationReport(position);

                Intent intent = new Intent(mContext, SolarSystemActivity.class);
                intent.putExtra("au.com.codeka.warworlds.StarKey", sitrep.getStarKey());

                SituationReport.MoveCompleteRecord mcr = sitrep.getMoveCompleteRecord();
                if (mcr != null) {
                    if (mcr.getScoutReportKey() != null &&
                        mcr.getScoutReportKey().length() > 0) {
                        // if there's a scout report, we'll want to show that
                        intent.putExtra("au.com.codeka.warworlds.ShowScoutReport", true);
                    }
                }
{'fraction_non_alphanumeric': 0.09697912615065474, 'fraction_numerical': 0.0007779074290159471, 'mean_word_length': 3.453810623556582, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '830372', 'n_tokens_mistral': 2270, 'n_tokens_neox': 2172, 'n_words': 411}