FontPickerDialog - maplesyrup/maple-android GitHub Wiki

Overview

This class provides a dialog to choose a font. All fonts available on the device will be detected and displayed as a list. We can bundle more TTF files to allow the user to choose from a wider variety of fonts.

The dialog was built with inspiration from the FontPreference class made by George Yunaev under Apache 2.0 and found at http://www.ulduzsoft.com/2012/01/fontpreference-dialog-for-android/

Features

The FontPickerDialog extends DialogFragment. It defines an interface for a FontPickerDialogListener. To use this dialog you must implement FontPickerDialog.FontPickerDialogListener which defines the method onFontSelected(FontPickerDialog dialog).

This callback function returns the dialog object after the user has selected a font. You can call getSelectedFont() on the dialog object to obtain the file path of the font that was selected.

The dialog is arranged as a listview. Each font that the FontManager finds on the phone is represented as a textview, with the text being the name of the font, and written in the style of the font itself.

Users can scroll through the list, and select a font by clicking on an option. On click the dialog is closed and the choice is returned to the caller.

There is a cancel button available if the user chooses not to use one of the fonts.

Bugs

Planned Features

  1. Bundle TTF fonts to allow for better font variety.
  2. Improve the layout of the dialog.