summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/view
diff options
context:
space:
mode:
authorDave Tharp <dtharp@codeaurora.org>2015-06-19 08:46:57 -0700
committerjrizzoli <joey@cyanogenmoditalia.it>2015-08-28 13:15:45 +0200
commit9a082b13f1011a40d3dea942fa8ad3d40ed41971 (patch)
tree08d48b2ceab57e4df09e108f38e619e1d5eeaa01 /src/com/android/browser/view
parent490ca7fb96367bd8444698b59a5d0fe17f1a90d1 (diff)
downloadandroid_packages_apps_Gello-9a082b13f1011a40d3dea942fa8ad3d40ed41971.tar.gz
android_packages_apps_Gello-9a082b13f1011a40d3dea942fa8ad3d40ed41971.tar.bz2
android_packages_apps_Gello-9a082b13f1011a40d3dea942fa8ad3d40ed41971.zip
MDM Edit Bookmark Restriction
When enabled through the MDM mechanism, Bookmark editing operations are disabled: - Edit and Delete pop-up menu options are disabled - The 'Add Bookmark' and 'New Folder' buttons are greyed and if pressed a Toast message is displayed: 'Managed by your administrator' - All existing bookmark items (except the MDM Managed tree if it is present) are overlaid with a lock icon (existing: ic_deco_secure). - The 'Star' icon is greyed and if pressed results in the above Toast message New files are the core implementation of the EditBookmarksRestriction and the tests for it: EditBookmarksRestriction.java EditBookmarkRestrictionsTest.java Note the has been some refactoring in BrowserBookmarksAdapter.java to simplify the handling of bitmaps with regard to overlay operations. We now always set the bitmaps with setImageBitmap() instead of sometimes using setImageResource(). This simplifies the code considerably but does result in a side effect: Folder icons look a bit different now because they are translated and scaled the same way as bookmark bitmaps. So instead of center-crop, they appear as if they are scaled width-wise and top-aligned. Personally, I like the look, but if its not acceptable, I'll adjust it as needed. Change-Id: I966f84485873593ca70f2822cdace30a15464c44
Diffstat (limited to 'src/com/android/browser/view')
-rw-r--r--src/com/android/browser/view/BookmarkThumbImageView.java48
1 files changed, 18 insertions, 30 deletions
diff --git a/src/com/android/browser/view/BookmarkThumbImageView.java b/src/com/android/browser/view/BookmarkThumbImageView.java
index 21c1f4fb..50b35447 100644
--- a/src/com/android/browser/view/BookmarkThumbImageView.java
+++ b/src/com/android/browser/view/BookmarkThumbImageView.java
@@ -38,8 +38,6 @@ import android.widget.ImageView;
public class BookmarkThumbImageView extends ImageView {
- private boolean mAdjustDown = true;
-
public BookmarkThumbImageView(Context context) {
this(context, null);
}
@@ -52,39 +50,29 @@ public class BookmarkThumbImageView extends ImageView {
super(context, attrs, defStyleAttr);
}
- public boolean getAdjustDown() {
- return mAdjustDown;
- }
-
- public void setmAdjustDown(boolean mAdjustDown) {
- this.mAdjustDown = mAdjustDown;
- }
-
@Override
public void setImageDrawable(Drawable drawable) {
- if (mAdjustDown) {
- int drawableWidth = drawable.getIntrinsicWidth();
- int drawableHeight = drawable.getIntrinsicHeight();
- int containerWidth = getWidth() - getPaddingLeft() - getPaddingRight();
- int containerHeight = getHeight() - getPaddingTop() - getPaddingBottom();
+ int drawableWidth = drawable.getIntrinsicWidth();
+ int drawableHeight = drawable.getIntrinsicHeight();
+ int containerWidth = getWidth() - getPaddingLeft() - getPaddingRight();
+ int containerHeight = getHeight() - getPaddingTop() - getPaddingBottom();
- float scale;
- Matrix m = new Matrix();
- if ( (drawableWidth * containerHeight) > (containerWidth * drawableHeight)) {
- scale = (float) containerHeight / (float) drawableHeight;
- } else {
- scale = (float) containerWidth / (float) drawableWidth;
- float translateY = (containerHeight - drawableHeight * scale) / 2;
- if (translateY < 0) {
- translateY = 0;
- }
- m.postTranslate(0, translateY + 0.5f);
+ float scale;
+ Matrix m = new Matrix();
+ if ( (drawableWidth * containerHeight) > (containerWidth * drawableHeight)) {
+ scale = (float) containerHeight / (float) drawableHeight;
+ } else {
+ scale = (float) containerWidth / (float) drawableWidth;
+ float translateY = (containerHeight - drawableHeight * scale) / 2;
+ if (translateY < 0) {
+ translateY = 0;
}
- m.setScale(scale, scale);
-
- this.setScaleType(ScaleType.MATRIX);
- this.setImageMatrix(m);
+ m.postTranslate(0, translateY + 0.5f);
}
+ m.setScale(scale, scale);
+
+ this.setScaleType(ScaleType.MATRIX);
+ this.setImageMatrix(m);
super.setImageDrawable(drawable);
}
}