From 7066003b2032a49ae5e59dab9b706259bdeb7e6e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 14 May 2015 00:07:08 -0700 Subject: [PATCH] Various lint error fixes. > Fixing some RTL errors by specifying both marginStart and marginLeft > Moving all layout direction checks to Utilities > Explicitely adding @TargetApi before every method Change-Id: Ibe9c52b93b5a6adeadb27ace2b312770fd732ea0 --- .../android/gallery3d/exif/ExifInterface.java | 6 +-- .../launcher3/WallpaperCropActivity.java | 8 +++- .../launcher3/WallpaperPickerActivity.java | 4 +- res/layout-land/launcher.xml | 1 - res/layout-land/migration_cling.xml | 1 + res/layout-port/migration_cling.xml | 1 + res/layout/apps_list_view.xml | 2 + res/layout/search_drop_target_bar.xml | 3 ++ res/layout/widgets_list_row_view.xml | 1 + res/values-land/styles.xml | 2 +- res/values-sw720dp/styles.xml | 2 +- res/values/styles.xml | 4 +- .../launcher3/AppsContainerRecyclerView.java | 6 +-- .../android/launcher3/AppsContainerView.java | 12 +++-- src/com/android/launcher3/BubbleTextView.java | 11 ++++- .../android/launcher3/ButtonDropTarget.java | 15 ++++--- src/com/android/launcher3/DeviceProfile.java | 6 +-- src/com/android/launcher3/DragController.java | 7 +-- src/com/android/launcher3/DragLayer.java | 14 ++---- src/com/android/launcher3/DragView.java | 1 + src/com/android/launcher3/Folder.java | 13 +++--- .../android/launcher3/FolderPagedView.java | 8 ++-- src/com/android/launcher3/InfoDropTarget.java | 16 +++++-- src/com/android/launcher3/Launcher.java | 4 +- .../android/launcher3/LauncherAnimUtils.java | 4 +- .../LauncherAppWidgetProviderInfo.java | 5 +++ src/com/android/launcher3/LauncherClings.java | 4 +- .../LauncherStateTransitionAnimation.java | 6 ++- src/com/android/launcher3/MemoryTracker.java | 2 +- src/com/android/launcher3/PagedView.java | 45 ++++++++----------- .../launcher3/ShortcutAndWidgetContainer.java | 6 +-- .../launcher3/UninstallDropTarget.java | 3 +- src/com/android/launcher3/Utilities.java | 6 +++ src/com/android/launcher3/Workspace.java | 38 ++++++++-------- .../OverviewScreenAccessibilityDelegate.java | 7 ++- .../compat/AppWidgetManagerCompatV16.java | 2 + .../compat/LauncherActivityInfoCompatVL.java | 4 +- .../compat/LauncherAppsCompatVL.java | 2 + .../compat/PackageInstallerCompatVL.java | 3 ++ .../launcher3/compat/UserHandleCompat.java | 3 +- .../compat/UserManagerCompatV17.java | 8 ++-- .../launcher3/compat/UserManagerCompatVL.java | 5 ++- .../launcher3/widget/WidgetsListAdapter.java | 12 +++-- 43 files changed, 181 insertions(+), 132 deletions(-) diff --git a/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java b/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java index a1cf0fc852..9247e879f1 100644 --- a/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java +++ b/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java @@ -1247,7 +1247,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Long(l[0]); + return Long.valueOf(l[0]); } /** @@ -1266,7 +1266,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Integer(l[0]); + return Integer.valueOf(l[0]); } /** @@ -1285,7 +1285,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Byte(l[0]); + return Byte.valueOf(l[0]); } /** diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 142a9cb10e..affad0f45e 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -190,7 +190,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb } }); } catch (SecurityException securityException) { - if (isDestroyed()) { + if (isActivityDestroyed()) { // Temporarily granted permissions are revoked when the activity // finishes, potentially resulting in a SecurityException here. // Even though {@link #isDestroyed} might also return true in different @@ -221,6 +221,12 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb return false; } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) + protected boolean isActivityDestroyed() { + return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) + && isDestroyed(); + } + @Thunk void addReusableBitmap(TileSource src) { synchronized (mReusableBitmaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 93320919e1..1ba5b4b2e9 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -665,7 +665,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Thunk void initializeScrollForRtl() { - if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + if (Utilities.isRtl(getResources())) { final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { public void onGlobalLayout() { @@ -838,7 +838,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { int rotation = BitmapUtils.getRotationFromExif(context, uri); return createThumbnail(defaultSize, context, uri, null, null, 0, rotation, false); } catch (SecurityException securityException) { - if (isDestroyed()) { + if (isActivityDestroyed()) { // Temporarily granted permissions are revoked when the activity // finishes, potentially resulting in a SecurityException here. // Even though {@link #isDestroyed} might also return true in different diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml index d5dd91ab42..f0f7bbb9f4 100644 --- a/res/layout-land/launcher.xml +++ b/res/layout-land/launcher.xml @@ -18,7 +18,6 @@ diff --git a/res/layout-port/migration_cling.xml b/res/layout-port/migration_cling.xml index 81689d38b3..3f696a216c 100644 --- a/res/layout-port/migration_cling.xml +++ b/res/layout-port/migration_cling.xml @@ -48,6 +48,7 @@ android:layout_height="wrap_content" android:layout_below="@+id/ic_cling_migration" android:layout_marginStart="@dimen/cling_migration_content_margin" + android:layout_marginLeft="@dimen/cling_migration_content_margin" android:orientation="vertical" android:paddingLeft="24dp" android:paddingRight="24dp" > diff --git a/res/layout/apps_list_view.xml b/res/layout/apps_list_view.xml index ef20323c1e..5e50191eaf 100644 --- a/res/layout/apps_list_view.xml +++ b/res/layout/apps_list_view.xml @@ -56,6 +56,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="start|center_vertical" + android:layout_marginLeft="4dp" android:layout_marginStart="4dp" android:paddingTop="13dp" android:paddingBottom="13dp" @@ -86,6 +87,7 @@ android:layout_height="wrap_content" android:layout_gravity="end|center_vertical" android:layout_marginEnd="6dp" + android:layout_marginRight="6dp" android:paddingTop="13dp" android:paddingBottom="13dp" android:contentDescription="@string/apps_view_search_bar_hint" diff --git a/res/layout/search_drop_target_bar.xml b/res/layout/search_drop_target_bar.xml index 69f42bb4cb..b0435aa0e9 100644 --- a/res/layout/search_drop_target_bar.xml +++ b/res/layout/search_drop_target_bar.xml @@ -36,6 +36,7 @@ @@ -49,6 +50,7 @@ @@ -62,6 +64,7 @@ diff --git a/res/layout/widgets_list_row_view.xml b/res/layout/widgets_list_row_view.xml index 2cbdb5cfff..be62ee9fc2 100644 --- a/res/layout/widgets_list_row_view.xml +++ b/res/layout/widgets_list_row_view.xml @@ -58,6 +58,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="@dimen/widget_row_padding" + android:layout_marginLeft="@dimen/widget_row_padding" android:orientation="horizontal" android:divider="@drawable/widgets_row_divider" android:showDividers="middle" diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml index 8a255c91bc..c5a76d595b 100644 --- a/res/values-land/styles.xml +++ b/res/values-land/styles.xml @@ -28,7 +28,7 @@ - - - - +