com.example.stefan.movies.Fragments.Others.OpenSourceLicenses.java Source code

Java tutorial

Introduction

Here is the source code for com.example.stefan.movies.Fragments.Others.OpenSourceLicenses.java

Source

package com.example.stefan.movies.Fragments.Others;

import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.stefan.movies.R;

/**
 * Created by Stefan on 19-07-2016.
 */
public class OpenSourceLicenses extends DialogFragment {

    final OpenSourceLicenses context = this;
    ImageView searchTitleIcon;
    TextView searchTitleName;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {

        final Dialog dialog = new Dialog(getActivity());

        dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.fragment_opensource_licenses);

        searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile);
        searchTitleIcon.setImageResource(R.drawable.ic_security_black_24dp);
        searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange));

        searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName);
        searchTitleName.setText(R.string.licenses_header_title);

        // Closes the Dialog
        Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel);
        dialogBtnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
        return dialog;
    }
}