states: added India states by English names, added placeholder tag

This commit is contained in:
Thibault Deckers 2023-03-25 11:44:01 +01:00
parent f375361c13
commit 14782815ed
8 changed files with 161 additions and 26 deletions

View file

@ -7,7 +7,8 @@ All notable changes to this project will be documented in this file.
### Added
- Collection: optional support for Samsung and Sony burst patterns
- Info: improved state/place display (requires rescan, limited to AU/GB/EN)
- Info: improved state/place display (requires rescan, limited to AU/GB/IN/US)
- Info: edit tags with state placeholder
- improved support for system font scale
### Changed

View file

@ -5,11 +5,13 @@ class GeoStates {
static final Set<String> stateCountryCodes = {
CountryCode.AU,
CountryCode.GB,
CountryCode.IN,
CountryCode.US,
}.map((v) => v.alpha2).toSet();
static const stateCodeByName = {
..._australiaEnglish,
..._indiaEnglish,
..._unitedKingdomEnglish,
..._unitedStatesEnglish,
};
@ -25,6 +27,45 @@ class GeoStates {
'Western Australia': EmojiStateCodes.auWesternAustralia,
};
static const _indiaEnglish = {
'Andaman and Nicobar Islands': EmojiStateCodes.inAndamanAndNicobarIslands,
'Andhra Pradesh': EmojiStateCodes.inAndhraPradesh,
'Arunachal Pradesh': EmojiStateCodes.inArunachalPradesh,
'Assam': EmojiStateCodes.inAssam,
'Bihar': EmojiStateCodes.inBihar,
'Chandigarh': EmojiStateCodes.inChandigarh,
'Chhattisgarh': EmojiStateCodes.inChhattisgarh,
'Daman and Diu': EmojiStateCodes.inDamanAndDiu,
'Delhi': EmojiStateCodes.inDelhi,
'Dadra and Nagar Haveli': EmojiStateCodes.inDadraAndNagarHaveli,
'Goa': EmojiStateCodes.inGoa,
'Gujarat': EmojiStateCodes.inGujarat,
'Himachal Pradesh': EmojiStateCodes.inHimachalPradesh,
'Haryana': EmojiStateCodes.inHaryana,
'Jharkhand': EmojiStateCodes.inJharkhand,
'Jammu and Kashmir': EmojiStateCodes.inJammuAndKashmir,
'Karnataka': EmojiStateCodes.inKarnataka,
'Kerala': EmojiStateCodes.inKerala,
'Lakshadweep': EmojiStateCodes.inLakshadweep,
'Maharashtra': EmojiStateCodes.inMaharashtra,
'Meghalaya': EmojiStateCodes.inMeghalaya,
'Manipur': EmojiStateCodes.inManipur,
'Madhya Pradesh': EmojiStateCodes.inMadhyaPradesh,
'Mizoram': EmojiStateCodes.inMizoram,
'Nagaland': EmojiStateCodes.inNagaland,
'Odisha': EmojiStateCodes.inOdisha,
'Punjab': EmojiStateCodes.inPunjab,
'Puducherry': EmojiStateCodes.inPuducherry,
'Rajasthan': EmojiStateCodes.inRajasthan,
'Sikkim': EmojiStateCodes.inSikkim,
'Telangana': EmojiStateCodes.inTelangana,
'Tamil Nadu': EmojiStateCodes.inTamilNadu,
'Tripura': EmojiStateCodes.inTripura,
'Uttar Pradesh': EmojiStateCodes.inUttarPradesh,
'Uttarakhand': EmojiStateCodes.inUttarakhand,
'West Bengal': EmojiStateCodes.inWestBengal,
};
static const _unitedKingdomEnglish = {
'England': EmojiStateCodes.gbEngland,
'Northern Ireland': EmojiStateCodes.gbNorthernIreland,

View file

@ -951,6 +951,7 @@
"tagEditorSectionPlaceholders": "Placeholders",
"tagPlaceholderCountry": "Country",
"tagPlaceholderState": "State",
"tagPlaceholderPlace": "Place",
"panoramaEnableSensorControl": "Enable sensor control",

View file

@ -56,7 +56,7 @@ extension ExtraAvesEntryLocation on AvesEntry {
final v = addresses.first;
var locality = v.locality ?? v.subLocality ?? v.featureName;
if (locality == null || locality == v.subThoroughfare) {
locality = v.subAdminArea ?? v.addressLine;
locality = v.subAdminArea;
}
addressDetails = AddressDetails(
id: id,

View file

@ -11,12 +11,14 @@ class PlaceholderFilter extends CollectionFilter {
static const type = 'placeholder';
static const _country = 'country';
static const _state = 'state';
static const _place = 'place';
final String placeholder;
late final IconData _icon;
static final country = PlaceholderFilter._private(_country);
static final state = PlaceholderFilter._private(_state);
static final place = PlaceholderFilter._private(_place);
@override
@ -27,6 +29,9 @@ class PlaceholderFilter extends CollectionFilter {
case _country:
_icon = AIcons.country;
break;
case _state:
_icon = AIcons.state;
break;
case _place:
_icon = AIcons.place;
break;
@ -48,6 +53,7 @@ class PlaceholderFilter extends CollectionFilter {
Future<String?> toTag(AvesEntry entry) async {
switch (placeholder) {
case _country:
case _state:
case _place:
if (!entry.isCatalogued) {
await entry.catalog(background: false, force: false, persist: true);
@ -60,8 +66,14 @@ class PlaceholderFilter extends CollectionFilter {
final address = entry.addressDetails;
if (address == null) return null;
if (placeholder == _country) return address.countryName;
if (placeholder == _place) return address.place;
switch (placeholder) {
case _country:
return address.countryName;
case _state:
return address.stateName;
case _place:
return address.place;
}
break;
}
return null;
@ -81,6 +93,8 @@ class PlaceholderFilter extends CollectionFilter {
switch (placeholder) {
case _country:
return context.l10n.tagPlaceholderCountry;
case _state:
return context.l10n.tagPlaceholderState;
case _place:
return context.l10n.tagPlaceholderPlace;
default:

View file

@ -40,6 +40,44 @@ class EmojiStateCodes {
static const gbScotland = 'gbsct';
static const gbWales = 'gbwls';
// IN
static const inAndamanAndNicobarIslands = 'inan';
static const inAndhraPradesh = 'inap';
static const inArunachalPradesh = 'inar';
static const inAssam = 'inas';
static const inBihar = 'inbr';
static const inChandigarh = 'inch';
static const inChhattisgarh = 'inct';
static const inDamanAndDiu = 'indd';
static const inDelhi = 'indl';
static const inDadraAndNagarHaveli = 'indn';
static const inGoa = 'inga';
static const inGujarat = 'ingj';
static const inHimachalPradesh = 'inhp';
static const inHaryana = 'inhr';
static const inJharkhand = 'injh';
static const inJammuAndKashmir = 'injk';
static const inKarnataka = 'inka';
static const inKerala = 'inkl';
static const inLakshadweep = 'inld';
static const inMaharashtra = 'inmh';
static const inMeghalaya = 'inml';
static const inManipur = 'inmn';
static const inMadhyaPradesh = 'inmp';
static const inMizoram = 'inmz';
static const inNagaland = 'innl';
static const inOdisha = 'inor';
static const inPunjab = 'inpb';
static const inPuducherry = 'inpy';
static const inRajasthan = 'inrj';
static const inSikkim = 'insk';
static const inTelangana = 'intg';
static const inTamilNadu = 'intn';
static const inTripura = 'intr';
static const inUttarPradesh = 'inup';
static const inUttarakhand = 'inut';
static const inWestBengal = 'inwb';
// US
static const usAlabama = 'usal';
static const usAlaska = 'usak';

View file

@ -32,10 +32,14 @@ class _TagEditorPageState extends State<TagEditorPage> {
final FocusNode _newTagTextFocusNode = FocusNode();
final ValueNotifier<String?> _expandedSectionNotifier = ValueNotifier(null);
late final List<CollectionFilter> _topTags;
late final List<PlaceholderFilter> _placeholders = [PlaceholderFilter.country, PlaceholderFilter.place];
final List<CollectionFilter> _userAddedFilters = [];
static const Color untaggedColor = Colors.blueGrey;
static final List<PlaceholderFilter> _placeholders = [
PlaceholderFilter.country,
PlaceholderFilter.state,
PlaceholderFilter.place,
];
Map<AvesEntry, Set<CollectionFilter>> get tagsByEntry => widget.filtersByEntry;

View file

@ -602,7 +602,8 @@
"viewerInfoSearchSuggestionRights",
"wallpaperUseScrollEffect",
"tagEditorPageTitle",
"tagEditorPageNewTagFieldLabel"
"tagEditorPageNewTagFieldLabel",
"tagPlaceholderState"
],
"ckb": [
@ -1167,6 +1168,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -1183,7 +1185,8 @@
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle"
"settingsVideoBackgroundModeDialogTitle",
"tagPlaceholderState"
],
"de": [
@ -1221,7 +1224,8 @@
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle",
"settingsDisablingBinWarningDialogMessage"
"settingsDisablingBinWarningDialogMessage",
"tagPlaceholderState"
],
"el": [
@ -1237,17 +1241,20 @@
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle"
"settingsVideoBackgroundModeDialogTitle",
"tagPlaceholderState"
],
"es": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"eu": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"fa": [
@ -1715,6 +1722,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -1726,6 +1734,10 @@
"filePickerUseThisFolder"
],
"fr": [
"tagPlaceholderState"
],
"gl": [
"columnCount",
"chipActionGoToPlacePage",
@ -2223,6 +2235,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -2860,6 +2873,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -3477,6 +3491,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -3490,12 +3505,14 @@
"id": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"it": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"ja": [
@ -3550,7 +3567,12 @@
"settingsDisablingBinWarningDialogMessage",
"settingsAccessibilityShowPinchGestureAlternatives",
"settingsDisplayUseTvInterface",
"settingsWidgetDisplayedItem"
"settingsWidgetDisplayedItem",
"tagPlaceholderState"
],
"ko": [
"tagPlaceholderState"
],
"lt": [
@ -3598,7 +3620,8 @@
"settingsVideoGestureVerticalDragBrightnessVolume",
"settingsDisablingBinWarningDialogMessage",
"settingsAccessibilityShowPinchGestureAlternatives",
"settingsDisplayUseTvInterface"
"settingsDisplayUseTvInterface",
"tagPlaceholderState"
],
"nb": [
@ -3609,7 +3632,8 @@
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle"
"settingsVideoBackgroundModeDialogTitle",
"tagPlaceholderState"
],
"nl": [
@ -3672,7 +3696,8 @@
"settingsDisablingBinWarningDialogMessage",
"settingsAccessibilityShowPinchGestureAlternatives",
"settingsDisplayUseTvInterface",
"settingsWidgetDisplayedItem"
"settingsWidgetDisplayedItem",
"tagPlaceholderState"
],
"nn": [
@ -3994,23 +4019,27 @@
"mapAttributionStamen",
"mapEmptyRegion",
"viewerInfoSearchSuggestionDimensions",
"wallpaperUseScrollEffect"
"wallpaperUseScrollEffect",
"tagPlaceholderState"
],
"pl": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"pt": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundModeDialogTitle"
"settingsVideoBackgroundModeDialogTitle",
"tagPlaceholderState"
],
"ro": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"ru": [
@ -4030,7 +4059,8 @@
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle",
"settingsVideoGestureVerticalDragBrightnessVolume"
"settingsVideoGestureVerticalDragBrightnessVolume",
"tagPlaceholderState"
],
"sk": [
@ -4447,6 +4477,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -4807,6 +4838,7 @@
"tagEditorSectionRecent",
"tagEditorSectionPlaceholders",
"tagPlaceholderCountry",
"tagPlaceholderState",
"tagPlaceholderPlace",
"panoramaEnableSensorControl",
"panoramaDisableSensorControl",
@ -4853,12 +4885,14 @@
"settingsCollectionBurstPatternsNone",
"settingsVideoBackgroundMode",
"settingsVideoBackgroundModeDialogTitle",
"settingsDisablingBinWarningDialogMessage"
"settingsDisablingBinWarningDialogMessage",
"tagPlaceholderState"
],
"uk": [
"settingsCollectionBurstPatternsTile",
"settingsCollectionBurstPatternsNone"
"settingsCollectionBurstPatternsNone",
"tagPlaceholderState"
],
"zh": [
@ -4904,7 +4938,8 @@
"settingsVideoGestureVerticalDragBrightnessVolume",
"settingsDisablingBinWarningDialogMessage",
"settingsAccessibilityShowPinchGestureAlternatives",
"settingsDisplayUseTvInterface"
"settingsDisplayUseTvInterface",
"tagPlaceholderState"
],
"zh_Hant": [
@ -4951,6 +4986,7 @@
"settingsVideoGestureVerticalDragBrightnessVolume",
"settingsDisablingBinWarningDialogMessage",
"settingsAccessibilityShowPinchGestureAlternatives",
"settingsDisplayUseTvInterface"
"settingsDisplayUseTvInterface",
"tagPlaceholderState"
]
}