summaryrefslogtreecommitdiffstats
path: root/ui/android
diff options
context:
space:
mode:
authoraurimas@google.com <aurimas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 20:28:38 +0000
committeraurimas@google.com <aurimas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 20:28:38 +0000
commitab5ac0c38a2a0e562bced6db98767f0ca595a414 (patch)
treeb04082d4f9a92a54977ddd8deb8635ffb26d7263 /ui/android
parent08db0df29b62802dcd24a7df80478d996bd0123e (diff)
downloadchromium_src-ab5ac0c38a2a0e562bced6db98767f0ca595a414.zip
chromium_src-ab5ac0c38a2a0e562bced6db98767f0ca595a414.tar.gz
chromium_src-ab5ac0c38a2a0e562bced6db98767f0ca595a414.tar.bz2
Fixing style issues in ui/android/java/
BUG=320711 NOTRY=true R=newt@chromium.org Review URL: https://codereview.chromium.org/109483012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/android')
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorPickerDialog.java11
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorPickerSimple.java49
-rw-r--r--ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/OnColorChangedListener.java1
-rw-r--r--ui/android/java/src/org/chromium/ui/UiUtils.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java1
-rw-r--r--ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/Clipboard.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java4
-rw-r--r--ui/android/java/src/org/chromium/ui/base/ViewAndroid.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/base/WindowAndroid.java6
-rw-r--r--ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java5
-rw-r--r--ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java297
-rw-r--r--ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java2
-rw-r--r--ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java4
18 files changed, 200 insertions, 200 deletions
diff --git a/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java b/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
index ca4d245..f6d3ace 100644
--- a/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
+++ b/ui/android/java/src/org/chromium/ui/ColorPickerDialog.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,7 +35,6 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
/**
* @param context The context the dialog is to run in.
- * @param theme The theme to display the dialog in.
* @param listener The object to notify when the color is set.
* @param color The initial color to set.
* @param suggestions The list of suggestions.
@@ -152,9 +151,7 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
* Tries to notify any listeners that the color has been set.
*/
private void tryNotifyColorSet(int color) {
- if (mListener != null) {
- mListener.onColorChanged(color);
- }
+ if (mListener != null) mListener.onColorChanged(color);
}
/**
@@ -163,8 +160,6 @@ public class ColorPickerDialog extends AlertDialog implements OnColorChangedList
*/
private void updateCurrentColor(int color) {
mCurrentColor = color;
- if (mCurrentColorView != null) {
- mCurrentColorView.setBackgroundColor(color);
- }
+ if (mCurrentColorView != null) mCurrentColorView.setBackgroundColor(color);
}
}
diff --git a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java b/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
index d3ca34f..69b880e 100644
--- a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
+++ b/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
@@ -1,6 +1,7 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package org.chromium.ui;
import android.content.Context;
@@ -18,25 +19,27 @@ public class ColorPickerSimple extends ListView implements OnColorSuggestionClic
private OnColorChangedListener mOnColorChangedListener;
- private static final int[] DEFAULT_COLORS = { Color.RED,
- Color.CYAN,
- Color.BLUE,
- Color.GREEN,
- Color.MAGENTA,
- Color.YELLOW,
- Color.BLACK,
- Color.WHITE
- };
+ private static final int[] DEFAULT_COLORS = {
+ Color.RED,
+ Color.CYAN,
+ Color.BLUE,
+ Color.GREEN,
+ Color.MAGENTA,
+ Color.YELLOW,
+ Color.BLACK,
+ Color.WHITE
+ };
- private static final int[] DEFAULT_COLOR_LABEL_IDS = { R.string.color_picker_button_red,
- R.string.color_picker_button_cyan,
- R.string.color_picker_button_blue,
- R.string.color_picker_button_green,
- R.string.color_picker_button_magenta,
- R.string.color_picker_button_yellow,
- R.string.color_picker_button_black,
- R.string.color_picker_button_white
- };
+ private static final int[] DEFAULT_COLOR_LABEL_IDS = {
+ R.string.color_picker_button_red,
+ R.string.color_picker_button_cyan,
+ R.string.color_picker_button_blue,
+ R.string.color_picker_button_green,
+ R.string.color_picker_button_magenta,
+ R.string.color_picker_button_yellow,
+ R.string.color_picker_button_black,
+ R.string.color_picker_button_white
+ };
public ColorPickerSimple(Context context) {
super(context);
@@ -65,15 +68,13 @@ public class ColorPickerSimple extends ListView implements OnColorSuggestionClic
if (suggestions == null) {
suggestions = new ColorSuggestion[DEFAULT_COLORS.length];
for (int i = 0; i < suggestions.length; ++i) {
- suggestions[i] =
- new ColorSuggestion(
- DEFAULT_COLORS[i],
- getContext().getString(DEFAULT_COLOR_LABEL_IDS[i]));
+ suggestions[i] = new ColorSuggestion(DEFAULT_COLORS[i],
+ getContext().getString(DEFAULT_COLOR_LABEL_IDS[i]));
}
}
- ColorSuggestionListAdapter adapter = new ColorSuggestionListAdapter(getContext(),
- suggestions);
+ ColorSuggestionListAdapter adapter = new ColorSuggestionListAdapter(
+ getContext(), suggestions);
adapter.setOnColorSuggestionClickListener(this);
setAdapter(adapter);
}
diff --git a/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java b/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
index 0d0e8be..b237acb 100644
--- a/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/ColorSuggestionListAdapter.java
@@ -38,7 +38,7 @@ public class ColorSuggestionListAdapter extends BaseAdapter implements View.OnCl
void onColorSuggestionClick(ColorSuggestion suggestion);
}
- private final static int COLORS_PER_ROW = 4;
+ private static final int COLORS_PER_ROW = 4;
ColorSuggestionListAdapter(Context context, ColorSuggestion[] suggestions) {
mContext = context;
@@ -96,7 +96,7 @@ public class ColorSuggestionListAdapter extends BaseAdapter implements View.OnCl
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout layout;
if (convertView != null && convertView instanceof LinearLayout) {
- layout = (LinearLayout) convertView;
+ layout = (LinearLayout) convertView;
} else {
layout = new LinearLayout(mContext);
layout.setLayoutParams(new AbsListView.LayoutParams(
diff --git a/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java b/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
index 4caa3cf..c4847fa 100644
--- a/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
+++ b/ui/android/java/src/org/chromium/ui/OnColorChangedListener.java
@@ -1,6 +1,7 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
package org.chromium.ui;
/**
diff --git a/ui/android/java/src/org/chromium/ui/UiUtils.java b/ui/android/java/src/org/chromium/ui/UiUtils.java
index c11d9e3..c9c7c0c 100644
--- a/ui/android/java/src/org/chromium/ui/UiUtils.java
+++ b/ui/android/java/src/org/chromium/ui/UiUtils.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,7 +28,7 @@ public class UiUtils {
}
/** The minimum size of the bottom margin below the app to detect a keyboard. */
- private static float KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP = 100;
+ private static final float KEYBOARD_DETECT_BOTTOM_THRESHOLD_DP = 100;
/**
* Shows the software keyboard if necessary.
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
index b6f6c32..9aa88e8 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillDividerDrawable.java
@@ -11,7 +11,7 @@ import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-public class AutofillDividerDrawable extends Drawable {
+class AutofillDividerDrawable extends Drawable {
private Paint mPaint;
private Rect mDividerRect;
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
index 4ddb959..94608af 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
package org.chromium.ui.autofill;
import android.content.Context;
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
index 0d372e7..af6951c 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
@@ -81,7 +81,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
AutofillPopupDelegate autofillCallback) {
super(context, null, 0, R.style.AutofillPopupWindow);
mContext = context;
- mViewAndroidDelegate = viewAndroidDelegate ;
+ mViewAndroidDelegate = viewAndroidDelegate;
mAutofillCallback = autofillCallback;
setOnItemClickListener(this);
diff --git a/ui/android/java/src/org/chromium/ui/base/Clipboard.java b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
index 48a541e..aaa500e 100644
--- a/ui/android/java/src/org/chromium/ui/base/Clipboard.java
+++ b/ui/android/java/src/org/chromium/ui/base/Clipboard.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
index 1095b64..839a860 100644
--- a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
+++ b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
index c6fd1e4..6d85a35 100644
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -191,7 +191,7 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
}
private boolean shouldShowImageTypes() {
- return shouldShowTypes(ALL_IMAGE_TYPES,IMAGE_TYPE);
+ return shouldShowTypes(ALL_IMAGE_TYPES, IMAGE_TYPE);
}
private boolean shouldShowVideoTypes() {
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
index 9f48026..c765a56 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroid.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
index 34d280a..6d3694c 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
index 6996694..44469e5 100644
--- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,7 +35,7 @@ public class WindowAndroid {
protected HashMap<Integer, String> mIntentErrors;
/**
- * @param context, the application context..
+ * @param context The application context.
*/
public WindowAndroid(Context context) {
assert context == context.getApplicationContext();
@@ -175,7 +175,7 @@ public class WindowAndroid {
/**
* Tests that an activity is available to handle the passed in intent.
- * @param Intent the intent to check.
+ * @param intent The intent to check.
* @return True if an activity is available to process this intent when started, meaning that
* Context.startActivity will not throw ActivityNotFoundException.
*/
diff --git a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
index 7d78b52d..913890223 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/BitmapHelper.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,9 @@ import android.graphics.BitmapFactory;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+/**
+ * Helper class to decode and sample down bitmap resources.
+ */
@JNINamespace("gfx")
public class BitmapHelper {
@CalledByNative
diff --git a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
index 4cfe1a1..188c405c 100644
--- a/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
+++ b/ui/android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,152 +27,153 @@ import org.chromium.base.JNINamespace;
public class DeviceDisplayInfo {
- private final Context mAppContext;
- private final WindowManager mWinManager;
-
- private DeviceDisplayInfo(Context context) {
- mAppContext = context.getApplicationContext();
- mWinManager = (WindowManager) mAppContext.getSystemService(Context.WINDOW_SERVICE);
- }
-
- /**
- * @return Display height in physical pixels.
- */
- @CalledByNative
- public int getDisplayHeight() {
- return getMetrics().heightPixels;
- }
-
- /**
- * @return Display width in physical pixels.
- */
- @CalledByNative
- public int getDisplayWidth() {
- return getMetrics().widthPixels;
- }
-
- @SuppressWarnings("deprecation")
- private int getPixelFormat() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
- return getDisplay().getPixelFormat();
- }
- // JellyBean MR1 and later always uses RGBA_8888.
- return PixelFormat.RGBA_8888;
- }
-
- /**
- * @return Bits per pixel.
- */
- @CalledByNative
- public int getBitsPerPixel() {
- int format = getPixelFormat();
- PixelFormat info = new PixelFormat();
- PixelFormat.getPixelFormatInfo(format, info);
- return info.bitsPerPixel;
- }
-
- /**
- * @return Bits per component.
- */
- @SuppressWarnings("deprecation")
- @CalledByNative
- public int getBitsPerComponent() {
- int format = getPixelFormat();
- switch (format) {
- case PixelFormat.RGBA_4444:
- return 4;
-
- case PixelFormat.RGBA_5551:
- return 5;
-
- case PixelFormat.RGBA_8888:
- case PixelFormat.RGBX_8888:
- case PixelFormat.RGB_888:
- return 8;
-
- case PixelFormat.RGB_332:
- return 2;
-
- case PixelFormat.RGB_565:
- return 5;
-
- // Non-RGB formats.
- case PixelFormat.A_8:
- case PixelFormat.LA_88:
- case PixelFormat.L_8:
- return 0;
-
- // Unknown format. Use 8 as a sensible default.
- default:
- return 8;
- }
- }
-
- /**
- * @return A scaling factor for the Density Independent Pixel unit.
- * 1.0 is 160dpi, 0.75 is 120dpi, 2.0 is 320dpi.
- */
- @CalledByNative
- public double getDIPScale() {
- return getMetrics().density;
- }
-
- /**
- * @return Smallest screen size in density-independent pixels that the
- * application will see, regardless of orientation.
- */
- @CalledByNative
- private int getSmallestDIPWidth() {
- return mAppContext.getResources().getConfiguration().smallestScreenWidthDp;
- }
-
- private void registerListener() {
- mAppContext.registerComponentCallbacks(
- new ComponentCallbacks() {
- @Override
- public void onConfigurationChanged(Configuration configuration) {
- updateNativeSharedDisplayInfo();
- }
-
- @Override
- public void onLowMemory() {
- }
- });
- }
-
- private void updateNativeSharedDisplayInfo() {
- nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(),
- getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(),
- getDIPScale(), getSmallestDIPWidth());
- }
-
- private Display getDisplay() {
- return mWinManager.getDefaultDisplay();
- }
-
- private DisplayMetrics getMetrics() {
- return mAppContext.getResources().getDisplayMetrics();
- }
-
- /**
- * Creates DeviceDisplayInfo for a given Context.
- * @param context A context to use.
- * @return DeviceDisplayInfo associated with a given Context.
- */
- public static DeviceDisplayInfo create(Context context) {
- return new DeviceDisplayInfo(context);
- }
-
- @CalledByNative
- private static DeviceDisplayInfo createWithListener(Context context) {
- DeviceDisplayInfo deviceDisplayInfo = new DeviceDisplayInfo(context);
- deviceDisplayInfo.registerListener();
- return deviceDisplayInfo;
- }
-
- private native void nativeUpdateSharedDeviceDisplayInfo(int displayHeight,
- int displayWidth, int bitsPerPixel,
- int bitsPerComponent, double dipScale,
- int smallestDIPWidth);
+ private final Context mAppContext;
+ private final WindowManager mWinManager;
+
+ private DeviceDisplayInfo(Context context) {
+ mAppContext = context.getApplicationContext();
+ mWinManager = (WindowManager) mAppContext.getSystemService(Context.WINDOW_SERVICE);
+ }
+
+ /**
+ * @return Display height in physical pixels.
+ */
+ @CalledByNative
+ public int getDisplayHeight() {
+ return getMetrics().heightPixels;
+ }
+
+ /**
+ * @return Display width in physical pixels.
+ */
+ @CalledByNative
+ public int getDisplayWidth() {
+ return getMetrics().widthPixels;
+ }
+
+ @SuppressWarnings("deprecation")
+ private int getPixelFormat() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return getDisplay().getPixelFormat();
+ }
+ // JellyBean MR1 and later always uses RGBA_8888.
+ return PixelFormat.RGBA_8888;
+ }
+
+ /**
+ * @return Bits per pixel.
+ */
+ @CalledByNative
+ public int getBitsPerPixel() {
+ int format = getPixelFormat();
+ PixelFormat info = new PixelFormat();
+ PixelFormat.getPixelFormatInfo(format, info);
+ return info.bitsPerPixel;
+ }
+
+ /**
+ * @return Bits per component.
+ */
+ @SuppressWarnings("deprecation")
+ @CalledByNative
+ public int getBitsPerComponent() {
+ int format = getPixelFormat();
+ switch (format) {
+ case PixelFormat.RGBA_4444:
+ return 4;
+
+ case PixelFormat.RGBA_5551:
+ return 5;
+
+ case PixelFormat.RGBA_8888:
+ case PixelFormat.RGBX_8888:
+ case PixelFormat.RGB_888:
+ return 8;
+
+ case PixelFormat.RGB_332:
+ return 2;
+
+ case PixelFormat.RGB_565:
+ return 5;
+
+ // Non-RGB formats.
+ case PixelFormat.A_8:
+ case PixelFormat.LA_88:
+ case PixelFormat.L_8:
+ return 0;
+
+ // Unknown format. Use 8 as a sensible default.
+ default:
+ return 8;
+ }
+ }
+
+ /**
+ * @return A scaling factor for the Density Independent Pixel unit. 1.0 is
+ * 160dpi, 0.75 is 120dpi, 2.0 is 320dpi.
+ */
+ @CalledByNative
+ public double getDIPScale() {
+ return getMetrics().density;
+ }
+
+ /**
+ * @return Smallest screen size in density-independent pixels that the
+ * application will see, regardless of orientation.
+ */
+ @CalledByNative
+ private int getSmallestDIPWidth() {
+ return mAppContext.getResources().getConfiguration().smallestScreenWidthDp;
+ }
+
+ private void registerListener() {
+ mAppContext.registerComponentCallbacks(
+ new ComponentCallbacks() {
+ @Override
+ public void onConfigurationChanged(Configuration configuration) {
+ updateNativeSharedDisplayInfo();
+ }
+
+ @Override
+ public void onLowMemory() {
+ }
+ });
+ }
+
+ private void updateNativeSharedDisplayInfo() {
+ nativeUpdateSharedDeviceDisplayInfo(getDisplayHeight(),
+ getDisplayWidth(), getBitsPerPixel(), getBitsPerComponent(),
+ getDIPScale(), getSmallestDIPWidth());
+ }
+
+ private Display getDisplay() {
+ return mWinManager.getDefaultDisplay();
+ }
+
+ private DisplayMetrics getMetrics() {
+ return mAppContext.getResources().getDisplayMetrics();
+ }
+
+ /**
+ * Creates DeviceDisplayInfo for a given Context.
+ *
+ * @param context A context to use.
+ * @return DeviceDisplayInfo associated with a given Context.
+ */
+ public static DeviceDisplayInfo create(Context context) {
+ return new DeviceDisplayInfo(context);
+ }
+
+ @CalledByNative
+ private static DeviceDisplayInfo createWithListener(Context context) {
+ DeviceDisplayInfo deviceDisplayInfo = new DeviceDisplayInfo(context);
+ deviceDisplayInfo.registerListener();
+ return deviceDisplayInfo;
+ }
+
+ private native void nativeUpdateSharedDeviceDisplayInfo(int displayHeight,
+ int displayWidth, int bitsPerPixel,
+ int bitsPerComponent, double dipScale,
+ int smallestDIPWidth);
}
diff --git a/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java b/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
index 6e2d6fe..bc57e1f 100644
--- a/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
+++ b/ui/android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
index 5e46760..53d3303 100644
--- a/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
+++ b/ui/android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
@@ -34,8 +34,8 @@ class SurfaceTexturePlatformWrapper {
@CalledByNative
private static void setFrameAvailableCallback(SurfaceTexture surfaceTexture,
long nativeSurfaceTextureListener) {
- surfaceTexture.setOnFrameAvailableListener(
- new SurfaceTextureListener(nativeSurfaceTextureListener));
+ surfaceTexture.setOnFrameAvailableListener(
+ new SurfaceTextureListener(nativeSurfaceTextureListener));
}
@CalledByNative