implement share to mapquest

This commit is contained in:
Trent Palmer 2019-08-05 22:56:02 -07:00
parent d0395df257
commit f18e1dc301
8 changed files with 197 additions and 12 deletions

View File

@ -37,7 +37,7 @@ _____
## road map ## road map
* *
* add more things to be implemented * add more things to be implemented
* add input from Bing Maps, Mapquest apps * add input from Bing Maps, OSM?
* add other elevation api server options * add other elevation api server options
* include shared-prefs import/export in history import/export * include shared-prefs import/export in history import/export

View File

@ -6,3 +6,7 @@ eddc2f07cd8aaf710cdebeead84b1c5d6b82312b4a099bd6cb09372713f0ddd3 libre_gps_pars
8c32da0c647d3b464678fe327cffe3a6750e402088552fcee7fa16b8789ecb02 libre_gps_parser/0.1.4/armv11/app-release.apk 8c32da0c647d3b464678fe327cffe3a6750e402088552fcee7fa16b8789ecb02 libre_gps_parser/0.1.4/armv11/app-release.apk
9bef42c7919074e3661c8680cb69aa786102c4df47495dd4731efff163a8ed9b libre_gps_parser/0.1.4/arm64v12/app.aab 9bef42c7919074e3661c8680cb69aa786102c4df47495dd4731efff163a8ed9b libre_gps_parser/0.1.4/arm64v12/app.aab
21460b736f6045e569443db8cdac7942c352085b3222628d100814dd5a7217d5 libre_gps_parser/0.1.4/arm64v12/app-release.apk 21460b736f6045e569443db8cdac7942c352085b3222628d100814dd5a7217d5 libre_gps_parser/0.1.4/arm64v12/app-release.apk
14ea6f6ce2566cf02ad5e2f783099eaa178714a5917077774a44b3ba2685bf64 libre_gps_parser/0.1.5/armv13/app.aab
4a26beeafff34e0d4dd1f08a235fa36ca32746c279cef637d4b47b657ab60c95 libre_gps_parser/0.1.5/armv13/app-release.apk
248eff0408748b089d13d55266aae1d542d6666ffaa7155bd948b2addf3c5efe libre_gps_parser/0.1.5/arm64v14/app.aab
412e83dcc9112b8814f3e261a452cee924a38eb8e14c90a96e3140148caededf libre_gps_parser/0.1.5/arm64v14/app-release.apk

View File

@ -55,7 +55,7 @@ InkWell aboutApp(BuildContext context) {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
'Version: 0.1.4\n', 'Version: 0.1.5\n',
style: TextStyle( style: TextStyle(
color: candyApple, color: candyApple,
), ),
@ -166,7 +166,8 @@ InkWell aboutApp(BuildContext context) {
], ],
), ),
); );
}); }
);
}, },
); );
} }

View File

