commit
db7ec37b2d
49 changed files with 422 additions and 160 deletions
7
OsmAnd/res/anim/slide_in_right.xml
Normal file
7
OsmAnd/res/anim/slide_in_right.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="100%p" android:toXDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime" />
|
||||
</set>
|
7
OsmAnd/res/anim/slide_out_right.xml
Normal file
7
OsmAnd/res/anim/slide_out_right.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="100%p"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime" />
|
||||
</set>
|
|
@ -12,8 +12,7 @@
|
|||
android:id="@+id/main_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_left_menu_dark">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_bar_layout"
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical|start"
|
||||
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="?attr/active_color_basic"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Some Title"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start" />
|
||||
tools:text="Some Title" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/compound_button"
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
android:id="@+id/show_all_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical|start"
|
||||
android:paddingTop="@dimen/list_header_padding"
|
||||
android:paddingBottom="@dimen/list_header_padding"
|
||||
android:layout_marginStart="@dimen/route_info_list_text_padding"
|
||||
|
|
31
OsmAnd/res/layout/popup_menu_item.xml
Normal file
31
OsmAnd/res/layout/popup_menu_item.xml
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="horizontal" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/standard_icon_size"
|
||||
android:layout_height="@dimen/standard_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
tools:src="@drawable/ic_action_info_dark"
|
||||
android:tint="?attr/primary_icon_color"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:paddingBottom="@dimen/content_padding_small"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Title" />
|
||||
|
||||
</LinearLayout>
|
|
@ -155,6 +155,7 @@
|
|||
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
|
||||
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
|
||||
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
|
||||
<item name="right_menu_view_bg">@drawable/bg_right_menu_light</item>
|
||||
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
|
||||
<item name="dashboard_divider">@color/divider_color_light</item>
|
||||
<item name="divider_color">@color/divider_color</item>
|
||||
|
|
|
@ -425,6 +425,17 @@ public class AndroidUtils {
|
|||
: ctx.getResources().getColor(R.color.text_color_secondary_light));
|
||||
}
|
||||
|
||||
public static int getTextMaxWidth(float textSize, List<String> titles) {
|
||||
int width = 0;
|
||||
for (String title : titles) {
|
||||
int titleWidth = getTextWidth(textSize, title);
|
||||
if (titleWidth > width) {
|
||||
width = titleWidth;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
public static int getTextWidth(float textSize, String text) {
|
||||
Paint paint = new Paint();
|
||||
paint.setTextSize(textSize);
|
||||
|
|
80
OsmAnd/src/net/osmand/plus/SimplePopUpMenuItemAdapter.java
Normal file
80
OsmAnd/src/net/osmand/plus/SimplePopUpMenuItemAdapter.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SimplePopUpMenuItemAdapter
|
||||
extends ArrayAdapter<SimplePopUpMenuItem> {
|
||||
|
||||
private List<SimplePopUpMenuItem> items;
|
||||
|
||||
public SimplePopUpMenuItemAdapter(@NonNull Context context, int resource,
|
||||
List<SimplePopUpMenuItem> items) {
|
||||
super(context, resource);
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
if (convertView == null) {
|
||||
convertView = inflater.inflate(R.layout.popup_menu_item, parent, false);
|
||||
}
|
||||
SimplePopUpMenuItem item = getItem(position);
|
||||
if (item != null) {
|
||||
TextView tvTitle = convertView.findViewById(R.id.title);
|
||||
tvTitle.setText(item.title);
|
||||
ImageView ivIcon = convertView.findViewById(R.id.icon);
|
||||
Drawable icon = item.icon;
|
||||
if (icon != null) {
|
||||
ivIcon.setImageDrawable(icon);
|
||||
} else {
|
||||
ivIcon.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public SimplePopUpMenuItem getItem(int position) {
|
||||
return items.get(position);
|
||||
}
|
||||
|
||||
public static class SimplePopUpMenuItem {
|
||||
private CharSequence title;
|
||||
private Drawable icon;
|
||||
|
||||
public SimplePopUpMenuItem(CharSequence title, Drawable icon) {
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public Drawable getIcon() {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -31,6 +32,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.ListPopupWindow;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
@ -53,8 +55,13 @@ import net.osmand.plus.widgets.TextViewEx;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||
|
||||
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||
|
||||
public class UiUtilities {
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(UiUtilities.class);
|
||||
|
@ -680,4 +687,39 @@ public class UiUtilities {
|
|||
return spannable;
|
||||
}
|
||||
}
|
||||
|
||||
public static ListPopupWindow createListPopupWindow(Context themedCtx,
|
||||
View v, int minWidth,
|
||||
List<SimplePopUpMenuItem> items,
|
||||
final AdapterView.OnItemClickListener listener) {
|
||||
int contentPadding = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
int contentPaddingHalf = themedCtx.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||
int defaultListTextSize = themedCtx.getResources().getDimensionPixelSize(R.dimen.default_list_text_size);
|
||||
|
||||
List<String> titles = new ArrayList<>();
|
||||
for (SimplePopUpMenuItem item : items) {
|
||||
titles.add(String.valueOf(item.getTitle()));
|
||||
}
|
||||
float itemWidth = AndroidUtils.getTextMaxWidth(defaultListTextSize, titles) + contentPadding;
|
||||
|
||||
SimplePopUpMenuItemAdapter adapter =
|
||||
new SimplePopUpMenuItemAdapter(themedCtx, R.layout.popup_menu_item, items);
|
||||
final ListPopupWindow listPopupWindow = new ListPopupWindow(themedCtx);
|
||||
listPopupWindow.setAnchorView(v);
|
||||
listPopupWindow.setContentWidth((int) (Math.max(itemWidth, minWidth)));
|
||||
listPopupWindow.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||
listPopupWindow.setVerticalOffset(-v.getHeight() + contentPaddingHalf);
|
||||
listPopupWindow.setModal(true);
|
||||
listPopupWindow.setAdapter(adapter);
|
||||
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (listener != null) {
|
||||
listener.onItemClick(parent, view, position, id);
|
||||
}
|
||||
listPopupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
return listPopupWindow;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.activities;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
|
@ -197,8 +198,12 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
.create();
|
||||
items.add(markersGroupItem);
|
||||
|
||||
Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark);
|
||||
if (shareIcon != null) {
|
||||
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||
}
|
||||
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
||||
.setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
|
||||
.setIcon(shareIcon)
|
||||
.setTitle(getString(R.string.shared_string_share))
|
||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -454,7 +454,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
|||
|
||||
if (!MenuItemCompat.isActionViewExpanded(mi)) {
|
||||
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS, true);
|
||||
createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
rightTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
|
||||
updateData();
|
||||
|
@ -164,7 +164,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
if (!mRecording.isPhoto()) {
|
||||
if (mPlugin.isPlaying(mRecording)) {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_control_stop);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_rec_stop;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_rec_stop;
|
||||
int pos = mPlugin.getPlayingPosition();
|
||||
String durationStr;
|
||||
if (pos == -1) {
|
||||
|
@ -177,14 +177,14 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
rightTitleButtonController.visible = false;
|
||||
} else {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_play);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_play_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_play_dark;
|
||||
String durationStr = mRecording.getPlainDuration(accessibilityEnabled);
|
||||
leftTitleButtonController.needRightText = true;
|
||||
leftTitleButtonController.rightTextCaption = "— " + durationStr;
|
||||
}
|
||||
} else {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.recording_context_menu_show);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_view;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_view;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package net.osmand.plus.audionotes;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
|
@ -49,8 +51,12 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
|||
.create();
|
||||
items.add(playItem);
|
||||
|
||||
Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark);
|
||||
if (shareIcon != null) {
|
||||
AndroidUtils.getDrawableForDirection(requireContext(), shareIcon);
|
||||
}
|
||||
BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder()
|
||||
.setIcon(getContentIcon(R.drawable.ic_action_gshare_dark))
|
||||
.setIcon(shareIcon)
|
||||
.setTitle(getString(R.string.shared_string_share))
|
||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.audionotes;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
@ -21,10 +22,12 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -33,6 +36,7 @@ import net.osmand.GPXUtilities.GPXFile;
|
|||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -163,14 +167,18 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
menu = ((ActionBarProgressActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((ActionBarProgressActivity) getActivity()).getClearToolbar(false);
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
((ActionBarProgressActivity) getActivity()).updateListViewFooter(footerView);
|
||||
menu.clear();
|
||||
if (AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||
menu = ((ActionBarProgressActivity) activity).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((ActionBarProgressActivity) activity).getClearToolbar(false);
|
||||
}
|
||||
((ActionBarProgressActivity) activity).updateListViewFooter(footerView);
|
||||
|
||||
MenuItem item = menu.add(R.string.shared_string_sort).setIcon(R.drawable.ic_action_list_sort);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
@ -182,7 +190,9 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
|||
});
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark);
|
||||
Drawable shareIcon = AndroidUtils.getDrawableForDirection(activity,
|
||||
getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark));
|
||||
item = menu.add(R.string.shared_string_share).setIcon(shareIcon);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -377,13 +387,16 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme
|
|||
@Override
|
||||
public boolean onCreateActionMode(final ActionMode mode, Menu menu) {
|
||||
LOG.debug("onCreateActionMode");
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (type == MODE_SHARE) {
|
||||
listAdapter.insert(SHARE_LOCATION_FILE, 0);
|
||||
}
|
||||
switchSelectionMode(true);
|
||||
int titleRes = type == MODE_DELETE ? R.string.shared_string_delete_all : R.string.shared_string_share;
|
||||
int iconRes = type == MODE_DELETE ? R.drawable.ic_action_delete_dark : R.drawable.ic_action_gshare_dark;
|
||||
MenuItem item = menu.add(titleRes).setIcon(iconRes);
|
||||
Drawable icon = AndroidUtils.getDrawableForDirection(app,
|
||||
app.getUIUtilities().getIcon(iconRes));
|
||||
MenuItem item = menu.add(titleRes).setIcon(icon);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.ExpandableListView.OnChildClickListener;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.core.view.MenuItemCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
|
@ -83,10 +84,20 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
|||
}
|
||||
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType) {
|
||||
Drawable d = iconId == 0 ? null : requireMyApplication().getUIUtilities().getIcon(iconId,
|
||||
isLightActionBar() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
return createMenuItem(m, id, titleRes, iconId, menuItemType, false);
|
||||
}
|
||||
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType,
|
||||
boolean flipIconForRtl) {
|
||||
OsmandApplication app = requireMyApplication();
|
||||
Drawable d = iconId == 0 ? null : app.getUIUtilities().getIcon(iconId, isLightActionBar() ?
|
||||
R.color.active_buttons_and_links_text_light :
|
||||
R.color.active_buttons_and_links_text_dark);
|
||||
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
||||
if (d != null) {
|
||||
if (flipIconForRtl) {
|
||||
d = AndroidUtils.getDrawableForDirection(app, d);
|
||||
}
|
||||
menuItem.setIcon(d);
|
||||
}
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.development;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
|
@ -15,6 +16,7 @@ import androidx.appcompat.app.ActionBar;
|
|||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -94,8 +96,10 @@ public class LogcatActivity extends ActionBarProgressActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark);
|
||||
MenuItem share = menu.add(0, SHARE_ID, 0, R.string.shared_string_export);
|
||||
share.setIcon(R.drawable.ic_action_gshare_dark);
|
||||
share.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon));
|
||||
share.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -67,7 +68,8 @@ public abstract class BaseMenuController {
|
|||
|
||||
public int getSlideInAnimation() {
|
||||
if (isLandscapeLayout()) {
|
||||
return R.anim.slide_in_left;
|
||||
return AndroidUtils.isLayoutRtl(getMapActivity())
|
||||
? R.anim.slide_in_right : R.anim.slide_in_left;
|
||||
} else {
|
||||
return R.anim.slide_in_bottom;
|
||||
}
|
||||
|
@ -75,7 +77,8 @@ public abstract class BaseMenuController {
|
|||
|
||||
public int getSlideOutAnimation() {
|
||||
if (isLandscapeLayout()) {
|
||||
return R.anim.slide_out_left;
|
||||
return AndroidUtils.isLayoutRtl(getMapActivity())
|
||||
? R.anim.slide_out_right : R.anim.slide_out_left;
|
||||
} else {
|
||||
return R.anim.slide_out_bottom;
|
||||
}
|
||||
|
|
|
@ -628,7 +628,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
}
|
||||
Drawable drawable = getIcon(iconResId, bottomButtonsColor);
|
||||
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(directionsButton, null, null, drawable, null);
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
directionsButton, null, null, drawable, null);
|
||||
int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
|
||||
directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
|
||||
directionsButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1147,11 +1148,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(leftTitleButtonView, leftTitleButtonController.enabled, title);
|
||||
if (leftTitleButtonController.visible) {
|
||||
leftTitleButtonView.setVisibility(View.VISIBLE);
|
||||
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
|
||||
Drawable rightIcon = leftTitleButtonController.getRightIcon();
|
||||
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = leftTitleButtonController.getStartIcon();
|
||||
Drawable endIcon = leftTitleButtonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
leftTitleButton, startIcon, null, endIcon, null);
|
||||
leftTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) leftTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) leftTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
} else {
|
||||
leftTitleButtonView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -1166,11 +1168,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(rightTitleButtonView, rightTitleButtonController.enabled, rightTitleButtonController.caption);
|
||||
rightTitleButtonView.setVisibility(rightTitleButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
|
||||
Drawable rightIcon = rightTitleButtonController.getRightIcon();
|
||||
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = rightTitleButtonController.getStartIcon();
|
||||
Drawable endIcon = rightTitleButtonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
rightTitleButton, startIcon, null, endIcon, null);
|
||||
rightTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) rightTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) rightTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
} else {
|
||||
rightTitleButtonView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -1182,11 +1185,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(bottomTitleButtonView, bottomTitleButtonController.enabled, bottomTitleButtonController.caption);
|
||||
bottomTitleButtonView.setVisibility(bottomTitleButtonController.visible ? View.VISIBLE : View.GONE);
|
||||
|
||||
Drawable leftIcon = bottomTitleButtonController.getLeftIcon();
|
||||
Drawable rightIcon = bottomTitleButtonController.getRightIcon();
|
||||
bottomTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = bottomTitleButtonController.getStartIcon();
|
||||
Drawable endIcon = bottomTitleButtonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
bottomTitleButton, startIcon, null, endIcon, null);
|
||||
bottomTitleButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) bottomTitleButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) bottomTitleButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
} else {
|
||||
bottomTitleButtonView.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -1206,11 +1210,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(leftDownloadButtonView, leftDownloadButtonController.enabled, leftDownloadButtonController.caption);
|
||||
leftDownloadButtonView.setVisibility(leftDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
|
||||
Drawable rightIcon = leftDownloadButtonController.getRightIcon();
|
||||
leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = leftDownloadButtonController.getStartIcon();
|
||||
Drawable endIcon = leftDownloadButtonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
leftDownloadButton, startIcon, null, endIcon, null);
|
||||
leftDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) leftDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) leftDownloadButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
} else {
|
||||
leftDownloadButtonView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -1222,11 +1227,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(rightDownloadButtonView, rightDownloadButtonController.enabled, rightDownloadButtonController.caption);
|
||||
rightDownloadButtonView.setVisibility(rightDownloadButtonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
|
||||
Drawable rightIcon = rightDownloadButtonController.getRightIcon();
|
||||
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = rightDownloadButtonController.getStartIcon();
|
||||
Drawable endIcon = rightDownloadButtonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
rightDownloadButton, startIcon, null, endIcon, null);
|
||||
rightDownloadButton.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) rightDownloadButtonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) rightDownloadButtonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
} else {
|
||||
rightDownloadButtonView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
@ -1292,11 +1298,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
setupButton(buttonView, buttonController.enabled, buttonController.caption);
|
||||
buttonView.setVisibility(buttonController.visible ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
Drawable leftIcon = buttonController.getLeftIcon();
|
||||
Drawable rightIcon = buttonController.getRightIcon();
|
||||
buttonText.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, rightIcon, null);
|
||||
Drawable startIcon = buttonController.getStartIcon();
|
||||
Drawable endIcon = buttonController.getEndIcon();
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
buttonText, startIcon, null, endIcon, null);
|
||||
buttonText.setCompoundDrawablePadding(view.getResources().getDimensionPixelSize(R.dimen.content_padding_half));
|
||||
((LinearLayout) buttonView).setGravity(rightIcon != null ? Gravity.END : Gravity.START);
|
||||
((LinearLayout) buttonView).setGravity(endIcon != null ? Gravity.END : Gravity.START);
|
||||
buttonView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1805,7 +1812,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
if (!Algorithms.isEmpty(typeStr)) {
|
||||
line2Str.append(typeStr);
|
||||
Drawable icon = menu.getTypeIcon();
|
||||
line2.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
line2, icon, null, null, null);
|
||||
line2.setCompoundDrawablePadding(dpToPx(5f));
|
||||
}
|
||||
if (!Algorithms.isEmpty(streetStr) && !menu.displayStreetNameInTitle()) {
|
||||
|
@ -1830,7 +1838,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
line3.setVisibility(View.VISIBLE);
|
||||
line3.setText(subtypeStr);
|
||||
Drawable icon = menu.getSubtypeIcon();
|
||||
line3.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(
|
||||
line3, icon, null, null, null);
|
||||
line3.setCompoundDrawablePadding(dpToPx(5f));
|
||||
}
|
||||
|
||||
|
|
|
@ -659,7 +659,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
|||
}
|
||||
|
||||
leftDownloadButtonController.visible = !downloaded;
|
||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||
|
||||
boolean internetConnectionAvailable =
|
||||
mapActivity.getMyApplication().getSettings().isInternetConnectionAvailable();
|
||||
|
@ -712,33 +712,33 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
|||
|
||||
public abstract class TitleButtonController {
|
||||
public String caption = "";
|
||||
public int leftIconId = 0;
|
||||
public int rightIconId = 0;
|
||||
public int startIconId = 0;
|
||||
public int endIconId = 0;
|
||||
public boolean needRightText = false;
|
||||
public String rightTextCaption = "";
|
||||
public boolean visible = true;
|
||||
public boolean tintIcon = true;
|
||||
public Drawable leftIcon;
|
||||
public Drawable rightIcon;
|
||||
public Drawable startIcon;
|
||||
public Drawable endIcon;
|
||||
public boolean enabled = true;
|
||||
|
||||
@Nullable
|
||||
public Drawable getLeftIcon() {
|
||||
public Drawable getStartIcon() {
|
||||
return getIconDrawable(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Drawable getRightIcon() {
|
||||
public Drawable getEndIcon() {
|
||||
return getIconDrawable(false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Drawable getIconDrawable(boolean left) {
|
||||
Drawable drawable = left ? leftIcon : rightIcon;
|
||||
private Drawable getIconDrawable(boolean start) {
|
||||
Drawable drawable = start ? startIcon : endIcon;
|
||||
if (drawable != null) {
|
||||
return drawable;
|
||||
}
|
||||
int resId = left ? leftIconId : rightIconId;
|
||||
int resId = start ? startIconId : endIconId;
|
||||
if (resId != 0) {
|
||||
if (tintIcon) {
|
||||
return enabled ? getNormalIcon(resId) : getDisabledIcon(resId);
|
||||
|
@ -751,11 +751,11 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
|||
|
||||
public void clearIcon(boolean left) {
|
||||
if (left) {
|
||||
leftIcon = null;
|
||||
leftIconId = 0;
|
||||
startIcon = null;
|
||||
startIconId = 0;
|
||||
} else {
|
||||
rightIcon = null;
|
||||
rightIconId = 0;
|
||||
endIcon = null;
|
||||
endIconId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
|||
};
|
||||
leftDownloadButtonController.caption =
|
||||
downloadRegion != null ? downloadRegion.getLocaleName() : mapActivity.getString(R.string.shared_string_download);
|
||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||
|
||||
titleProgressController = new TitleProgressController() {
|
||||
@Override
|
||||
|
|
|
@ -278,7 +278,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
|
||||
Drawable pressed = app.getUIUtilities().getIcon(R.drawable.ic_action_read_text,
|
||||
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
|
||||
button.setCompoundDrawablesWithIntrinsicBounds(Build.VERSION.SDK_INT >= 21
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(button, Build.VERSION.SDK_INT >= 21
|
||||
? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null);
|
||||
button.setCompoundDrawablePadding(dpToPx(8f));
|
||||
llText.addView(button);
|
||||
|
|
|
@ -201,8 +201,8 @@ public class AMapPointMenuController extends MenuController {
|
|||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
titleButtonController.caption = contextMenuButton.getLeftTextCaption();
|
||||
titleButtonController.rightTextCaption = contextMenuButton.getRightTextCaption();
|
||||
titleButtonController.leftIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getLeftIconName());
|
||||
titleButtonController.rightIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getRightIconName());
|
||||
titleButtonController.startIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getLeftIconName());
|
||||
titleButtonController.endIconId = AndroidUtils.getDrawableId(app, contextMenuButton.getRightIconName());
|
||||
titleButtonController.enabled = contextMenuButton.isEnabled();
|
||||
titleButtonController.tintIcon = contextMenuButton.isTintIcon();
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class AmenityMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_read_text;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_read_text;
|
||||
}
|
||||
|
||||
openingHoursInfo = OpeningHoursParser.getInfo(amenity.getOpeningHours());
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.graphics.drawable.Drawable;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -41,7 +40,7 @@ public class ImpassibleRoadsMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -124,7 +124,7 @@ public class MapDataMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftDownloadButtonController.caption = mapActivity.getString(R.string.shared_string_download);
|
||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||
|
||||
rightDownloadButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
@ -154,7 +154,7 @@ public class MapDataMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightDownloadButtonController.caption = mapActivity.getString(R.string.download_select_map_types);
|
||||
rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm;
|
||||
rightDownloadButtonController.startIconId = R.drawable.ic_plugin_srtm;
|
||||
|
||||
bottomTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
@ -171,7 +171,7 @@ public class MapDataMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
bottomTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||
bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
bottomTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
|
||||
titleProgressController = new TitleProgressController() {
|
||||
@Override
|
||||
|
@ -396,7 +396,7 @@ public class MapDataMenuController extends MenuController {
|
|||
}
|
||||
|
||||
leftDownloadButtonController.visible = true;
|
||||
leftDownloadButtonController.leftIconId = R.drawable.ic_action_import;
|
||||
leftDownloadButtonController.startIconId = R.drawable.ic_action_import;
|
||||
if (backuped) {
|
||||
leftDownloadButtonController.caption = mapActivity.getString(R.string.local_index_mi_restore);
|
||||
} else if (indexItem != null) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MapMarkerMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(mapMarker.history ? R.string.shared_string_restore : R.string.mark_passed);
|
||||
leftTitleButtonController.leftIcon = createPassedIcon(getPassedIconBgNormalColorId());
|
||||
leftTitleButtonController.startIcon = createPassedIcon(getPassedIconBgNormalColorId());
|
||||
|
||||
if (!mapMarker.history) {
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
|
@ -69,7 +69,7 @@ public class MapMarkerMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightTitleButtonController.caption = mapActivity.getString(R.string.make_active);
|
||||
rightTitleButtonController.leftIcon = createShowOnTopbarIcon(getDeviceTopNormalColorId());
|
||||
rightTitleButtonController.startIcon = createShowOnTopbarIcon(getDeviceTopNormalColorId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PointDescriptionMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.avoid_road);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_road_works_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_road_works_dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,10 @@ public class TargetPointMenuController extends MenuController {
|
|||
};
|
||||
if (nav && intermediatePointsCount == 0 && !targetPoint.start) {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.cancel_navigation);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_remove_dark;
|
||||
} else {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_remove);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,11 +82,11 @@ public class TransportRouteController extends MenuController {
|
|||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_next);
|
||||
|
||||
if (AndroidUtils.isLayoutRtl(mapActivity)) {
|
||||
leftTitleButtonController.rightIconId = R.drawable.ic_arrow_forward;
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_arrow_back;
|
||||
leftTitleButtonController.endIconId = R.drawable.ic_arrow_forward;
|
||||
rightTitleButtonController.startIconId = R.drawable.ic_arrow_back;
|
||||
} else {
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_arrow_back;
|
||||
rightTitleButtonController.rightIconId = R.drawable.ic_arrow_forward;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_arrow_back;
|
||||
rightTitleButtonController.endIconId = R.drawable.ic_arrow_forward;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,14 @@ package net.osmand.plus.mapcontextmenu.other;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
|
||||
import com.github.mikephil.charting.charts.LineChart;
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
|
@ -35,7 +34,6 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
|
||||
|
@ -49,6 +47,8 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.SimplePopUpMenuItemAdapter.SimplePopUpMenuItem;
|
||||
|
||||
public class TrackDetailsMenu {
|
||||
|
||||
@Nullable
|
||||
|
@ -172,6 +172,8 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
}
|
||||
});
|
||||
int navigationIconResId = AndroidUtils.getNavigationIconResId(mapActivity);
|
||||
toolbarController.setBackBtnIconIds(navigationIconResId, navigationIconResId);
|
||||
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -489,6 +491,9 @@ public class TrackDetailsMenu {
|
|||
if (mapActivity == null || gpxItem == null) {
|
||||
return;
|
||||
}
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
final UiUtilities ic = app.getUIUtilities();
|
||||
final boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
GPXTrackAnalysis analysis = gpxItem.analysis;
|
||||
if (analysis == null || gpxItem.chartTypes == null) {
|
||||
parentView.setVisibility(View.GONE);
|
||||
|
@ -575,9 +580,6 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
});
|
||||
|
||||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
final UiUtilities ic = app.getUIUtilities();
|
||||
|
||||
GpxUiHelper.setupGPXChart(app, chart, 4);
|
||||
|
||||
List<ILineDataSet> dataSets = new ArrayList<>();
|
||||
|
@ -651,23 +653,22 @@ public class TrackDetailsMenu {
|
|||
yAxis.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
for (final GPXDataSetType[] types : availableTypes) {
|
||||
MenuItem menuItem = optionsMenu.getMenu()
|
||||
.add(GPXDataSetType.getName(app, types))
|
||||
.setIcon(GPXDataSetType.getImageDrawable(app, types));
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
Context themedContext = UiUtilities.getThemedContext(v.getContext(), nightMode);
|
||||
List<SimplePopUpMenuItem> items = new ArrayList<>();
|
||||
for (GPXDataSetType[] types : availableTypes) {
|
||||
items.add(new SimplePopUpMenuItem(
|
||||
GPXDataSetType.getName(app, types),
|
||||
GPXDataSetType.getImageDrawable(app, types)));
|
||||
}
|
||||
UiUtilities.createListPopupWindow(
|
||||
themedContext, v, v.getWidth(), items, new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem mItem) {
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
GpxDisplayItem gpxItem = getGpxItem();
|
||||
gpxItem.chartTypes = types;
|
||||
gpxItem.chartTypes = availableTypes.get(position);
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
optionsMenu.show();
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
yAxisArrow.setVisibility(View.VISIBLE);
|
||||
|
@ -695,28 +696,25 @@ public class TrackDetailsMenu {
|
|||
xAxis.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final PopupMenu optionsMenu = new PopupMenu(v.getContext(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
for (final GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
||||
MenuItem menuItem = optionsMenu.getMenu()
|
||||
.add(type.getStringId()).setIcon(type.getImageDrawable(app));
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
Context themedContext = UiUtilities.getThemedContext(v.getContext(), nightMode);
|
||||
List<SimplePopUpMenuItem> items = new ArrayList<>();
|
||||
for (GPXDataSetAxisType type : GPXDataSetAxisType.values()) {
|
||||
items.add(new SimplePopUpMenuItem(
|
||||
app.getString(type.getStringId()), type.getImageDrawable(app)));
|
||||
}
|
||||
UiUtilities.createListPopupWindow(themedContext,
|
||||
v, v.getWidth(), items, new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem mItem) {
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
GpxDisplayItem gpxItem = getGpxItem();
|
||||
if (gpxItem != null) {
|
||||
gpxItem.chartAxisType = type;
|
||||
gpxItem.chartAxisType = GPXDataSetAxisType.values()[position];
|
||||
gpxItem.chartHighlightPos = -1;
|
||||
gpxItem.chartMatrix = null;
|
||||
update();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
optionsMenu.show();
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
xAxisArrow.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -30,6 +30,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
|||
private TrackDetailsMenu menu;
|
||||
private View mainView;
|
||||
private boolean paused = true;
|
||||
private boolean nightMode;
|
||||
|
||||
@Nullable
|
||||
private MapActivity getMapActivity() {
|
||||
|
@ -46,7 +47,7 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
|||
Bundle savedInstanceState) {
|
||||
MapActivity mapActivity = requireMapActivity();
|
||||
menu = mapActivity.getTrackDetailsMenu();
|
||||
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
ContextThemeWrapper context =
|
||||
new ContextThemeWrapper(mapActivity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.track_details, container, false);
|
||||
|
@ -192,7 +193,6 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
|||
if (ctx != null) {
|
||||
boolean portraitMode = AndroidUiHelper.isOrientationPortrait(ctx);
|
||||
boolean landscapeLayout = !portraitMode;
|
||||
boolean nightMode = ctx.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
if (!landscapeLayout) {
|
||||
AndroidUtils.setBackground(ctx, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
} else {
|
||||
|
|
|
@ -1492,8 +1492,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
|||
return true;
|
||||
}
|
||||
});
|
||||
Drawable shareIcon = iconsCache.getThemedIcon((R.drawable.ic_action_gshare_dark));
|
||||
item = optionsMenu.getMenu().add(R.string.shared_string_share)
|
||||
.setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_gshare_dark));
|
||||
.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -393,7 +393,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
|
|||
|
||||
if (!mi.isActionViewExpanded()) {
|
||||
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER);
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true);
|
||||
GPXFile gpxFile = getGpx();
|
||||
if (gpxFile != null && gpxFile.path != null) {
|
||||
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
|
@ -152,7 +153,9 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
|||
GPXFile gpxFile = getGpx();
|
||||
if (gpxFile != null) {
|
||||
if (gpxFile.path != null && !gpxFile.showCurrentTrack) {
|
||||
MenuItem item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark)
|
||||
Drawable shareIcon = app.getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark));
|
||||
MenuItem item = menu.add(R.string.shared_string_share)
|
||||
.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon))
|
||||
.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_upload);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_export;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_export;
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
rightTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
|
||||
categoryDescr = getCategoryDescr();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OsmBugMenuController extends MenuController {
|
|||
} else {
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.poi_dialog_reopen);
|
||||
}
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_note_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_note_dark;
|
||||
|
||||
rightTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class OsmBugMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_close);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
||||
rightTitleButtonController.startIconId = R.drawable.ic_action_remove_dark;
|
||||
|
||||
updateData();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Dialog;
|
|||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -248,7 +249,9 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
|||
});
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
item = menu.add(R.string.shared_string_export).setIcon(R.drawable.ic_action_gshare_dark);
|
||||
Drawable shareIcon = getMyApplication().getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark));
|
||||
item = menu.add(R.string.shared_string_export)
|
||||
.setIcon(AndroidUtils.getDrawableForDirection(getMyApplication(), shareIcon));
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_delete_dark;
|
||||
}
|
||||
|
||||
private void buildParkingDescription(MapActivity mapActivity) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
|||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
@ -485,6 +486,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
}
|
||||
|
||||
private void buildMenuButtons(@NonNull View view) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
AppCompatImageView backButton = (AppCompatImageView) view.findViewById(R.id.back_button);
|
||||
AppCompatImageButton backButtonFlow = (AppCompatImageButton) view.findViewById(R.id.back_button_flow);
|
||||
OnClickListener backOnClick = new OnClickListener() {
|
||||
|
@ -525,8 +527,13 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
saveRoute.setOnClickListener(saveOnClick);
|
||||
saveRouteFlow.setOnClickListener(saveOnClick);
|
||||
|
||||
View shareRoute = view.findViewById(R.id.share_as_gpx);
|
||||
View shareRouteFlow = view.findViewById(R.id.share_as_gpx_flow);
|
||||
ImageView shareRoute = (ImageView) view.findViewById(R.id.share_as_gpx);
|
||||
ImageView shareRouteFlow = (ImageView) view.findViewById(R.id.share_as_gpx_flow);
|
||||
Drawable shareIcon = getIcon(R.drawable.ic_action_gshare_dark, nightMode ?
|
||||
R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
|
||||
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||
shareRoute.setImageDrawable(shareIcon);
|
||||
shareRouteFlow.setImageDrawable(shareIcon);
|
||||
OnClickListener shareOnClick = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -967,6 +967,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
||||
final RouteMenuAppModes mode = app.getRoutingOptionsHelper().getRouteMenuAppMode(applicationMode);
|
||||
boolean isLayoutRTL = AndroidUtils.isLayoutRtl(app);
|
||||
|
||||
updateControlButtons(mapActivity, mainView);
|
||||
LinearLayout optionsButton = (LinearLayout) mainView.findViewById(R.id.map_options_route_button);
|
||||
|
@ -984,7 +985,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
clickRouteParams();
|
||||
}
|
||||
});
|
||||
AndroidUtils.setBackground(app, optionsButton, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
||||
AndroidUtils.setBackground(app, optionsButton, nightMode,
|
||||
isLayoutRTL ? R.drawable.route_info_trans_gradient_left_light : R.drawable.route_info_trans_gradient_light,
|
||||
isLayoutRTL ? R.drawable.route_info_trans_gradient_left_dark :R.drawable.route_info_trans_gradient_dark);
|
||||
|
||||
HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container);
|
||||
scrollView.setVerticalScrollBarEnabled(false);
|
||||
|
|
|
@ -511,8 +511,9 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
slideInAnim = R.anim.slide_in_bottom;
|
||||
slideOutAnim = R.anim.slide_out_bottom;
|
||||
} else {
|
||||
slideInAnim = R.anim.slide_in_left;
|
||||
slideOutAnim = R.anim.slide_out_left;
|
||||
boolean isLayoutRtl = AndroidUtils.isLayoutRtl(mapActivity);
|
||||
slideInAnim = isLayoutRtl ? R.anim.slide_in_right : R.anim.slide_in_left;
|
||||
slideOutAnim = isLayoutRtl ? R.anim.slide_out_right : R.anim.slide_out_left;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
|||
}
|
||||
int expandType = args.getInt(EXPAND_TYPE_KEY, -1);
|
||||
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.bottom_sheet_item_toolbar_title, null);
|
||||
final View titleView = UiUtilities.getInflater(ctx, nightMode)
|
||||
.inflate(R.layout.bottom_sheet_item_toolbar_title, null);
|
||||
TextView textView = (TextView) titleView.findViewById(R.id.title);
|
||||
textView.setText(R.string.show_along_the_route);
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ public class MapMarkersCard extends BaseCard {
|
|||
if (i > 0) {
|
||||
View div = new View(ctx);
|
||||
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(ctx, 1f));
|
||||
p.setMargins(listTextPadding, 0, 0, 0);
|
||||
AndroidUtils.setMargins(p, listTextPadding, 0, 0, 0);
|
||||
div.setLayoutParams(p);
|
||||
AndroidUtils.setBackgroundColor(ctx, div, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
|
||||
div.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -59,6 +61,11 @@ public class PedestrianRouteCard extends BaseCard {
|
|||
} else {
|
||||
AndroidUtils.setBackground(app, buttonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
Drawable icPedestrian = app.getUIUtilities().getIcon(
|
||||
R.drawable.ic_action_pedestrian_dark,
|
||||
R.color.description_font_and_bottom_sheet_icons);
|
||||
((ImageView) view.findViewById(R.id.image)).setImageDrawable(
|
||||
AndroidUtils.getDrawableForDirection(app, icPedestrian));
|
||||
view.findViewById(R.id.card_divider).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.top_divider).setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
|
@ -110,7 +111,7 @@ public class TracksCard extends BaseCard {
|
|||
img.setVisibility(View.VISIBLE);
|
||||
LinearLayout container = (LinearLayout) v.findViewById(R.id.container);
|
||||
container.setMinimumHeight(minCardHeight);
|
||||
container.setPadding(listContentPadding, 0, 0, 0);
|
||||
AndroidUtils.setPadding(container, listContentPadding, 0, 0, 0);
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -173,6 +173,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
private SearchUICore searchUICore;
|
||||
private SearchResultListener defaultResultListener;
|
||||
private String searchQuery;
|
||||
private boolean nightMode;
|
||||
|
||||
private LatLon centerLatLon;
|
||||
private net.osmand.Location location = null;
|
||||
|
@ -229,6 +230,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
app = getMyApplication();
|
||||
nightMode = !app.getSettings().isLightContent();
|
||||
navigationInfo = new NavigationInfo(app);
|
||||
accessibilityAssistant = new AccessibilityAssistant(getActivity());
|
||||
boolean isLightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||
|
@ -483,7 +485,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
);
|
||||
|
||||
titleEdit = (TextView) view.findViewById(R.id.titleEdit);
|
||||
view.findViewById(R.id.shareButton).setOnClickListener(
|
||||
Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark,
|
||||
nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light);
|
||||
shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon);
|
||||
ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton);
|
||||
shareButton.setImageDrawable(shareIcon);
|
||||
shareButton.setOnClickListener(
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1205,7 +1212,6 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
if (SearchUICore.isDebugMode()) {
|
||||
LOG.info("UI >> Start loading categories");
|
||||
}
|
||||
final boolean nightMode = !app.getSettings().isLightContent();
|
||||
SearchResultCollection res = searchUICore.shallowSearch(SearchAmenityTypesAPI.class, "", null);
|
||||
if (res != null) {
|
||||
List<QuickSearchListItem> rows = new ArrayList<>();
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.widget.TextView;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
|
|
@ -396,6 +396,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
routePlanningBtn = createHudButton(routePlanButton, R.drawable.ic_action_gdirections_dark, ROUTE_PLANNING_HUD_ID)
|
||||
.setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark)
|
||||
.setBg(R.drawable.btn_round, R.drawable.btn_round_night);
|
||||
routePlanningBtn.flipIconForRtl = true;
|
||||
controls.add(routePlanningBtn);
|
||||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -990,6 +991,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
int resClrLight = R.color.map_button_icon_color_light;
|
||||
int resClrDark = R.color.map_button_icon_color_dark;
|
||||
String id;
|
||||
boolean flipIconForRtl;
|
||||
|
||||
boolean nightMode = false;
|
||||
boolean f = true;
|
||||
|
@ -1158,6 +1160,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
d = ctx.getUIUtilities().getIcon(resLightId);
|
||||
} else if (resId != 0) {
|
||||
d = ctx.getUIUtilities().getIcon(resId, nightMode ? resClrDark : resClrLight);
|
||||
if (flipIconForRtl) {
|
||||
d = AndroidUtils.getDrawableForDirection(ctx, d);
|
||||
}
|
||||
}
|
||||
if (iv instanceof ImageView) {
|
||||
if (compass) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class WikivoyageWptPtMenuController extends WptPtMenuController {
|
|||
}
|
||||
};
|
||||
leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);
|
||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_read_text;
|
||||
leftTitleButtonController.startIconId = R.drawable.ic_action_read_text;
|
||||
}
|
||||
|
||||
private static TravelArticle getTravelArticle(@NonNull MapActivity mapActivity, @NonNull WptPt wpt) {
|
||||
|
|
Loading…
Reference in a new issue