Merge pull request #9617 from TacoTheDank/deprecation-fixes

Fix a bunch of deprecations
This commit is contained in:
Vitaliy 2020-08-14 15:13:15 +03:00 committed by GitHub
commit 8c6d57468a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 109 additions and 174 deletions

View file

@ -43,7 +43,7 @@ public abstract class CacheFragmentStatePagerAdapter extends FragmentStatePagerA
private SparseArray<Fragment> mPages;
public CacheFragmentStatePagerAdapter(FragmentManager fm) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
mPages = new SparseArray<Fragment>();
mFm = fm;
}

View file

@ -19,7 +19,6 @@ import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.MenuItemCompat;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
@ -102,7 +101,7 @@ public class EditPOIFilterActivity extends OsmandListActivity {
createMenuItem(menu, FILTER, R.string.filter_current_poiButton,
R.drawable.ic_action_done,
//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);
}

View file

@ -32,7 +32,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.view.ActionMode;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import net.osmand.AndroidUtils;
import net.osmand.Location;
@ -435,7 +434,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
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() {
@Override
public boolean onMenuItemClick(MenuItem item) {
@ -452,11 +451,11 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
((FavoritesActivity) getActivity()).updateListViewFooter(footerView);
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, 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);
if (!mi.isActionViewExpanded()) {
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, MenuItem.SHOW_AS_ACTION_ALWAYS, true);
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, MenuItem.SHOW_AS_ACTION_ALWAYS);
}
}
@ -483,7 +482,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
enableSelectionMode(true);
createMenuItem(menu, SELECT_MAP_MARKERS_ACTION_MODE_ID, R.string.select_map_markers,
R.drawable.ic_action_flag,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItem.SHOW_AS_ACTION_IF_ROOM);
favoritesSelected.clear();
groupsToDelete.clear();
favouritesAdapter.notifyDataSetInvalidated();
@ -546,7 +545,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
enableSelectionMode(true);
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItem.SHOW_AS_ACTION_IF_ROOM);
favoritesSelected.clear();
groupsToDelete.clear();
favouritesAdapter.notifyDataSetInvalidated();

View file

@ -18,7 +18,6 @@ import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.Fragment;
import com.jwetherell.openmap.common.LatLonPoint;
@ -106,7 +105,7 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
light = false;
}
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.setOnMenuItemClickListener(new OnMenuItemClickListener() {

View file

@ -10,8 +10,6 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.ExpandableListView;
import androidx.core.view.MenuItemCompat;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -64,7 +62,7 @@ public abstract class OsmandExpandableListActivity extends
return onOptionsItemSelected(item);
}
});
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setShowAsAction(menuItemType);
return menuItem;
}

View file

@ -10,8 +10,6 @@ import android.widget.HeaderViewListAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import androidx.core.view.MenuItemCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -68,7 +66,7 @@ public abstract class OsmandListActivity extends
return onOptionsItemSelected(item);
}
});
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setShowAsAction(menuItemType);
return menuItem;
}

View file

@ -39,7 +39,7 @@ public class TabActivity extends ActionBarProgressActivity {
private List<TabItem> mTabs;
public OsmandFragmentPagerAdapter(FragmentManager fm, List<TabItem> items) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
mTabs = items;
}

View file

@ -2,6 +2,7 @@ package net.osmand.plus.activities.actions;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -9,7 +10,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.text.Html;
import android.widget.Toast;

View file

