Fix a bunch of deprecations
This commit is contained in:
parent
44b84bf65d
commit
9bed3254b6
51 changed files with 109 additions and 174 deletions
|
@ -43,7 +43,7 @@ public abstract class CacheFragmentStatePagerAdapter extends FragmentStatePagerA
|
||||||
private SparseArray<Fragment> mPages;
|
private SparseArray<Fragment> mPages;
|
||||||
|
|
||||||
public CacheFragmentStatePagerAdapter(FragmentManager fm) {
|
public CacheFragmentStatePagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
mPages = new SparseArray<Fragment>();
|
mPages = new SparseArray<Fragment>();
|
||||||
mFm = fm;
|
mFm = fm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
|
@ -102,7 +101,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
|
||||||
createMenuItem(menu, FILTER, R.string.filter_current_poiButton,
|
createMenuItem(menu, FILTER, R.string.filter_current_poiButton,
|
||||||
R.drawable.ic_action_done,
|
R.drawable.ic_action_done,
|
||||||
//R.drawable.a_1_navigation_accept_light, R.drawable.a_1_navigation_accept_dark,
|
//R.drawable.a_1_navigation_accept_light, R.drawable.a_1_navigation_accept_dark,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT | MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.appcompat.view.ActionMode;
|
import androidx.appcompat.view.ActionMode;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
@ -435,7 +434,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
menu.clear();
|
menu.clear();
|
||||||
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||||
mi.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
mi.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
@ -452,11 +451,11 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
((FavoritesActivity) getActivity()).updateListViewFooter(footerView);
|
((FavoritesActivity) getActivity()).updateListViewFooter(footerView);
|
||||||
|
|
||||||
|
|
||||||
if (!MenuItemCompat.isActionViewExpanded(mi)) {
|
if (!mi.isActionViewExpanded()) {
|
||||||
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItem.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, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.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, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag, MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,7 +482,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
enableSelectionMode(true);
|
enableSelectionMode(true);
|
||||||
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
|
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
|
||||||
R.drawable.ic_action_flag,
|
R.drawable.ic_action_flag,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
favoritesSelected.clear();
|
favoritesSelected.clear();
|
||||||
groupsToDelete.clear();
|
groupsToDelete.clear();
|
||||||
favouritesAdapter.notifyDataSetInvalidated();
|
favouritesAdapter.notifyDataSetInvalidated();
|
||||||
|
@ -546,7 +545,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
enableSelectionMode(true);
|
enableSelectionMode(true);
|
||||||
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
|
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
|
||||||
R.drawable.ic_action_delete_dark,
|
R.drawable.ic_action_delete_dark,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
favoritesSelected.clear();
|
favoritesSelected.clear();
|
||||||
groupsToDelete.clear();
|
groupsToDelete.clear();
|
||||||
favouritesAdapter.notifyDataSetInvalidated();
|
favouritesAdapter.notifyDataSetInvalidated();
|
||||||
|
|
|
@ -18,7 +18,6 @@ import android.widget.EditText;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.jwetherell.openmap.common.LatLonPoint;
|
import com.jwetherell.openmap.common.LatLonPoint;
|
||||||
|
@ -106,7 +105,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
||||||
light = false;
|
light = false;
|
||||||
}
|
}
|
||||||
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
menuItem = menuItem.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_marker_dark, light));
|
menuItem = menuItem.setIcon(app.getUIUtilities().getIcon(R.drawable.ic_action_marker_dark, light));
|
||||||
|
|
||||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
|
|
|
@ -10,8 +10,6 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ExpandableListView;
|
import android.widget.ExpandableListView;
|
||||||
|
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
@ -64,7 +62,7 @@ public abstract class OsmandExpandableListActivity extends
|
||||||
return onOptionsItemSelected(item);
|
return onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
|
menuItem.setShowAsAction(menuItemType);
|
||||||
return menuItem;
|
return menuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@ import android.widget.HeaderViewListAdapter;
|
||||||
import android.widget.ListAdapter;
|
import android.widget.ListAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -68,7 +66,7 @@ public abstract class OsmandListActivity extends
|
||||||
return onOptionsItemSelected(item);
|
return onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
|
menuItem.setShowAsAction(menuItemType);
|
||||||
return menuItem;
|
return menuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class TabActivity extends ActionBarProgressActivity {
|
||||||
private List<TabItem> mTabs;
|
private List<TabItem> mTabs;
|
||||||
|
|
||||||
public OsmandFragmentPagerAdapter(FragmentManager fm, List<TabItem> items) {
|
public OsmandFragmentPagerAdapter(FragmentManager fm, List<TabItem> items) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
mTabs = items;
|
mTabs = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.activities.actions;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -9,7 +10,6 @@ import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.ClipboardManager;
|
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -82,7 +81,7 @@ public class SearchAddressFragment extends Fragment {
|
||||||
}
|
}
|
||||||
if(getActivity() instanceof SearchAddressActivity) {
|
if(getActivity() instanceof SearchAddressActivity) {
|
||||||
MenuItem menuItem = menu.add(0, SELECT_POINT, 0, "");
|
MenuItem menuItem = menu.add(0, SELECT_POINT, 0, "");
|
||||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
if (getApplication().accessibilityEnabled())
|
if (getApplication().accessibilityEnabled())
|
||||||
menuItem.setTitle(R.string.shared_string_ok);
|
menuItem.setTitle(R.string.shared_string_ok);
|
||||||
menuItem = menuItem.setIcon(R.drawable.ic_action_done);
|
menuItem = menuItem.setIcon(R.drawable.ic_action_done);
|
||||||
|
@ -95,7 +94,7 @@ public class SearchAddressFragment extends Fragment {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
MenuItem menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
menuItem = menuItem.setIcon(R.drawable.ic_action_marker_dark);
|
menuItem = menuItem.setIcon(R.drawable.ic_action_marker_dark);
|
||||||
|
|
||||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
|
@ -107,7 +106,7 @@ public class SearchAddressFragment extends Fragment {
|
||||||
});
|
});
|
||||||
if (ENABLE_ONLINE_ADDRESS) {
|
if (ENABLE_ONLINE_ADDRESS) {
|
||||||
menuItem = menu.add(0, ONLINE_SEARCH, 0, R.string.search_online_address);
|
menuItem = menu.add(0, ONLINE_SEARCH, 0, R.string.search_online_address);
|
||||||
MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
menuItem = menuItem.setIcon(R.drawable.ic_world_globe_dark);
|
menuItem = menuItem.setIcon(R.drawable.ic_world_globe_dark);
|
||||||
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,6 @@ import android.widget.Toast;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
@ -124,7 +123,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
public boolean onCreateOptionsMenu(Menu omenu) {
|
public boolean onCreateOptionsMenu(Menu omenu) {
|
||||||
Menu menu = getClearToolbar(true).getMenu();
|
Menu menu = getClearToolbar(true).getMenu();
|
||||||
searchPOILevel = menu.add(0, SEARCH_MORE, 0, R.string.search_POI_level_btn);
|
searchPOILevel = menu.add(0, SEARCH_MORE, 0, R.string.search_POI_level_btn);
|
||||||
MenuItemCompat.setShowAsAction(searchPOILevel, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
searchPOILevel.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
searchPOILevel.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
searchPOILevel.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
@ -133,7 +132,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
});
|
});
|
||||||
showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter);
|
showFilterItem = menu.add(0, FILTER, 0, R.string.search_poi_filter);
|
||||||
MenuItemCompat.setShowAsAction(showFilterItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
showFilterItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
showFilterItem = showFilterItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
showFilterItem = showFilterItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
||||||
R.drawable.ic_action_filter_dark));
|
R.drawable.ic_action_filter_dark));
|
||||||
showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
showFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
|
@ -156,7 +155,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
});
|
});
|
||||||
|
|
||||||
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
showOnMapItem = menu.add(0, SHOW_ON_MAP, 0, R.string.shared_string_show_on_map);
|
||||||
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
showOnMapItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getUIUtilities().getIcon(
|
||||||
R.drawable.ic_show_on_map));
|
R.drawable.ic_show_on_map));
|
||||||
showOnMapItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
showOnMapItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
||||||
|
@ -176,10 +175,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
showOnMapItem.setEnabled(!isNameSearch() || amenityAdapter.getCount() > 0);
|
showOnMapItem.setEnabled(!isNameSearch() || amenityAdapter.getCount() > 0);
|
||||||
if (filter != null && !isNameSearch()) {
|
if (filter != null && !isNameSearch()) {
|
||||||
createMenuItem(omenu, SAVE_FILTER, R.string.edit_filter_save_as_menu_item, R.drawable.ic_action_favorite,
|
createMenuItem(omenu, SAVE_FILTER, R.string.edit_filter_save_as_menu_item, R.drawable.ic_action_favorite,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
if (!filter.isStandardFilter()) {
|
if (!filter.isStandardFilter()) {
|
||||||
createMenuItem(omenu, DELETE_FILTER, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
|
createMenuItem(omenu, DELETE_FILTER, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateButtonState(false);
|
updateButtonState(false);
|
||||||
|
|
|
@ -12,7 +12,6 @@ import android.view.animation.LinearInterpolator;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -129,7 +128,7 @@ public class AudioVideoNoteRecordingMenuFullScreen extends AudioVideoNoteRecordi
|
||||||
stopProgress();
|
stopProgress();
|
||||||
|
|
||||||
progressBar.setProgress(0);
|
progressBar.setProgress(0);
|
||||||
ViewCompat.setAlpha(progressBar, 1f);
|
progressBar.setAlpha(1f);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
animatorCompat = ValueAnimator.ofInt(0);
|
animatorCompat = ValueAnimator.ofInt(0);
|
||||||
|
|
|
@ -1036,11 +1036,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
try {
|
try {
|
||||||
Method m = mr.getClass().getDeclaredMethod("setOrientationHint", Integer.TYPE);
|
Method m = mr.getClass().getDeclaredMethod("setOrientationHint", Integer.TYPE);
|
||||||
Display display = ((WindowManager) mapActivity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
Display display = ((WindowManager) mapActivity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||||
if (display.getOrientation() == Surface.ROTATION_0) {
|
if (display.getRotation() == Surface.ROTATION_0) {
|
||||||
m.invoke(mr, 90);
|
m.invoke(mr, 90);
|
||||||
} else if (display.getOrientation() == Surface.ROTATION_270) {
|
} else if (display.getRotation() == Surface.ROTATION_270) {
|
||||||
m.invoke(mr, 180);
|
m.invoke(mr, 180);
|
||||||
} else if (display.getOrientation() == Surface.ROTATION_180) {
|
} else if (display.getRotation() == Surface.ROTATION_180) {
|
||||||
m.invoke(mr, 270);
|
m.invoke(mr, 270);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -4,10 +4,10 @@ import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.ClipboardManager;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
||||||
if (mapView != null) {
|
if (mapView != null) {
|
||||||
WindowManager wm = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager wm = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
|
||||||
if (wm != null) {
|
if (wm != null) {
|
||||||
int orientation = wm.getDefaultDisplay().getOrientation();
|
int orientation = wm.getDefaultDisplay().getRotation();
|
||||||
app.getLocationProvider().updateScreenOrientation(orientation);
|
app.getLocationProvider().updateScreenOrientation(orientation);
|
||||||
mapView.setMapLocationListener(this);
|
mapView.setMapLocationListener(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import android.widget.ExpandableListView;
|
||||||
import android.widget.ExpandableListView.OnChildClickListener;
|
import android.widget.ExpandableListView.OnChildClickListener;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -106,7 +105,7 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
||||||
return onOptionsItemSelected(item);
|
return onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
|
menuItem.setShowAsAction(menuItemType);
|
||||||
return menuItem;
|
return menuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.dashboard;
|
package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -9,8 +10,8 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
@ -37,10 +38,10 @@ public abstract class DashBaseFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(activity);
|
super.onAttach(context);
|
||||||
if (activity instanceof MapActivity) {
|
if (context instanceof MapActivity) {
|
||||||
dashboard = ((MapActivity) activity).getDashboard();
|
dashboard = ((MapActivity) context).getDashboard();
|
||||||
dashboard.onAttach(this);
|
dashboard.onAttach(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,8 +172,8 @@ public abstract class DashBaseFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss() {
|
public void onDismiss() {
|
||||||
dashboardOnMap.blacklistFragmentByTag(fragmentTag);
|
dashboardOnMap.blacklistFragmentByTag(fragmentTag);
|
||||||
ViewCompat.setTranslationX(fragmentView, 0);
|
fragmentView.setTranslationX(0);
|
||||||
ViewCompat.setAlpha(fragmentView, 1);
|
fragmentView.setAlpha(1);
|
||||||
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
|
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
|
||||||
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
|
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
|
||||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||||
|
@ -186,8 +187,8 @@ public abstract class DashBaseFragment extends Fragment {
|
||||||
|
|
||||||
public void onUndo() {
|
public void onUndo() {
|
||||||
dashboardOnMap.unblacklistFragmentClass(fragmentTag);
|
dashboardOnMap.unblacklistFragmentClass(fragmentTag);
|
||||||
ViewCompat.setTranslationX(fragmentView, 0);
|
fragmentView.setTranslationX(0);
|
||||||
ViewCompat.setAlpha(fragmentView, 1);
|
fragmentView.setAlpha(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@ import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -98,8 +96,8 @@ public class DashErrorFragment extends DashBaseFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss() {
|
public void onDismiss() {
|
||||||
dashboardOnMap.hideFragmentByTag(fragmentTag);
|
dashboardOnMap.hideFragmentByTag(fragmentTag);
|
||||||
ViewCompat.setTranslationX(fragmentView, 0);
|
fragmentView.setTranslationX(0);
|
||||||
ViewCompat.setAlpha(fragmentView, 1);
|
fragmentView.setAlpha(1);
|
||||||
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
|
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
|
||||||
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
|
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
|
||||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||||
|
@ -113,8 +111,8 @@ public class DashErrorFragment extends DashBaseFragment {
|
||||||
|
|
||||||
public void onUndo() {
|
public void onUndo() {
|
||||||
dashboardOnMap.unhideFragmentByTag(fragmentTag);
|
dashboardOnMap.unhideFragmentByTag(fragmentTag);
|
||||||
ViewCompat.setTranslationX(fragmentView, 0);
|
fragmentView.setTranslationX(0);
|
||||||
ViewCompat.setAlpha(fragmentView, 1);
|
fragmentView.setAlpha(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTranslationY(View v, int y) {
|
private void setTranslationY(View v, int y) {
|
||||||
ViewCompat.setTranslationY(v, y);
|
v.setTranslationY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.osmand.plus.dashboard.tools;
|
package net.osmand.plus.dashboard.tools;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -51,9 +50,9 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
private static final int DEFAULT_NUMBER_OF_ROWS = 5;
|
private static final int DEFAULT_NUMBER_OF_ROWS = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(activity);
|
super.onAttach(context);
|
||||||
mapActivity = (MapActivity) activity;
|
mapActivity = (MapActivity) context;
|
||||||
mFragmentsData = new ArrayList<>();
|
mFragmentsData = new ArrayList<>();
|
||||||
for (DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
|
for (DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
|
||||||
if (fragmentData.canBeDisabled()) mFragmentsData.add(fragmentData);
|
if (fragmentData.canBeDisabled()) mFragmentsData.add(fragmentData);
|
||||||
|
|
|
@ -65,12 +65,12 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
|
||||||
tv.setPadding(0, 5, 0, 7);
|
tv.setPadding(0, 5, 0, 7);
|
||||||
|
|
||||||
ScrollView sv = new ScrollView(this);
|
ScrollView sv = new ScrollView(this);
|
||||||
gl.addView(sv, new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
|
gl.addView(sv, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
android.view.ViewGroup.LayoutParams.FILL_PARENT));
|
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
final LinearLayout ll = new LinearLayout(this);
|
final LinearLayout ll = new LinearLayout(this);
|
||||||
ll.setOrientation(LinearLayout.VERTICAL);
|
ll.setOrientation(LinearLayout.VERTICAL);
|
||||||
sv.addView(ll, new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
|
sv.addView(ll, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
android.view.ViewGroup.LayoutParams.FILL_PARENT));
|
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
|
||||||
// add buttons
|
// add buttons
|
||||||
setContentView(gl);
|
setContentView(gl);
|
||||||
|
@ -271,7 +271,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
|
||||||
button.setGravity(Gravity.LEFT);
|
button.setGravity(Gravity.LEFT);
|
||||||
button.setTransformationMethod(null); //or else button text is all upper case
|
button.setTransformationMethod(null); //or else button text is all upper case
|
||||||
button.setText(description);
|
button.setText(description);
|
||||||
button.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
|
button.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||||
if (!description.startsWith("\u25BA (")) {
|
if (!description.startsWith("\u25BA (")) {
|
||||||
// Section headline buttons
|
// Section headline buttons
|
||||||
button.setPadding(10, 20, 10, 5);
|
button.setPadding(10, 20, 10, 5);
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.WebSettings;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
@ -82,21 +81,7 @@ public class HelpArticleDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
//Scale web view font size with system font size
|
//Scale web view font size with system font size
|
||||||
float scale = getActivity().getResources().getConfiguration().fontScale;
|
float scale = getActivity().getResources().getConfiguration().fontScale;
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
webView.getSettings().setTextZoom((int) (scale * 100f));
|
||||||
webView.getSettings().setTextZoom((int) (scale * 100f));
|
|
||||||
} else {
|
|
||||||
if (scale <= 0.7f) {
|
|
||||||
webView.getSettings().setTextSize(WebSettings.TextSize.SMALLEST);
|
|
||||||
} else if (scale <= 0.85f) {
|
|
||||||
webView.getSettings().setTextSize(WebSettings.TextSize.SMALLER);
|
|
||||||
} else if (scale <= 1.0f) {
|
|
||||||
webView.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
|
|
||||||
} else if (scale <= 1.15f) {
|
|
||||||
webView.getSettings().setTextSize(WebSettings.TextSize.LARGER);
|
|
||||||
} else {
|
|
||||||
webView.getSettings().setTextSize(WebSettings.TextSize.LARGEST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (assetName != null) {
|
if (assetName != null) {
|
||||||
String fileContents = getAssetAsString(assetName, getActivity());
|
String fileContents = getAssetAsString(assetName, getActivity());
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.Space;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -32,7 +33,6 @@ import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.legacy.widget.Space;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import net.osmand.AndroidNetworkUtils;
|
import net.osmand.AndroidNetworkUtils;
|
||||||
|
@ -540,12 +539,12 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
||||||
MenuItem itemReload = menu.add(0, RELOAD_ID, 0, R.string.shared_string_refresh);
|
MenuItem itemReload = menu.add(0, RELOAD_ID, 0, R.string.shared_string_refresh);
|
||||||
Drawable icReload = app.getUIUtilities().getIcon(R.drawable.ic_action_refresh_dark, colorResId);
|
Drawable icReload = app.getUIUtilities().getIcon(R.drawable.ic_action_refresh_dark, colorResId);
|
||||||
itemReload.setIcon(icReload);
|
itemReload.setIcon(icReload);
|
||||||
MenuItemCompat.setShowAsAction(itemReload, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
itemReload.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
||||||
MenuItem itemSearch = menu.add(0, SEARCH_ID, 1, R.string.shared_string_search);
|
MenuItem itemSearch = menu.add(0, SEARCH_ID, 1, R.string.shared_string_search);
|
||||||
Drawable icSearch = app.getUIUtilities().getIcon(R.drawable.ic_action_search_dark, colorResId);
|
Drawable icSearch = app.getUIUtilities().getIcon(R.drawable.ic_action_search_dark, colorResId);
|
||||||
itemSearch.setIcon(icSearch);
|
itemSearch.setIcon(icSearch);
|
||||||
MenuItemCompat.setShowAsAction(itemSearch, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
itemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -695,8 +695,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
||||||
Drawable icon = getMyApplication().getUIUtilities().getIcon(actionIconId, colorResId);
|
Drawable icon = getMyApplication().getUIUtilities().getIcon(actionIconId, colorResId);
|
||||||
it.setIcon(icon);
|
it.setIcon(icon);
|
||||||
}
|
}
|
||||||
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM |
|
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
|
||||||
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
||||||
private final boolean showSettingsOnly;
|
private final boolean showSettingsOnly;
|
||||||
|
|
||||||
LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res, boolean showSettingsOnly) {
|
LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res, boolean showSettingsOnly) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
this.showSettingsOnly = showSettingsOnly;
|
this.showSettingsOnly = showSettingsOnly;
|
||||||
titles = new String[titleIds.length];
|
titles = new String[titleIds.length];
|
||||||
for (int i = 0; i < titleIds.length; i++) {
|
for (int i = 0; i < titleIds.length; i++) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.mapcontextmenu;
|
package net.osmand.plus.mapcontextmenu;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -11,7 +12,6 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.text.ClipboardManager;
|
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
|
@ -551,7 +551,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
|
||||||
private final List<Fragment> fragments;
|
private final List<Fragment> fragments;
|
||||||
|
|
||||||
MapMarkersViewPagerAdapter(FragmentManager fm) {
|
MapMarkersViewPagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
fragments = Arrays.asList(activeFragment, groupsFragment, historyFragment);
|
fragments = Arrays.asList(activeFragment, groupsFragment, historyFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
@ -122,7 +121,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
||||||
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
listener.onDragStarted(holder);
|
listener.onDragStarted(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
@ -183,7 +182,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
|
||||||
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
inDragAndDrop = true;
|
inDragAndDrop = true;
|
||||||
if (showRoundTripItem) {
|
if (showRoundTripItem) {
|
||||||
int roundTripItemPos = finishPos;
|
int roundTripItemPos = finishPos;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
@ -67,7 +66,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
|
||||||
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
listener.onDragStarted(holder);
|
listener.onDragStarted(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -43,7 +43,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.view.ActionMode;
|
import androidx.appcompat.view.ActionMode;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.FileUtils;
|
import net.osmand.FileUtils;
|
||||||
|
@ -430,11 +429,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
menu.clear();
|
menu.clear();
|
||||||
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS
|
MenuItem mi = createMenuItem(menu, SEARCH_ID, R.string.search_poi_filter, R.drawable.ic_action_search_dark, MenuItem.SHOW_AS_ACTION_ALWAYS
|
||||||
| MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
| MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||||
SearchView searchView = new SearchView(getActivity());
|
SearchView searchView = new SearchView(getActivity());
|
||||||
FavoritesActivity.updateSearchView(getActivity(), searchView);
|
FavoritesActivity.updateSearchView(getActivity(), searchView);
|
||||||
MenuItemCompat.setActionView(mi, searchView);
|
mi.setActionView(searchView);
|
||||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -449,7 +448,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setOnActionExpandListener(mi, new MenuItemCompat.OnActionExpandListener() {
|
mi.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -518,7 +517,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
final MenuItem item;
|
final MenuItem item;
|
||||||
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
|
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
|
||||||
item = menu.add(0, contextMenuItem.getTitleId(), j + 1, contextMenuItem.getTitle());
|
item = menu.add(0, contextMenuItem.getTitleId(), j + 1, contextMenuItem.getTitle());
|
||||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -617,8 +616,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
updateSelectionMode(mode);
|
updateSelectionMode(mode);
|
||||||
MenuItem it = menu.add(R.string.shared_string_show_on_map);
|
MenuItem it = menu.add(R.string.shared_string_show_on_map);
|
||||||
it.setIcon(R.drawable.ic_action_done);
|
it.setIcon(R.drawable.ic_action_done);
|
||||||
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
|
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||||
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
updateCurrentTrack();
|
updateCurrentTrack();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -686,8 +685,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
if (actionIconId != 0) {
|
if (actionIconId != 0) {
|
||||||
it.setIcon(actionIconId);
|
it.setIcon(actionIconId);
|
||||||
}
|
}
|
||||||
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
|
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||||
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.view.ActionMode;
|
import androidx.appcompat.view.ActionMode;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
@ -449,7 +448,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
|
||||||
setSelectionMode(true);
|
setSelectionMode(true);
|
||||||
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
|
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
|
||||||
R.drawable.ic_action_delete_dark,
|
R.drawable.ic_action_delete_dark,
|
||||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
selectedItems.clear();
|
selectedItems.clear();
|
||||||
selectedGroups.clear();
|
selectedGroups.clear();
|
||||||
adapter.notifyDataSetInvalidated();
|
adapter.notifyDataSetInvalidated();
|
||||||
|
|
|
@ -28,8 +28,6 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.viewpager.widget.PagerAdapter;
|
import androidx.viewpager.widget.PagerAdapter;
|
||||||
|
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
|
@ -170,7 +168,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
if (gpxFile.showCurrentTrack) {
|
if (gpxFile.showCurrentTrack) {
|
||||||
MenuItem item = menu.add(R.string.shared_string_refresh).setIcon(R.drawable.ic_action_refresh_dark)
|
MenuItem item = menu.add(R.string.shared_string_refresh).setIcon(R.drawable.ic_action_refresh_dark)
|
||||||
|
@ -184,7 +182,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1099,7 +1097,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
int imageId = getImageId(tabType);
|
int imageId = getImageId(tabType);
|
||||||
switch (tabs.getTabSelectionType()) {
|
switch (tabs.getTabSelectionType()) {
|
||||||
case ALPHA:
|
case ALPHA:
|
||||||
ViewCompat.setAlpha(img, tabs.getTabTextSelectedAlpha());
|
img.setAlpha(tabs.getTabTextSelectedAlpha());
|
||||||
break;
|
break;
|
||||||
case SOLID_COLOR:
|
case SOLID_COLOR:
|
||||||
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTextColor()));
|
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTextColor()));
|
||||||
|
@ -1114,7 +1112,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
|
||||||
int imageId = getImageId(tabType);
|
int imageId = getImageId(tabType);
|
||||||
switch (tabs.getTabSelectionType()) {
|
switch (tabs.getTabSelectionType()) {
|
||||||
case ALPHA:
|
case ALPHA:
|
||||||
ViewCompat.setAlpha(img, tabs.getTabTextAlpha());
|
img.setAlpha(tabs.getTabTextAlpha());
|
||||||
break;
|
break;
|
||||||
case SOLID_COLOR:
|
case SOLID_COLOR:
|
||||||
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTabInactiveTextColor()));
|
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTabInactiveTextColor()));
|
||||||
|
|
|
@ -215,12 +215,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
|
|
||||||
ViewTreeObserver obs = view.getViewTreeObserver();
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
obs.removeGlobalOnLayoutListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getActivity() != null) {
|
if (getActivity() != null) {
|
||||||
tabLayout.setupWithViewPager(viewPager);
|
tabLayout.setupWithViewPager(viewPager);
|
||||||
}
|
}
|
||||||
|
@ -781,7 +775,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
private final String[] titles;
|
private final String[] titles;
|
||||||
|
|
||||||
PoiInfoPagerAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
|
PoiInfoPagerAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
titles = new String[]{basicTitle, extendedTitle};
|
titles = new String[]{basicTitle, extendedTitle};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
@ -642,7 +641,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment implements Selec
|
||||||
h.moveIcon.setOnTouchListener(new View.OnTouchListener() {
|
h.moveIcon.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
listener.onDragStarted(holder);
|
listener.onDragStarted(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
@ -392,7 +391,7 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
|
||||||
profileViewHolder.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
profileViewHolder.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
listener.onDragStarted(holder);
|
listener.onDragStarted(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -23,7 +23,6 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -513,7 +512,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment
|
||||||
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) ==
|
if (event.getActionMasked() ==
|
||||||
MotionEvent.ACTION_DOWN) {
|
MotionEvent.ACTION_DOWN) {
|
||||||
onStartDragListener.onStartDrag(h);
|
onStartDragListener.onStartDrag(h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import androidx.annotation.ColorRes;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
@ -171,7 +170,7 @@ public abstract class SwitchableAction<T> extends QuickAction {
|
||||||
holder.handleView.setOnTouchListener(new View.OnTouchListener() {
|
holder.handleView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) ==
|
if (event.getActionMasked() ==
|
||||||
MotionEvent.ACTION_DOWN) {
|
MotionEvent.ACTION_DOWN) {
|
||||||
onStartDragListener.onStartDrag(holder);
|
onStartDragListener.onStartDrag(holder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -865,7 +865,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
private int routesCount;
|
private int routesCount;
|
||||||
|
|
||||||
RoutesPagerAdapter(FragmentManager fm, int routesCount) {
|
RoutesPagerAdapter(FragmentManager fm, int routesCount) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
this.routesCount = routesCount;
|
this.routesCount = routesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2369,7 +2369,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
private final String[] titles;
|
private final String[] titles;
|
||||||
|
|
||||||
public SearchFragmentPagerAdapter(FragmentManager fm, Resources res) {
|
public SearchFragmentPagerAdapter(FragmentManager fm, Resources res) {
|
||||||
super(fm);
|
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
||||||
titles = new String[titleIds.length];
|
titles = new String[titleIds.length];
|
||||||
for (int i = 0; i < titleIds.length; i++) {
|
for (int i = 0; i < titleIds.length; i++) {
|
||||||
titles[i] = res.getString(titleIds[i]);
|
titles[i] = res.getString(titleIds[i]);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
|
@ -190,7 +189,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
|
||||||
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
listener.onDragStarted(holder);
|
listener.onDragStarted(holder);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -458,7 +458,7 @@ public class DynamicListView extends ObservableListView {
|
||||||
int switchViewNewTop = switchView.getTop();
|
int switchViewNewTop = switchView.getTop();
|
||||||
int delta = switchViewStartTop - switchViewNewTop;
|
int delta = switchViewStartTop - switchViewNewTop;
|
||||||
|
|
||||||
ViewCompat.setTranslationY(switchView, delta);
|
switchView.setTranslationY(delta);
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT < 12) {
|
if (android.os.Build.VERSION.SDK_INT < 12) {
|
||||||
ViewCompat.animate(switchView)
|
ViewCompat.animate(switchView)
|
||||||
|
|
|
@ -45,7 +45,6 @@ import androidx.annotation.ColorRes;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.util.Pair;
|
import androidx.core.util.Pair;
|
||||||
import androidx.core.view.ViewCompat;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||||
|
|
||||||
|
@ -345,11 +344,11 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
switch (tabSelectionType) {
|
switch (tabSelectionType) {
|
||||||
case ALPHA:
|
case ALPHA:
|
||||||
float alpha = pager.getCurrentItem() == i ? tabTextSelectedAlpha : tabTextAlpha;
|
float alpha = pager.getCurrentItem() == i ? tabTextSelectedAlpha : tabTextAlpha;
|
||||||
ViewCompat.setAlpha(tab_title, alpha);
|
tab_title.setAlpha(alpha);
|
||||||
tab_title.setTextColor(tabTextColor);
|
tab_title.setTextColor(tabTextColor);
|
||||||
break;
|
break;
|
||||||
case SOLID_COLOR:
|
case SOLID_COLOR:
|
||||||
ViewCompat.setAlpha(tab_title, OPAQUE);
|
tab_title.setAlpha(OPAQUE);
|
||||||
tab_title.setTextColor(pager.getCurrentItem() == i ? tabTextColor : tabInactiveTextColor);
|
tab_title.setTextColor(pager.getCurrentItem() == i ? tabTextColor : tabInactiveTextColor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -564,7 +563,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
title.setTypeface(tabTypeface, tabTypefaceStyle);
|
title.setTypeface(tabTypeface, tabTypefaceStyle);
|
||||||
switch (tabSelectionType) {
|
switch (tabSelectionType) {
|
||||||
case ALPHA:
|
case ALPHA:
|
||||||
ViewCompat.setAlpha(title, tabTextAlpha);
|
title.setAlpha(tabTextAlpha);
|
||||||
break;
|
break;
|
||||||
case SOLID_COLOR:
|
case SOLID_COLOR:
|
||||||
title.setTextColor(tabInactiveTextColor);
|
title.setTextColor(tabInactiveTextColor);
|
||||||
|
@ -584,7 +583,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
|
||||||
title.setTypeface(tabTypeface, tabTypefaceSelectedStyle);
|
title.setTypeface(tabTypeface, tabTypefaceSelectedStyle);
|
||||||
switch (tabSelectionType) {
|
switch (tabSelectionType) {
|
||||||
case ALPHA:
|
case ALPHA:
|
||||||
ViewCompat.setAlpha(title, tabTextSelectedAlpha);
|
title.setAlpha(tabTextSelectedAlpha);
|
||||||
break;
|
break;
|
||||||
case SOLID_COLOR:
|
case SOLID_COLOR:
|
||||||
title.setTextColor(tabTextColor);
|
title.setTextColor(tabTextColor);
|
||||||
|
|
|
@ -725,8 +725,8 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSwiping) {
|
if (mSwiping) {
|
||||||
ViewCompat.setTranslationX(mSwipeDownView, deltaX);
|
mSwipeDownView.setTranslationX(deltaX);
|
||||||
ViewCompat.setAlpha(mSwipeDownView, Math.max(0f, Math.min(1f,
|
mSwipeDownView.setAlpha(Math.max(0f, Math.min(1f,
|
||||||
1f - 2f * Math.abs(deltaX) / mViewWidth)));
|
1f - 2f * Math.abs(deltaX) / mViewWidth)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -824,8 +824,8 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
|
||||||
|
|
||||||
ViewGroup.LayoutParams lp;
|
ViewGroup.LayoutParams lp;
|
||||||
for (PendingDismissData pendingDismiss : mPendingDismisses) {
|
for (PendingDismissData pendingDismiss : mPendingDismisses) {
|
||||||
ViewCompat.setAlpha(pendingDismiss.view, 1f);
|
pendingDismiss.view.setAlpha(1f);
|
||||||
ViewCompat.setTranslationX(pendingDismiss.view, 0);
|
pendingDismiss.view.setTranslationX(0);
|
||||||
lp = pendingDismiss.childView.getLayoutParams();
|
lp = pendingDismiss.childView.getLayoutParams();
|
||||||
lp.height = originalLayoutHeight;
|
lp.height = originalLayoutHeight;
|
||||||
pendingDismiss.childView.setLayoutParams(lp);
|
pendingDismiss.childView.setLayoutParams(lp);
|
||||||
|
|
|
@ -1114,14 +1114,14 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(View view) {
|
public void onAnimationEnd(View view) {
|
||||||
iv.setVisibility(View.GONE);
|
iv.setVisibility(View.GONE);
|
||||||
ViewCompat.setAlpha(iv, 1f);
|
iv.setAlpha(1f);
|
||||||
hideAnimator = null;
|
hideAnimator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancel(View view) {
|
public void onAnimationCancel(View view) {
|
||||||
iv.setVisibility(View.GONE);
|
iv.setVisibility(View.GONE);
|
||||||
ViewCompat.setAlpha(iv, 1f);
|
iv.setAlpha(1f);
|
||||||
hideAnimator = null;
|
hideAnimator = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.views.mapwidgets;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
@ -10,7 +11,6 @@ import android.graphics.Paint;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.ClipboardManager;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
|
|
@ -8,8 +8,6 @@ import android.view.MotionEvent;
|
||||||
import android.view.ViewConfiguration;
|
import android.view.ViewConfiguration;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.core.view.MotionEventCompat;
|
|
||||||
|
|
||||||
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
|
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
|
||||||
|
|
||||||
public class InterceptorFrameLayout extends FrameLayout {
|
public class InterceptorFrameLayout extends FrameLayout {
|
||||||
|
@ -47,7 +45,7 @@ public class InterceptorFrameLayout extends FrameLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
final int action = MotionEventCompat.getActionMasked(ev);
|
final int action = ev.getActionMasked();
|
||||||
|
|
||||||
if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
|
if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
|
||||||
mIsScrolling = false;
|
mIsScrolling = false;
|
||||||
|
|
|
@ -228,7 +228,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
|
||||||
@Override
|
@Override
|
||||||
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
|
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
|
||||||
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
|
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
|
||||||
ViewCompat.setFitsSystemWindows(child, true);
|
child.setFitsSystemWindows(true);
|
||||||
}
|
}
|
||||||
int savedTop = child.getTop();
|
int savedTop = child.getTop();
|
||||||
// First let the parent lay it out
|
// First let the parent lay it out
|
||||||
|
@ -348,7 +348,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child,
|
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child,
|
||||||
View directTargetChild, View target, int nestedScrollAxes) {
|
View directTargetChild, View target, int nestedScrollAxes, int type) {
|
||||||
mLastNestedScrollDy = 0;
|
mLastNestedScrollDy = 0;
|
||||||
mNestedScrolled = false;
|
mNestedScrolled = false;
|
||||||
return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
|
return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
|
||||||
|
@ -356,7 +356,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dx,
|
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, V child, View target, int dx,
|
||||||
int dy, int[] consumed) {
|
int dy, int[] consumed, int type) {
|
||||||
View scrollingChild = mNestedScrollingChildRef.get();
|
View scrollingChild = mNestedScrollingChildRef.get();
|
||||||
if (target != scrollingChild) {
|
if (target != scrollingChild) {
|
||||||
return;
|
return;
|
||||||
|
@ -392,7 +392,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target) {
|
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, View target, int type) {
|
||||||
if (child.getTop() == mMinOffset) {
|
if (child.getTop() == mMinOffset) {
|
||||||
setStateInternal(STATE_EXPANDED);
|
setStateInternal(STATE_EXPANDED);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -227,9 +227,9 @@ public class SwipeDismissTouchListener implements View.OnTouchListener {
|
||||||
|
|
||||||
if (mSwiping) {
|
if (mSwiping) {
|
||||||
mTranslationX = deltaX;
|
mTranslationX = deltaX;
|
||||||
ViewCompat.setTranslationX(mView, deltaX - mSwipingSlop);
|
mView.setTranslationX(deltaX - mSwipingSlop);
|
||||||
// TODO: use an ease-out interpolator or such
|
// TODO: use an ease-out interpolator or such
|
||||||
ViewCompat.setAlpha(mView, Math.max(0f, Math.min(1f,
|
mView.setAlpha(Math.max(0f, Math.min(1f,
|
||||||
1f - 2f * Math.abs(deltaX) / mViewWidth)));
|
1f - 2f * Math.abs(deltaX) / mViewWidth)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.widget.TextView;
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
import androidx.appcompat.widget.PopupMenu;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.MenuItemCompat;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.core.samples.android.sample1.OsmandResources;
|
import net.osmand.core.samples.android.sample1.OsmandResources;
|
||||||
|
@ -91,7 +90,7 @@ public class ContextMenuHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
MenuItemCompat.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_ALWAYS);
|
mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
topBar.setNavigationOnClickListener(new View.OnClickListener() {
|
topBar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
|
@ -108,21 +107,7 @@ public class ContextMenuHelper {
|
||||||
|
|
||||||
//Scale web view font size with system font size
|
//Scale web view font size with system font size
|
||||||
float scale = ctx.getResources().getConfiguration().fontScale;
|
float scale = ctx.getResources().getConfiguration().fontScale;
|
||||||
if (android.os.Build.VERSION.SDK_INT >= 14) {
|
settings.setTextZoom((int) (scale * 100f));
|
||||||
settings.setTextZoom((int) (scale * 100f));
|
|
||||||
} else {
|
|
||||||
if (scale <= 0.7f) {
|
|
||||||
settings.setTextSize(WebSettings.TextSize.SMALLEST);
|
|
||||||
} else if (scale <= 0.85f) {
|
|
||||||
settings.setTextSize(WebSettings.TextSize.SMALLER);
|
|
||||||
} else if (scale <= 1.0f) {
|
|
||||||
settings.setTextSize(WebSettings.TextSize.NORMAL);
|
|
||||||
} else if (scale <= 1.15f) {
|
|
||||||
settings.setTextSize(WebSettings.TextSize.LARGER);
|
|
||||||
} else {
|
|
||||||
settings.setTextSize(WebSettings.TextSize.LARGEST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);
|
wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);
|
||||||
// wv.loadUrl(OsMoService.SIGN_IN_URL + app.getSettings().OSMO_DEVICE_KEY.get());
|
// wv.loadUrl(OsMoService.SIGN_IN_URL + app.getSettings().OSMO_DEVICE_KEY.get());
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package net.osmand.core.samples.android.sample1.mapcontextmenu;
|
package net.osmand.core.samples.android.sample1.mapcontextmenu;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.ClipboardManager;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
Loading…
Reference in a new issue