From b0d7f9c79d44bb2493ef5f9e4e53af85a8693d0c Mon Sep 17 00:00:00 2001 From: Dmitry Donskoy Date: Sat, 9 Jun 2018 17:53:31 +0300 Subject: [PATCH] [android] Fixed review notes --- .../layout/fragment_bookmark_categories_pager.xml | 4 +--- .../background/AbstractLogBroadcastReceiver.java | 1 - .../bookmarks/SystemDownloadCompletedReceiver.java | 8 ++------ .../com/mapswithme/maps/widget/PlaceholderView.java | 2 +- .../maps/widget/placepage/PlacePageView.java | 12 +++++++----- android/src/com/mapswithme/util/Utils.java | 2 +- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/android/res/layout/fragment_bookmark_categories_pager.xml b/android/res/layout/fragment_bookmark_categories_pager.xml index dc4a8e966d..8fb96bf4ea 100644 --- a/android/res/layout/fragment_bookmark_categories_pager.xml +++ b/android/res/layout/fragment_bookmark_categories_pager.xml @@ -5,13 +5,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> - - - \ No newline at end of file + diff --git a/android/src/com/mapswithme/maps/background/AbstractLogBroadcastReceiver.java b/android/src/com/mapswithme/maps/background/AbstractLogBroadcastReceiver.java index 3627ff1137..c98f80b79b 100644 --- a/android/src/com/mapswithme/maps/background/AbstractLogBroadcastReceiver.java +++ b/android/src/com/mapswithme/maps/background/AbstractLogBroadcastReceiver.java @@ -32,7 +32,6 @@ public abstract class AbstractLogBroadcastReceiver extends BroadcastReceiver + !backgroundTracker().isForeground(); LOGGER.i(getTag(), msg); CrashlyticsUtils.log(Log.INFO, getTag(), msg); - assert intent != null; onReceiveInternal(context, intent); } diff --git a/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedReceiver.java b/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedReceiver.java index 417718e0f1..41ff1b838d 100644 --- a/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedReceiver.java +++ b/android/src/com/mapswithme/maps/bookmarks/SystemDownloadCompletedReceiver.java @@ -19,15 +19,11 @@ public class SystemDownloadCompletedReceiver extends AbstractLogBroadcastReceive } @Override - public void onReceiveInternal(@NonNull Context context, @Nullable Intent intent) + public void onReceiveInternal(@NonNull Context context, @NonNull Intent intent) { DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); - if (manager == null || intent == null - || !DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) - { + if (manager == null) return; - } - intent.setClass(context, SystemDownloadCompletedService.class); context.startService(intent); } diff --git a/android/src/com/mapswithme/maps/widget/PlaceholderView.java b/android/src/com/mapswithme/maps/widget/PlaceholderView.java index 6dcc8e3d93..52a04bb9ec 100644 --- a/android/src/com/mapswithme/maps/widget/PlaceholderView.java +++ b/android/src/com/mapswithme/maps/widget/PlaceholderView.java @@ -91,7 +91,7 @@ public class PlaceholderView extends FrameLayout try { attrsArray = - context.getTheme().obtainStyledAttributes(attrs, R.styleable.PlaceholderView,0,0); + context.getTheme().obtainStyledAttributes(attrs, R.styleable.PlaceholderView, 0, 0); mImgSrcDefault = attrsArray.getResourceId( R.styleable.PlaceholderView_imgSrcDefault, UiUtils.NO_ID); diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 4ae8d6c019..9defea5cba 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -687,12 +687,14 @@ public class PlacePageView extends RelativeLayout public boolean isEditableMapObject() { boolean isBookmark = MapObject.isOfType(MapObject.BOOKMARK, mMapObject); - if (!isBookmark) - return false; - long id = Utils.castTo(mMapObject).getBookmarkId(); - return BookmarkManager.INSTANCE.isEditableBookmark(id); - + if (isBookmark) + { + long id = Utils.castTo(mMapObject).getBookmarkId(); + return BookmarkManager.INSTANCE.isEditableBookmark(id); + } + return true; } + private void initHotelRatingView() { mHotelReview = findViewById(R.id.ll__place_hotel_rating); diff --git a/android/src/com/mapswithme/util/Utils.java b/android/src/com/mapswithme/util/Utils.java index 640f1a7806..5c5df8e6b1 100644 --- a/android/src/com/mapswithme/util/Utils.java +++ b/android/src/com/mapswithme/util/Utils.java @@ -217,7 +217,7 @@ public class Utils @NonNull public static T castTo(@NonNull Object instance) { - //noinspection unchecked + // Noinspection unchecked return (T) instance; }