diff --git a/android/build.gradle b/android/build.gradle index 0b685fa92d..b19eca23ab 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } - ext.googleServiceEnabled = file('google-services.json').exists(); + ext.googleServiceEnabled = file('google-services.json').exists() if (googleServiceEnabled) { println("Building with Google Services") } else { @@ -154,7 +154,7 @@ configurations.all { force "androidx.versionedparcelable:versionedparcelable:1.1.0" force "androidx.recyclerview:recyclerview:1.2.0-alpha02" - failOnVersionConflict(); + failOnVersionConflict() } } @@ -240,8 +240,8 @@ android { flavorDimensions "default" productFlavors { - final int HUAWEI_VERSION_CODE_BASE = 20000; - final int TENCENT_VERSION_CODE_BASE = 10000; + final int HUAWEI_VERSION_CODE_BASE = 20000 + final int TENCENT_VERSION_CODE_BASE = 10000 google { dimension "default" @@ -384,7 +384,7 @@ android { } splits.abi { - boolean enabled = project.hasProperty('splitApk'); + boolean enabled = project.hasProperty('splitApk') println ("Create separate apks: " + enabled) enable enabled reset() @@ -570,7 +570,7 @@ def createObbGenerateTask(type, data, name) { def createObbAlignTask(type, rawObb, alignedObb) { def sdkDir = "${android.getSdkDirectory().getAbsolutePath()}" def zipalignPath = sdkDir + File.separator + "build-tools" + File.separator + - propBuildToolsVersion + File.separator + "zipalign"; + propBuildToolsVersion + File.separator + "zipalign" return tasks.create(name: "obb${type}Align", dependsOn: "obb${type}Generate", type: Exec, description: 'Align obb files') { commandLine zipalignPath, '-v', '8', rawObb, alignedObb @@ -591,7 +591,7 @@ task obbPush(dependsOn: ['obbGenerate', 'obbPushMain', 'obbPushPatch']) { } android.buildTypes.all { buildType -> - def suffix = applicationIdSuffix != null ? applicationIdSuffix : ""; + def suffix = applicationIdSuffix != null ? applicationIdSuffix : "" def authorityValue = android.defaultConfig.applicationId + suffix + ".provider" def authority = "\"" + authorityValue + "\"" buildConfigField 'String', 'FILE_PROVIDER_AUTHORITY', authority diff --git a/android/gradle.properties b/android/gradle.properties index 76df4c5bc9..1ab8c6a7e0 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -9,17 +9,17 @@ propReleaseNdkFlags=V=1 NDK_DEBUG=0 PRODUCTION=1 propMultiDexVersion=2.0.1 # list of files for obb-s -propObbFonts ../data/01_dejavusans.ttf \ +propObbFonts=../data/01_dejavusans.ttf \ ../data/02_droidsans-fallback.ttf \ ../data/03_jomolhari-id-a3d.ttf \ ../data/04_padauk.ttf \ ../data/05_khmeros.ttf \ ../data/06_code2000.ttf \ ../data/07_roboto_medium.ttf -propObbWorlds ../data/World.mwm \ +propObbWorlds=../data/World.mwm \ ../data/WorldCoasts.mwm -propObbWorldsOutput build/worlds.obb -propObbFontsOutput build/fonts.obb +propObbWorldsOutput=build/worlds.obb +propObbFontsOutput=build/fonts.obb org.gradle.parallel=true org.gradle.caching=true diff --git a/android/src/com/mapswithme/maps/NavigationButtonsAnimationController.java b/android/src/com/mapswithme/maps/NavigationButtonsAnimationController.java index d865394abe..ef083390ad 100644 --- a/android/src/com/mapswithme/maps/NavigationButtonsAnimationController.java +++ b/android/src/com/mapswithme/maps/NavigationButtonsAnimationController.java @@ -34,7 +34,7 @@ class NavigationButtonsAnimationController private float mTopLimit; private float mBottomLimit; - private float mCompassHeight; + private final float mCompassHeight; NavigationButtonsAnimationController(@NonNull View zoomIn, @NonNull View zoomOut, @NonNull View myPosition, @NonNull final View contentView, diff --git a/android/src/com/mapswithme/maps/SplashActivity.java b/android/src/com/mapswithme/maps/SplashActivity.java index 115dfb11dc..e5952f9051 100644 --- a/android/src/com/mapswithme/maps/SplashActivity.java +++ b/android/src/com/mapswithme/maps/SplashActivity.java @@ -64,7 +64,7 @@ public class SplashActivity extends AppCompatActivity }; @NonNull - private Runnable mOnboardingStepsTask = new Runnable() + private final Runnable mOnboardingStepsTask = new Runnable() { @Override public void run() diff --git a/android/src/com/mapswithme/maps/VideoTimer.java b/android/src/com/mapswithme/maps/VideoTimer.java index 535e0d7055..18130858c8 100644 --- a/android/src/com/mapswithme/maps/VideoTimer.java +++ b/android/src/com/mapswithme/maps/VideoTimer.java @@ -6,7 +6,7 @@ import java.util.TimerTask; public class VideoTimer { - private static String TAG = "VideoTimer"; + private static final String TAG = "VideoTimer"; Timer m_timer; diff --git a/android/src/com/mapswithme/maps/background/NotificationService.java b/android/src/com/mapswithme/maps/background/NotificationService.java index 8e4edae097..319d5db933 100644 --- a/android/src/com/mapswithme/maps/background/NotificationService.java +++ b/android/src/com/mapswithme/maps/background/NotificationService.java @@ -89,7 +89,7 @@ public class NotificationService extends JobIntentService return; } - final NotificationExecutor notifyOrder[] = + final NotificationExecutor[] notifyOrder = { this::notifyIsNotAuthenticated, this::notifySmart diff --git a/android/src/com/mapswithme/maps/bookmarks/BaseBookmarkCategoriesFragment.java b/android/src/com/mapswithme/maps/bookmarks/BaseBookmarkCategoriesFragment.java index 85fbbb722a..23e19545f7 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BaseBookmarkCategoriesFragment.java +++ b/android/src/com/mapswithme/maps/bookmarks/BaseBookmarkCategoriesFragment.java @@ -393,7 +393,7 @@ public abstract class BaseBookmarkCategoriesFragment extends BaseMwmRecyclerFrag @IdRes private final int mId; @NonNull - private MenuClickProcessorBase mInternalProcessor; + private final MenuClickProcessorBase mInternalProcessor; MenuItemClickProcessorWrapper(@IdRes int id, @NonNull MenuClickProcessorBase processorBase) { diff --git a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java index 7a07a25532..11f2b6553a 100644 --- a/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java +++ b/android/src/com/mapswithme/maps/bookmarks/BookmarkListAdapter.java @@ -226,7 +226,7 @@ public class BookmarkListAdapter extends RecyclerView.Adapter mSortedBlocks; + private final List mSortedBlocks; SortedSectionsDataSource(@NonNull DataSource dataSource, @NonNull List sortedBlocks) diff --git a/android/src/com/mapswithme/maps/bookmarks/CatalogListenerDecorator.java b/android/src/com/mapswithme/maps/bookmarks/CatalogListenerDecorator.java index f0718b247a..e7a428bb99 100644 --- a/android/src/com/mapswithme/maps/bookmarks/CatalogListenerDecorator.java +++ b/android/src/com/mapswithme/maps/bookmarks/CatalogListenerDecorator.java @@ -13,9 +13,9 @@ import com.mapswithme.maps.dialog.DialogUtils; class CatalogListenerDecorator extends BookmarkManager.DefaultBookmarksCatalogListener { @NonNull - private Fragment mFragment; + private final Fragment mFragment; @Nullable - private BookmarkManager.BookmarksCatalogListener mWrapped; + private final BookmarkManager.BookmarksCatalogListener mWrapped; CatalogListenerDecorator(@NonNull Fragment fragment) { diff --git a/android/src/com/mapswithme/maps/bookmarks/Holders.java b/android/src/com/mapswithme/maps/bookmarks/Holders.java index 25b46afdad..75b6de2b89 100644 --- a/android/src/com/mapswithme/maps/bookmarks/Holders.java +++ b/android/src/com/mapswithme/maps/bookmarks/Holders.java @@ -61,9 +61,9 @@ public class Holders public static class HeaderViewHolder extends RecyclerView.ViewHolder { @NonNull - private TextView mButton; + private final TextView mButton; @NonNull - private TextView mText; + private final TextView mText; HeaderViewHolder(@NonNull View itemView) @@ -374,7 +374,7 @@ public class Holders @NonNull private final TextView mDistance; @NonNull - private View mMore; + private final View mMore; BookmarkViewHolder(@NonNull View itemView) { diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java index 22ae34640e..f561fb943e 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/Bookmark.java @@ -22,9 +22,9 @@ public class Bookmark extends MapObject { private Icon mIcon; private long mCategoryId; - private long mBookmarkId; - private double mMerX; - private double mMerY; + private final long mBookmarkId; + private final double mMerX; + private final double mMerY; public Bookmark(@NonNull FeatureId featureId, @IntRange(from = 0) long categoryId, @IntRange(from = 0) long bookmarkId, String title, @Nullable String secondaryTitle, diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java index 7340787312..70905eabe8 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java @@ -1468,7 +1468,7 @@ public enum BookmarkManager UPLOAD_RESULT_MALFORMED_DATA_ERROR, /* Edit on web */ UPLOAD_RESULT_ACCESS_ERROR, - UPLOAD_RESULT_INVALID_CALL; + UPLOAD_RESULT_INVALID_CALL } static class BookmarkCategoriesCache extends Observable diff --git a/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java b/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java index 6f2a84113b..4b87715638 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/DistanceAndAzimut.java @@ -2,8 +2,8 @@ package com.mapswithme.maps.bookmarks.data; public class DistanceAndAzimut { - private String mDistance; - private double mAzimuth; + private final String mDistance; + private final double mAzimuth; public String getDistance() { diff --git a/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java b/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java index 22c2614b4d..4d894e1126 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/FeatureId.java @@ -36,7 +36,7 @@ public class FeatureId implements Parcelable if (TextUtils.isEmpty(id)) throw new AssertionError("Feature id string is empty"); - String parts[] = id.split(":"); + String[] parts = id.split(":"); if (parts.length != 3) throw new AssertionError("Wrong feature id string format"); diff --git a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java index 2a3c2a3bb4..a37d99e249 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/MapObject.java @@ -45,7 +45,7 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider, Wikipedia, Flats, BuildingLevels, - Level; + Level } @Retention(RetentionPolicy.SOURCE) @@ -76,23 +76,23 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider, private String mTitle; @Nullable - private String mSecondaryTitle; + private final String mSecondaryTitle; private String mSubtitle; private double mLat; private double mLon; - private String mAddress; - private Metadata mMetadata; - private String mApiId; + private final String mAddress; + private final Metadata mMetadata; + private final String mApiId; @Nullable private List mBanners; @Nullable private List mReachableByTaxiTypes; @Nullable - private String mBookingSearchUrl; + private final String mBookingSearchUrl; @Nullable - private LocalAdInfo mLocalAdInfo; + private final LocalAdInfo mLocalAdInfo; @Nullable - private RoutePointInfo mRoutePointInfo; + private final RoutePointInfo mRoutePointInfo; @OpeningMode private final int mOpeningMode; private final boolean mShouldShowUGC; @@ -107,12 +107,12 @@ public class MapObject implements PopularityProvider, ShareableInfoProvider, @Nullable private ArrayList mRatings; @Nullable - private HotelsFilter.HotelType mHotelType; + private final HotelsFilter.HotelType mHotelType; @PriceFilterView.PriceDef private final int mPriceRate; @Nullable private List mRawTypes; - private boolean mIsTopChoice; + private final boolean mIsTopChoice; public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType, String title, @Nullable String secondaryTitle, String subtitle, String address, diff --git a/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePoint.java b/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePoint.java index 8f5c0c0bee..2a6edfc26b 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePoint.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/ParcelablePoint.java @@ -6,7 +6,7 @@ import android.os.Parcelable; public class ParcelablePoint implements Parcelable { - private Point mInternalPoint; + private final Point mInternalPoint; public Point getPoint() { diff --git a/android/src/com/mapswithme/maps/bookmarks/data/RoadWarningMarkType.java b/android/src/com/mapswithme/maps/bookmarks/data/RoadWarningMarkType.java index a196f79a48..eaea9fa40c 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/RoadWarningMarkType.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/RoadWarningMarkType.java @@ -5,5 +5,5 @@ public enum RoadWarningMarkType TOLL, FERRY, DIRTY, - UNKNOWN; + UNKNOWN } diff --git a/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java b/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java index 7bcd4ccf8e..cb51e97ddb 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/SortedBlock.java @@ -11,9 +11,9 @@ public class SortedBlock @NonNull private final String mName; @NonNull - private List mBookmarkIds; + private final List mBookmarkIds; @NonNull - private List mTrackIds; + private final List mTrackIds; public SortedBlock(@NonNull String name, @NonNull Long[] bookmarkIds, @NonNull Long[] trackIds) diff --git a/android/src/com/mapswithme/maps/downloader/ChunkTask.java b/android/src/com/mapswithme/maps/downloader/ChunkTask.java index 0cef0ebd6f..8c3637446a 100644 --- a/android/src/com/mapswithme/maps/downloader/ChunkTask.java +++ b/android/src/com/mapswithme/maps/downloader/ChunkTask.java @@ -240,7 +240,7 @@ class ChunkTask extends AsyncTask { // Because of timeouts in InputStream.read (for bad connection), // try to introduce dynamic buffer size to read in one query. - final int arrSize[] = {64, 32, 1}; + final int[] arrSize = {64, 32, 1}; int ret = IO_EXCEPTION; for (int size : arrSize) diff --git a/android/src/com/mapswithme/maps/editor/CuisineAdapter.java b/android/src/com/mapswithme/maps/editor/CuisineAdapter.java index b0f856586c..c6a0051e74 100644 --- a/android/src/com/mapswithme/maps/editor/CuisineAdapter.java +++ b/android/src/com/mapswithme/maps/editor/CuisineAdapter.java @@ -38,8 +38,8 @@ public class CuisineAdapter extends RecyclerView.Adapter mItems = new ArrayList<>(); - private Set mSelectedKeys = new HashSet<>(); + private final List mItems = new ArrayList<>(); + private final Set mSelectedKeys = new HashSet<>(); private String mFilter; public CuisineAdapter() diff --git a/android/src/com/mapswithme/maps/editor/FeatureCategoryAdapter.java b/android/src/com/mapswithme/maps/editor/FeatureCategoryAdapter.java index c124dea07e..9e0d46c67f 100644 --- a/android/src/com/mapswithme/maps/editor/FeatureCategoryAdapter.java +++ b/android/src/com/mapswithme/maps/editor/FeatureCategoryAdapter.java @@ -16,7 +16,7 @@ public class FeatureCategoryAdapter extends RecyclerView.Adapter { private final List mNames; - private int mMandatoryNamesCount; + private final int mMandatoryNamesCount; private boolean mAdditionalLanguagesShown; MultilanguageAdapter(EditorHostFragment hostFragment) diff --git a/android/src/com/mapswithme/maps/editor/SimpleTimetableAdapter.java b/android/src/com/mapswithme/maps/editor/SimpleTimetableAdapter.java index 6b474aa48c..e948ff2ba9 100644 --- a/android/src/com/mapswithme/maps/editor/SimpleTimetableAdapter.java +++ b/android/src/com/mapswithme/maps/editor/SimpleTimetableAdapter.java @@ -149,7 +149,7 @@ class SimpleTimetableAdapter extends RecyclerView.Adapter(Arrays.asList(OpeningHours.nativeAddWorkingDay(tts, position, day))); refreshComplement(); notifyDataSetChanged(); @@ -157,7 +157,7 @@ class SimpleTimetableAdapter extends RecyclerView.Adapter(Arrays.asList(OpeningHours.nativeRemoveWorkingDay(tts, position, day))); refreshComplement(); notifyDataSetChanged(); @@ -193,7 +193,7 @@ class SimpleTimetableAdapter extends RecyclerView.Adapter static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - private ImageView mImage; + private final ImageView mImage; private final RecyclerClickListener mListener; private int mPosition; diff --git a/android/src/com/mapswithme/maps/intent/Factory.java b/android/src/com/mapswithme/maps/intent/Factory.java index 2603353d16..ac2f3cbacd 100644 --- a/android/src/com/mapswithme/maps/intent/Factory.java +++ b/android/src/com/mapswithme/maps/intent/Factory.java @@ -619,7 +619,7 @@ public class Factory output = new FileOutputStream(tmpFile); input = resolver.openInputStream(mData); - final byte buffer[] = new byte[Constants.MB / 2]; + final byte[] buffer = new byte[Constants.MB / 2]; int read; while ((read = input.read(buffer)) != -1) output.write(buffer, 0, read); diff --git a/android/src/com/mapswithme/maps/location/SensorHelper.java b/android/src/com/mapswithme/maps/location/SensorHelper.java index 0b69a39fe4..e6efdfe7d9 100644 --- a/android/src/com/mapswithme/maps/location/SensorHelper.java +++ b/android/src/com/mapswithme/maps/location/SensorHelper.java @@ -18,7 +18,7 @@ class SensorHelper implements SensorEventListener private Sensor mRotation; @SuppressWarnings("NotNullFieldNotInitialized") @NonNull - private MwmApplication mMwmApplication; + private final MwmApplication mMwmApplication; @Override public void onSensorChanged(SensorEvent event) diff --git a/android/src/com/mapswithme/maps/onboarding/NewsFragment.java b/android/src/com/mapswithme/maps/onboarding/NewsFragment.java index a8b2208f79..154c6f0270 100644 --- a/android/src/com/mapswithme/maps/onboarding/NewsFragment.java +++ b/android/src/com/mapswithme/maps/onboarding/NewsFragment.java @@ -163,7 +163,7 @@ public class NewsFragment extends BaseNewsFragment implements AlertDialogCallbac if (length == 0) return ""; - StringBuilder sb = new StringBuilder(""); + StringBuilder sb = new StringBuilder(); for (String key : keys) sb.append(key); diff --git a/android/src/com/mapswithme/maps/onboarding/OnboardingTip.java b/android/src/com/mapswithme/maps/onboarding/OnboardingTip.java index fc3fe08098..92e19095b1 100644 --- a/android/src/com/mapswithme/maps/onboarding/OnboardingTip.java +++ b/android/src/com/mapswithme/maps/onboarding/OnboardingTip.java @@ -36,9 +36,9 @@ public class OnboardingTip implements Parcelable @interface ScreenType {} @ScreenType - private int mType; + private final int mType; @NonNull - private String mUrl; + private final String mUrl; @SuppressWarnings("unused") OnboardingTip(@ScreenType int type, @NonNull String url) diff --git a/android/src/com/mapswithme/maps/promo/CatalogPromoController.java b/android/src/com/mapswithme/maps/promo/CatalogPromoController.java index ab5597fa30..2335a667f9 100644 --- a/android/src/com/mapswithme/maps/promo/CatalogPromoController.java +++ b/android/src/com/mapswithme/maps/promo/CatalogPromoController.java @@ -34,9 +34,9 @@ public class CatalogPromoController implements Promo.Listener, Detachable mActivationCallbacks = new ArrayList<>(); + private final List mActivationCallbacks = new ArrayList<>(); @SuppressWarnings("NullableProblems") @NonNull private View mYearlyButton; diff --git a/android/src/com/mapswithme/maps/purchase/BookmarkPaymentState.java b/android/src/com/mapswithme/maps/purchase/BookmarkPaymentState.java index a40c4e0c3e..c973b4f7e8 100644 --- a/android/src/com/mapswithme/maps/purchase/BookmarkPaymentState.java +++ b/android/src/com/mapswithme/maps/purchase/BookmarkPaymentState.java @@ -124,7 +124,7 @@ enum BookmarkPaymentState UiUtils.hide(fragment.getViewOrThrow(), R.id.subs_progress); fragment.updateSubsProductDetails(); } - };; + }; private static void showProgress(@NonNull BookmarkPaymentFragment fragment) { diff --git a/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java b/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java index c5558a0f38..1080dbb64b 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingBottomMenuController.java @@ -89,7 +89,7 @@ final class RoutingBottomMenuController implements View.OnClickListener private TaxiInfo.Product mTaxiProduct; @Nullable - private RoutingBottomMenuListener mListener; + private final RoutingBottomMenuListener mListener; @NonNull static RoutingBottomMenuController newInstance(@NonNull Activity activity, @NonNull View frame, diff --git a/android/src/com/mapswithme/maps/routing/SearchWheel.java b/android/src/com/mapswithme/maps/routing/SearchWheel.java index 1bf2379fdc..b1439d799d 100644 --- a/android/src/com/mapswithme/maps/routing/SearchWheel.java +++ b/android/src/com/mapswithme/maps/routing/SearchWheel.java @@ -37,7 +37,7 @@ class SearchWheel implements View.OnClickListener private SearchOption mCurrentOption; private static final long CLOSE_DELAY_MILLIS = 5000L; - private Runnable mCloseRunnable = new Runnable() { + private final Runnable mCloseRunnable = new Runnable() { @Override public void run() { @@ -58,13 +58,13 @@ class SearchWheel implements View.OnClickListener ATM(R.id.search_atm, R.drawable.ic_routing_atm_off, R.drawable.ic_routing_atm_on, R.string.atm); @IdRes - private int mResId; + private final int mResId; @DrawableRes - private int mDrawableOff; + private final int mDrawableOff; @DrawableRes - private int mDrawableOn; + private final int mDrawableOn; @StringRes - private int mQueryId; + private final int mQueryId; SearchOption(@IdRes int resId, @DrawableRes int drawableOff, @DrawableRes int drawableOn, @StringRes int queryId) diff --git a/android/src/com/mapswithme/maps/routing/TransitStepAdapter.java b/android/src/com/mapswithme/maps/routing/TransitStepAdapter.java index 4ace915a53..ecf139d2e9 100644 --- a/android/src/com/mapswithme/maps/routing/TransitStepAdapter.java +++ b/android/src/com/mapswithme/maps/routing/TransitStepAdapter.java @@ -14,7 +14,7 @@ import java.util.List; public class TransitStepAdapter extends RecyclerView.Adapter { @NonNull - private List mItems = new ArrayList<>(); + private final List mItems = new ArrayList<>(); @Override public TransitStepViewHolder onCreateViewHolder(ViewGroup parent, int viewType) @@ -45,7 +45,7 @@ public class TransitStepAdapter extends RecyclerView.AdapterfindViewById(R.id.price); + mPrice = root.findViewById(R.id.price); View content = root.findViewById(R.id.content); RecyclerView type = content.findViewById(R.id.type); type.setLayoutManager(new TagLayoutManager()); diff --git a/android/src/com/mapswithme/maps/search/FloatingSearchToolbarController.java b/android/src/com/mapswithme/maps/search/FloatingSearchToolbarController.java index 4256428902..ca72585366 100644 --- a/android/src/com/mapswithme/maps/search/FloatingSearchToolbarController.java +++ b/android/src/com/mapswithme/maps/search/FloatingSearchToolbarController.java @@ -13,7 +13,7 @@ public class FloatingSearchToolbarController extends SearchToolbarController @Nullable private VisibilityListener mVisibilityListener; @Nullable - private SearchToolbarListener mListener; + private final SearchToolbarListener mListener; public interface VisibilityListener { diff --git a/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java b/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java index f8088d255f..ca4c1472e3 100644 --- a/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java +++ b/android/src/com/mapswithme/maps/search/HotelsTypeAdapter.java @@ -80,7 +80,7 @@ class HotelsTypeAdapter extends RecyclerView.Adapter mItems; @Nullable - private OnTypeSelectedListener mListener; + private final OnTypeSelectedListener mListener; HotelsTypeViewHolder(@NonNull View itemView, @NonNull List items, @Nullable OnTypeSelectedListener listener) diff --git a/android/src/com/mapswithme/maps/search/SearchEngine.java b/android/src/com/mapswithme/maps/search/SearchEngine.java index 3c88f90fbe..37df07dd74 100644 --- a/android/src/com/mapswithme/maps/search/SearchEngine.java +++ b/android/src/com/mapswithme/maps/search/SearchEngine.java @@ -16,6 +16,7 @@ import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; public enum SearchEngine implements NativeSearchListener, NativeMapSearchListener, @@ -157,13 +158,8 @@ public enum SearchEngine implements NativeSearchListener, double lat, double lon, @Nullable HotelsFilter hotelsFilter, @Nullable BookingFilterParams bookingParams) { - try - { - return nativeRunSearch(query.getBytes("utf-8"), Language.getKeyboardLocale(context), - timestamp, hasLocation, lat, lon, hotelsFilter, bookingParams); - } catch (UnsupportedEncodingException ignored) { } - - return false; + return nativeRunSearch(query.getBytes(StandardCharsets.UTF_8), Language.getKeyboardLocale(context), + timestamp, hasLocation, lat, lon, hotelsFilter, bookingParams); } @MainThread @@ -171,11 +167,8 @@ public enum SearchEngine implements NativeSearchListener, boolean isMapAndTable, @Nullable HotelsFilter hotelsFilter, @Nullable BookingFilterParams bookingParams) { - try - { - nativeRunInteractiveSearch(query.getBytes("utf-8"), locale, timestamp, isMapAndTable, - hotelsFilter, bookingParams); - } catch (UnsupportedEncodingException ignored) { } + nativeRunInteractiveSearch(query.getBytes(StandardCharsets.UTF_8), locale, timestamp, isMapAndTable, + hotelsFilter, bookingParams); } @MainThread @@ -189,24 +182,14 @@ public enum SearchEngine implements NativeSearchListener, @MainThread public static void searchMaps(@NonNull Context context, String query, long timestamp) { - try - { - nativeRunSearchMaps(query.getBytes("utf-8"), Language.getKeyboardLocale(context), - timestamp); - } catch (UnsupportedEncodingException ignored) { } + nativeRunSearchMaps(query.getBytes(StandardCharsets.UTF_8), Language.getKeyboardLocale(context), + timestamp); } @MainThread public boolean searchInBookmarks(@NonNull String query, long categoryId, long timestamp) { - try - { - return nativeRunSearchInBookmarks(query.getBytes("utf-8"), categoryId, timestamp); - } catch (UnsupportedEncodingException ex) - { - LOGGER.w(TAG, "Unsupported encoding in bookmarks search.", ex); - } - return false; + return nativeRunSearchInBookmarks(query.getBytes(StandardCharsets.UTF_8), categoryId, timestamp); } public void setQuery(@Nullable String query) diff --git a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java index 34c25f091d..c0eba2863c 100644 --- a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java +++ b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java @@ -221,7 +221,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment return; } - boolean enabled = TtsPlayer.INSTANCE.isEnabled(); + boolean enabled = TtsPlayer.isEnabled(); mPrefEnabled.setChecked(enabled); mPrefEnabled.setSummary(null); mPrefEnabled.setTitle(enabled ? R.string.on : R.string.off); @@ -251,10 +251,10 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment mCurrentLanguage = TtsPlayer.getSelectedLanguage(languages); boolean available = (mCurrentLanguage != null && mCurrentLanguage.downloaded); - mPrefLanguages.setEnabled(available && TtsPlayer.INSTANCE.isEnabled()); + mPrefLanguages.setEnabled(available && TtsPlayer.isEnabled()); mPrefLanguages.setSummary(available ? mCurrentLanguage.name : null); mPrefLanguages.setValue(available ? mCurrentLanguage.internalCode : null); - mPrefEnabled.setChecked(available && TtsPlayer.INSTANCE.isEnabled()); + mPrefEnabled.setChecked(available && TtsPlayer.isEnabled()); enableListeners(true); } diff --git a/android/src/com/mapswithme/maps/settings/StoragePathFragment.java b/android/src/com/mapswithme/maps/settings/StoragePathFragment.java index fabee54187..8d4b829c44 100644 --- a/android/src/com/mapswithme/maps/settings/StoragePathFragment.java +++ b/android/src/com/mapswithme/maps/settings/StoragePathFragment.java @@ -114,7 +114,7 @@ public class StoragePathFragment extends BaseSettingsFragment static String getSizeString(long size) { - final String units[] = { "Kb", "Mb", "Gb" }; + final String[] units = { "Kb", "Mb", "Gb" }; long current = Constants.KB; int i = 0; diff --git a/android/src/com/mapswithme/maps/settings/UnitLocale.java b/android/src/com/mapswithme/maps/settings/UnitLocale.java index 9d2d0a9ca9..a89b5cb489 100644 --- a/android/src/com/mapswithme/maps/settings/UnitLocale.java +++ b/android/src/com/mapswithme/maps/settings/UnitLocale.java @@ -13,7 +13,7 @@ public class UnitLocale { final String code = Locale.getDefault().getCountry(); // USA, UK, Liberia, Burma - String arr[] = {"US", "GB", "LR", "MM"}; + String[] arr = {"US", "GB", "LR", "MM"}; for (String s : arr) if (s.equalsIgnoreCase(code)) return UNITS_FOOT; diff --git a/android/src/com/mapswithme/maps/ugc/EditParams.java b/android/src/com/mapswithme/maps/ugc/EditParams.java index 33f47ebec3..d79ebfd2d7 100644 --- a/android/src/com/mapswithme/maps/ugc/EditParams.java +++ b/android/src/com/mapswithme/maps/ugc/EditParams.java @@ -23,10 +23,10 @@ public class EditParams private final boolean mFromNotification; // TODO: mLat, mLon, mAddress are added just for debugging null feature id for ugc object. // Remove they after problem is fixed. - private double mLat; - private double mLon; + private final double mLat; + private final double mLon; @Nullable - private String mAddress; + private final String mAddress; private EditParams(@NonNull Builder builder) { diff --git a/android/src/com/mapswithme/maps/ugc/UGCRatingAdapter.java b/android/src/com/mapswithme/maps/ugc/UGCRatingAdapter.java index 7cf7e03867..fcc2d1530f 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCRatingAdapter.java +++ b/android/src/com/mapswithme/maps/ugc/UGCRatingAdapter.java @@ -18,7 +18,7 @@ import java.util.List; class UGCRatingAdapter extends RecyclerView.Adapter { @NonNull - private ArrayList mItems = new ArrayList<>(); + private final ArrayList mItems = new ArrayList<>(); @Override public UGCRatingAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) diff --git a/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java b/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java index bc1c1d079a..81e1b89936 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java +++ b/android/src/com/mapswithme/maps/ugc/UGCRatingRecordsAdapter.java @@ -18,7 +18,7 @@ import java.util.List; class UGCRatingRecordsAdapter extends RecyclerView.Adapter { @NonNull - private ArrayList mItems = new ArrayList<>(); + private final ArrayList mItems = new ArrayList<>(); @Override public UGCRatingRecordsAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) diff --git a/android/src/com/mapswithme/maps/ugc/UGCReviewAdapter.java b/android/src/com/mapswithme/maps/ugc/UGCReviewAdapter.java index 2fc90eaa32..c6358ec11b 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCReviewAdapter.java +++ b/android/src/com/mapswithme/maps/ugc/UGCReviewAdapter.java @@ -20,7 +20,7 @@ class UGCReviewAdapter extends Adapter { static final int MAX_COUNT = 3; @NonNull - private ArrayList mItems = new ArrayList<>(); + private final ArrayList mItems = new ArrayList<>(); @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) diff --git a/android/src/com/mapswithme/maps/ugc/UGCUpdate.java b/android/src/com/mapswithme/maps/ugc/UGCUpdate.java index ee570c2355..81dea23dda 100644 --- a/android/src/com/mapswithme/maps/ugc/UGCUpdate.java +++ b/android/src/com/mapswithme/maps/ugc/UGCUpdate.java @@ -13,7 +13,7 @@ class UGCUpdate private final UGC.Rating[] mRatings; @Nullable private String mText; - private long mTimeMillis; + private final long mTimeMillis; @NonNull private final String mDeviceLocale; @NonNull diff --git a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java index 2e264d4739..6835618d89 100644 --- a/android/src/com/mapswithme/maps/widget/SearchToolbarController.java +++ b/android/src/com/mapswithme/maps/widget/SearchToolbarController.java @@ -511,8 +511,8 @@ public class SearchToolbarController extends ToolbarController } } - public static interface RoomsGuestsMenuStateCallback + public interface RoomsGuestsMenuStateCallback { - public void onRoomsGuestsMenuStateChange(boolean isOpen); + void onRoomsGuestsMenuStateChange(boolean isOpen); } } diff --git a/android/src/com/mapswithme/maps/widget/menu/BottomSheetMenuController.java b/android/src/com/mapswithme/maps/widget/menu/BottomSheetMenuController.java index 18de866b51..5a6075e631 100644 --- a/android/src/com/mapswithme/maps/widget/menu/BottomSheetMenuController.java +++ b/android/src/com/mapswithme/maps/widget/menu/BottomSheetMenuController.java @@ -25,7 +25,7 @@ public class BottomSheetMenuController implements MenuController @NonNull private final MenuRenderer mMenuRenderer; @Nullable - private MenuStateObserver mStateObserver; + private final MenuStateObserver mStateObserver; private final BottomSheetBehavior.BottomSheetCallback mSheetCallback = new BottomSheetBehavior.BottomSheetCallback() { diff --git a/android/src/com/mapswithme/maps/widget/menu/MyPositionButton.java b/android/src/com/mapswithme/maps/widget/menu/MyPositionButton.java index 1145daced1..9f32200736 100644 --- a/android/src/com/mapswithme/maps/widget/menu/MyPositionButton.java +++ b/android/src/com/mapswithme/maps/widget/menu/MyPositionButton.java @@ -24,7 +24,7 @@ public class MyPositionButton private static final SparseArray mIcons = new SparseArray<>(); // Location mode -> Button icon private int mMode; - private boolean mVisible; + private final boolean mVisible; private final int mFollowPaddingShift; diff --git a/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java b/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java index af93fff50d..07cb92bd09 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java +++ b/android/src/com/mapswithme/maps/widget/placepage/DirectionFragment.java @@ -48,7 +48,7 @@ public class DirectionFragment extends BaseMwmDialogFragment }); initViews(root); if (savedInstanceState != null) - setMapObject(savedInstanceState.getParcelable(EXTRA_MAP_OBJECT)); + setMapObject(savedInstanceState.getParcelable(EXTRA_MAP_OBJECT)); return root; } diff --git a/android/src/com/mapswithme/maps/widget/placepage/GalleryAdapter.java b/android/src/com/mapswithme/maps/widget/placepage/GalleryAdapter.java index 425c9ca8fa..2413f969fc 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/GalleryAdapter.java +++ b/android/src/com/mapswithme/maps/widget/placepage/GalleryAdapter.java @@ -126,9 +126,9 @@ class GalleryAdapter extends RecyclerView.Adapter static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @NonNull - private ImageView mImage; + private final ImageView mImage; @NonNull - private View mMore; + private final View mMore; @Nullable private final RecyclerClickListener mListener; private int mPosition; diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index ed0584388f..b25eda9fc0 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -290,7 +290,7 @@ public class PlacePageView extends NestedScrollViewClickFixed private final EditBookmarkClickListener mEditBookmarkClickListener = new EditBookmarkClickListener(); @NonNull - private OnClickListener mDownloadClickListener = new OnClickListener() + private final OnClickListener mDownloadClickListener = new OnClickListener() { @Override public void onClick(View v) @@ -300,7 +300,7 @@ public class PlacePageView extends NestedScrollViewClickFixed }; @NonNull - private OnClickListener mCancelDownloadListener = new OnClickListener() + private final OnClickListener mCancelDownloadListener = new OnClickListener() { @Override public void onClick(View v) diff --git a/android/src/com/mapswithme/util/Constants.java b/android/src/com/mapswithme/util/Constants.java index 74e576a8d4..91203e045d 100644 --- a/android/src/com/mapswithme/util/Constants.java +++ b/android/src/com/mapswithme/util/Constants.java @@ -66,7 +66,7 @@ public final class Constants { public static final float RATING_INCORRECT_VALUE = 0.0f; - private Rating() {}; + private Rating() {} } diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index 96e84623d2..c293bb662d 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -771,7 +771,7 @@ public class Utils public enum PartnerAppOpenMode { - None, Direct, Indirect; + None, Direct, Indirect } public interface Proc diff --git a/android/src/com/mapswithme/util/ViewServer.java b/android/src/com/mapswithme/util/ViewServer.java index 156ed93531..d7970596b8 100644 --- a/android/src/com/mapswithme/util/ViewServer.java +++ b/android/src/com/mapswithme/util/ViewServer.java @@ -547,7 +547,7 @@ public class ViewServer implements Runnable { } private class ViewServerWorker implements Runnable, WindowListener { - private Socket mClient; + private final Socket mClient; private boolean mNeedWindowListUpdate; private boolean mNeedFocusedWindowUpdate; diff --git a/android/src/com/mapswithme/util/log/ZipLogsTask.java b/android/src/com/mapswithme/util/log/ZipLogsTask.java index 20c3fa42c7..bdc78a901c 100644 --- a/android/src/com/mapswithme/util/log/ZipLogsTask.java +++ b/android/src/com/mapswithme/util/log/ZipLogsTask.java @@ -65,11 +65,11 @@ class ZipLogsTask implements Runnable else { try(FileInputStream fi = new FileInputStream(sourcePath); - BufferedInputStream origin = new BufferedInputStream(fi, BUFFER_SIZE);) + BufferedInputStream origin = new BufferedInputStream(fi, BUFFER_SIZE)) { ZipEntry entry = new ZipEntry(getLastPathComponent(sourcePath)); out.putNextEntry(entry); - byte data[] = new byte[BUFFER_SIZE]; + byte[] data = new byte[BUFFER_SIZE]; int count; while ((count = origin.read(data, 0, BUFFER_SIZE)) != -1) { out.write(data, 0, count); @@ -103,7 +103,7 @@ class ZipLogsTask implements Runnable } else { - byte data[] = new byte[BUFFER_SIZE]; + byte[] data = new byte[BUFFER_SIZE]; String unmodifiedFilePath = file.getPath(); String relativePath = unmodifiedFilePath .substring(basePathLength);