@ -435,6 +435,19 @@ Future<bool> setPreferenceUseWeather(bool useWeather) async {
return (committed); return (committed);
} }
Future<bool> getPreferenceUseShareToMapQuest() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
bool _useShareToMapQuest = prefs.getBool("useShareToMapQuest") ?? false;
return _useShareToMapQuest;
}
Future<bool> setPreferenceUseShareToMapQuest(bool useShareToMapQuest) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
bool committed = await prefs.setBool("useShareToMapQuest", useShareToMapQuest);
return (committed);
}
Future<String> getPreferenceDBExportFileName() async { Future<String> getPreferenceDBExportFileName() async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
String dbExportFileName = String dbExportFileName =

View File

@ -5,8 +5,9 @@ import 'package:share/share.dart';
final double textHeight = 1.5; final double textHeight = 1.5;
Row lnlDec(String latnLong) { Row lnlDec(String latnLong,BuildContext context) {
Future<void> _launchLnL() async {
Future<void> _launchLnLgMaps() async {
AndroidIntent intent = AndroidIntent( AndroidIntent intent = AndroidIntent(
action: 'action_view', action: 'action_view',
data: Uri.encodeFull('geo:$latnLong?z=12'), data: Uri.encodeFull('geo:$latnLong?z=12'),
@ -15,6 +16,133 @@ Row lnlDec(String latnLong) {
await intent.launch(); await intent.launch();
} }
Future<void> _launchLnLqMaps() async {
AndroidIntent intent = AndroidIntent(
action: 'action_view',
data: Uri.encodeFull('geo:$latnLong'),
package: 'com.mapquest.android.ace',
);
await intent.launch();
}
Future<void> _launchLnL() async {
bool _useShareToMapQuest = await getPreferenceUseShareToMapQuest();
if (_useShareToMapQuest) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
backgroundColor: ivory,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Flexible(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(
top: 40,
bottom: 10,
),
child: Wrap(
runSpacing: 30,
alignment: WrapAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(
horizontal: 15,
),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
),
height: 75,
child: RaisedButton(
color: peacockBlue,
child: Icon(
Icons.arrow_back,
size: 48.0,
color: Colors.white,
),
onPressed: () {
Navigator.of(context).pop();
}),
),
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 15,
),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
),
height: 75,
child: RaisedButton(
color: peacockBlue,
child: Text(
"MapQuest",
style: TextStyle(
height: textHeight,
color: Colors.white,
fontSize: 24,
),
),
onPressed: () {
_launchLnLqMaps();
}),
),
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 15,
),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
),
height: 75,
child: RaisedButton(
color: peacockBlue,
child: Text(
"GoogleMaps",
style: TextStyle(
height: textHeight,
color: Colors.white,
fontSize: 24,
),
),
onPressed: () {
_launchLnLgMaps();
}
),
),
),
],
),
),
],
),
),
),
],
),
);
}
);
} else {
await _launchLnLgMaps();
}
}
List<String> _latNLong = ['x', 'y']; List<String> _latNLong = ['x', 'y'];
if ((latnLong == 'none') || (latnLong == null)) { if ((latnLong == 'none') || (latnLong == null)) {
return Row( return Row(

View File

@ -286,8 +286,8 @@ class _LatNLongState extends State<LatNLong> {
padding: myBoxPadding, padding: myBoxPadding,
decoration: myBoxDecoration(ivory), decoration: myBoxDecoration(ivory),
child: (this.latnLong != null) child: (this.latnLong != null)
? lnlDec(this.latnLong) ? lnlDec(this.latnLong,context)
: lnlDec('none'), : lnlDec('none',context),
), ),
IntrinsicHeight( IntrinsicHeight(
child: Row( child: Row(
@ -493,8 +493,8 @@ class _LatNLongState extends State<LatNLong> {
padding: myBoxPadding, padding: myBoxPadding,
decoration: myBoxDecoration(ivory), decoration: myBoxDecoration(ivory),
child: (this.latnLong != null) child: (this.latnLong != null)
? lnlDec(this.latnLong) ? lnlDec(this.latnLong,context)
: lnlDec('none'), : lnlDec('none',context),
), ),
IntrinsicHeight( IntrinsicHeight(
child: Row( child: Row(
@ -641,8 +641,8 @@ class _LatNLongState extends State<LatNLong> {
padding: myBoxPadding, padding: myBoxPadding,
decoration: myBoxDecoration(ivory), decoration: myBoxDecoration(ivory),
child: (this.latnLong != null) child: (this.latnLong != null)
? lnlDec(this.latnLong) ? lnlDec(this.latnLong,context)
: lnlDec('none'), : lnlDec('none',context),
), ),
), ),
Expanded( Expanded(

View File

@ -22,6 +22,7 @@ class _SettingsState extends State<Settings> {
final _oWMKController = TextEditingController(); final _oWMKController = TextEditingController();
bool _useElevation = false; bool _useElevation = false;
bool _useWeather = false; bool _useWeather = false;
bool _useShareToMapQuest = false;
double textHeight = 1.5; double textHeight = 1.5;
@override @override
@ -600,6 +601,42 @@ class _SettingsState extends State<Settings> {
), ),
) )
: Container()), : Container()),
Container(
padding: myBoxPadding,
decoration: myBoxDecoration(ivory),
child: Row(
children: [
Expanded(
child: Text(
'Enable Share Decimal Coordinates to MapQuest?',
style: TextStyle(
height: textHeight,
fontSize: 20,
),
),
),
Container(
padding: EdgeInsets.all(15.0),
child: Transform.scale(
scale: 2,
child: Switch(
value: this._useShareToMapQuest,
onChanged: (value) {
setPreferenceUseShareToMapQuest(value).then((bool committed) {
setState(() {
this._useShareToMapQuest = value;
});
});
},
activeTrackColor: peacockBlue,
activeColor: navy,
inactiveThumbColor: candyApple,
),
),
),
],
),
),
Container( Container(
padding: myBoxPadding, padding: myBoxPadding,
decoration: myBoxDecoration(ivory), decoration: myBoxDecoration(ivory),
@ -706,6 +743,7 @@ class _SettingsState extends State<Settings> {
String _dbEFNS = await getPreferenceDBExportFileName(); String _dbEFNS = await getPreferenceDBExportFileName();
bool _useElev = await getPreferenceUseElevation(); bool _useElev = await getPreferenceUseElevation();
bool _useWTHR = await getPreferenceUseWeather(); bool _useWTHR = await getPreferenceUseWeather();
bool _useShareToMQst = await getPreferenceUseShareToMapQuest();
setState(() { setState(() {
this.elevationServer = _evServer; this.elevationServer = _evServer;
this.openWeatherMapKey = _oWMK; this.openWeatherMapKey = _oWMK;
@ -713,6 +751,7 @@ class _SettingsState extends State<Settings> {
this._useWeather = _useWTHR; this._useWeather = _useWTHR;
this.shortOWMAK = _oWMK.substring(0, 5); this.shortOWMAK = _oWMK.substring(0, 5);
this._dbExportFileNameString = _dbEFNS; this._dbExportFileNameString = _dbEFNS;
this._useShareToMapQuest = _useShareToMQst;
}); });
} }

View File

@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.1.2+12 version: 0.1.5+14
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.1.0 <3.0.0"