/* * This file is part of Popcorn Time. * * Popcorn Time is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Popcorn Time is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Popcorn Time. If not, see <http://www.gnu.org/licenses/>. */ package pct.droid.fragments.dialog; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.View; import android.widget.TextView; import butterknife.ButterKnife; import butterknife.Bind; import pct.droid.R; public class SynopsisDialogFragment extends DialogFragment { @Bind(R.id.synopsis) TextView synopsisText; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.fragment_synopsis, null); ButterKnife.bind(this, view); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) .setView(view) .setNeutralButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } } ); if (getArguments().containsKey("text")) { synopsisText.setText(getArguments().getString("text")); } return builder.create(); } }