@ -16,7 +16,6 @@ import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.Fragment;
import net.osmand.data.LatLon;
@ -82,7 +81,7 @@ public class SearchAddressFragment extends Fragment {
}
if(getActivity() instanceof SearchAddressActivity) {
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())
menuItem.setTitle(R.string.shared_string_ok);
menuItem = menuItem.setIcon(R.drawable.ic_action_done);
@ -95,7 +94,7 @@ public class SearchAddressFragment extends Fragment {
});
} else {
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.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@ -107,7 +106,7 @@ public class SearchAddressFragment extends Fragment {
});
if (ENABLE_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.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override

View file

@ -34,7 +34,6 @@ import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.MenuItemCompat;
import androidx.core.view.ViewCompat;
import net.osmand.Location;
@ -124,7 +123,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
public boolean onCreateOptionsMenu(Menu omenu) {
Menu menu = getClearToolbar(true).getMenu();
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() {
@Override
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);
MenuItemCompat.setShowAsAction(showFilterItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
showFilterItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
showFilterItem = showFilterItem.setIcon(getMyApplication().getUIUtilities().getIcon(
R.drawable.ic_action_filter_dark));
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);
MenuItemCompat.setShowAsAction(showOnMapItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
showOnMapItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
showOnMapItem = showOnMapItem.setIcon(getMyApplication().getUIUtilities().getIcon(
R.drawable.ic_show_on_map));
showOnMapItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@ -176,10 +175,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
showOnMapItem.setEnabled(!isNameSearch() || amenityAdapter.getCount() > 0);
if (filter != null && !isNameSearch()) {
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()) {
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);

View file

@ -12,7 +12,6 @@ import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.ProgressBar;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import net.osmand.plus.R;
@ -129,7 +128,7 @@ public class AudioVideoNoteRecordingMenuFullScreen extends AudioVideoNoteRecordi
stopProgress();
progressBar.setProgress(0);
ViewCompat.setAlpha(progressBar, 1f);
progressBar.setAlpha(1f);
progressBar.setVisibility(View.VISIBLE);
animatorCompat = ValueAnimator.ofInt(0);

View file

@ -1036,11 +1036,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
try {
Method m = mr.getClass().getDeclaredMethod("setOrientationHint", Integer.TYPE);
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);
} else if (display.getOrientation() == Surface.ROTATION_270) {
} else if (display.getRotation() == Surface.ROTATION_270) {
m.invoke(mr, 180);
} else if (display.getOrientation() == Surface.ROTATION_180) {
} else if (display.getRotation() == Surface.ROTATION_180) {
m.invoke(mr, 270);
}
} catch (Exception e) {

View file

@ -4,10 +4,10 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.util.TypedValue;
import android.view.GestureDetector;
import android.view.LayoutInflater;

View file

@ -101,7 +101,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
if (mapView != null) {
WindowManager wm = (WindowManager) app.getSystemService(Context.WINDOW_SERVICE);
if (wm != null) {
int orientation = wm.getDefaultDisplay().getOrientation();
int orientation = wm.getDefaultDisplay().getRotation();
app.getLocationProvider().updateScreenOrientation(orientation);
mapView.setMapLocationListener(this);
}

View file

@ -13,7 +13,6 @@ import android.widget.ExpandableListView;
import android.widget.ExpandableListView.OnChildClickListener;
import androidx.annotation.NonNull;
import androidx.core.view.MenuItemCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
@ -106,7 +105,7 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
return onOptionsItemSelected(item);
}
});
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setShowAsAction(menuItemType);
return menuItem;
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.dashboard;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
@ -9,8 +10,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import com.google.android.material.snackbar.Snackbar;
@ -37,10 +38,10 @@ public abstract class DashBaseFragment extends Fragment {
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof MapActivity) {
dashboard = ((MapActivity) activity).getDashboard();
public void onAttach(@NonNull Context context) {
super.onAttach(context);
if (context instanceof MapActivity) {
dashboard = ((MapActivity) context).getDashboard();
dashboard.onAttach(this);
}
}
@ -171,8 +172,8 @@ public abstract class DashBaseFragment extends Fragment {
@Override
public void onDismiss() {
dashboardOnMap.blacklistFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
fragmentView.setTranslationX(0);
fragmentView.setAlpha(1);
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@ -186,8 +187,8 @@ public abstract class DashBaseFragment extends Fragment {
public void onUndo() {
dashboardOnMap.unblacklistFragmentClass(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
fragmentView.setTranslationX(0);
fragmentView.setAlpha(1);
}
}
}

View file

@ -9,8 +9,6 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import com.google.android.material.snackbar.Snackbar;
import net.osmand.plus.OsmandApplication;
@ -98,8 +96,8 @@ public class DashErrorFragment extends DashBaseFragment {
@Override
public void onDismiss() {
dashboardOnMap.hideFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
fragmentView.setTranslationX(0);
fragmentView.setAlpha(1);
Snackbar.make(parentView, dashboardOnMap.getMyApplication().getResources()
.getString(R.string.shared_string_card_was_hidden), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@ -113,8 +111,8 @@ public class DashErrorFragment extends DashBaseFragment {
public void onUndo() {
dashboardOnMap.unhideFragmentByTag(fragmentTag);
ViewCompat.setTranslationX(fragmentView, 0);
ViewCompat.setAlpha(fragmentView, 1);
fragmentView.setTranslationX(0);
fragmentView.setAlpha(1);
}
}
}

View file

@ -1217,7 +1217,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
}
private void setTranslationY(View v, int y) {
ViewCompat.setTranslationY(v, y);
v.setTranslationY(y);
}
@SuppressLint("NewApi")

View file

@ -1,6 +1,5 @@
package net.osmand.plus.dashboard.tools;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
@ -51,9 +50,9 @@ public class DashboardSettingsDialogFragment extends DialogFragment
private static final int DEFAULT_NUMBER_OF_ROWS = 5;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mapActivity = (MapActivity) activity;
public void onAttach(@NonNull Context context) {
super.onAttach(context);
mapActivity = (MapActivity) context;
mFragmentsData = new ArrayList<>();
for (DashFragmentData fragmentData : mapActivity.getDashboard().getFragmentsData()) {
if (fragmentData.canBeDisabled()) mFragmentsData.add(fragmentData);

View file

@ -65,12 +65,12 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
tv.setPadding(0, 5, 0, 7);
ScrollView sv = new ScrollView(this);
gl.addView(sv, new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT));
gl.addView(sv, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
final LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
sv.addView(ll, new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT));
sv.addView(ll, new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT));
// add buttons
setContentView(gl);
@ -271,7 +271,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity {
button.setGravity(Gravity.LEFT);
button.setTransformationMethod(null); //or else button text is all upper case
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 (")) {
// Section headline buttons
button.setPadding(10, 20, 10, 5);

View file

@ -6,7 +6,6 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -82,21 +81,7 @@ public class HelpArticleDialogFragment extends DialogFragment {
//Scale web view font size with system font size
float scale = getActivity().getResources().getConfiguration().fontScale;
if (android.os.Build.VERSION.SDK_INT >= 14) {
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);
}
}
webView.getSettings().setTextZoom((int) (scale * 100f));
if (assetName != null) {
String fileContents = getAssetAsString(assetName, getActivity());

View file

@ -20,6 +20,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Space;
import android.widget.TextView;
import android.widget.Toast;
@ -32,7 +33,6 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.legacy.widget.Space;
import androidx.viewpager.widget.ViewPager;
import net.osmand.AndroidUtils;

View file

@ -21,7 +21,6 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.DialogFragment;
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);
Drawable icReload = app.getUIUtilities().getIcon(R.drawable.ic_action_refresh_dark, colorResId);
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);
Drawable icSearch = app.getUIUtilities().getIcon(R.drawable.ic_action_search_dark, colorResId);
itemSearch.setIcon(icSearch);
MenuItemCompat.setShowAsAction(itemSearch, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
itemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
}

View file

@ -695,8 +695,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
Drawable icon = getMyApplication().getUIUtilities().getIcon(actionIconId, colorResId);
it.setIcon(icon);
}
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM |
MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}

View file

@ -194,7 +194,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
private final boolean showSettingsOnly;
LiveUpdatesFragmentPagerAdapter(FragmentManager fm, Resources res, boolean showSettingsOnly) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
this.showSettingsOnly = showSettingsOnly;
titles = new String[titleIds.length];
for (int i = 0; i < titleIds.length; i++) {

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapcontextmenu;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -11,7 +12,6 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.text.ClipboardManager;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;

View file

@ -551,7 +551,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
private final List<Fragment> fragments;
MapMarkersViewPagerAdapter(FragmentManager fm) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
fragments = Arrays.asList(activeFragment, groupsFragment, historyFragment);
}

View file

@ -8,7 +8,6 @@ import android.widget.ImageView;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
@ -122,7 +121,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;

View file

@ -9,7 +9,6 @@ import android.view.ViewGroup;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.GPXUtilities.WptPt;
@ -183,7 +182,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
inDragAndDrop = true;
if (showRoundTripItem) {
int roundTripItemPos = finishPos;

View file

@ -11,7 +11,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.GPXUtilities.WptPt;
@ -67,7 +66,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;

View file

@ -43,7 +43,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import net.osmand.AndroidUtils;
import net.osmand.FileUtils;
@ -430,11 +429,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
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);
SearchView searchView = new SearchView(getActivity());
FavoritesActivity.updateSearchView(getActivity(), searchView);
MenuItemCompat.setActionView(mi, searchView);
mi.setActionView(searchView);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
@ -449,7 +448,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
return true;
}
});
MenuItemCompat.setOnActionExpandListener(mi, new MenuItemCompat.OnActionExpandListener() {
mi.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
return true;
@ -518,7 +517,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
final MenuItem item;
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
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())) {
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
@ -617,8 +616,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
updateSelectionMode(mode);
MenuItem it = menu.add(R.string.shared_string_show_on_map);
it.setIcon(R.drawable.ic_action_done);
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
updateCurrentTrack();
return true;
}
@ -686,8 +685,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
if (actionIconId != 0) {
it.setIcon(actionIconId);
}
MenuItemCompat.setShowAsAction(it, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM
| MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
it.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}

