ui fixes
This commit is contained in:
parent
e722fc3d07
commit
a64173640a
6 changed files with 122 additions and 79 deletions
|
@ -4,13 +4,15 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top">
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginBottom="@dimen/setting_profile_item_height">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -62,7 +64,6 @@
|
|||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?attr/main_font_color_basic"
|
||||
android:text="Base Profile"/>
|
||||
|
||||
<TextView
|
||||
|
@ -72,12 +73,13 @@
|
|||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?attr/main_font_color_basic"
|
||||
tools:text="Item additional desription"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/type_down_arrow"
|
||||
android:id="@+id/type_down_arrow2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
|
@ -89,17 +91,29 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_top"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -171,6 +185,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/click_block_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -187,6 +202,16 @@
|
|||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/type_down_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|right"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:tint="@color/settings_divider"
|
||||
android:src="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
<net.osmand.plus.widgets.OsmandTextFieldBoxes
|
||||
android:id="@+id/navigation_type_otfb"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -230,17 +255,30 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_top"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -412,17 +450,11 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/list_content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_shadow2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_shadow_footer"/>
|
||||
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.profiles;
|
|||
|
||||
import static net.osmand.plus.profiles.ProfileBottomSheetDialogFragment.TYPE_APP_PROFILE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnDismissListener;
|
||||
import android.content.Intent;
|
||||
|
@ -63,7 +64,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
ArrayList<RoutingProfile> routingProfiles;
|
||||
OsmandApplication app;
|
||||
RoutingProfile selectedRoutingProfile = null;
|
||||
float defSpeed = 0f;
|
||||
|
||||
private boolean isNew = false;
|
||||
private boolean isUserProfile = false;
|
||||
|
@ -250,8 +250,16 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
@Override
|
||||
public void onSelectedType(int pos) {
|
||||
isDataChanged = true;
|
||||
for (int i = 0; i < routingProfiles.size(); i++) {
|
||||
if (i == pos) {
|
||||
routingProfiles.get(i).setSelected(true);
|
||||
} else {
|
||||
routingProfiles.get(i).setSelected(false);
|
||||
}
|
||||
}
|
||||
selectedRoutingProfile = routingProfiles.get(pos);
|
||||
navTypeEt.setText(selectedRoutingProfile.getName());
|
||||
LOG.debug(routingProfiles);
|
||||
profile.setRoutingProfile(selectedRoutingProfile);
|
||||
}
|
||||
};
|
||||
|
@ -299,8 +307,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
fragment.setArguments(bundle);
|
||||
if (getActivity() != null) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, "select_nav_type")
|
||||
.commitAllowingStateLoss();
|
||||
.add(fragment, "select_nav_type").commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
navTypeEt.setCursorVisible(false);
|
||||
|
@ -333,8 +340,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
public void onClick(View v) {
|
||||
if (isDataChanged) {
|
||||
needSaveDialog();
|
||||
} else {
|
||||
|
||||
} else if (getSettings() != null) {
|
||||
getSettings().APPLICATION_MODE.set(mode);
|
||||
Intent i = new Intent(getActivity(), MapActivity.class);
|
||||
i.putExtra(OPEN_CONFIG_ON_MAP, MAP_CONFIG);
|
||||
|
@ -349,7 +355,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
public void onClick(View v) {
|
||||
if (isDataChanged) {
|
||||
needSaveDialog();
|
||||
} else {
|
||||
} else if (getSettings() != null) {
|
||||
getSettings().APPLICATION_MODE.set(mode);
|
||||
Intent i = new Intent(getActivity(), MapActivity.class);
|
||||
i.putExtra(OPEN_CONFIG_ON_MAP, SCREEN_CONFIG);
|
||||
|
@ -364,7 +370,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
public void onClick(View v) {
|
||||
if (isDataChanged) {
|
||||
needSaveDialog();
|
||||
} else {
|
||||
} else if (getSettings() != null) {
|
||||
getSettings().APPLICATION_MODE.set(mode);
|
||||
Intent i = new Intent(getActivity(), SettingsNavigationActivity.class);
|
||||
i.putExtra(OPEN_CONFIG_ON_MAP, NAV_CONFIG);
|
||||
|
@ -425,16 +431,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void needSaveDialog() {
|
||||
if (getActivity() != null) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||
bld.setTitle("Save Changes");
|
||||
bld.setMessage("You need to save changes to Profile before proceed");
|
||||
bld.setNegativeButton(R.string.shared_string_ok, null);
|
||||
bld.show();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean saveNewProfile() {
|
||||
|
||||
if (isUserProfile && !isNew) {
|
||||
|
@ -442,27 +438,20 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
if (profile.getRoutingProfile() == null && getActivity() != null) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||
bld.setTitle("Select Routing Type");
|
||||
bld.setMessage("You need to select Routing Type to create New Application Profile");
|
||||
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
||||
bld.show();
|
||||
showSaveWarningDialog(
|
||||
"Select Routing Type",
|
||||
"You need to select Routing Type to create New Application Profile",
|
||||
getActivity());
|
||||
return false;
|
||||
} else if (profile.getUserProfileTitle().isEmpty() && getActivity() != null) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||
bld.setTitle("Enter Profile Name");
|
||||
bld.setMessage("Profile name shouldn't be empty!");
|
||||
bld.setNegativeButton(R.string.shared_string_dismiss,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
navTypeEt.requestFocus();
|
||||
}
|
||||
});
|
||||
bld.show();
|
||||
} else if (getActivity() != null && profile.getUserProfileTitle().isEmpty()
|
||||
|| profile.getUserProfileTitle().replace(" ", "").length() < 1) {
|
||||
showSaveWarningDialog(
|
||||
"Enter Profile Name",
|
||||
"Profile name shouldn't be empty!",
|
||||
getActivity()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
||||
if (m.getUserProfileName() != null && m.getUserProfileName().equals(profile.getUserProfileTitle())
|
||||
&& getActivity() != null) {
|
||||
|
@ -528,6 +517,24 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void needSaveDialog() {
|
||||
if (getActivity() != null) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||
bld.setTitle("Save Changes");
|
||||
bld.setMessage("You need to save changes to Profile before proceed");
|
||||
bld.setNegativeButton(R.string.shared_string_ok, null);
|
||||
bld.show();
|
||||
}
|
||||
}
|
||||
|
||||
private void showSaveWarningDialog(String title, String message, Activity activity) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(activity);
|
||||
bld.setTitle(title);
|
||||
bld.setMessage(message);
|
||||
bld.setNegativeButton(R.string.shared_string_dismiss, null);
|
||||
bld.show();
|
||||
}
|
||||
|
||||
void onDeleteProfileClick() {
|
||||
if (getActivity() != null) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(getActivity());
|
||||
|
@ -552,8 +559,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
|
||||
private ArrayList<RoutingProfile> getRoutingProfiles() {
|
||||
ArrayList<RoutingProfile> routingProfiles = new ArrayList<>();
|
||||
Map<String, GeneralRouter> routingProfilesNames = getMyApplication()
|
||||
.getDefaultRoutingConfig().getAllRoutes();
|
||||
Map<String, GeneralRouter> routingProfilesNames = getMyApplication().getDefaultRoutingConfig().getAllRoutes();
|
||||
for (Entry<String, GeneralRouter> e : routingProfilesNames.entrySet()) {
|
||||
String name;
|
||||
String description = getResources().getString(R.string.osmand_default_routing);
|
||||
|
@ -579,6 +585,10 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
iconRes = R.drawable.map_action_sail_boat_dark;
|
||||
name = getString(R.string.app_mode_boat);
|
||||
break;
|
||||
case "geocoding":
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
name = "Geocoding";
|
||||
break;
|
||||
default:
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
name = Algorithms
|
||||
|
@ -586,10 +596,8 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
description = "Custom profile"; //todo add filename
|
||||
break;
|
||||
}
|
||||
|
||||
routingProfiles.add(new RoutingProfile(e.getKey(), name, description, iconRes, false));
|
||||
}
|
||||
|
||||
return routingProfiles;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,11 +146,11 @@ public class ProfileBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
final ProfileDataObject item = items.get(position);
|
||||
holder.title.setText(item.getName());
|
||||
if (item.isSelected()) {
|
||||
holder.icon.setImageDrawable(getIcon(item.getIconRes(), isNightMode
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(getIcon(item.getIconRes(), R.color.icon_color));
|
||||
holder.icon.setImageDrawable(getIcon(item.getIconRes(), isNightMode
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(getIcon(item.getIconRes(), R.color.icon_color));
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -167,18 +167,15 @@ public class ProfileBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
}
|
||||
}
|
||||
});
|
||||
if (item instanceof RoutingProfile) {
|
||||
holder.descr.setText(Algorithms
|
||||
.capitalizeFirstLetterAndLowercase(item.getDescription()));
|
||||
if (item.isSelected()) {
|
||||
holder.radioButton.setChecked(true);
|
||||
previousSelection = position;
|
||||
} else {
|
||||
holder.radioButton.setChecked(false);
|
||||
}
|
||||
|
||||
holder.descr.setText(item.getDescription());
|
||||
if (item.isSelected()) {
|
||||
holder.radioButton.setChecked(true);
|
||||
previousSelection = position;
|
||||
} else {
|
||||
holder.descr.setText(item.getDescription());
|
||||
holder.radioButton.setChecked(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,8 @@ public class SelectIconBottomSheetDialogFragment extends BottomSheetDialogFragme
|
|||
private IconIdListener listListener;
|
||||
private RecyclerView recyclerView;
|
||||
private IconIdAdapter adapter;
|
||||
private TextView title;
|
||||
|
||||
|
||||
public void setIconIdListener(IconIdListener listener) {
|
||||
this.listener = listener;
|
||||
|
@ -75,10 +77,13 @@ public class SelectIconBottomSheetDialogFragment extends BottomSheetDialogFragme
|
|||
}
|
||||
};
|
||||
recyclerView = view.findViewById(R.id.menu_list_view);
|
||||
title = view.findViewById(R.id.dialog_title);
|
||||
title.setText("Select icon");
|
||||
adapter = new IconIdAdapter(icons, isNightMode(getMyApplication()), listListener);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
|
||||
Button cancelBtn = view.findViewById(R.id.cancel_selection);
|
||||
cancelBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -119,15 +124,18 @@ public class SelectIconBottomSheetDialogFragment extends BottomSheetDialogFragme
|
|||
final int pos = position;
|
||||
final IconResWithDescr item = items.get(position);
|
||||
holder.title.setText(item.getTitleId());
|
||||
holder.icon.setImageDrawable(getIcon(item.getResId(), isNightMode
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light));
|
||||
if(item.isSelected()) {
|
||||
if (item.isSelected) {
|
||||
holder.icon.setImageDrawable(getIcon(item.getResId(), isNightMode
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light));
|
||||
holder.radioButton.setChecked(true);
|
||||
previousSelection = position;
|
||||
} else {
|
||||
holder.radioButton.setChecked(false);
|
||||
holder.icon.setImageDrawable(getIcon(item.getResId(), R.color.icon_color));
|
||||
}
|
||||
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -120,7 +120,6 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelableArrayList(TYPE_APP_PROFILE, baseProfiles);
|
||||
dialog.setArguments(bundle);
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.add(dialog, "select_base_type").commitAllowingStateLoss();
|
||||
|
|
|
@ -687,7 +687,6 @@ public class RouteProvider {
|
|||
GeneralRouterProfile p ;
|
||||
|
||||
if (params.mode.getRoutingProfile() != null ) {
|
||||
//todo get assigned routing profile from ApplicationMode
|
||||
p = GeneralRouterProfile.CUSTOM;
|
||||
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
||||
p = GeneralRouterProfile.BICYCLE;
|
||||
|
|
Loading…
Reference in a new issue