Fix UI in edit profiles screen

This commit is contained in:
Vitaliy 2019-12-24 12:19:42 +02:00
parent 1a83b4c847
commit bb0ccd33f5
6 changed files with 48 additions and 7 deletions

View file

@ -68,7 +68,7 @@ import net.osmand.plus.measurementtool.command.ClearPointsCommand;
import net.osmand.plus.measurementtool.command.MovePointCommand;
import net.osmand.plus.measurementtool.command.RemovePointCommand;
import net.osmand.plus.measurementtool.command.ReorderPointCommand;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;

View file

@ -20,7 +20,7 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import java.util.Collections;
import java.util.List;

View file

@ -29,6 +29,7 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.settings.BaseSettingsFragment;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import java.util.ArrayList;
import java.util.Collections;
@ -47,6 +48,9 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
private EditProfilesAdapter adapter;
private boolean nightMode;
private boolean wasDrawerDisabled;
@Nullable
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -59,6 +63,8 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
appModesOrders.put(mode.getStringKey(), mode.getOrder());
}
}
nightMode = !app.getSettings().isLightContent();
View mainView = inflater.inflate(R.layout.edit_profiles_list_fragment, container, false);
AndroidUtils.addStatusBarPadding21v(getContext(), mainView);
@ -186,6 +192,41 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
outState.putStringArrayList(DELETED_APP_MODES_KEY, deletedModesKeys);
}
@Override
public void onResume() {
super.onResume();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
wasDrawerDisabled = mapActivity.isDrawerDisabled();
if (!wasDrawerDisabled) {
mapActivity.disableDrawer();
}
}
}
public void onPause() {
super.onPause();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && !wasDrawerDisabled) {
mapActivity.enableDrawer();
}
}
@Override
public int getStatusBarColorId() {
return nightMode ? R.color.status_bar_color_dark : R.color.status_bar_color_light;
}
@Nullable
public MapActivity getMapActivity() {
FragmentActivity activity = getActivity();
if (activity instanceof MapActivity) {
return (MapActivity) activity;
} else {
return null;
}
}
public List<EditProfileDataObject> getProfiles(boolean deleted) {
List<EditProfileDataObject> profiles = new ArrayList<>();
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {

View file

@ -28,9 +28,9 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback.UnmovableItem;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback.OnItemMoveCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.UnmovableItem;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback.OnItemMoveCallback;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -20,7 +20,7 @@ import android.widget.TextView;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.dialogs.SelectMapViewQuickActionsBottomSheet;
import net.osmand.plus.profiles.ReorderItemTouchHelperCallback;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -1,4 +1,4 @@
package net.osmand.plus.profiles;
package net.osmand.plus.views.controls;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;