View file

@ -35,7 +35,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -449,7 +448,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
setSelectionMode(true);
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
R.drawable.ic_action_delete_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItem.SHOW_AS_ACTION_IF_ROOM);
selectedItems.clear();
selectedGroups.clear();
adapter.notifyDataSetInvalidated();

View file

@ -28,8 +28,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import androidx.core.view.ViewCompat;
import androidx.viewpager.widget.PagerAdapter;
import com.github.mikephil.charting.charts.LineChart;
@ -170,7 +168,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
return true;
}
});
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
if (gpxFile.showCurrentTrack) {
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;
}
});
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);
switch (tabs.getTabSelectionType()) {
case ALPHA:
ViewCompat.setAlpha(img, tabs.getTabTextSelectedAlpha());
img.setAlpha(tabs.getTabTextSelectedAlpha());
break;
case SOLID_COLOR:
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTextColor()));
@ -1114,7 +1112,7 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit
int imageId = getImageId(tabType);
switch (tabs.getTabSelectionType()) {
case ALPHA:
ViewCompat.setAlpha(img, tabs.getTabTextAlpha());
img.setAlpha(tabs.getTabTextAlpha());
break;
case SOLID_COLOR:
img.setImageDrawable(app.getUIUtilities().getPaintedIcon(imageId, tabs.getTabInactiveTextColor()));

View file

@ -215,12 +215,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@Override
public void onGlobalLayout() {
ViewTreeObserver obs = view.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeGlobalOnLayoutListener(this);
}
if (getActivity() != null) {
tabLayout.setupWithViewPager(viewPager);
}
@ -781,7 +775,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
private final String[] titles;
PoiInfoPagerAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
titles = new String[]{basicTitle, extendedTitle};
}

View file

@ -20,7 +20,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
@ -642,7 +641,7 @@ public class RearrangePoiFiltersFragment extends DialogFragment implements Selec
h.moveIcon.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;

View file

@ -17,7 +17,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -392,7 +391,7 @@ public class EditProfilesFragment extends BaseOsmAndFragment {
profileViewHolder.moveButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;

View file

@ -23,7 +23,6 @@ import androidx.annotation.Nullable;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -513,7 +512,7 @@ public class QuickActionListFragment extends BaseOsmAndFragment
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) ==
if (event.getActionMasked() ==
MotionEvent.ACTION_DOWN) {
onStartDragListener.onStartDrag(h);
}

View file

@ -16,7 +16,6 @@ import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.view.MotionEventCompat;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
@ -171,7 +170,7 @@ public abstract class SwitchableAction<T> extends QuickAction {
holder.handleView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) ==
if (event.getActionMasked() ==
MotionEvent.ACTION_DOWN) {
onStartDragListener.onStartDrag(holder);
}

View file

@ -865,7 +865,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
private int routesCount;
RoutesPagerAdapter(FragmentManager fm, int routesCount) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
this.routesCount = routesCount;
}

View file

@ -2369,7 +2369,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
private final String[] titles;
public SearchFragmentPagerAdapter(FragmentManager fm, Resources res) {
super(fm);
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
titles = new String[titleIds.length];
for (int i = 0; i < titleIds.length; i++) {
titles[i] = res.getString(titleIds[i]);

View file

@ -15,7 +15,6 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
@ -190,7 +189,7 @@ public class RearrangeMenuItemsAdapter extends RecyclerView.Adapter<RecyclerView
h.moveButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
listener.onDragStarted(holder);
}
return false;

View file

@ -458,7 +458,7 @@ public class DynamicListView extends ObservableListView {
int switchViewNewTop = switchView.getTop();
int delta = switchViewStartTop - switchViewNewTop;
ViewCompat.setTranslationY(switchView, delta);
switchView.setTranslationY(delta);
if (android.os.Build.VERSION.SDK_INT < 12) {
ViewCompat.animate(switchView)

View file

@ -45,7 +45,6 @@ import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.core.util.Pair;
import androidx.core.view.ViewCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
@ -345,11 +344,11 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
switch (tabSelectionType) {
case ALPHA:
float alpha = pager.getCurrentItem() == i ? tabTextSelectedAlpha : tabTextAlpha;
ViewCompat.setAlpha(tab_title, alpha);
tab_title.setAlpha(alpha);
tab_title.setTextColor(tabTextColor);
break;
case SOLID_COLOR:
ViewCompat.setAlpha(tab_title, OPAQUE);
tab_title.setAlpha(OPAQUE);
tab_title.setTextColor(pager.getCurrentItem() == i ? tabTextColor : tabInactiveTextColor);
break;
}
@ -564,7 +563,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
title.setTypeface(tabTypeface, tabTypefaceStyle);
switch (tabSelectionType) {
case ALPHA:
ViewCompat.setAlpha(title, tabTextAlpha);
title.setAlpha(tabTextAlpha);
break;
case SOLID_COLOR:
title.setTextColor(tabInactiveTextColor);
@ -584,7 +583,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView {
title.setTypeface(tabTypeface, tabTypefaceSelectedStyle);
switch (tabSelectionType) {
case ALPHA:
ViewCompat.setAlpha(title, tabTextSelectedAlpha);
title.setAlpha(tabTextSelectedAlpha);
break;
case SOLID_COLOR:
title.setTextColor(tabTextColor);

View file

@ -725,8 +725,8 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
}
if (mSwiping) {
ViewCompat.setTranslationX(mSwipeDownView, deltaX);
ViewCompat.setAlpha(mSwipeDownView, Math.max(0f, Math.min(1f,
mSwipeDownView.setTranslationX(deltaX);
mSwipeDownView.setAlpha(Math.max(0f, Math.min(1f,
1f - 2f * Math.abs(deltaX) / mViewWidth)));
return true;
}
@ -824,8 +824,8 @@ public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
ViewGroup.LayoutParams lp;
for (PendingDismissData pendingDismiss : mPendingDismisses) {
ViewCompat.setAlpha(pendingDismiss.view, 1f);
ViewCompat.setTranslationX(pendingDismiss.view, 0);
pendingDismiss.view.setAlpha(1f);
pendingDismiss.view.setTranslationX(0);
lp = pendingDismiss.childView.getLayoutParams();
lp.height = originalLayoutHeight;
pendingDismiss.childView.setLayoutParams(lp);

View file

@ -1114,14 +1114,14 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override
public void onAnimationEnd(View view) {
iv.setVisibility(View.GONE);
ViewCompat.setAlpha(iv, 1f);
iv.setAlpha(1f);
hideAnimator = null;
}
@Override
public void onAnimationCancel(View view) {
iv.setVisibility(View.GONE);
ViewCompat.setAlpha(iv, 1f);
iv.setAlpha(1f);
hideAnimator = null;
}
});

View file

@ -2,6 +2,7 @@ package net.osmand.plus.views.mapwidgets;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
@ -10,7 +11,6 @@ import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.ClipboardManager;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;

View file

@ -8,8 +8,6 @@ import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.widget.FrameLayout;
import androidx.core.view.MotionEventCompat;
import net.osmand.plus.widgets.tools.SwipeDismissTouchListener;
public class InterceptorFrameLayout extends FrameLayout {
@ -47,7 +45,7 @@ public class InterceptorFrameLayout extends FrameLayout {
@Override
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) {
mIsScrolling = false;

View file

@ -228,7 +228,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
@Override
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) {
ViewCompat.setFitsSystemWindows(child, true);
child.setFitsSystemWindows(true);
}
int savedTop = child.getTop();
// First let the parent lay it out
@ -348,7 +348,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V child,
View directTargetChild, View target, int nestedScrollAxes) {
View directTargetChild, View target, int nestedScrollAxes, int type) {
mLastNestedScrollDy = 0;
mNestedScrolled = false;
return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0;
@ -356,7 +356,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
@Override
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();
if (target != scrollingChild) {
return;
@ -392,7 +392,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
}
@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) {
setStateInternal(STATE_EXPANDED);
return;

View file

@ -227,9 +227,9 @@ public class SwipeDismissTouchListener implements View.OnTouchListener {
if (mSwiping) {
mTranslationX = deltaX;
ViewCompat.setTranslationX(mView, deltaX - mSwipingSlop);
mView.setTranslationX(deltaX - mSwipingSlop);
// 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)));
return true;
}

View file

@ -21,7 +21,6 @@ import android.widget.TextView;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import net.osmand.AndroidUtils;
import net.osmand.core.samples.android.sample1.OsmandResources;
@ -91,7 +90,7 @@ public class ContextMenuHelper {
return true;
}
});
MenuItemCompat.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_ALWAYS);
mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
topBar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
@ -108,21 +107,7 @@ public class ContextMenuHelper {
//Scale web view font size with system font size
float scale = ctx.getResources().getConfiguration().fontScale;
if (android.os.Build.VERSION.SDK_INT >= 14) {
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);
}
}
settings.setTextZoom((int) (scale * 100f));
wv.loadDataWithBaseURL(null, content, "text/html", "UTF-8", null);
// wv.loadUrl(OsMoService.SIGN_IN_URL + app.getSettings().OSMO_DEVICE_KEY.get());

View file

@ -1,13 +1,13 @@
package net.osmand.core.samples.android.sample1.mapcontextmenu;
import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.util.TypedValue;