diff --git a/mobile/android/base/LightweightThemeDrawable.java b/mobile/android/base/LightweightThemeDrawable.java index a5db7a423dcf..090fcdcea807 100644 --- a/mobile/android/base/LightweightThemeDrawable.java +++ b/mobile/android/base/LightweightThemeDrawable.java @@ -53,8 +53,9 @@ public class LightweightThemeDrawable extends Drawable { @Override public void draw(Canvas canvas) { // Draw the colors, if available. - if (mColorPaint != null) + if (mColorPaint != null) { canvas.drawPaint(mColorPaint); + } // Draw the bitmap. canvas.drawPaint(mPaint); @@ -75,7 +76,7 @@ public class LightweightThemeDrawable extends Drawable { @Override public void setColorFilter(ColorFilter filter) { mPaint.setColorFilter(filter); - } + } /** * Creates a paint that paint a particular color. @@ -112,17 +113,17 @@ public class LightweightThemeDrawable extends Drawable { } private void initializeBitmapShader() { - // A bitmap-shader to draw the bitmap. + // A bitmap-shader to draw the bitmap. // Clamp mode will repeat the last row of pixels. // Hence its better to have an endAlpha of 0 for the linear-gradient. - BitmapShader bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + BitmapShader bitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); - // A linear-gradient to specify the opacity of the bitmap. - LinearGradient gradient = new LinearGradient(0, 0, 0, mBitmap.getHeight(), mStartColor, mEndColor, Shader.TileMode.CLAMP); + // A linear-gradient to specify the opacity of the bitmap. + LinearGradient gradient = new LinearGradient(0, 0, 0, mBitmap.getHeight(), mStartColor, mEndColor, Shader.TileMode.CLAMP); - // Make a combined shader -- a performance win. + // Make a combined shader -- a performance win. // The linear-gradient is the 'SRC' and the bitmap-shader is the 'DST'. - // Drawing the DST in the SRC will provide the opacity. - mPaint.setShader(new ComposeShader(bitmapShader, gradient, PorterDuff.Mode.DST_IN)); + // Drawing the DST in the SRC will provide the opacity. + mPaint.setShader(new ComposeShader(bitmapShader, gradient, PorterDuff.Mode.DST_IN)); } } diff --git a/mobile/android/base/TextSelection.java b/mobile/android/base/TextSelection.java index 67afa464eed6..7e55d8f612b6 100644 --- a/mobile/android/base/TextSelection.java +++ b/mobile/android/base/TextSelection.java @@ -189,11 +189,11 @@ class TextSelection extends Layer implements GeckoEventListener { } private void showActionMode(final JSONArray items) { - String itemsString = items.toString(); - if (itemsString.equals(mCurrentItems)) { - return; - } - mCurrentItems = itemsString; + String itemsString = items.toString(); + if (itemsString.equals(mCurrentItems)) { + return; + } + mCurrentItems = itemsString; if (mCallback != null) { mCallback.updateItems(items); @@ -214,7 +214,7 @@ class TextSelection extends Layer implements GeckoEventListener { final ActionModeCompat.Presenter presenter = (ActionModeCompat.Presenter) context; presenter.endActionModeCompat(); } - mCurrentItems = null; + mCurrentItems = null; } @Override diff --git a/mobile/android/base/animation/ViewHelper.java b/mobile/android/base/animation/ViewHelper.java index 65fe9eff4e16..64f2dc359b47 100644 --- a/mobile/android/base/animation/ViewHelper.java +++ b/mobile/android/base/animation/ViewHelper.java @@ -7,56 +7,56 @@ package org.mozilla.gecko.animation; import android.view.View; public final class ViewHelper { - private ViewHelper() { - } + private ViewHelper() { + } - public static float getTranslationX(View view) { - AnimatorProxy proxy = AnimatorProxy.create(view); - return proxy.getTranslationX(); - } + public static float getTranslationX(View view) { + AnimatorProxy proxy = AnimatorProxy.create(view); + return proxy.getTranslationX(); + } - public static void setTranslationX(View view, float translationX) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - proxy.setTranslationX(translationX); - } + public static void setTranslationX(View view, float translationX) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + proxy.setTranslationX(translationX); + } - public static float getTranslationY(View view) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - return proxy.getTranslationY(); - } + public static float getTranslationY(View view) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + return proxy.getTranslationY(); + } - public static void setTranslationY(View view, float translationY) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - proxy.setTranslationY(translationY); - } + public static void setTranslationY(View view, float translationY) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + proxy.setTranslationY(translationY); + } - public static float getAlpha(View view) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - return proxy.getAlpha(); - } + public static float getAlpha(View view) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + return proxy.getAlpha(); + } - public static void setAlpha(View view, float alpha) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - proxy.setAlpha(alpha); - } + public static void setAlpha(View view, float alpha) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + proxy.setAlpha(alpha); + } - public static int getWidth(View view) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - return proxy.getWidth(); - } + public static int getWidth(View view) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + return proxy.getWidth(); + } - public static void setWidth(View view, int width) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - proxy.setWidth(width); - } + public static void setWidth(View view, int width) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + proxy.setWidth(width); + } - public static int getHeight(View view) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - return proxy.getHeight(); - } + public static int getHeight(View view) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + return proxy.getHeight(); + } - public static void setHeight(View view, int height) { - final AnimatorProxy proxy = AnimatorProxy.create(view); - proxy.setHeight(height); - } + public static void setHeight(View view, int height) { + final AnimatorProxy proxy = AnimatorProxy.create(view); + proxy.setHeight(height); + } } diff --git a/mobile/android/base/background/preferences/PreferenceManagerCompat.java b/mobile/android/base/background/preferences/PreferenceManagerCompat.java index 91090e43ead7..f27dd53e691b 100644 --- a/mobile/android/base/background/preferences/PreferenceManagerCompat.java +++ b/mobile/android/base/background/preferences/PreferenceManagerCompat.java @@ -32,7 +32,7 @@ import android.util.Log; public class PreferenceManagerCompat { - private static final String TAG = PreferenceManagerCompat.class.getSimpleName(); + private static final String TAG = PreferenceManagerCompat.class.getSimpleName(); /** * Interface definition for a callback to be invoked when a @@ -52,22 +52,22 @@ public class PreferenceManagerCompat { boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference); } - static PreferenceManager newInstance(Activity activity, int firstRequestCode) { - try { - Constructor c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class); - c.setAccessible(true); - return c.newInstance(activity, firstRequestCode); - } catch (Exception e) { - Log.w(TAG, "Couldn't call constructor PreferenceManager by reflection", e); - } - return null; - } + static PreferenceManager newInstance(Activity activity, int firstRequestCode) { + try { + Constructor c = PreferenceManager.class.getDeclaredConstructor(Activity.class, int.class); + c.setAccessible(true); + return c.newInstance(activity, firstRequestCode); + } catch (Exception e) { + Log.w(TAG, "Couldn't call constructor PreferenceManager by reflection", e); + } + return null; + } - /** + /** * Sets the owning preference fragment */ static void setFragment(PreferenceManager manager, PreferenceFragment fragment) { - // stub + // stub } /** @@ -76,34 +76,34 @@ public class PreferenceManagerCompat { * * @param listener The callback to be invoked. */ - static void setOnPreferenceTreeClickListener(PreferenceManager manager, final OnPreferenceTreeClickListener listener) { - try { - Field onPreferenceTreeClickListener = PreferenceManager.class.getDeclaredField("mOnPreferenceTreeClickListener"); - onPreferenceTreeClickListener.setAccessible(true); - if (listener != null) { - Object proxy = Proxy.newProxyInstance( - onPreferenceTreeClickListener.getType().getClassLoader(), - new Class[] { onPreferenceTreeClickListener.getType() }, - new InvocationHandler() { - @Override + static void setOnPreferenceTreeClickListener(PreferenceManager manager, final OnPreferenceTreeClickListener listener) { + try { + Field onPreferenceTreeClickListener = PreferenceManager.class.getDeclaredField("mOnPreferenceTreeClickListener"); + onPreferenceTreeClickListener.setAccessible(true); + if (listener != null) { + Object proxy = Proxy.newProxyInstance( + onPreferenceTreeClickListener.getType().getClassLoader(), + new Class[] { onPreferenceTreeClickListener.getType() }, + new InvocationHandler() { + @Override public Object invoke(Object proxy, Method method, Object[] args) { - if (method.getName().equals("onPreferenceTreeClick")) { - return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1])); - } else { - return null; - } - } - }); - onPreferenceTreeClickListener.set(manager, proxy); - } else { - onPreferenceTreeClickListener.set(manager, null); - } - } catch (Exception e) { - Log.w(TAG, "Couldn't set PreferenceManager.mOnPreferenceTreeClickListener by reflection", e); - } - } + if (method.getName().equals("onPreferenceTreeClick")) { + return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1])); + } else { + return null; + } + } + }); + onPreferenceTreeClickListener.set(manager, proxy); + } else { + onPreferenceTreeClickListener.set(manager, null); + } + } catch (Exception e) { + Log.w(TAG, "Couldn't set PreferenceManager.mOnPreferenceTreeClickListener by reflection", e); + } + } - /** + /** * Inflates a preference hierarchy from the preference hierarchies of * {@link Activity Activities} that match the given {@link Intent}. An * {@link Activity} defines its preference hierarchy with meta-data using @@ -118,19 +118,19 @@ public class PreferenceManagerCompat { * @return The root hierarchy (if one was not provided, the new hierarchy's * root). */ - static PreferenceScreen inflateFromIntent(PreferenceManager manager, Intent intent, PreferenceScreen screen) { - try { + static PreferenceScreen inflateFromIntent(PreferenceManager manager, Intent intent, PreferenceScreen screen) { + try { Method m = PreferenceManager.class.getDeclaredMethod("inflateFromIntent", Intent.class, PreferenceScreen.class); m.setAccessible(true); PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, intent, screen); return prefScreen; } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.inflateFromIntent by reflection", e); - } - return null; - } + Log.w(TAG, "Couldn't call PreferenceManager.inflateFromIntent by reflection", e); + } + return null; + } - /** + /** * Inflates a preference hierarchy from XML. If a preference hierarchy is * given, the new preference hierarchies will be merged in. * @@ -142,90 +142,90 @@ public class PreferenceManagerCompat { * root). * @hide */ - static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) { - try { + static PreferenceScreen inflateFromResource(PreferenceManager manager, Activity activity, int resId, PreferenceScreen screen) { + try { Method m = PreferenceManager.class.getDeclaredMethod("inflateFromResource", Context.class, int.class, PreferenceScreen.class); m.setAccessible(true); PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(manager, activity, resId, screen); return prefScreen; } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e); - } - return null; - } + Log.w(TAG, "Couldn't call PreferenceManager.inflateFromResource by reflection", e); + } + return null; + } - /** + /** * Returns the root of the preference hierarchy managed by this class. * * @return The {@link PreferenceScreen} object that is at the root of the hierarchy. */ - static PreferenceScreen getPreferenceScreen(PreferenceManager manager) { - try { + static PreferenceScreen getPreferenceScreen(PreferenceManager manager) { + try { Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen"); m.setAccessible(true); return (PreferenceScreen) m.invoke(manager); } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e); - } - return null; - } + Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e); + } + return null; + } - /** + /** * Called by the {@link PreferenceManager} to dispatch a subactivity result. */ - static void dispatchActivityResult(PreferenceManager manager, int requestCode, int resultCode, Intent data) { - try { + static void dispatchActivityResult(PreferenceManager manager, int requestCode, int resultCode, Intent data) { + try { Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityResult", int.class, int.class, Intent.class); m.setAccessible(true); m.invoke(manager, requestCode, resultCode, data); } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityResult by reflection", e); - } - } + Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityResult by reflection", e); + } + } - /** + /** * Called by the {@link PreferenceManager} to dispatch the activity stop * event. */ - static void dispatchActivityStop(PreferenceManager manager) { - try { + static void dispatchActivityStop(PreferenceManager manager) { + try { Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityStop"); m.setAccessible(true); m.invoke(manager); } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityStop by reflection", e); - } - } + Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityStop by reflection", e); + } + } - /** + /** * Called by the {@link PreferenceManager} to dispatch the activity destroy * event. */ - static void dispatchActivityDestroy(PreferenceManager manager) { - try { - Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityDestroy"); - m.setAccessible(true); - m.invoke(manager); - } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityDestroy by reflection", e); - } - } + static void dispatchActivityDestroy(PreferenceManager manager) { + try { + Method m = PreferenceManager.class.getDeclaredMethod("dispatchActivityDestroy"); + m.setAccessible(true); + m.invoke(manager); + } catch (Exception e) { + Log.w(TAG, "Couldn't call PreferenceManager.dispatchActivityDestroy by reflection", e); + } + } - /** + /** * Sets the root of the preference hierarchy. * * @param preferenceScreen The root {@link PreferenceScreen} of the preference hierarchy. * @return Whether the {@link PreferenceScreen} given is different than the previous. */ - static boolean setPreferences(PreferenceManager manager, PreferenceScreen screen) { - try { - Method m = PreferenceManager.class.getDeclaredMethod("setPreferences", PreferenceScreen.class); - m.setAccessible(true); - return ((Boolean) m.invoke(manager, screen)); - } catch (Exception e) { - Log.w(TAG, "Couldn't call PreferenceManager.setPreferences by reflection", e); - } - return false; - } + static boolean setPreferences(PreferenceManager manager, PreferenceScreen screen) { + try { + Method m = PreferenceManager.class.getDeclaredMethod("setPreferences", PreferenceScreen.class); + m.setAccessible(true); + return ((Boolean) m.invoke(manager, screen)); + } catch (Exception e) { + Log.w(TAG, "Couldn't call PreferenceManager.setPreferences by reflection", e); + } + return false; + } } diff --git a/mobile/android/base/prompts/ColorPickerInput.java b/mobile/android/base/prompts/ColorPickerInput.java index 79e665aca8d8..eb775b09cd16 100644 --- a/mobile/android/base/prompts/ColorPickerInput.java +++ b/mobile/android/base/prompts/ColorPickerInput.java @@ -54,6 +54,6 @@ public class ColorPickerInput extends PromptInput { @Override public boolean canApplyInputStyle() { - return false; + return false; } } diff --git a/mobile/android/base/tests/helpers/AssertionHelper.java b/mobile/android/base/tests/helpers/AssertionHelper.java index be3f962bf8f1..09c7e3027974 100644 --- a/mobile/android/base/tests/helpers/AssertionHelper.java +++ b/mobile/android/base/tests/helpers/AssertionHelper.java @@ -99,11 +99,11 @@ public final class AssertionHelper { } public static void fAssertIsPixel(final String message, final int actual, final int r, final int g, final int b) { - sAsserter.ispixel(actual, r, g, b, message); + sAsserter.ispixel(actual, r, g, b, message); } public static void fAssertIsNotPixel(final String message, final int actual, final int r, final int g, final int b) { - sAsserter.isnotpixel(actual, r, g, b, message); + sAsserter.isnotpixel(actual, r, g, b, message); } public static void fFail(final String message) { diff --git a/mobile/android/base/updater/UpdateService.java b/mobile/android/base/updater/UpdateService.java index 1824a4c3fc0e..cc5134c2f05e 100644 --- a/mobile/android/base/updater/UpdateService.java +++ b/mobile/android/base/updater/UpdateService.java @@ -393,10 +393,10 @@ public class UpdateService extends IntentService { mBuilder = new NotificationCompat.Builder(this); mBuilder.setContentTitle(getResources().getString(R.string.updater_downloading_title)) - .setContentText(mApplyImmediately ? "" : getResources().getString(R.string.updater_downloading_select)) - .setSmallIcon(android.R.drawable.stat_sys_download) - .setContentIntent(contentIntent) - .setDeleteIntent(deleteIntent); + .setContentText(mApplyImmediately ? "" : getResources().getString(R.string.updater_downloading_select)) + .setSmallIcon(android.R.drawable.stat_sys_download) + .setContentIntent(contentIntent) + .setDeleteIntent(deleteIntent); mBuilder.setProgress(100, 0, true); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); @@ -480,10 +480,10 @@ public class UpdateService extends IntentService { output.write(buf, 0, len); bytesRead += len; // Updating the notification takes time so only do it every 1MB - if(bytesRead - lastNotify > 1048576) { - mBuilder.setProgress(length, bytesRead, false); - mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); - lastNotify = bytesRead; + if (bytesRead - lastNotify > 1048576) { + mBuilder.setProgress(length, bytesRead, false); + mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); + lastNotify = bytesRead; } } diff --git a/mobile/android/base/widget/TabThumbnailWrapper.java b/mobile/android/base/widget/TabThumbnailWrapper.java index c9b5777ede4a..156f920466ec 100644 --- a/mobile/android/base/widget/TabThumbnailWrapper.java +++ b/mobile/android/base/widget/TabThumbnailWrapper.java @@ -28,7 +28,7 @@ public class TabThumbnailWrapper extends FrameLayout { if (mRecording) { mergeDrawableStates(drawableState, STATE_RECORDING); - } + } return drawableState; }