Search in sources :

Example 1 with RecordCheckDialogRecyclerViewAdapter

use of com.nightonke.saver.adapter.RecordCheckDialogRecyclerViewAdapter in project CoCoin by Nightonke.

the class RecordCheckDialogFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    View view = LayoutInflater.from(context).inflate(R.layout.fragment_dialog_list, null, false);
    recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    RecordCheckDialogRecyclerViewAdapter adapter = new RecordCheckDialogRecyclerViewAdapter(context, list, this);
    recyclerView.setAdapter(adapter);
    builder.setTitle("Title");
    builder.setView(view);
    builder.setPositiveButton(mContext.getResources().getString(R.string.get), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    final AlertDialog alert = builder.create();
    TextView title = new TextView(mContext);
    title.setHeight(120);
    title.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    title.setText(this.title);
    alert.setCustomTitle(title);
    alert.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialog) {
            Button btnPositive = alert.getButton(Dialog.BUTTON_POSITIVE);
            btnPositive.setTypeface(CoCoinUtil.typefaceLatoLight);
        }
    });
    return alert;
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) RecordCheckDialogRecyclerViewAdapter(com.nightonke.saver.adapter.RecordCheckDialogRecyclerViewAdapter) DialogInterface(android.content.DialogInterface) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Button(android.widget.Button) TextView(android.widget.TextView) NonNull(android.support.annotation.NonNull)

Aggregations

AlertDialog (android.app.AlertDialog)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 NonNull (android.support.annotation.NonNull)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 RecordCheckDialogRecyclerViewAdapter (com.nightonke.saver.adapter.RecordCheckDialogRecyclerViewAdapter)1