Better design for Configure Screen implementation in progress.
This commit is contained in:
parent
230de1cb2e
commit
90481f92d6
4 changed files with 45 additions and 28 deletions
|
@ -88,5 +88,16 @@
|
|||
android:src="@drawable/ic_action_edit_dark"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_refresh"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="right"
|
||||
android:background="@drawable/dashboard_button_light"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_refresh_dark"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
|
@ -36,11 +36,11 @@ public class ContextMenuAdapter {
|
|||
|
||||
public interface OnContextMenuClick {
|
||||
//boolean return type needed to desribe if drawer needed to be close or not
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
|
||||
}
|
||||
|
||||
public interface OnIntegerValueChangedListener {
|
||||
public boolean onIntegerValueChangedListener(int newValue);
|
||||
boolean onIntegerValueChangedListener(int newValue);
|
||||
}
|
||||
|
||||
public static abstract class OnRowItemClick implements OnContextMenuClick {
|
||||
|
|
|
@ -74,6 +74,7 @@ import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.views.DownloadedRegionsLayer;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.controls.DynamicListView;
|
||||
import net.osmand.plus.views.controls.DynamicListViewCallbacks;
|
||||
|
@ -81,6 +82,7 @@ import net.osmand.plus.views.controls.StableArrayAdapter;
|
|||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.DismissCallbacks;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable;
|
||||
import net.osmand.plus.views.mapwidgets.MapWidgetRegistry;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
@ -487,6 +489,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
backPressed();
|
||||
}
|
||||
});
|
||||
ImageView refreshToolbarItem = (ImageView) dashboardView.findViewById(R.id.toolbar_refresh);
|
||||
refreshToolbarItem.setVisibility(View.GONE);
|
||||
|
||||
if (waypointsVisible && getMyApplication().getWaypointHelper().getAllPoints().size() > 0) {
|
||||
if (getMyApplication().getWaypointHelper().isRouteCalculated()) {
|
||||
|
@ -537,6 +541,22 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (visibleType == DashboardType.CONFIGURE_SCREEN) {
|
||||
refreshToolbarItem.setVisibility(View.VISIBLE);
|
||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapWidgetRegistry registry = mapActivity.getMapLayers().getMapWidgetRegistry();
|
||||
registry.resetToDefault();
|
||||
MapInfoLayer mil = mapActivity.getMapLayers().getMapInfoLayer();
|
||||
if (mil != null) {
|
||||
mil.recreateControls();
|
||||
}
|
||||
updateListAdapter(registry.getViewConfigureMenuAdapter(mapActivity));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -21,11 +19,13 @@ import net.osmand.plus.views.MapInfoLayer;
|
|||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.LinearLayout;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class MapWidgetRegistry {
|
||||
|
||||
|
@ -488,20 +488,6 @@ public class MapWidgetRegistry {
|
|||
map.getDashboard().updateListAdapter(getViewConfigureMenuAdapter(map));
|
||||
}
|
||||
});
|
||||
cm.item(R.string.map_widget_reset).iconColor(R.drawable.ic_action_reset_to_default_dark)
|
||||
.listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
resetToDefault();
|
||||
MapInfoLayer mil = map.getMapLayers().getMapInfoLayer();
|
||||
if (mil != null) {
|
||||
mil.recreateControls();
|
||||
}
|
||||
map.getDashboard().updateListAdapter(getViewConfigureMenuAdapter(map));
|
||||
return false;
|
||||
}
|
||||
}).reg();
|
||||
final ApplicationMode mode = settings.getApplicationMode();
|
||||
addControls(map, cm, mode);
|
||||
return cm;
|
||||
|
|
Loading…
Reference in a new issue