package fr.masciulli.drinks.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import fr.masciulli.drinks.R;

public class AboutDialogFragment extends DialogFragment {

    @InjectView(R.id.version_name)
    TextView mVersionNameView;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        LayoutInflater inflater = getActivity().getLayoutInflater();

        View root = inflater.inflate(R.layout.dialog_about, null);
        ButterKnife.inject(this, root);

        try {
            PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
            mVersionNameView.setText(pInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            mVersionNameView.setText(getString(R.string.unknown_version));
        }


        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(root);

        return builder.create();
    }

    @OnClick(R.id.ok)
    void dismissDialog() {
        dismiss();
    }
}

@@ -430,16 +430,56 @@
 nClick;%0A
+import fr.masciulli.drinks.BuildConfig;%0A
 import f
@@ -1013,16 +1013,178 @@
 (), 0);%0A
+            String versionNameText = pInfo.versionName;%0A            if (BuildConfig.DEBUG)%0A            %7B%0A                versionNameText += %22.dev%22;%0A            %7D%0A
         
@@ -1212,22 +1212,16 @@
 setText(
-pInfo.
 versionN
@@ -1223,16 +1223,20 @@
 sionName
+Text
 );%0A     

Add .dev to version name in about dialog