Fixes.
Icons color. Prevent editing of base app profiles
This commit is contained in:
parent
adc45b7783
commit
1bcd7f7bf6
5 changed files with 93 additions and 73 deletions
|
@ -12,62 +12,61 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:paddingEnd="@dimen/content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_coordinates_latitude"
|
||||
android:tint="?attr/primary_icon_color"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/main_font_color_basic"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="Item Title"/>
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:tint="?attr/primary_icon_color"
|
||||
tools:src="@drawable/ic_action_coordinates_latitude"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="match_parent"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Item additional desription"/>
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/compound_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:saveEnabled="false"/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?attr/main_font_color_basic"
|
||||
tools:text="Item Title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
tools:text="Item additional desription"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/compound_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:saveEnabled="false"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -89,6 +91,13 @@
|
|||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/click_block_layout"
|
||||
android:clickable="false"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -81,6 +81,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
private View screenConfigBtn;
|
||||
private View navConfigBtn;
|
||||
private LinearLayout buttonsLayout;
|
||||
private FrameLayout clickBlockLayout;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -117,6 +118,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
screenConfigBtn = view.findViewById(R.id.screen_config_btn);
|
||||
navConfigBtn = view.findViewById(R.id.nav_settings_btn);
|
||||
buttonsLayout = view.findViewById(R.id.buttons_layout);
|
||||
clickBlockLayout = view.findViewById(R.id.click_block_layout);
|
||||
|
||||
profileNameEt.setFocusable(true);
|
||||
profileNameEt.setSelectAllOnFocus(true);
|
||||
|
@ -143,6 +145,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
title = profile.getUserProfileTitle();
|
||||
profileNameEt.setText(title);
|
||||
startIconId = profile.iconId;
|
||||
|
||||
} else if (isNew) {
|
||||
isDataChanged = true;
|
||||
title = String
|
||||
|
@ -155,6 +158,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
title = getResources().getString(profile.getKey());
|
||||
profileNameEt.setText(profile.getKey());
|
||||
startIconId = profile.getIconId();
|
||||
clickBlockLayout.setClickable(true);
|
||||
}
|
||||
|
||||
profile.setUserProfileTitle(title);
|
||||
|
@ -254,22 +258,23 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
selectNavTypeBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final ProfileBottomSheetDialogFragment fragment = new ProfileBottomSheetDialogFragment();
|
||||
fragment.setProfileTypeListener(profileTypeDialogListener);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelableArrayList("routing_profiles", routingProfiles);
|
||||
fragment.setArguments(bundle);
|
||||
if (getActivity() != null) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, "select_nav_type")
|
||||
.commitAllowingStateLoss();
|
||||
if(isNew || isUserProfile) {
|
||||
final ProfileBottomSheetDialogFragment fragment = new ProfileBottomSheetDialogFragment();
|
||||
fragment.setProfileTypeListener(profileTypeDialogListener);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelableArrayList("routing_profiles", routingProfiles);
|
||||
fragment.setArguments(bundle);
|
||||
if (getActivity() != null) {
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.add(fragment, "select_nav_type")
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
navTypeEt.setCursorVisible(false);
|
||||
navTypeEt.setTextIsSelectable(false);
|
||||
navTypeEt.clearFocus();
|
||||
navTypeEt.requestFocus(ExtendedEditText.FOCUS_UP);
|
||||
}
|
||||
|
||||
navTypeEt.setCursorVisible(false);
|
||||
navTypeEt.setTextIsSelectable(false);
|
||||
navTypeEt.clearFocus();
|
||||
navTypeEt.requestFocus(ExtendedEditText.FOCUS_UP);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -348,10 +353,9 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
saveButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
saveNewProfile();
|
||||
// if (saveNewProfile()) {
|
||||
// getActivity().onBackPressed();
|
||||
// }
|
||||
if (saveNewProfile()) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -370,6 +374,11 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
});
|
||||
|
||||
if (!isUserProfile && !isNew) {
|
||||
profileNameEt.setFocusable(false);
|
||||
navTypeEt.setFocusable(false);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -472,6 +481,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
if (getSettings() != null) {
|
||||
getSettings().AVAILABLE_APP_MODES.set(vls.toString());
|
||||
}
|
||||
isDataChanged = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,10 +60,12 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
final ApplicationMode item = items.get(position);
|
||||
if (item.getParent() != null) {
|
||||
holder.title.setText(item.getUserProfileName());
|
||||
holder.descr.setText(String.format("Type: %s", Algorithms.capitalizeFirstLetterAndLowercase(item.getParent().getStringKey().replace("_", " "))));
|
||||
holder.descr.setText(String.format("Type: %s",
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(item.getParent().getStringKey().replace("_", " "))));
|
||||
} else {
|
||||
holder.title.setText(app.getResources().getString(item.getStringResource()));
|
||||
holder.descr.setText(String.format("Base Profile, type: %s", Algorithms.capitalizeFirstLetterAndLowercase(item.getStringKey().replace("_", " "))));
|
||||
holder.descr.setText(String.format("Base Profile, type: %s",
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(item.getStringKey().replace("_", " "))));
|
||||
}
|
||||
|
||||
holder.title.setTextColor(app.getResources().getColor(isNightMode(app)
|
||||
|
@ -80,16 +82,16 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
}
|
||||
});
|
||||
|
||||
if (item.getParent() != null) {
|
||||
// if (item.getParent() != null) {
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.editProfile(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
holder.profileOptions.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
// } else {
|
||||
// holder.profileOptions.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
|
|||
Intent intent = new Intent(getActivity(), EditProfileActivity.class);
|
||||
intent.putExtra("stringKey", item.getStringKey());
|
||||
intent.putExtra("isNew", false);
|
||||
if (!item.getUserProfileName().isEmpty()) {
|
||||
if (item.getUserProfileName() != null && !item.getUserProfileName().isEmpty()) {
|
||||
intent.putExtra("isUserProfile", true);
|
||||
}
|
||||
startActivity(intent);
|
||||
|
|
Loading…
Reference in a new issue