RustamG / file-dialogs

An Android library with save and open file dialogs.
28 stars 8 forks source link

Specify file name #1

Closed Spettacolo83 closed 7 years ago

Spettacolo83 commented 7 years ago

Hello there, thank you for this amazing class! Can I set the default file name before call the show function? The component that I need to modify is: mFileNameText = (MaterialEditText) view.findViewById(R.id.et_filename); but it is protected! Let me know how can I do that! Thank you!

RustamG commented 7 years ago

Hi @Spettacolo83

You can extend SaveFileDialog class, override onViewCreated method and set the name there like this:

public class MySaveDialog extends SaveFileDialog {

    @Override 
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

        super.onViewCreated(view, savedInstanceState);

        mFileNameText.setText("My file name");
    }
}

If you need to pass the name from outside the dialog you can use your custom argument. Let me know if you need further details on this.