<commit_before>package de.geeksfactory.opacclient.frontend;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;

import org.json.JSONException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceManager;
import de.geeksfactory.opacclient.OpacClient;
import de.geeksfactory.opacclient.R;
import de.geeksfactory.opacclient.apis.OpacApi.OpacErrorException;
import de.geeksfactory.opacclient.barcode.BarcodeScanIntegrator.ScanResult;
import de.geeksfactory.opacclient.frontend.OpacActivity.AccountSelectedListener;
import de.geeksfactory.opacclient.networking.SSLSecurityException;
import de.geeksfactory.opacclient.objects.Account;
import de.geeksfactory.opacclient.searchfields.BarcodeSearchField;
import de.geeksfactory.opacclient.searchfields.CheckboxSearchField;
import de.geeksfactory.opacclient.searchfields.DropdownSearchField;
import de.geeksfactory.opacclient.searchfields.SearchField;
import de.geeksfactory.opacclient.searchfields.SearchField.Meaning;
import de.geeksfactory.opacclient.searchfields.SearchQuery;
import de.geeksfactory.opacclient.searchfields.TextSearchField;
import de.geeksfactory.opacclient.storage.JsonSearchFieldDataSource;
import de.geeksfactory.opacclient.storage.SearchFieldDataSource;

public class SearchFragment extends Fragment implements AccountSelectedListener {
    protected SharedPreferences sp;
    protected Callback callback;
    protected View view;
    protected OpacClient app;
    protected Bundle savedState;
    protected boolean advanced = false;
    protected List<SearchField> fields;
    protected String barcodeScanningField;
    protected ScanResult scanResult;
    private LoadSearchFieldsTask task;

    protected LinearLayout llFormFields, llAdvancedFields, llExpand;
    protected EditText etSimpleSearch;
    protected CardView rlReplaced;
    protected Button btnReplacedDownload;
    protected ImageView ivExpandIcon;
    protected ScrollView scroll;
    protected ProgressBar progressBar;
    protected RelativeLayout rlSimpleSearch, rlOuter;
    protected TextView tvSearchAdvHeader, tvExpandString;
    protected ViewGroup errorView;

    public SearchFragment() {}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_search, container, false);
        findViews();

        setHasOptionsMenu(true);

        setRetainInstance(true);

        sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        app = (OpacClient) getActivity().getApplication();

        // if (getIntent().getBooleanExtra("barcode", false)) {
        // BarcodeScanIntegrator integrator = new BarcodeScanIntegrator(
        // SearchActivity.this);
        // integrator.initiateScan();
        // } else {
        // ArrayAdapter<CharSequence> order_adapter = ArrayAdapter
        // .createFromResource(this, R.array.orders,
        // R.layout.simple_spinner_item);
        // order_adapter
        // .setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
        // ((Spinner) SearchActivity.this.findViewById(R.id.cbOrder))
        // .setAdapter(order_adapter);
        // }

        return view;
    }

    protected void findViews() {
        llFormFields = view.findViewById(R.id.llFormFields);
        llAdvancedFields = view.findViewById(R.id.llAdvancedFields);
        etSimpleSearch = view.findViewById(R.id.etSimpleSearch);
        rlReplaced = view.findViewById(R.id.rlReplaced);
        btnReplacedDownload = view.findViewById(R.id.btnReplacedDownload);
        llExpand = view.findViewById(R.id.llExpand);
        scroll = view.findViewById(R.id.scroll);
        progressBar = view.findViewById(R.id.progressBar);
        rlSimpleSearch = view.findViewById(R.id.rlSimpleSearch);
        tvSearchAdvHeader = view.findViewById(R.id.tvSearchAdvHeader);
        rlOuter = view.findViewById(R.id.rlOuter);
        ivExpandIcon = view.findViewById(R.id.ivExpandIcon);
        tvExpandString = view.findViewById(R.id.tvExpandString);
        errorView = view.findViewById(R.id.error_view);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);<commit_msg>Adding support for different layout in plus app<commit_after>package de.geeksfactory.opacclient.frontend;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;

