preference

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NetworkTypes = []ItemPreference{
		{Key: string(libutils.Mainnet), Value: libutils.Mainnet.Display()},
		{Key: string(libutils.Testnet), Value: libutils.Testnet.Display()},
	}

	// ExchOptions holds the configurable options for exchange servers.
	ExchOptions = []ItemPreference{
		{Key: values.BinanceExchange, Value: values.StrUsdBinance},
		{Key: values.BittrexExchange, Value: values.StrUsdBittrex},
		{Key: values.DefaultExchangeValue, Value: values.StrNone},
	}

	// LangOptions stores the configurable language options.
	LangOptions = []ItemPreference{
		{Key: localizable.ENGLISH, Value: values.StrEnglish},
		{Key: localizable.FRENCH, Value: values.StrFrench},
		{Key: localizable.SPANISH, Value: values.StrSpanish},
	}

	// LogOptions are the selectable debug levels.
	LogOptions = []ItemPreference{
		{Key: libutils.LogLevelTrace, Value: values.StrLogLevelTrace},
		{Key: libutils.LogLevelDebug, Value: values.StrLogLevelDebug},
		{Key: libutils.LogLevelInfo, Value: values.StrLogLevelInfo},
		{Key: libutils.LogLevelWarn, Value: values.StrLogLevelWarn},
		{Key: libutils.LogLevelError, Value: values.StrLogLevelError},
		{Key: libutils.LogLevelCritical, Value: values.StrLogLevelCritical},
	}
)

Functions

func GetKeyValue

func GetKeyValue(key string, options []ItemPreference) string

GetKeyValue return the value for a key within a set of prefence options. The key is case sensitive, `Key` != `key`. Returns the empty string if the key is not found.

Types

type C

type C = layout.Context

type D

type D = layout.Dimensions

type ItemPreference

type ItemPreference struct {
	Key   string // option's key
	Value string // option's value
}

ItemPreference models the options shown by the list preference modal.

type ListPreferenceModal

type ListPreferenceModal struct {
	*load.Load
	*cryptomaterial.Modal
	// contains filtered or unexported fields
}

func NewListPreference

func NewListPreference(l *load.Load, preferenceKey, defaultValue string, items []ItemPreference) *ListPreferenceModal

func (*ListPreferenceModal) Handle

func (lp *ListPreferenceModal) Handle()

func (*ListPreferenceModal) IsWallet

func (lp *ListPreferenceModal) IsWallet(setAccount bool) *ListPreferenceModal

func (*ListPreferenceModal) Layout

func (lp *ListPreferenceModal) Layout(gtx C) D

func (*ListPreferenceModal) OnDismiss

func (lp *ListPreferenceModal) OnDismiss()

func (*ListPreferenceModal) OnResume

func (lp *ListPreferenceModal) OnResume()

func (*ListPreferenceModal) ReadPreferenceKeyedValue

func (lp *ListPreferenceModal) ReadPreferenceKeyedValue() string

func (*ListPreferenceModal) SavePreferenceKeyedValue

func (lp *ListPreferenceModal) SavePreferenceKeyedValue()

func (*ListPreferenceModal) Title

func (*ListPreferenceModal) UpdateValues

func (lp *ListPreferenceModal) UpdateValues(clicked func(val string)) *ListPreferenceModal

func (*ListPreferenceModal) UseCustomWidget

func (lp *ListPreferenceModal) UseCustomWidget(layout layout.Widget) *ListPreferenceModal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL