Merge change 24908 into eclair

* changes:
  Show icons for storage and geolocation
diff --git a/res/drawable/location.png b/res/drawable/location.png
new file mode 100644
index 0000000..c7eb1dc
--- /dev/null
+++ b/res/drawable/location.png
Binary files differ
diff --git a/res/drawable/usage_empty.png b/res/drawable/usage_empty.png
new file mode 100644
index 0000000..6a7e2db
--- /dev/null
+++ b/res/drawable/usage_empty.png
Binary files differ
diff --git a/res/drawable/usage_high.png b/res/drawable/usage_high.png
new file mode 100644
index 0000000..006e1ac
--- /dev/null
+++ b/res/drawable/usage_high.png
Binary files differ
diff --git a/res/drawable/usage_low.png b/res/drawable/usage_low.png
new file mode 100644
index 0000000..828ffb2
--- /dev/null
+++ b/res/drawable/usage_low.png
Binary files differ
diff --git a/res/drawable/usage_medium.png b/res/drawable/usage_medium.png
new file mode 100644
index 0000000..dc37363
--- /dev/null
+++ b/res/drawable/usage_medium.png
Binary files differ
diff --git a/res/layout/application.xml b/res/layout/application.xml
deleted file mode 100644
index d8de265..0000000
--- a/res/layout/application.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-  android:drawingCacheQuality="auto"
-  android:layout_width="fill_parent"
-  android:layout_height="wrap_content"
-  android:gravity="center"
-  android:padding="0dip">
-
-  <ImageView android:id="@+id/icon"
-    android:layout_width="32px"
-    android:layout_height="32px"
-    android:padding="2dip" />
-
-  <TwoLineListItem
-    android:paddingTop="2dip"
-    android:paddingBottom="2dip"
-    android:layout_width="fill_parent"
-    android:layout_height="wrap_content"
-    android:minHeight="?android:attr/listPreferredItemHeight"
-    android:mode="twoLine">
-
-    <TextView android:id="@+id/title"
-      android:layout_width="fill_parent"
-      android:layout_height="wrap_content"
-      android:layout_marginLeft="6dip"
-      android:layout_marginTop="6dip"
-      android:textAppearance="?android:attr/textAppearanceLarge"/>
-
-    <TextView android:id="@+id/subtitle"
-      android:layout_width="fill_parent"
-      android:layout_height="wrap_content"
-      android:layout_below="@+id/title"
-      android:layout_alignLeft="@+id/title"
-      android:textAppearance="?android:attr/textAppearanceSmall"/>
-
-  </TwoLineListItem>
-
-</LinearLayout>
diff --git a/res/layout/website_settings_row.xml b/res/layout/website_settings_row.xml
new file mode 100644
index 0000000..911e1d6
--- /dev/null
+++ b/res/layout/website_settings_row.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  android:drawingCacheQuality="auto"
+  android:layout_width="fill_parent"
+  android:layout_height="?android:attr/listPreferredItemHeight"
+  android:gravity="center"
+  android:padding="0dip">
+
+  <ImageView android:id="@+id/icon"
+    android:layout_width="32px"
+    android:layout_height="32px"
+    android:layout_alignParentTop="true"
+    android:layout_alignParentLeft="true"
+    android:layout_alignParentBottom="true"
+    android:padding="2dip" />
+
+  <LinearLayout android:id="@+id/features"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_alignParentTop="true"
+    android:layout_alignParentBottom="true"
+    android:layout_alignParentRight="true"
+    android:gravity="center"
+    android:padding="0dip"
+    android:layout_marginRight="2dip">
+
+    <ImageView android:id="@+id/location_icon"
+      android:layout_width="32px"
+      android:layout_height="32px"
+      android:padding="2dip" />
+
+    <ImageView android:id="@+id/usage_icon"
+      android:layout_width="32px"
+      android:layout_height="32px"
+      android:padding="2dip" />
+
+  </LinearLayout>
+
+  <TextView android:id="@+id/title"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_alignParentTop="true"
+    android:layout_alignWithParentIfMissing="true"
+    android:layout_toRightOf="@id/icon"
+    android:layout_toLeftOf="@id/features"
+    android:layout_marginLeft="6dip"
+    android:layout_marginTop="6dip"
+    android:textAppearance="?android:attr/textAppearanceLarge"/>
+
+  <TextView android:id="@+id/subtitle"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_toRightOf="@id/icon"
+    android:layout_toLeftOf="@id/features"
+    android:layout_below="@id/title"
+    android:layout_alignLeft="@id/title"
+    android:layout_marginBottom="2dip"
+    android:textAppearance="?android:attr/textAppearanceSmall"/>
+
+</RelativeLayout>
diff --git a/src/com/android/browser/WebsiteSettingsActivity.java b/src/com/android/browser/WebsiteSettingsActivity.java
index fc72b62..9c9b6ac 100644
--- a/src/com/android/browser/WebsiteSettingsActivity.java
+++ b/src/com/android/browser/WebsiteSettingsActivity.java
@@ -155,6 +155,11 @@
         private int mResource;
         private LayoutInflater mInflater;
         private Bitmap mDefaultIcon;
