Search in sources :

Example 1 with MainActivity

use of dagger.extension.example.view.main.MainActivity in project dagger-test-example by aschattney.

the class ErrorDialogFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ((MainActivity) getActivity()).inject(this, getArguments().getString("message"), getArguments().getString("title"));
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    ErrorBinding binding = DataBindingUtil.inflate(LayoutInflater.from(getActivity()), R.layout.error, null, false);
    binding.setVm(vm);
    builder.setView(binding.getRoot());
    builder.setPositiveButton("OK", null);
    return builder.create();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ErrorBinding(dagger.extension.example.databinding.ErrorBinding) MainActivity(dagger.extension.example.view.main.MainActivity) NonNull(android.support.annotation.NonNull)

Aggregations

NonNull (android.support.annotation.NonNull)1 AlertDialog (android.support.v7.app.AlertDialog)1 ErrorBinding (dagger.extension.example.databinding.ErrorBinding)1 MainActivity (dagger.extension.example.view.main.MainActivity)1