<commit_before>/*
 * Copyright (C) 2013 <NAME>
 *
 * 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 net.simonvt.cathode.ui.dialog;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import net.simonvt.cathode.R;

public class AboutDialog extends DialogFragment {

  private static final String DIALOG_LICENSES =
      "net.simonvt.cathode.ui.dialog.AboutDialog.licenses";

  @InjectView(R.id.version) TextView version;
  @InjectView(R.id.licenses) View licenses;
  @InjectView(R.id.sourceCode) View sourceCode;

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle inState) {
    return inflater.inflate(R.layout.dialog_about, container, false);
  }

  @Override public void onViewCreated(View view, Bundle inState) {
    super.onViewCreated(view, inState);
    ButterKnife.inject(this, view);
    getDialog().setTitle(R.string.app_name);

    String versionName;
    try {
      versionName = getActivity().getPackageManager()
          .getPackageInfo(getActivity().getPackageName(), 0).versionName;
      version.setText(getString(R.string.version_x, versionName));
    } catch (PackageManager.NameNotFoundException e) {
      version.setText(R.string.version_unknown);
    }

    licenses.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        new LicensesDialog().show(getFragmentManager(), DIALOG_LICENSES);
      }
    });<commit_msg>Get version name from BuildConfig.<commit_after>/*
 * Copyright (C) 2013 <NAME>
 *
 * 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 net.simonvt.cathode.ui.dialog;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import net.simonvt.cathode.BuildConfig;
import net.simonvt.cathode.R;

public class AboutDialog extends DialogFragment {

  private static final String DIALOG_LICENSES =
      "net.simonvt.cathode.ui.dialog.AboutDialog.licenses";

  @InjectView(R.id.version) TextView version;
  @InjectView(R.id.licenses) View licenses;
  @InjectView(R.id.sourceCode) View sourceCode;

  @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle inState) {
    return inflater.inflate(R.layout.dialog_about, container, false);
  }

  @Override public void onViewCreated(View view, Bundle inState) {
    super.onViewCreated(view, inState);
    ButterKnife.inject(this, view);
    getDialog().setTitle(R.string.app_name);

    version.setText(getString(R.string.version_x, BuildConfig.VERSION_NAME));

    licenses.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        new LicensesDialog().show(getFragmentManager(), DIALOG_LICENSES);
      }
    });
{'fraction_non_alphanumeric': 0.09706703910614525, 'fraction_numerical': 0.004422718808193668, 'mean_word_length': 4.523136246786632, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1219384', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1224, 'n_words': 349}