+        private Bitmap mUsageEmptyIcon;
+        private Bitmap mUsageLowIcon;
+        private Bitmap mUsageMediumIcon;
+        private Bitmap mUsageHighIcon;
+        private Bitmap mLocationIcon;
         private Site mCurrentSite;
 
         public SiteAdapter(Context context, int rsc) {
@@ -163,6 +168,16 @@
             mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             mDefaultIcon = BitmapFactory.decodeResource(getResources(),
                     R.drawable.ic_launcher_shortcut_browser_bookmark);
+            mUsageEmptyIcon = BitmapFactory.decodeResource(getResources(),
+                    R.drawable.usage_empty);
+            mUsageLowIcon = BitmapFactory.decodeResource(getResources(),
+                    R.drawable.usage_low);
+            mUsageMediumIcon = BitmapFactory.decodeResource(getResources(),
+                    R.drawable.usage_medium);
+            mUsageHighIcon = BitmapFactory.decodeResource(getResources(),
+                    R.drawable.usage_high);
+            mLocationIcon = BitmapFactory.decodeResource(getResources(),
+                    R.drawable.location);
             populateOrigins();
         }
 
@@ -315,6 +330,8 @@
             TextView title;
             TextView subtitle;
             ImageView icon;
+            ImageView usageIcon;
+            ImageView locationIcon;
 
             if (convertView == null) {
                 view = mInflater.inflate(mResource, parent, false);
@@ -325,6 +342,10 @@
             title = (TextView) view.findViewById(R.id.title);
             subtitle = (TextView) view.findViewById(R.id.subtitle);
             icon = (ImageView) view.findViewById(R.id.icon);
+            usageIcon = (ImageView) view.findViewById(R.id.usage_icon);
+            locationIcon = (ImageView) view.findViewById(R.id.location_icon);
+            usageIcon.setVisibility(View.GONE);
+            locationIcon.setVisibility(View.GONE);
 
             if (mCurrentSite == null) {
                 setTitle(getString(R.string.pref_extras_website_settings));
@@ -333,6 +354,8 @@
                 title.setText(site.getPrettyTitle());
                 subtitle.setText(site.getPrettyOrigin());
                 icon.setVisibility(View.VISIBLE);
+                usageIcon.setVisibility(View.INVISIBLE);
+                locationIcon.setVisibility(View.INVISIBLE);
                 Bitmap bmp = site.getIcon();
                 if (bmp == null) {
                     bmp = mDefaultIcon;
@@ -341,6 +364,33 @@
                 // We set the site as the view's tag,
                 // so that we can get it in onItemClick()
                 view.setTag(site);
+
+                if (site.hasFeature(Site.FEATURE_WEB_STORAGE)) {
+                  String origin = site.getOrigin();
+                  long usageInBytes = WebStorage.getInstance().getUsageForOrigin(origin);
+                  float usageInMegabytes = (float) usageInBytes / (1024.0F * 1024.0F);
+                  usageIcon.setVisibility(View.VISIBLE);
+
+                  // We set the correct icon:
+                  // 0 < empty < 0.1MB
+                  // 0.1MB < low < 3MB
+                  // 3MB < medium < 6MB
+                  // 6MB < high
+                  if (usageInMegabytes <= 0.1) {
+                    usageIcon.setImageBitmap(mUsageEmptyIcon);
+                  } else if (usageInMegabytes > 0.1 && usageInMegabytes <= 3) {
+                    usageIcon.setImageBitmap(mUsageLowIcon);
+                  } else if (usageInMegabytes > 3 && usageInMegabytes <= 6) {
+                    usageIcon.setImageBitmap(mUsageMediumIcon);
+                  } else if (usageInMegabytes > 6) {
+                    usageIcon.setImageBitmap(mUsageHighIcon);
+                  }
+                }
+
+                if (site.hasFeature(Site.FEATURE_GEOLOCATION)) {
+                  locationIcon.setVisibility(View.VISIBLE);
+                  locationIcon.setImageBitmap(mLocationIcon);
+                }
             } else {
                 setTitle(mCurrentSite.getPrettyTitle());
                 icon.setVisibility(View.GONE);
@@ -432,7 +482,7 @@
         if (sMBStored == null) {
             sMBStored = getString(R.string.webstorage_origin_summary_mb_stored);
         }
-        mAdapter = new SiteAdapter(this, R.layout.application);
+        mAdapter = new SiteAdapter(this, R.layout.website_settings_row);
         setListAdapter(mAdapter);
         getListView().setOnItemClickListener(mAdapter);
     }