Skip to content

[Deprecated]Localizing your Chooser

Ashish Shekar edited this page May 25, 2017 · 1 revision

Let's begin

You can use StorageChooserView class to localize your chooser. This class works like a bridge between chooser and the developer.

StorageChooser <------- StorageChooserView --------> Developer

It has a static implementation shown below

                    StorageChooserView.setChooserHeading(getString(R.string.title_storage_chooser));
                    StorageChooserView.setInternalStorageText(getString(R.string.title_storage_chooser_internal));

                    // button labels
                    StorageChooserView.setLabelCreate(getString(R.string.label_create));
                    StorageChooserView.setLabelSelect(getString(R.string.label_select));
                    StorageChooserView.setLabelNewFolder(getString(R.string.new_folder));

                    // textfield strings
                    StorageChooserView.setTextfieldHint(getString(R.string.hint_folder_name));
                    StorageChooserView.setTextfieldError(getString(R.string.error_tip_empty_field));

                    // toast strings
                    StorageChooserView.setToastFolderCreated(getString(R.string.create_folder_success));
                    StorageChooserView.setToastFolderError(getString(R.string.create_folder_error));

And strings used here for reference are as follows:

            <string name="title_storage_chooser">Choose Storage</string>
            <string name="title_storage_chooser_internal">Internal Storage</string>

            <string name="label_create">Create</string>
            <string name="label_select">Select</string>
            <string name="new_folder">New Folder</string>

            <string name="hint_folder_name">Folder Name</string>
            <string name="error_tip_empty_field">Empty folder name</string>

            <string name="create_folder_success">Folder created</string>
            <string name="create_folder_error">Could not create folder</string>

Clone this wiki locally