import org.json.JSONException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceManager;
import de.geeksfactory.opacclient.OpacClient;
import de.geeksfactory.opacclient.R;
import de.geeksfactory.opacclient.apis.OpacApi.OpacErrorException;
import de.geeksfactory.opacclient.barcode.BarcodeScanIntegrator.ScanResult;
import de.geeksfactory.opacclient.frontend.OpacActivity.AccountSelectedListener;
import de.geeksfactory.opacclient.networking.SSLSecurityException;
import de.geeksfactory.opacclient.objects.Account;
import de.geeksfactory.opacclient.searchfields.BarcodeSearchField;
import de.geeksfactory.opacclient.searchfields.CheckboxSearchField;
import de.geeksfactory.opacclient.searchfields.DropdownSearchField;
import de.geeksfactory.opacclient.searchfields.SearchField;
import de.geeksfactory.opacclient.searchfields.SearchField.Meaning;
import de.geeksfactory.opacclient.searchfields.SearchQuery;
import de.geeksfactory.opacclient.searchfields.TextSearchField;
import de.geeksfactory.opacclient.storage.JsonSearchFieldDataSource;
import de.geeksfactory.opacclient.storage.SearchFieldDataSource;

public class SearchFragment extends Fragment implements AccountSelectedListener {
    protected SharedPreferences sp;
    protected Callback callback;
    protected View view;
    protected OpacClient app;
    protected Bundle savedState;
    protected boolean advanced = false;
    protected List<SearchField> fields;
    protected String barcodeScanningField;
    protected ScanResult scanResult;
    private LoadSearchFieldsTask task;

    protected LinearLayout llFormFields, llAdvancedFields, llExpand;
    protected EditText etSimpleSearch;
    protected CardView rlReplaced;
    protected Button btnReplacedDownload;
    protected ImageView ivExpandIcon;
    protected ScrollView scroll;
    protected ProgressBar progressBar;
    protected RelativeLayout rlSimpleSearch, rlOuter;
    protected TextView tvSearchAdvHeader, tvExpandString;
    protected ViewGroup errorView;

    public SearchFragment() {}

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(getLayoutId(), container, false);
        findViews();

        setHasOptionsMenu(true);

        setRetainInstance(true);

        sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        app = (OpacClient) getActivity().getApplication();

        // if (getIntent().getBooleanExtra("barcode", false)) {
        // BarcodeScanIntegrator integrator = new BarcodeScanIntegrator(
        // SearchActivity.this);
        // integrator.initiateScan();
        // } else {
        // ArrayAdapter<CharSequence> order_adapter = ArrayAdapter
        // .createFromResource(this, R.array.orders,
        // R.layout.simple_spinner_item);
        // order_adapter
        // .setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
        // ((Spinner) SearchActivity.this.findViewById(R.id.cbOrder))
        // .setAdapter(order_adapter);
        // }

        return view;
    }

    protected int getLayoutId() {
        return R.layout.fragment_search;
    }

    protected void findViews() {
        llFormFields = view.findViewById(R.id.llFormFields);
        llAdvancedFields = view.findViewById(R.id.llAdvancedFields);
        etSimpleSearch = view.findViewById(R.id.etSimpleSearch);
        rlReplaced = view.findViewById(R.id.rlReplaced);
        btnReplacedDownload = view.findViewById(R.id.btnReplacedDownload);
        llExpand = view.findViewById(R.id.llExpand);
        scroll = view.findViewById(R.id.scroll);
        progressBar = view.findViewById(R.id.progressBar);
        rlSimpleSearch = view.findViewById(R.id.rlSimpleSearch);
        tvSearchAdvHeader = view.findViewById(R.id.tvSearchAdvHeader);
        rlOuter = view.findViewById(R.id.rlOuter);
        ivExpandIcon = view.findViewById(R.id.ivExpandIcon);
        tvExpandString = view.findViewById(R.id.tvExpandString);
        errorView = view.findViewById(R.id.error_view);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
{'fraction_non_alphanumeric': 0.08727770177838577, 'fraction_numerical': 0.0, 'mean_word_length': 4.493987975951904, 'pattern_counts': {'":': 0, '<': 7, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4559850', 'n_tokens_mistral': 3115, 'n_tokens_neox': 2954, 'n_words': 549}