-
- All Implemented Interfaces:
-
de.c1710.filemojicompat_ui.interfaces.EmojiPreferenceInterface
public class EmojiPreference implements EmojiPreferenceInterface
An easy-to-use helper for dealing with storing and retrieving emoji pack preferences.
-
-
Field Summary
Fields Modifier and Type Field Description private StringsharedPreferenceNamepublic final static EmojiPreferenceINSTANCE
-
Method Summary
Modifier and Type Method Description final SharedPreferencesgetSharedPreferences(Context context)final StringgetOrSetSharedPreferenceName(Context context)StringgetSelected(Context context)Returns the id/hash of the currently selected emoji pack UnitsetSelected(Context context, String value)Stores the id/hash of the currently/newly selected emoji pack StringgetDefault(Context context)Returns the name of the default pack for this application. UnitsetDefault(Context context, String value)Sets the id/hash of the default emoji pack for this application. StringgetNameForCustom(Context context, String hash)Returns the name assigned for a certain custom/imported emoji pack. UnitsetNameForCustom(Context context, String name, String hash)Sets the user-visible name for a custom emoji pack. final StringgetSharedPreferenceName()final UnitsetSharedPreferenceName(String sharedPreferenceName)-
-
Method Detail
-
getSharedPreferences
final SharedPreferences getSharedPreferences(Context context)
-
getOrSetSharedPreferenceName
final String getOrSetSharedPreferenceName(Context context)
-
getSelected
String getSelected(Context context)
Returns the id/hash of the currently selected emoji pack
-
setSelected
Unit setSelected(Context context, String value)
Stores the id/hash of the currently/newly selected emoji pack
-
getDefault
String getDefault(Context context)
Returns the name of the default pack for this application. Note: Usually, this is SYSTEM_DEFAULT, but it may be overridden, if the application e.g. comes with an Asset-based default pack.
-
setDefault
Unit setDefault(Context context, String value)
Sets the id/hash of the default emoji pack for this application. Note: You should <i>never</i> use a de.c1710.filemojicompat_ui.packs.FileBasedEmojiPack here, because it may be deleted by the user. If you want to update their choice, use setSelected instead. Usually you would use a de.c1710.filemojicompat_ui.packs.AssetEmojiPack here.
-
getNameForCustom
String getNameForCustom(Context context, String hash)
Returns the name assigned for a certain custom/imported emoji pack. Note: You should only use this for display, internally, you should use the de.c1710.filemojicompat_ui.structures.EmojiPack.id/hash of the pack.
- Parameters:
hash- The file hash of the pack
-
setNameForCustom
Unit setNameForCustom(Context context, String name, String hash)
Sets the user-visible name for a custom emoji pack.
- Parameters:
hash- The file hash of the pack
-
getSharedPreferenceName
final String getSharedPreferenceName()
-
setSharedPreferenceName
final Unit setSharedPreferenceName(String sharedPreferenceName)
-
-
-
-