Revert "Better design for Configure Screen implementation in progress."

This reverts commit 90481f92d6.
This commit is contained in:
GaidamakUA 2016-03-24 11:15:47 +02:00
parent 7f8fbc5032
commit b66893bfeb
4 changed files with 28 additions and 45 deletions

View file

@ -88,16 +88,5 @@
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>

View file

@ -36,11 +36,11 @@ public class ContextMenuAdapter {
public interface OnContextMenuClick {
//boolean return type needed to desribe if drawer needed to be close or not
boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked);
}
public interface OnIntegerValueChangedListener {
boolean onIntegerValueChangedListener(int newValue);
public boolean onIntegerValueChangedListener(int newValue);
}
public static abstract class OnRowItemClick implements OnContextMenuClick {

View file

@ -74,7 +74,6 @@ 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;
@ -82,7 +81,6 @@ 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;
@ -489,8 +487,6 @@ 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()) {
@ -541,22 +537,6 @@ 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));
}
});
}
}

View file

@ -1,10 +1,12 @@
package net.osmand.plus.views.mapwidgets;
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;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
@ -19,13 +21,11 @@ import net.osmand.plus.views.MapInfoLayer;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
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;
public class MapWidgetRegistry {
@ -488,6 +488,20 @@ 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;