<commit_before>/*******************************************************************************
 * Copyright (C) 2012-2014 CNRS and University of Strasbourg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.github.cetoolbox;

import com.github.cetoolbox.fragments.tabs.AboutActivity;
import com.github.cetoolbox.fragments.tabs.ConductivityActivity;
import com.github.cetoolbox.fragments.tabs.FlowrateActivity;
import com.github.cetoolbox.fragments.tabs.InjectionActivity;
import com.github.cetoolbox.fragments.tabs.MobilityActivity;
import com.github.cetoolbox.fragments.tabs.ViscosityActivity;
import com.github.cetoolbox.GlobalState;

import android.os.Bundle;
import android.app.TabActivity;
import android.widget.TabHost;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Resources;
import android.content.SharedPreferences;

import com.github.cetoolbox.R;

public class CEToolboxActivity extends TabActivity {

	static public GlobalState fragmentData;
	public static final String PREFS_NAME = "capillary.electrophoresis.toolbox.PREFERENCE_FILE_KEY";
	static public SharedPreferences preferences;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		preferences = getSharedPreferences(PREFS_NAME, 0);

		initializeFragmentData();
		Resources res = getResources();

		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		try {
			intent = new Intent(this.getBaseContext(), InjectionActivity.class);
			spec = tabHost.newTabSpec("injection");
			spec.setContent(intent);
			spec.setIndicator("Injection",
					res.getDrawable(R.drawable.ic_action_injection));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(),
					ConductivityActivity.class);
			spec = tabHost.newTabSpec("conductivity");
			spec.setContent(intent);
			spec.setIndicator("Conductivity",
					res.getDrawable(R.drawable.ic_action_conductivity));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(), FlowrateActivity.class);
			spec = tabHost.newTabSpec("flowate");
			spec.setContent(intent);
			spec.setIndicator("Flowrate",
					res.getDrawable(R.drawable.ic_action_flowrate));
			tabHost.addTab(spec);

			/*
			 * intent = new Intent(this.getBaseContext(),
			 * MobilityActivity.class); spec = tabHost.newTabSpec("mobility");
			 * spec.setContent(intent); spec.setIndicator("Mobility");
			 * tabHost.addTab(spec);
			 */

			intent = new Intent(this.getBaseContext(), ViscosityActivity.class);
			spec = tabHost.newTabSpec("viscosity");
			spec.setContent(intent);
			spec.setIndicator("Viscosity",
					res.getDrawable(R.drawable.ic_action_viscosity));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(), AboutActivity.class);
			spec = tabHost.newTabSpec("about");
			spec.setContent(intent);
			spec.setIndicator("About",
					res.getDrawable(R.drawable.ic_action_about));
			tabHost.addTab(spec);

			/* width = number of letters * 10 + 10 */
			int displayWidth = getWindowManager().getDefaultDisplay()
					.getWidth();
			int defaultTabWidth = 100;
			if ((defaultTabWidth * tabHost.getTabWidget().getChildCount()) < displayWidth) {
				defaultTabWidth = (int) Math.ceil(displayWidth
						/ tabHost.getTabWidget().getChildCount());

			}

			for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
				tabHost.getTabWidget().getChildAt(i).getLayoutParams().width = defaultTabWidth;
			}

			/*
			 * tabHost.getTabWidget().getChildAt(1).getLayoutParams().width =
			 * 70; tabHost.getTabWidget().getChildAt(2).getLayoutParams().width
			 * = 60;
			 * tabHost.getTabWidget().getChildAt(3).getLayoutParams().width =
			 * 160; tabHost.getTabWidget().getChildAt(4).getLayoutParams().width
			 * = 160;
			 */
			tabHost.setCurrentTab(0);
		} catch (ActivityNotFoundException e) {
			/* e.printStackTrace(); */<commit_msg>Remove useless code<commit_after>/*
 * Copyright (C) 2012-2019 CNRS and University of Strasbourg
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.cetoolbox;

import com.github.cetoolbox.fragments.tabs.AboutActivity;
import com.github.cetoolbox.fragments.tabs.ConductivityActivity;
import com.github.cetoolbox.fragments.tabs.FlowrateActivity;
import com.github.cetoolbox.fragments.tabs.InjectionActivity;
import com.github.cetoolbox.fragments.tabs.MobilityActivity;
import com.github.cetoolbox.fragments.tabs.ViscosityActivity;
import com.github.cetoolbox.GlobalState;

import android.os.Bundle;
import android.app.TabActivity;

import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TabHost;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Resources;
import android.content.SharedPreferences;

public class CEToolboxActivity extends TabActivity {

	static public GlobalState fragmentData;
	public static final String PREFS_NAME = "capillary.electrophoresis.toolbox.PREFERENCE_FILE_KEY";
	static public SharedPreferences preferences;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		preferences = getSharedPreferences(PREFS_NAME, 0);

		initializeFragmentData();
		Resources res = getResources();

		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		try {
			intent = new Intent(this.getBaseContext(), InjectionActivity.class);
			spec = tabHost.newTabSpec("injection");
			spec.setContent(intent);
			spec.setIndicator("Injection",
					res.getDrawable(R.drawable.ic_action_injection));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(),
					ConductivityActivity.class);
			spec = tabHost.newTabSpec("conductivity");
			spec.setContent(intent);
			spec.setIndicator("Conductivity",
					res.getDrawable(R.drawable.ic_action_conductivity));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(), FlowrateActivity.class);
			spec = tabHost.newTabSpec("flowate");
			spec.setContent(intent);
			spec.setIndicator("Flowrate",
					res.getDrawable(R.drawable.ic_action_flowrate));
			tabHost.addTab(spec);

			/*
			 * intent = new Intent(this.getBaseContext(),
			 * MobilityActivity.class); spec = tabHost.newTabSpec("mobility");
			 * spec.setContent(intent); spec.setIndicator("Mobility");
			 * tabHost.addTab(spec);
			 */

			intent = new Intent(this.getBaseContext(), ViscosityActivity.class);
			spec = tabHost.newTabSpec("viscosity");
			spec.setContent(intent);
			spec.setIndicator("Viscosity",
					res.getDrawable(R.drawable.ic_action_viscosity));
			tabHost.addTab(spec);

			intent = new Intent(this.getBaseContext(), AboutActivity.class);
			spec = tabHost.newTabSpec("about");
			spec.setContent(intent);
			spec.setIndicator("About",
					res.getDrawable(R.drawable.ic_action_about));
			tabHost.addTab(spec);

			tabHost.setCurrentTab(0);
		} catch (ActivityNotFoundException e) {
			/* e.printStackTrace(); */
{'fraction_non_alphanumeric': 0.13070639115809707, 'fraction_numerical': 0.006006727534839019, 'mean_word_length': 4.904255319148936, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4738802', 'n_tokens_mistral': 2759, 'n_tokens_neox': 2403, 'n_words': 516}