private View createConfiguration() { final OsmandMapTileView view = map.getMapView(); FrameLayout.LayoutParams fparams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); final Drawable config = view.getResources().getDrawable(R.drawable.map_config); final Drawable configWhite = view.getResources().getDrawable(R.drawable.map_config_white); ImageViewWidget configuration = new ImageViewWidget(map) { private boolean nm; @Override public boolean updateInfo(DrawSettings drawSettings) { boolean nightMode = drawSettings != null && drawSettings.isNightMode(); if (nightMode != this.nm) { this.nm = nightMode; setImageDrawable(nightMode ? configWhite : config); return true; } return false; } }; configuration.setBackgroundDrawable(config); FrameLayout fl = new ConfigLayout(view.getContext(), configuration); fl.addView(configuration, fparams); fparams = new FrameLayout.LayoutParams(config.getMinimumWidth(), config.getMinimumHeight()); progressBar = new View(view.getContext()); fl.addView(progressBar, fparams); fl.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { openViewConfigureDialog(); } }); return fl; }
@Override public boolean updateInfo(DrawSettings drawSettings) { return config.updateInfo(drawSettings); }