<commit_before>package org.sugr.gearshift.ui;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;

import org.sugr.gearshift.G;
import org.sugr.gearshift.GearShiftApplication;
import org.sugr.gearshift.R;
import org.sugr.gearshift.core.TransmissionProfile;
import org.sugr.gearshift.core.TransmissionSession;
import org.sugr.gearshift.datasource.DataSource;
import org.sugr.gearshift.service.DataService;
import org.sugr.gearshift.service.DataServiceManager;
import org.sugr.gearshift.service.DataServiceManagerInterface;

import java.util.Arrays;
import java.util.List;

public class TransmissionSessionActivity extends ActionBarActivity implements DataServiceManagerInterface {
    private TransmissionProfile profile;
    private TransmissionSession session;
    private DataServiceManager manager;

    private boolean refreshing = false;

    private ServiceReceiver serviceReceiver;

    private static final String STATE_EXPANDED = "expanded_states";
    private static final String STATE_SCROLL_POSITION = "scroll_position_state";

    private static class Expanders {
        public static final int TOTAL_EXPANDERS = 4;

        public static final int GENERAL = 0;
        public static final int CONNECTIONS = 1;
        public static final int BANDWIDTH = 2;
        public static final int LIMITS = 3;
    }

    private boolean[] expandedStates = new boolean[Expanders.TOTAL_EXPANDERS];

    private List<String> encryptionValues;

    private View.OnClickListener expanderListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            View image;
            View content;
            int index;
            switch(v.getId()) {
                case R.id.transmission_session_general_expander:
                    image = v.findViewById(R.id.transmission_session_general_expander_image);
                    content = findViewById(R.id.transmission_session_general_content);
                    index = Expanders.GENERAL;
                    break;
                case R.id.transmission_session_connections_expander:
                    image = v.findViewById(R.id.transmission_session_connections_expander_image);
                    content = findViewById(R.id.transmission_session_connections_content);
                    index = Expanders.CONNECTIONS;
                    break;
                case R.id.transmission_session_bandwidth_expander:
                    image = v.findViewById(R.id.transmission_session_bandwidth_expander_image);
                    content = findViewById(R.id.transmission_session_bandwidth_content);
                    index = Expanders.BANDWIDTH;
                    break;
                case R.id.transmission_session_limits_expander:
                    image = v.findViewById(R.id.transmission_session_limits_expander_image);
                    content = findViewById(R.id.transmission_session_limits_content);
                    index = Expanders.LIMITS;
                    break;
                default:
                    return;
            }

            if (content.getVisibility() == View.GONE) {
                content.setVisibility(View.VISIBLE);
                content.setAlpha(0);
                content.animate().alpha(1);
                image.setRotation(0);
                expandedStates[index] = true;
            } else {
                content.setVisibility(View.GONE);
                image.setRotation(180);
                expandedStates[index] = false;
            }

            image.animate().rotationBy(180);
        }
    };


    private Runnable loseFocusRunnable = new Runnable() {
        @Override public void run() {
            findViewById(R.id.transmission_session_container).requestFocus();
        }
    };<commit_msg>add the expand animator to the session cards<commit_after>package org.sugr.gearshift.ui;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;

import org.sugr.gearshift.G;
import org.sugr.gearshift.GearShiftApplication;
import org.sugr.gearshift.R;
import org.sugr.gearshift.core.TransmissionProfile;
import org.sugr.gearshift.core.TransmissionSession;
import org.sugr.gearshift.datasource.DataSource;
import org.sugr.gearshift.service.DataService;
import org.sugr.gearshift.service.DataServiceManager;
import org.sugr.gearshift.service.DataServiceManagerInterface;
import org.sugr.gearshift.ui.util.ExpandAnimation;

import java.util.Arrays;
import java.util.List;

public class TransmissionSessionActivity extends ActionBarActivity implements DataServiceManagerInterface {
    private TransmissionProfile profile;
    private TransmissionSession session;
    private DataServiceManager manager;

    private boolean refreshing = false;

    private ServiceReceiver serviceReceiver;

    private static final String STATE_EXPANDED = "expanded_states";
    private static final String STATE_SCROLL_POSITION = "scroll_position_state";

    private static class Expanders {
        public static final int TOTAL_EXPANDERS = 4;

        public static final int GENERAL = 0;
        public static final int CONNECTIONS = 1;
        public static final int BANDWIDTH = 2;
        public static final int LIMITS = 3;
    }

    private boolean[] expandedStates = new boolean[Expanders.TOTAL_EXPANDERS];

    private List<String> encryptionValues;

    private View.OnClickListener expanderListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            View image;
            View content;
            int index;
            switch(v.getId()) {
                case R.id.transmission_session_general_expander:
                    image = v.findViewById(R.id.transmission_session_general_expander_image);
                    content = findViewById(R.id.transmission_session_general_content);
                    index = Expanders.GENERAL;
                    break;
                case R.id.transmission_session_connections_expander:
                    image = v.findViewById(R.id.transmission_session_connections_expander_image);
                    content = findViewById(R.id.transmission_session_connections_content);
                    index = Expanders.CONNECTIONS;
                    break;
                case R.id.transmission_session_bandwidth_expander:
                    image = v.findViewById(R.id.transmission_session_bandwidth_expander_image);
                    content = findViewById(R.id.transmission_session_bandwidth_content);
                    index = Expanders.BANDWIDTH;
                    break;
                case R.id.transmission_session_limits_expander:
                    image = v.findViewById(R.id.transmission_session_limits_expander_image);
                    content = findViewById(R.id.transmission_session_limits_content);
                    index = Expanders.LIMITS;
                    break;
                default:
                    return;
            }

            if (content.getVisibility() == View.GONE) {
                new ExpandAnimation(content).expand();
                image.setRotation(0);
                expandedStates[index] = true;
            } else {
                new ExpandAnimation(content).collapse();
                image.setRotation(180);
                expandedStates[index] = false;
            }

            image.animate().rotationBy(180);
        }
    };


    private Runnable loseFocusRunnable = new Runnable() {
        @Override public void run() {
            findViewById(R.id.transmission_session_container).requestFocus();
        }
    };
{'fraction_non_alphanumeric': 0.07819059613769941, 'fraction_numerical': 0.0041981528127623844, 'mean_word_length': 2.784352660841938, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2500270', 'n_tokens_mistral': 2620, 'n_tokens_neox': 2441, 'n_words': 487}