This commit is contained in:
Dmitry 2020-07-21 12:12:10 +03:00
commit 35d8edb23a
3 changed files with 31 additions and 12 deletions

View file

@ -174,6 +174,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="@dimen/toolbar_height" android:minHeight="@dimen/toolbar_height"
android:paddingBottom="@dimen/content_padding_half"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
@ -237,7 +238,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/context_menu_padding_margin_tiny" android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:paddingBottom="@dimen/content_padding"> android:paddingBottom="@dimen/content_padding_half">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/group_recycler_view" android:id="@+id/group_recycler_view"
@ -252,9 +253,22 @@
tools:itemCount="3" tools:itemCount="3"
tools:orientation="horizontal" tools:orientation="horizontal"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/point_editor_group_select_item"/> tools:listitem="@layout/point_editor_group_select_item" />
</LinearLayout> </LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/add_hidden_group_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular"
android:lineSpacingMultiplier="@dimen/bottom_sheet_text_spacing_multiplier"
android:letterSpacing="@dimen/description_letter_spacing"
android:textColor="?android:textColorSecondary"
android:text="@string/add_hidden_group_info"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<View <View

View file

@ -21,6 +21,7 @@
<string name="app_mode_wheelchair">Wheelchair</string> <string name="app_mode_wheelchair">Wheelchair</string>
<string name="app_mode_motor_scooter">Motor scooter</string> <string name="app_mode_motor_scooter">Motor scooter</string>
<string name="app_mode_enduro_motorcycle">Enduro motorcycle</string> <string name="app_mode_enduro_motorcycle">Enduro motorcycle</string>
<string name="add_hidden_group_info">The added point will not be visible on the map, since the selected group is hidden, you can find it in \"%s\".</string>
<string name="plugin_wikipedia_description">Get information about points of interest from Wikipedia. It is your pocket offline guide - just enable Wikipedia plugin and enjoy articles about objects around you.</string> <string name="plugin_wikipedia_description">Get information about points of interest from Wikipedia. It is your pocket offline guide - just enable Wikipedia plugin and enjoy articles about objects around you.</string>
<string name="search_download_wikipedia_maps">Download Wikipedia maps</string> <string name="search_download_wikipedia_maps">Download Wikipedia maps</string>
<string name="quick_action_remove_next_destination_descr">The current destination point on the route will be deleted. If it will be the Destination, navigation will stop.</string> <string name="quick_action_remove_next_destination_descr">The current destination point on the route will be deleted. If it will be the Destination, navigation will stop.</string>

View file

@ -11,7 +11,6 @@ import android.graphics.drawable.GradientDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -28,12 +27,11 @@ import android.widget.TextView;
import androidx.annotation.ColorInt; import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
@ -64,7 +62,9 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static net.osmand.data.FavouritePoint.*; import static net.osmand.data.FavouritePoint.BackgroundType;
import static net.osmand.data.FavouritePoint.DEFAULT_BACKGROUND_TYPE;
import static net.osmand.data.FavouritePoint.DEFAULT_UI_ICON_ID;
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.PERSONAL_CATEGORY; import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.PERSONAL_CATEGORY;
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.isPersonalCategoryDisplayName; import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.isPersonalCategoryDisplayName;
@ -75,6 +75,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
private View view; private View view;
private EditText nameEdit; private EditText nameEdit;
private TextView addDelDescription; private TextView addDelDescription;
private TextView addToHiddenGroupInfo;
private boolean cancelled; private boolean cancelled;
private boolean nightMode; private boolean nightMode;
@DrawableRes @DrawableRes
@ -155,6 +156,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
deleteIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId)); deleteIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_delete_dark, activeColorResId));
ImageView groupListIcon = (ImageView) view.findViewById(R.id.group_list_button_icon); ImageView groupListIcon = (ImageView) view.findViewById(R.id.group_list_button_icon);
groupListIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_group_select_all, activeColorResId)); groupListIcon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_group_select_all, activeColorResId));
addToHiddenGroupInfo = view.findViewById(R.id.add_hidden_group_info);
addToHiddenGroupInfo.setText(getString(R.string.add_hidden_group_info, getString(R.string.shared_string_my_places)));
View groupList = view.findViewById(R.id.group_list_button); View groupList = view.findViewById(R.id.group_list_button);
groupList.setOnClickListener(new View.OnClickListener() { groupList.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -895,6 +898,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
int previousSelectedPosition = getItemPosition(selectedItemName); int previousSelectedPosition = getItemPosition(selectedItemName);
selectedItemName = items.get(holder.getAdapterPosition()); selectedItemName = items.get(holder.getAdapterPosition());
updateColorSelector(getCategoryColor(selectedItemName), groupRecyclerView.getRootView()); updateColorSelector(getCategoryColor(selectedItemName), groupRecyclerView.getRootView());
addToHiddenGroupInfo.setVisibility(isCategoryVisible(selectedItemName) ? View.GONE : View.VISIBLE);
notifyItemChanged(holder.getAdapterPosition()); notifyItemChanged(holder.getAdapterPosition());
notifyItemChanged(previousSelectedPosition); notifyItemChanged(previousSelectedPosition);
} }
@ -921,15 +925,15 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
} }
int color; int color;
int iconID; int iconID;
if (!isCategoryVisible(group)) { if (isCategoryVisible(group)) {
color = ContextCompat.getColor(app, R.color.text_color_secondary_light);
iconID = R.drawable.ic_action_hide;
holder.groupName.setTypeface(null, Typeface.ITALIC);
} else {
int categoryColor = getCategoryColor(group); int categoryColor = getCategoryColor(group);
color = categoryColor == 0 ? getDefaultColor() : categoryColor; color = categoryColor == 0 ? getDefaultColor() : categoryColor;
iconID = R.drawable.ic_action_folder; iconID = R.drawable.ic_action_folder;
holder.groupName.setTypeface(null, Typeface.NORMAL); holder.groupName.setTypeface(null, Typeface.NORMAL);
} else {
color = ContextCompat.getColor(app, R.color.text_color_secondary_light);
iconID = R.drawable.ic_action_hide;
holder.groupName.setTypeface(null, Typeface.ITALIC);
} }
holder.groupIcon.setImageDrawable(UiUtilities.tintDrawable( holder.groupIcon.setImageDrawable(UiUtilities.tintDrawable(
AppCompatResources.getDrawable(app, iconID), color)); AppCompatResources.getDrawable(app, iconID), color));