// Path: app/src/main/java/in/blogspot/anselmbros/torchie/utils/Constants.java
// public class Constants {
//     public final static String ID_DEVICE = "0";
// 
//     public final static String ID_DEVICE_OUTPUT = "1";
//     public final static String ID_DEVICE_OUTPUT_TORCH = "10";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH = "11";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_LEGACY = "12";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_NEW = "13";
//     public final static String ID_DEVICE_OUTPUT_TORCH_SCREEN = "14";
//     public final static String ID_DEVICE_OUTPUT_VIBRATOR = "15";
// 
//     public final static String ID_DEVICE_INPUT = "2";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY = "20";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_NATIVE = "21";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_ROCKER = "22";
//     public final static String ID_DEVICE_INPUT_PROXIMITY = "23";
// 
//     public final static String PLAY_URI = "https://play.google.com/store/apps/details?id=in.blogspot.anselmbros.torchie";
//     public final static String WEB_URI = "https://torchieapp.wordpress.com";
//     public final static String ABOUTANSELM_URI = "https://anselm.in";
//     public final static String FACEBOOK_URI = "https://facebook.com/torchieapp";
//     public final static String WEB_DONATE_URI = "https://torchieapp.wordpress.com/donate/";
// }


import in.blogspot.anselmbros.torchie.utils.Constants;
import android.app.DialogFragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;
import in.blogspot.anselmbros.torchie.R;

        tvAboutNote = (TextView) rootView.findViewById(R.id.tv_about_note);
        tvAboutAnselm = (TextView) rootView.findViewById(R.id.tv_about_anselm);
        tvVisitSite = (TextView) rootView.findViewById(R.id.tv_visit_site);
        tvFacebook = (TextView) rootView.findViewById(R.id.tv_facebook);
        tvTranslatorNote = (TextView) rootView.findViewById(R.id.tv_translator_note);
        tvNotice = (TextView) rootView.findViewById(R.id.tv_notice);

        tvAboutNote.setMovementMethod(LinkMovementMethod.getInstance());
        tvTranslatorNote.setMovementMethod(LinkMovementMethod.getInstance());
        tvAboutAnselm.setOnClickListener(this);
        tvVisitSite.setOnClickListener(this);
        tvFacebook.setOnClickListener(this);
        tvNotice.setMovementMethod(LinkMovementMethod.getInstance());

        try {
            notice = String.format(getActivity().getResources().getString(R.string.notice), getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName);
            tvNotice.setText(notice);
        } catch (Exception e) {
            notice = getActivity().getResources().getString(R.string.notice);
            tvNotice.setText(notice);
        }

        return rootView;
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        if (v == tvAboutAnselm) {
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/utils/Constants.java
// public class Constants {
//     public final static String ID_DEVICE = "0";
// 
//     public final static String ID_DEVICE_OUTPUT = "1";
//     public final static String ID_DEVICE_OUTPUT_TORCH = "10";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH = "11";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_LEGACY = "12";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_NEW = "13";
//     public final static String ID_DEVICE_OUTPUT_TORCH_SCREEN = "14";
//     public final static String ID_DEVICE_OUTPUT_VIBRATOR = "15";
// 
//     public final static String ID_DEVICE_INPUT = "2";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY = "20";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_NATIVE = "21";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_ROCKER = "22";
//     public final static String ID_DEVICE_INPUT_PROXIMITY = "23";
// 
//     public final static String PLAY_URI = "https://play.google.com/store/apps/details?id=in.blogspot.anselmbros.torchie";
//     public final static String WEB_URI = "https://torchieapp.wordpress.com";
//     public final static String ABOUTANSELM_URI = "https://anselm.in";
//     public final static String FACEBOOK_URI = "https://facebook.com/torchieapp";
//     public final static String WEB_DONATE_URI = "https://torchieapp.wordpress.com/donate/";
// }


// Path: app/src/main/java/in/blogspot/anselmbros/torchie/ui/fragment/dialog/AboutDialog.java
import in.blogspot.anselmbros.torchie.utils.Constants;
import android.app.DialogFragment;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;
import in.blogspot.anselmbros.torchie.R;


        tvAboutNote = (TextView) rootView.findViewById(R.id.tv_about_note);
        tvAboutAnselm = (TextView) rootView.findViewById(R.id.tv_about_anselm);
        tvVisitSite = (TextView) rootView.findViewById(R.id.tv_visit_site);
        tvFacebook = (TextView) rootView.findViewById(R.id.tv_facebook);
        tvTranslatorNote = (TextView) rootView.findViewById(R.id.tv_translator_note);
        tvNotice = (TextView) rootView.findViewById(R.id.tv_notice);

        tvAboutNote.setMovementMethod(LinkMovementMethod.getInstance());
        tvTranslatorNote.setMovementMethod(LinkMovementMethod.getInstance());
        tvAboutAnselm.setOnClickListener(this);
        tvVisitSite.setOnClickListener(this);
        tvFacebook.setOnClickListener(this);
        tvNotice.setMovementMethod(LinkMovementMethod.getInstance());

        try {
            notice = String.format(getActivity().getResources().getString(R.string.notice), getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName);
            tvNotice.setText(notice);
        } catch (Exception e) {
            notice = getActivity().getResources().getString(R.string.notice);
            tvNotice.setText(notice);
        }

        return rootView;
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        if (v == tvAboutAnselm) {
            intent.setData(Uri.parse(Constants.ABOUTANSELM_URI));