mirror of
https://github.com/woheller69/solxpect.git
synced 2025-09-22 00:40:46 +02: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;
|
||||
View rootView;
|
||||
SQLiteHelper database;
|
||||
private WebView webview;
|
||||
|
||||
private AutoCompleteTextView autoCompleteTextView;
|
||||
City selectedCity;
|
||||
|
@ -70,6 +71,10 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
|||
String url="";
|
||||
String lang="en";
|
||||
|
||||
public AddLocationDialogOmGeocodingAPI() {
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
|
@ -84,6 +89,17 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
|||
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
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
|
@ -106,7 +122,7 @@ public class AddLocationDialogOmGeocodingAPI extends DialogFragment {
|
|||
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().setUserAgentString(BuildConfig.APPLICATION_ID+"/"+BuildConfig.VERSION_NAME);
|
||||
webview.setBackgroundColor(0x00000000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue