From 3ac20f09c5c00bff7ca65e56c3119a2b00a606ea Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Tue, 23 Mar 2021 22:42:28 +0100 Subject: [PATCH] [android] Cast linter fixes Signed-off-by: Alexander Borsuk --- .../ChooseBookmarkCategoryAdapter.java | 4 +-- .../maps/bookmarks/IconsAdapter.java | 2 +- .../maps/discovery/DiscoveryFragment.java | 2 +- .../maps/downloader/BottomPanel.java | 4 +-- .../downloader/CountrySuggestFragment.java | 20 +++++------ .../maps/downloader/DownloaderAdapter.java | 10 +++--- .../maps/downloader/DownloaderStatusIcon.java | 4 +-- .../maps/downloader/OnmapDownloader.java | 10 +++--- .../editor/AdvancedTimetableFragment.java | 6 ++-- .../maps/editor/CuisineAdapter.java | 4 +-- .../maps/editor/EditorFragment.java | 34 +++++++++---------- .../editor/HoursMinutesPickerFragment.java | 4 +-- .../maps/editor/MultilanguageAdapter.java | 4 +-- .../maps/editor/OsmAuthFragment.java | 8 ++--- .../maps/editor/ProfileFragment.java | 6 ++-- .../maps/editor/ReportFragment.java | 2 +- .../maps/editor/SimpleTimetableAdapter.java | 12 +++---- .../mapswithme/maps/editor/StreetAdapter.java | 6 ++-- .../maps/editor/StreetFragment.java | 2 +- .../mapswithme/maps/editor/ViralFragment.java | 2 +- .../gallery/FullScreenGalleryActivity.java | 12 +++---- .../gallery/FullScreenGalleryFragment.java | 2 +- .../maps/gallery/GalleryFragment.java | 2 +- .../com/mapswithme/maps/gallery/Holders.java | 10 +++--- .../mapswithme/maps/gallery/ImageAdapter.java | 2 +- .../gallery/SingleItemAdapterStrategy.java | 2 +- .../maps/onboarding/BaseNewsFragment.java | 4 +-- .../BasePermissionsDialogFragment.java | 6 ++-- .../maps/permissions/PermissionsAdapter.java | 10 +++--- .../PermissionsDetailDialogFragment.java | 2 +- .../StoragePermissionsDialogFragment.java | 6 ++-- .../mapswithme/maps/review/ReviewAdapter.java | 14 ++++---- .../maps/review/ReviewFragment.java | 2 +- .../BaseRoutingErrorDialogFragment.java | 4 +-- .../maps/routing/NavigationController.java | 34 +++++++++---------- .../routing/RoutingBottomMenuController.java | 20 +++++------ .../routing/RoutingErrorDialogFragment.java | 2 +- .../routing/RoutingMapsDownloadFragment.java | 6 ++-- .../maps/routing/RoutingPlanController.java | 16 ++++----- .../mapswithme/maps/routing/SearchWheel.java | 2 +- .../maps/search/HotelsTypeAdapter.java | 2 +- .../maps/search/PriceFilterView.java | 6 ++-- .../maps/search/SearchHistoryFragment.java | 2 +- .../maps/settings/SettingsPrefsFragment.java | 26 +++++++------- .../maps/settings/StoragePathFragment.java | 4 +-- .../com/mapswithme/maps/taxi/TaxiAdapter.java | 4 +-- .../mapswithme/maps/ugc/UGCController.java | 14 ++++---- .../mapswithme/maps/ugc/UGCRatingAdapter.java | 4 +-- .../maps/ugc/UGCRatingRecordsAdapter.java | 4 +-- .../mapswithme/maps/ugc/UGCReviewAdapter.java | 8 ++--- .../maps/widget/StackedButtonsDialog.java | 10 +++--- .../mapswithme/maps/widget/menu/NavMenu.java | 2 +- .../widget/placepage/DirectionFragment.java | 8 ++--- .../placepage/EditBookmarkFragment.java | 12 +++---- .../placepage/EditDescriptionFragment.java | 6 ++-- .../widget/placepage/FacilitiesAdapter.java | 2 +- .../maps/widget/placepage/GalleryAdapter.java | 2 +- .../maps/widget/placepage/NearbyAdapter.java | 8 ++--- .../widget/placepage/PlacePageButtons.java | 4 +-- .../maps/widget/placepage/ReviewAdapter.java | 10 +++--- 60 files changed, 221 insertions(+), 221 deletions(-) diff --git a/android/src/com/mapswithme/maps/bookmarks/ChooseBookmarkCategoryAdapter.java b/android/src/com/mapswithme/maps/bookmarks/ChooseBookmarkCategoryAdapter.java index dd4d912647..601b3b5942 100644 --- a/android/src/com/mapswithme/maps/bookmarks/ChooseBookmarkCategoryAdapter.java +++ b/android/src/com/mapswithme/maps/bookmarks/ChooseBookmarkCategoryAdapter.java @@ -111,8 +111,8 @@ public class ChooseBookmarkCategoryAdapter extends BaseBookmarkCategoryAdapter SpinnerViewHolder(View convertView) { - icon = (ImageView) convertView.findViewById(R.id.iv__color); + icon = convertView.findViewById(R.id.iv__color); } } diff --git a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java index dab3809dfa..1884668e8b 100644 --- a/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java +++ b/android/src/com/mapswithme/maps/discovery/DiscoveryFragment.java @@ -323,7 +323,7 @@ public class DiscoveryFragment extends BaseMwmToolbarFragment implements Discove UiUtils.hide(view, R.id.galleriesLayout); - PlaceholderView placeholder = (PlaceholderView) view.findViewById(R.id.placeholder); + PlaceholderView placeholder = view.findViewById(R.id.placeholder); placeholder.setContent(R.string.discovery_button_404_error_title, R.string.discovery_button_404_error_message); UiUtils.show(placeholder); diff --git a/android/src/com/mapswithme/maps/downloader/BottomPanel.java b/android/src/com/mapswithme/maps/downloader/BottomPanel.java index b0d06f5129..0cc687a3bd 100644 --- a/android/src/com/mapswithme/maps/downloader/BottomPanel.java +++ b/android/src/com/mapswithme/maps/downloader/BottomPanel.java @@ -55,7 +55,7 @@ class BottomPanel { mFragment = fragment; - mFab = (FloatingActionButton) frame.findViewById(R.id.fab); + mFab = frame.findViewById(R.id.fab); mFab.setOnClickListener(new View.OnClickListener() { @Override @@ -67,7 +67,7 @@ class BottomPanel } }); - mButton = (Button) frame.findViewById(R.id.action); + mButton = frame.findViewById(R.id.action); } private void setUpdateAllState(UpdateInfo info) diff --git a/android/src/com/mapswithme/maps/downloader/CountrySuggestFragment.java b/android/src/com/mapswithme/maps/downloader/CountrySuggestFragment.java index 00bf98d19b..d9d4d47a3a 100644 --- a/android/src/com/mapswithme/maps/downloader/CountrySuggestFragment.java +++ b/android/src/com/mapswithme/maps/downloader/CountrySuggestFragment.java @@ -142,19 +142,19 @@ public class CountrySuggestFragment extends BaseMwmFragment implements View.OnCl private void initViews(View view) { - mLlSelectDownload = (LinearLayout) view.findViewById(R.id.ll__select_download); - mLlActiveDownload = (LinearLayout) view.findViewById(R.id.ll__active_download); - mLlWithLocation = (LinearLayout) view.findViewById(R.id.ll__location_determined); - mLlNoLocation = (LinearLayout) view.findViewById(R.id.ll__location_unknown); - mBtnDownloadMap = (Button) view.findViewById(R.id.btn__download_map); + mLlSelectDownload = view.findViewById(R.id.ll__select_download); + mLlActiveDownload = view.findViewById(R.id.ll__active_download); + mLlWithLocation = view.findViewById(R.id.ll__location_determined); + mLlNoLocation = view.findViewById(R.id.ll__location_unknown); + mBtnDownloadMap = view.findViewById(R.id.btn__download_map); mBtnDownloadMap.setOnClickListener(this); - Button selectMap = (Button)view.findViewById(R.id.btn__select_map); + Button selectMap = view.findViewById(R.id.btn__select_map); selectMap.setOnClickListener(this); - mWpvDownloadProgress = (WheelProgressView) view.findViewById(R.id.wpv__download_progress); + mWpvDownloadProgress = view.findViewById(R.id.wpv__download_progress); mWpvDownloadProgress.setOnClickListener(this); - mTvCountry = (TextView) view.findViewById(R.id.tv__country_name); - mTvActiveCountry = (TextView) view.findViewById(R.id.tv__active_country_name); - mTvProgress = (TextView) view.findViewById(R.id.downloader_progress); + mTvCountry = view.findViewById(R.id.tv__country_name); + mTvActiveCountry = view.findViewById(R.id.tv__active_country_name); + mTvProgress = view.findViewById(R.id.downloader_progress); } private void updateViews() diff --git a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java index 42de9e8768..48f3856270 100644 --- a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java +++ b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java @@ -463,10 +463,10 @@ class DownloaderAdapter extends RecyclerView.Adapter @NonNull public LocalizedStreet getStreet() { - return ((StreetAdapter) getAdapter()).getSelectedStreet(); + return getAdapter().getSelectedStreet(); } protected void saveStreet(LocalizedStreet street) diff --git a/android/src/com/mapswithme/maps/editor/ViralFragment.java b/android/src/com/mapswithme/maps/editor/ViralFragment.java index 811affe47a..eee7bc0260 100644 --- a/android/src/com/mapswithme/maps/editor/ViralFragment.java +++ b/android/src/com/mapswithme/maps/editor/ViralFragment.java @@ -51,7 +51,7 @@ public class ViralFragment extends BaseMwmDialogFragment public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - TextView viralTextView = (TextView) view.findViewById(R.id.viral); + TextView viralTextView = view.findViewById(R.id.viral); Context context = requireContext(); String viralChangesMsg = context.getString(R.string.editor_done_dialog_1); diff --git a/android/src/com/mapswithme/maps/gallery/FullScreenGalleryActivity.java b/android/src/com/mapswithme/maps/gallery/FullScreenGalleryActivity.java index fb0c0149a4..827ef317cd 100644 --- a/android/src/com/mapswithme/maps/gallery/FullScreenGalleryActivity.java +++ b/android/src/com/mapswithme/maps/gallery/FullScreenGalleryActivity.java @@ -67,17 +67,17 @@ public class FullScreenGalleryActivity extends BaseMwmFragmentActivity displayToolbarAsActionBar(); mUserBlock = findViewById(R.id.rl__user_block); - mDescription = (TextView) findViewById(R.id.tv__description); - mUserName = (TextView) findViewById(R.id.tv__name); - mSource = (TextView) findViewById(R.id.tv__source); - mDate = (TextView) findViewById(R.id.tv__date); - mAvatar = (ImageView) findViewById(R.id.iv__avatar); + mDescription = findViewById(R.id.tv__description); + mUserName = findViewById(R.id.tv__name); + mSource = findViewById(R.id.tv__source); + mDate = findViewById(R.id.tv__date); + mAvatar = findViewById(R.id.iv__avatar); readParameters(); if (mImages != null) { mGalleryPageAdapter = new GalleryPageAdapter(getSupportFragmentManager(), mImages); - final ViewPager viewPager = (ViewPager) findViewById(R.id.vp__image); + final ViewPager viewPager = findViewById(R.id.vp__image); viewPager.addOnPageChangeListener(this); viewPager.setAdapter(mGalleryPageAdapter); viewPager.setCurrentItem(mPosition); diff --git a/android/src/com/mapswithme/maps/gallery/FullScreenGalleryFragment.java b/android/src/com/mapswithme/maps/gallery/FullScreenGalleryFragment.java index bd7637cd7e..34520f99c6 100644 --- a/android/src/com/mapswithme/maps/gallery/FullScreenGalleryFragment.java +++ b/android/src/com/mapswithme/maps/gallery/FullScreenGalleryFragment.java @@ -38,7 +38,7 @@ public class FullScreenGalleryFragment extends BaseMwmFragment if (mImage != null) { - ImageView imageView = (ImageView) view.findViewById(R.id.iv__image); + ImageView imageView = view.findViewById(R.id.iv__image); final View progress = view.findViewById(R.id.pb__loading_image); Glide.with(view.getContext()) .load(mImage.getUrl()) diff --git a/android/src/com/mapswithme/maps/gallery/GalleryFragment.java b/android/src/com/mapswithme/maps/gallery/GalleryFragment.java index f643cfd249..86eabbd8d5 100644 --- a/android/src/com/mapswithme/maps/gallery/GalleryFragment.java +++ b/android/src/com/mapswithme/maps/gallery/GalleryFragment.java @@ -40,7 +40,7 @@ public class GalleryFragment extends BaseMwmFragment implements RecyclerClickLis if (mImages != null) { - RecyclerView rvGallery = (RecyclerView) view.findViewById(R.id.rv__gallery); + RecyclerView rvGallery = view.findViewById(R.id.rv__gallery); rvGallery.setLayoutManager(new GridLayoutManager(getContext(), NUM_COLUMNS)); rvGallery.setAdapter(new ImageAdapter(mImages, this)); Drawable divider = ContextCompat.getDrawable(getContext(), R.drawable.divider_transparent_quarter); diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java index ffa7469906..4425a8c7ca 100644 --- a/android/src/com/mapswithme/maps/gallery/Holders.java +++ b/android/src/com/mapswithme/maps/gallery/Holders.java @@ -102,9 +102,9 @@ public class Holders @Nullable ItemSelectedListener listener) { super(itemView, items, listener); - mAvatar = (ImageView) itemView.findViewById(R.id.avatar); - mRating = (RatingView) itemView.findViewById(R.id.ratingView); - mButton = (TextView) itemView.findViewById(R.id.button); + mAvatar = itemView.findViewById(R.id.avatar); + mRating = itemView.findViewById(R.id.ratingView); + mButton = itemView.findViewById(R.id.button); } @Override @@ -362,8 +362,8 @@ public class Holders @Nullable ItemSelectedListener listener) { super(itemView, items, listener); - mProgressBar = (ProgressBar) itemView.findViewById(R.id.pb__progress); - mSubtitle = (TextView) itemView.findViewById(R.id.tv__subtitle); + mProgressBar = itemView.findViewById(R.id.pb__progress); + mSubtitle = itemView.findViewById(R.id.tv__subtitle); } @CallSuper diff --git a/android/src/com/mapswithme/maps/gallery/ImageAdapter.java b/android/src/com/mapswithme/maps/gallery/ImageAdapter.java index 8c91ffbca8..f5fd9cd11c 100644 --- a/android/src/com/mapswithme/maps/gallery/ImageAdapter.java +++ b/android/src/com/mapswithme/maps/gallery/ImageAdapter.java @@ -57,7 +57,7 @@ class ImageAdapter extends RecyclerView.Adapter super(itemView); mListener = listener; itemView.setOnClickListener(this); - mImage = (ImageView) itemView.findViewById(R.id.iv__image); + mImage = itemView.findViewById(R.id.iv__image); } @Override diff --git a/android/src/com/mapswithme/maps/gallery/SingleItemAdapterStrategy.java b/android/src/com/mapswithme/maps/gallery/SingleItemAdapterStrategy.java index f3c8ef29b3..b3c8a16c4b 100644 --- a/android/src/com/mapswithme/maps/gallery/SingleItemAdapterStrategy.java +++ b/android/src/com/mapswithme/maps/gallery/SingleItemAdapterStrategy.java @@ -46,7 +46,7 @@ abstract class SingleItemAdapterStrategy { super(itemView, listener); mDivider = itemView.findViewById(R.id.v__divider); - mUserName = (TextView) itemView.findViewById(R.id.tv__user_name); - mCommentDate = (TextView) itemView.findViewById(R.id.tv__comment_date); - mRating = (TextView) itemView.findViewById(R.id.tv__user_rating); + mUserName = itemView.findViewById(R.id.tv__user_name); + mCommentDate = itemView.findViewById(R.id.tv__comment_date); + mRating = itemView.findViewById(R.id.tv__user_rating); mPositiveReview = itemView.findViewById(R.id.ll__positive_review); - mTvPositiveReview = (TextView) itemView.findViewById(R.id.tv__positive_review); + mTvPositiveReview = itemView.findViewById(R.id.tv__positive_review); mNegativeReview = itemView.findViewById(R.id.ll__negative_review); - mTvNegativeReview = (TextView) itemView.findViewById(R.id.tv__negative_review); + mTvNegativeReview = itemView.findViewById(R.id.tv__negative_review); } @Override @@ -192,8 +192,8 @@ class ReviewAdapter extends RecyclerView.Adapter RatingHolder(View itemView, RecyclerClickListener listener) { super(itemView, listener); - mHotelRating = (TextView) itemView.findViewById(R.id.tv__place_hotel_rating); - mHotelRatingBase = (TextView) itemView.findViewById(R.id.tv__place_hotel_rating_base); + mHotelRating = itemView.findViewById(R.id.tv__place_hotel_rating); + mHotelRatingBase = itemView.findViewById(R.id.tv__place_hotel_rating_base); } public void bind(String rating, int ratingBase) diff --git a/android/src/com/mapswithme/maps/review/ReviewFragment.java b/android/src/com/mapswithme/maps/review/ReviewFragment.java index 5570ba4166..375d16c18e 100644 --- a/android/src/com/mapswithme/maps/review/ReviewFragment.java +++ b/android/src/com/mapswithme/maps/review/ReviewFragment.java @@ -42,7 +42,7 @@ public class ReviewFragment extends BaseMwmFragment implements RecyclerClickList if (mItems != null && mRating != null) { - RecyclerView rvGallery = (RecyclerView) view.findViewById(R.id.rv__review); + RecyclerView rvGallery = view.findViewById(R.id.rv__review); rvGallery.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); rvGallery.setAdapter(new ReviewAdapter(mItems, this, mRating, mRatingBase)); } diff --git a/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java b/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java index 9ce5e4936a..3e78e7afb1 100644 --- a/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java +++ b/android/src/com/mapswithme/maps/routing/BaseRoutingErrorDialogFragment.java @@ -105,7 +105,7 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment final View countryView = View.inflate(getActivity(), R.layout.dialog_missed_map, null); ((TextView) countryView.findViewById(R.id.tv__title)).setText(map.name); - final TextView szView = (TextView) countryView.findViewById(R.id.tv__size); + final TextView szView = countryView.findViewById(R.id.tv__size); szView.setText(StringUtils.getFileSizeString(requireContext(), map.totalSize)); ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) szView.getLayoutParams(); lp.rightMargin = 0; @@ -119,7 +119,7 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment @SuppressLint("InflateParams") final View countriesView = View.inflate(getActivity(), R.layout.dialog_missed_maps, null); - final ExpandableListView listView = (ExpandableListView) countriesView.findViewById(R.id.items_frame); + final ExpandableListView listView = countriesView.findViewById(R.id.items_frame); if (mMissingMaps.isEmpty()) { mCancelRoute = false; diff --git a/android/src/com/mapswithme/maps/routing/NavigationController.java b/android/src/com/mapswithme/maps/routing/NavigationController.java index b1c0f8f134..a41ce133f5 100644 --- a/android/src/com/mapswithme/maps/routing/NavigationController.java +++ b/android/src/com/mapswithme/maps/routing/NavigationController.java @@ -124,15 +124,15 @@ public class NavigationController implements Application.ActivityLifecycleCallba // Top frame View topFrame = mFrame.findViewById(R.id.nav_top_frame); View turnFrame = topFrame.findViewById(R.id.nav_next_turn_frame); - mNextTurnImage = (ImageView) turnFrame.findViewById(R.id.turn); - mNextTurnDistance = (TextView) turnFrame.findViewById(R.id.distance); - mCircleExit = (TextView) turnFrame.findViewById(R.id.circle_exit); + mNextTurnImage = turnFrame.findViewById(R.id.turn); + mNextTurnDistance = turnFrame.findViewById(R.id.distance); + mCircleExit = turnFrame.findViewById(R.id.circle_exit); mNextNextTurnFrame = topFrame.findViewById(R.id.nav_next_next_turn_frame); - mNextNextTurnImage = (ImageView) mNextNextTurnFrame.findViewById(R.id.turn); + mNextNextTurnImage = mNextNextTurnFrame.findViewById(R.id.turn); mStreetFrame = topFrame.findViewById(R.id.street_frame); - mNextStreet = (TextView) mStreetFrame.findViewById(R.id.street); + mNextStreet = mStreetFrame.findViewById(R.id.street); View shadow = topFrame.findViewById(R.id.shadow_top); UiUtils.hide(shadow); @@ -141,23 +141,23 @@ public class NavigationController implements Application.ActivityLifecycleCallba // Bottom frame mSpeedViewContainer = mBottomFrame.findViewById(R.id.speed_view_container); - mSpeedValue = (TextView) mBottomFrame.findViewById(R.id.speed_value); - mSpeedUnits = (TextView) mBottomFrame.findViewById(R.id.speed_dimen); - mTimeHourValue = (TextView) mBottomFrame.findViewById(R.id.time_hour_value); - mTimeHourUnits = (TextView) mBottomFrame.findViewById(R.id.time_hour_dimen); - mTimeMinuteValue = (TextView) mBottomFrame.findViewById(R.id.time_minute_value); - mTimeMinuteUnits = (TextView) mBottomFrame.findViewById(R.id.time_minute_dimen); - mDotTimeArrival = (ImageView) mBottomFrame.findViewById(R.id.dot_estimate); - mDotTimeLeft = (ImageView) mBottomFrame.findViewById(R.id.dot_left); - mDistanceValue = (TextView) mBottomFrame.findViewById(R.id.distance_value); - mDistanceUnits = (TextView) mBottomFrame.findViewById(R.id.distance_dimen); - mRouteProgress = (FlatProgressView) mBottomFrame.findViewById(R.id.navigation_progress); + mSpeedValue = mBottomFrame.findViewById(R.id.speed_value); + mSpeedUnits = mBottomFrame.findViewById(R.id.speed_dimen); + mTimeHourValue = mBottomFrame.findViewById(R.id.time_hour_value); + mTimeHourUnits = mBottomFrame.findViewById(R.id.time_hour_dimen); + mTimeMinuteValue = mBottomFrame.findViewById(R.id.time_minute_value); + mTimeMinuteUnits = mBottomFrame.findViewById(R.id.time_minute_dimen); + mDotTimeArrival = mBottomFrame.findViewById(R.id.dot_estimate); + mDotTimeLeft = mBottomFrame.findViewById(R.id.dot_left); + mDistanceValue = mBottomFrame.findViewById(R.id.distance_value); + mDistanceUnits = mBottomFrame.findViewById(R.id.distance_dimen); + mRouteProgress = mBottomFrame.findViewById(R.id.navigation_progress); mSearchButtonFrame = activity.findViewById(R.id.search_button_frame); mSearchWheel = new SearchWheel(mSearchButtonFrame); mOnboardingBtn = activity.findViewById(R.id.onboarding_btn); - ImageView bookmarkButton = (ImageView) mSearchButtonFrame.findViewById(R.id.btn_bookmarks); + ImageView bookmarkButton = mSearchButtonFrame.findViewById(R.id.btn_bookmarks); bookmarkButton.setImageDrawable(Graphics.tint(bookmarkButton.getContext(), R.drawable.ic_menu_bookmarks)); bookmarkButton.setOnClickListener(this); diff --git a/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java b/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java index 1080dbb64b..443a0a6f5a 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java @@ -140,12 +140,12 @@ final class RoutingBottomMenuController implements View.OnClickListener mAltitudeDifference = altitudeDifference; mNumbersFrame = numbersFrame; mActionFrame = actionFrame; - mActionMessage = (TextView) actionFrame.findViewById(R.id.tv__message); + mActionMessage = actionFrame.findViewById(R.id.tv__message); mActionButton = actionFrame.findViewById(R.id.btn__my_position_use); mActionButton.setOnClickListener(this); View actionSearchButton = actionFrame.findViewById(R.id.btn__search_point); actionSearchButton.setOnClickListener(this); - mActionIcon = (ImageView) mActionButton.findViewById(R.id.iv__icon); + mActionIcon = mActionButton.findViewById(R.id.iv__icon); UiUtils.hide(mAltitudeChartFrame, mTaxiFrame, mActionFrame); mListener = listener; int dividerRes = ThemeUtils.getResource(mContext, R.attr.transitStepDivider); @@ -178,9 +178,9 @@ final class RoutingBottomMenuController implements View.OnClickListener mTaxiInfo = info; mTaxiProduct = products.get(0); final PagerAdapter adapter = new TaxiAdapter(mContext, mTaxiInfo.getType(), products); - DotPager pager = new DotPager.Builder(mContext, (ViewPager) mTaxiFrame.findViewById(R.id.pager), + DotPager pager = new DotPager.Builder(mContext, mTaxiFrame.findViewById(R.id.pager), adapter) - .setIndicatorContainer((ViewGroup) mTaxiFrame.findViewById(R.id.indicator)) + .setIndicatorContainer(mTaxiFrame.findViewById(R.id.indicator)) .setPageChangedListener(new DotPager.OnPageChangedListener() { @Override @@ -201,7 +201,7 @@ final class RoutingBottomMenuController implements View.OnClickListener UiUtils.hide(mError, mAltitudeChartFrame, mActionFrame, mAltitudeChartFrame, mTaxiFrame); showStartButton(false); UiUtils.show(mTransitFrame); - RecyclerView rv = (RecyclerView) mTransitFrame.findViewById(R.id.transit_recycler_view); + RecyclerView rv = mTransitFrame.findViewById(R.id.transit_recycler_view); TransitStepAdapter adapter = new TransitStepAdapter(); rv.setLayoutManager(new MultilineLayoutManager()); rv.setNestedScrollingEnabled(false); @@ -210,12 +210,12 @@ final class RoutingBottomMenuController implements View.OnClickListener rv.setAdapter(adapter); adapter.setItems(info.getTransitSteps()); - TextView totalTimeView = (TextView) mTransitFrame.findViewById(R.id.total_time); - totalTimeView.setText(RoutingController.formatRoutingTime(mContext, (int) info.getTotalTime(), + TextView totalTimeView = mTransitFrame.findViewById(R.id.total_time); + totalTimeView.setText(RoutingController.formatRoutingTime(mContext, info.getTotalTime(), R.dimen.text_size_routing_number)); View dotView = mTransitFrame.findViewById(R.id.dot); View pedestrianIcon = mTransitFrame.findViewById(R.id.pedestrian_icon); - TextView distanceView = (TextView) mTransitFrame.findViewById(R.id.total_distance); + TextView distanceView = mTransitFrame.findViewById(R.id.total_distance); UiUtils.showIf(info.getTotalPedestrianTimeInSec() > 0, dotView, pedestrianIcon, distanceView); distanceView.setText(info.getTotalPedestrianDistance() + " " + info.getTotalPedestrianDistanceUnits()); } @@ -369,10 +369,10 @@ final class RoutingBottomMenuController implements View.OnClickListener } Spanned spanned = makeSpannedRoutingDetails(mContext, rinfo); - TextView numbersTime = (TextView) mNumbersFrame.findViewById(R.id.time); + TextView numbersTime = mNumbersFrame.findViewById(R.id.time); numbersTime.setText(spanned); - TextView numbersArrival = (TextView) mNumbersFrame.findViewById(R.id.arrival); + TextView numbersArrival = mNumbersFrame.findViewById(R.id.arrival); if (numbersArrival != null) { String arrivalTime = RoutingController.formatArrivalTime(rinfo.totalTimeInSeconds); diff --git a/android/src/com/mapswithme/maps/routing/RoutingErrorDialogFragment.java b/android/src/com/mapswithme/maps/routing/RoutingErrorDialogFragment.java index 6a9cf1497c..15f06fc125 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingErrorDialogFragment.java +++ b/android/src/com/mapswithme/maps/routing/RoutingErrorDialogFragment.java @@ -49,7 +49,7 @@ public class RoutingErrorDialogFragment extends BaseRoutingErrorDialogFragment private View addMessage(View frame) { - UiUtils.setTextAndHideIfEmpty((TextView)frame.findViewById(R.id.tv__message), mMessage); + UiUtils.setTextAndHideIfEmpty(frame.findViewById(R.id.tv__message), mMessage); return frame; } diff --git a/android/src/com/mapswithme/maps/routing/RoutingMapsDownloadFragment.java b/android/src/com/mapswithme/maps/routing/RoutingMapsDownloadFragment.java index c6d866793a..5bf7780690 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingMapsDownloadFragment.java +++ b/android/src/com/mapswithme/maps/routing/RoutingMapsDownloadFragment.java @@ -50,7 +50,7 @@ public class RoutingMapsDownloadFragment extends BaseRoutingErrorDialogFragment private View setupFrame(View frame) { UiUtils.hide(frame.findViewById(R.id.tv__message)); - mItemsFrame = (ViewGroup) frame.findViewById(R.id.items_frame); + mItemsFrame = frame.findViewById(R.id.items_frame); return frame; } @@ -77,7 +77,7 @@ public class RoutingMapsDownloadFragment extends BaseRoutingErrorDialogFragment if (frame == null) return null; - WheelProgressView res = (WheelProgressView) frame.findViewById(R.id.wheel_progress); + WheelProgressView res = frame.findViewById(R.id.wheel_progress); return ((res != null && UiUtils.isVisible(res)) ? res : null); } @@ -96,7 +96,7 @@ public class RoutingMapsDownloadFragment extends BaseRoutingErrorDialogFragment @Override void bindGroup(View view) { - WheelProgressView wheel = (WheelProgressView) view.findViewById(R.id.wheel_progress); + WheelProgressView wheel = view.findViewById(R.id.wheel_progress); UiUtils.show(wheel); updateWheel(wheel); } diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java index 91aebcc8dc..fb6b4d742b 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java @@ -70,7 +70,7 @@ public class RoutingPlanController extends ToolbarController button.deactivate(); }; - RoutingToolbarButton rb = (RoutingToolbarButton) mRouterTypes.findViewById(buttonId); + RoutingToolbarButton rb = mRouterTypes.findViewById(buttonId); listener.onCheckedChanged(rb, false); rb.setOnCheckedChangeListener(listener); rb.setOnClickListener(clickListener); @@ -85,15 +85,15 @@ public class RoutingPlanController extends ToolbarController mFrame = root; mRoutingPlanListener = routingPlanListener; - mRouterTypes = (RadioGroup) getToolbar().findViewById(R.id.route_type); + mRouterTypes = getToolbar().findViewById(R.id.route_type); setupRouterButtons(); View progressFrame = getToolbar().findViewById(R.id.progress_frame); - mProgressVehicle = (WheelProgressView) progressFrame.findViewById(R.id.progress_vehicle); - mProgressPedestrian = (WheelProgressView) progressFrame.findViewById(R.id.progress_pedestrian); - mProgressTransit = (WheelProgressView) progressFrame.findViewById(R.id.progress_transit); - mProgressBicycle = (WheelProgressView) progressFrame.findViewById(R.id.progress_bicycle); + mProgressVehicle = progressFrame.findViewById(R.id.progress_vehicle); + mProgressPedestrian = progressFrame.findViewById(R.id.progress_pedestrian); + mProgressTransit = progressFrame.findViewById(R.id.progress_transit); + mProgressBicycle = progressFrame.findViewById(R.id.progress_bicycle); // mProgressTaxi = (WheelProgressView) progressFrame.findViewById(R.id.progress_taxi); mRoutingBottomMenuController = RoutingBottomMenuController.newInstance(requireActivity(), mFrame, listener); @@ -227,7 +227,7 @@ public class RoutingPlanController extends ToolbarController progressView = mProgressBicycle; } - RoutingToolbarButton button = (RoutingToolbarButton)mRouterTypes + RoutingToolbarButton button = mRouterTypes .findViewById(mRouterTypes.getCheckedRadioButtonId()); button.progress(); @@ -293,7 +293,7 @@ public class RoutingPlanController extends ToolbarController { @IdRes int checkedId = mRouterTypes.getCheckedRadioButtonId(); - RoutingToolbarButton rb = (RoutingToolbarButton) mRouterTypes.findViewById(checkedId); + RoutingToolbarButton rb = mRouterTypes.findViewById(checkedId); rb.error(); showError(R.string.dialog_taxi_offline); } diff --git a/android/src/com/mapswithme/maps/routing/SearchWheel.java b/android/src/com/mapswithme/maps/routing/SearchWheel.java index b1439d799d..2f87790b42 100644 --- a/android/src/com/mapswithme/maps/routing/SearchWheel.java +++ b/android/src/com/mapswithme/maps/routing/SearchWheel.java @@ -106,7 +106,7 @@ class SearchWheel implements View.OnClickListener mTouchInterceptor = mFrame.findViewById(R.id.touch_interceptor); mTouchInterceptor.setOnClickListener(this); - mSearchButton = (ImageView) mFrame.findViewById(R.id.btn_search); + mSearchButton = mFrame.findViewById(R.id.btn_search); mSearchButton.setOnClickListener(this); mSearchLayout = mFrame.findViewById(R.id.search_frame); if (UiUtils.isLandscape(mFrame.getContext())) diff --git a/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java b/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java index ca4c1472e3..2eca969fe7 100644 --- a/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java +++ b/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java @@ -90,7 +90,7 @@ class HotelsTypeAdapter extends RecyclerView.Adapter public ViewHolder(View itemView) { super(itemView); - mName = (TextView) itemView.findViewById(R.id.tv__name); - mBar = (RatingBar) itemView.findViewById(R.id.rb__rate); + mName = itemView.findViewById(R.id.tv__name); + mBar = itemView.findViewById(R.id.rb__rate); mBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() { @Override diff --git a/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java b/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java index 81e1b89936..02dfb5d275 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java +++ b/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java @@ -56,8 +56,8 @@ class UGCRatingRecordsAdapter extends RecyclerView.Adapter public ViewHolder(View itemView) { super(itemView); - mAuthor = (TextView) itemView.findViewById(R.id.name); - mCommentDate = (TextView) itemView.findViewById(R.id.date); - mReview = (TextView) itemView.findViewById(R.id.review); - mRating = (RatingView) itemView.findViewById(R.id.rating); + mAuthor = itemView.findViewById(R.id.name); + mCommentDate = itemView.findViewById(R.id.date); + mReview = itemView.findViewById(R.id.review); + mRating = itemView.findViewById(R.id.rating); // TODO: remove "gone" visibility when review rating behaviour is fixed on the server. mRating.setVisibility(View.GONE); } diff --git a/android/src/com/mapswithme/maps/widget/StackedButtonsDialog.java b/android/src/com/mapswithme/maps/widget/StackedButtonsDialog.java index 7e31839555..0980d99be1 100644 --- a/android/src/com/mapswithme/maps/widget/StackedButtonsDialog.java +++ b/android/src/com/mapswithme/maps/widget/StackedButtonsDialog.java @@ -63,17 +63,17 @@ public class StackedButtonsDialog extends AppCompatDialog implements View.OnClic setOnCancelListener(mCancelListener); setContentView(R.layout.dialog_stacked_buttons); - TextView title = (TextView) findViewById(R.id.tv__title); + TextView title = findViewById(R.id.tv__title); UiUtils.setTextAndHideIfEmpty(title, mTitle); - TextView message = (TextView) findViewById(R.id.tv__message); + TextView message = findViewById(R.id.tv__message); UiUtils.setTextAndHideIfEmpty(message, mMessage); - TextView positive = (TextView) findViewById(R.id.btn__positive); + TextView positive = findViewById(R.id.btn__positive); positive.setOnClickListener(this); UiUtils.setTextAndHideIfEmpty(positive, mPositive); - TextView neutral = (TextView) findViewById(R.id.btn__neutral); + TextView neutral = findViewById(R.id.btn__neutral); neutral.setOnClickListener(this); UiUtils.setTextAndHideIfEmpty(neutral, mNeutral); - TextView negative = (TextView) findViewById(R.id.btn__negative); + TextView negative = findViewById(R.id.btn__negative); negative.setOnClickListener(this); UiUtils.setTextAndHideIfEmpty(negative, mNegative); } diff --git a/android/src/com/mapswithme/maps/widget/menu/NavMenu.java b/android/src/com/mapswithme/maps/widget/menu/NavMenu.java index eb6d2e2288..39307ec4fd 100644 --- a/android/src/com/mapswithme/maps/widget/menu/NavMenu.java +++ b/android/src/com/mapswithme/maps/widget/menu/NavMenu.java @@ -83,7 +83,7 @@ public class NavMenu extends BaseMenu .getResources().getInteger(R.integer.anim_menu); mContentFrame = mFrame.findViewById(R.id.content_frame); mToggleImage = new RotateDrawable(Graphics.tint(mFrame.getContext(), R.drawable.ic_menu_close, R.attr.iconTintLight)); - ImageView toggle = (ImageView) mLineFrame.findViewById(R.id.toggle); + ImageView toggle = mLineFrame.findViewById(R.id.toggle); toggle.setImageDrawable(mToggleImage); setToggleState(false, false); diff --git a/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java b/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java index 07cb92bd09..88b5b03e6a 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java +++ b/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java @@ -62,10 +62,10 @@ public class DirectionFragment extends BaseMwmDialogFragment private void initViews(View root) { - mAvDirection = (ArrowView) root.findViewById(R.id.av__direction); - mTvTitle = (TextView) root.findViewById(R.id.tv__title); - mTvSubtitle = (TextView) root.findViewById(R.id.tv__subtitle); - mTvDistance = (TextView) root.findViewById(R.id.tv__straight_distance); + mAvDirection = root.findViewById(R.id.av__direction); + mTvTitle = root.findViewById(R.id.tv__title); + mTvSubtitle = root.findViewById(R.id.tv__subtitle); + mTvDistance = root.findViewById(R.id.tv__straight_distance); UiUtils.waitLayout(mTvTitle, new ViewTreeObserver.OnGlobalLayoutListener() { @Override diff --git a/android/src/com/mapswithme/maps/widget/placepage/EditBookmarkFragment.java b/android/src/com/mapswithme/maps/widget/placepage/EditBookmarkFragment.java index 33a1e99e2c..48e0b8e868 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/EditBookmarkFragment.java +++ b/android/src/com/mapswithme/maps/widget/placepage/EditBookmarkFragment.java @@ -90,11 +90,11 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View. mBookmark = BookmarkManager.INSTANCE.getBookmarkInfo(bookmarkId); if (mBookmark != null) mIcon = mBookmark.getIcon(); - mEtName = (EditText) view.findViewById(R.id.et__bookmark_name); - mEtDescription = (EditText) view.findViewById(R.id.et__description); - mTvBookmarkGroup = (TextView) view.findViewById(R.id.tv__bookmark_set); + mEtName = view.findViewById(R.id.et__bookmark_name); + mEtDescription = view.findViewById(R.id.et__description); + mTvBookmarkGroup = view.findViewById(R.id.tv__bookmark_set); mTvBookmarkGroup.setOnClickListener(this); - mIvColor = (ImageView) view.findViewById(R.id.iv__bookmark_color); + mIvColor = view.findViewById(R.id.iv__bookmark_color); mIvColor.setOnClickListener(this); refreshBookmark(); initToolbar(view); @@ -102,9 +102,9 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View. private void initToolbar(View view) { - Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); + Toolbar toolbar = view.findViewById(R.id.toolbar); UiUtils.extendViewWithStatusBar(toolbar); - final TextView textView = (TextView) toolbar.findViewById(R.id.tv__save); + final TextView textView = toolbar.findViewById(R.id.tv__save); textView.setOnClickListener(new View.OnClickListener() { @Override diff --git a/android/src/com/mapswithme/maps/widget/placepage/EditDescriptionFragment.java b/android/src/com/mapswithme/maps/widget/placepage/EditDescriptionFragment.java index ccfbe65ca6..072f889a78 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/EditDescriptionFragment.java +++ b/android/src/com/mapswithme/maps/widget/placepage/EditDescriptionFragment.java @@ -64,7 +64,7 @@ public class EditDescriptionFragment extends BaseMwmDialogFragment description = Html.fromHtml(description).toString(); } - mEtDescription = (EditText) view.findViewById(R.id.et__description); + mEtDescription = view.findViewById(R.id.et__description); mEtDescription.setText(description); initToolbar(view); @@ -79,9 +79,9 @@ public class EditDescriptionFragment extends BaseMwmDialogFragment private void initToolbar(View view) { - Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); + Toolbar toolbar = view.findViewById(R.id.toolbar); UiUtils.extendViewWithStatusBar(toolbar); - final TextView textView = (TextView) toolbar.findViewById(R.id.tv__save); + final TextView textView = toolbar.findViewById(R.id.tv__save); textView.setOnClickListener(new View.OnClickListener() { @Override diff --git a/android/src/com/mapswithme/maps/widget/placepage/FacilitiesAdapter.java b/android/src/com/mapswithme/maps/widget/placepage/FacilitiesAdapter.java index 7bd0d36d2c..7e9e0242db 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/FacilitiesAdapter.java +++ b/android/src/com/mapswithme/maps/widget/placepage/FacilitiesAdapter.java @@ -77,7 +77,7 @@ class FacilitiesAdapter extends RecyclerView.Adapter { super(itemView); mListener = listener; - mImage = (ImageView) itemView.findViewById(R.id.iv__image); + mImage = itemView.findViewById(R.id.iv__image); mMore = itemView.findViewById(R.id.tv__more); itemView.setOnClickListener(this); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/NearbyAdapter.java b/android/src/com/mapswithme/maps/widget/placepage/NearbyAdapter.java index 1a98afa748..1120dee574 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/NearbyAdapter.java +++ b/android/src/com/mapswithme/maps/widget/placepage/NearbyAdapter.java @@ -95,10 +95,10 @@ class NearbyAdapter extends BaseAdapter public ViewHolder(View view, @Nullable OnItemClickListener listener) { mListener = listener; - mIcon = (ImageView) view.findViewById(R.id.iv__icon); - mTitle = (TextView) view.findViewById(R.id.tv__title); - mType = (TextView) view.findViewById(R.id.tv__type); - mDistance = (TextView) view.findViewById(R.id.tv__distance); + mIcon = view.findViewById(R.id.iv__icon); + mTitle = view.findViewById(R.id.tv__title); + mType = view.findViewById(R.id.tv__type); + mDistance = view.findViewById(R.id.tv__distance); view.setOnClickListener(this); } diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java index 78e5cda811..785eff9d84 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageButtons.java @@ -518,8 +518,8 @@ public final class PlacePageButtons LayoutInflater inflater = LayoutInflater.from(context); View parent = inflater.inflate(R.layout.place_page_button, mFrame, false); - ImageView icon = (ImageView) parent.findViewById(R.id.icon); - TextView title = (TextView) parent.findViewById(R.id.title); + ImageView icon = parent.findViewById(R.id.icon); + TextView title = parent.findViewById(R.id.title); title.setText(current.getTitle()); icon.setImageResource(current.getIcon().getEnabledStateResId(context)); diff --git a/android/src/com/mapswithme/maps/widget/placepage/ReviewAdapter.java b/android/src/com/mapswithme/maps/widget/placepage/ReviewAdapter.java index a8ddb7d6d9..822bd18148 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/ReviewAdapter.java +++ b/android/src/com/mapswithme/maps/widget/placepage/ReviewAdapter.java @@ -78,13 +78,13 @@ class ReviewAdapter extends RecyclerView.Adapter { super(view); mDivider = view.findViewById(R.id.v__divider); - mUserName = (TextView) view.findViewById(R.id.tv__user_name); - mCommentDate = (TextView) view.findViewById(R.id.tv__comment_date); - mRating = (TextView) view.findViewById(R.id.tv__user_rating); + mUserName = view.findViewById(R.id.tv__user_name); + mCommentDate = view.findViewById(R.id.tv__comment_date); + mRating = view.findViewById(R.id.tv__user_rating); mPositiveReview = view.findViewById(R.id.ll__positive_review); - mTvPositiveReview = (TextView) view.findViewById(R.id.tv__positive_review); + mTvPositiveReview = view.findViewById(R.id.tv__positive_review); mNegativeReview = view.findViewById(R.id.ll__negative_review); - mTvNegativeReview = (TextView) view.findViewById(R.id.tv__negative_review); + mTvNegativeReview = view.findViewById(R.id.tv__negative_review); } public void bind(Review item, boolean isShowDivider)