mirror of
https://github.com/woheller69/solxpect.git
synced 2025-12-16 17:30:13 +01:00
allow rotation in AddLocation
This commit is contained in:
parent
5039510970
commit
0d53115e68
1 changed files with 17 additions and 1 deletions
|
|
@ -56,6 +56,7 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
||||||
Activity activity;
|
Activity activity;
|
||||||
View rootView;
|
View rootView;
|
||||||
SQLiteHelper database;
|
SQLiteHelper database;
|
||||||
|
private WebView webview;
|
||||||
|
|
||||||
private AutoCompleteTextView autoCompleteTextView;
|
private AutoCompleteTextView autoCompleteTextView;
|
||||||
City selectedCity;
|
City selectedCity;
|
||||||
|
|
@ -70,6 +71,10 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
||||||
String url="";
|
String url="";
|
||||||
String lang="en";
|
String lang="en";
|
||||||
|
|
||||||
|
public AddLocationDialogOmGeocodingAPI() {
|
||||||
|
setRetainInstance(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
|
|
@ -84,6 +89,17 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
||||||
if (savedInstanceState != null) dismiss();
|
if (savedInstanceState != null) dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
handler.removeMessages(TRIGGER_HIDE_KEYBOARD);
|
||||||
|
if(selectedCity != null && webview != null) {
|
||||||
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
String osmTiles = sp.getString("pref_OsmTiles_URL", BuildConfig.TILES_URL);
|
||||||
|
webview.loadUrl("file:///android_asset/map.html?lat=" + selectedCity.getLatitude() + "&lon=" + selectedCity.getLongitude() + "&tiles=" + osmTiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -106,7 +122,7 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
||||||
this.database = SQLiteHelper.getInstance(activity);
|
this.database = SQLiteHelper.getInstance(activity);
|
||||||
|
|
||||||
|
|
||||||
final WebView webview= rootView.findViewById(R.id.webViewAddLocation);
|
webview = rootView.findViewById(R.id.webViewAddLocation);
|
||||||
webview.getSettings().setJavaScriptEnabled(true);
|
webview.getSettings().setJavaScriptEnabled(true);
|
||||||
webview.getSettings().setUserAgentString(BuildConfig.APPLICATION_ID+"/"+BuildConfig.VERSION_NAME);
|
webview.getSettings().setUserAgentString(BuildConfig.APPLICATION_ID+"/"+BuildConfig.VERSION_NAME);
|
||||||
webview.setBackgroundColor(0x00000000);
|
webview.setBackgroundColor(0x00000000);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue