<commit_before>package com.bukhmastov.cdoitmo.activities;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;

import com.bukhmastov.cdoitmo.R;
import com.bukhmastov.cdoitmo.adapters.SuggestionsListView;
import com.bukhmastov.cdoitmo.objects.entities.Suggestion;
import com.bukhmastov.cdoitmo.utils.CtxWrapper;
import com.bukhmastov.cdoitmo.utils.Log;
import com.bukhmastov.cdoitmo.utils.Static;

import java.util.ArrayList;
import java.util.Locale;

public abstract class SearchActivity extends AppCompatActivity {

    private static final String TAG = "SearchActivity";
    protected final SearchActivity self = this;
    private static final int REQ_CODE_SPEECH_INPUT = 1337;
    private enum EXTRA_ACTION_MODE {Speech_recognition, Clear, None}
    private EditText search_edit_text;

    abstract String getHint();
    abstract ArrayList<Suggestion> getSuggestions(String query);
    abstract void onDone(String query, String label);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        switch (Static.getAppTheme(this)) {
            case "light":
            default: setTheme(R.style.AppTheme_Search); break;
            case "dark": setTheme(R.style.AppTheme_Search_Dark); break;
            case "white": setTheme(R.style.AppTheme_Search_White); break;
            case "black": setTheme(R.style.AppTheme_Search_Black); break;
        }
        super.onCreate(savedInstanceState);
        Log.i(TAG, "Activity created");
        setContentView(R.layout.activity_search);
    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        Log.v(TAG, "onPostCreate");
        findViewById(R.id.search_close).setOnClickListener(v -> {
            Log.v(TAG, "search_close clicked");
            finish();
        });
        search_edit_text = findViewById(R.id.search_edittext);
        search_edit_text.setHint(getHint());
        search_edit_text.addTextChangedListener(textWatcher);
        search_edit_text.setOnKeyListener(onKeyListener);
        setMode(EXTRA_ACTION_MODE.Speech_recognition);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();<commit_msg>Search activity: suggestions now visible from the beginning<commit_after>package com.bukhmastov.cdoitmo.activities;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;

import com.bukhmastov.cdoitmo.R;
import com.bukhmastov.cdoitmo.adapters.SuggestionsListView;
import com.bukhmastov.cdoitmo.objects.entities.Suggestion;
import com.bukhmastov.cdoitmo.utils.CtxWrapper;
import com.bukhmastov.cdoitmo.utils.Log;
import com.bukhmastov.cdoitmo.utils.Static;

import java.util.ArrayList;
import java.util.Locale;

public abstract class SearchActivity extends AppCompatActivity {

    private static final String TAG = "SearchActivity";
    protected final SearchActivity self = this;
    private static final int REQ_CODE_SPEECH_INPUT = 1337;
    private enum EXTRA_ACTION_MODE {Speech_recognition, Clear, None}
    private EditText search_edit_text;

    abstract String getHint();
    abstract ArrayList<Suggestion> getSuggestions(String query);
    abstract void onDone(String query, String label);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        switch (Static.getAppTheme(this)) {
            case "light":
            default: setTheme(R.style.AppTheme_Search); break;
            case "dark": setTheme(R.style.AppTheme_Search_Dark); break;
            case "white": setTheme(R.style.AppTheme_Search_White); break;
            case "black": setTheme(R.style.AppTheme_Search_Black); break;
        }
        super.onCreate(savedInstanceState);
        Log.i(TAG, "Activity created");
        setContentView(R.layout.activity_search);
    }

    @Override
    protected void onPostCreate(@Nullable Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        Log.v(TAG, "onPostCreate");
        findViewById(R.id.search_close).setOnClickListener(v -> {
            Log.v(TAG, "search_close clicked");
            finish();
        });
        search_edit_text = findViewById(R.id.search_edittext);
        search_edit_text.setHint(getHint());
        search_edit_text.addTextChangedListener(textWatcher);
        search_edit_text.setOnKeyListener(onKeyListener);
        setMode(EXTRA_ACTION_MODE.Speech_recognition);
        setSuggestions(getSuggestions(""));
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
{'fraction_non_alphanumeric': 0.09448529411764706, 'fraction_numerical': 0.001838235294117647, 'mean_word_length': 4.061395348837209, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 7, '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': '3873906', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1537, 'n_words': 301}