Adjusting wallpaper picker to match spec
Change-Id: I004f15119648b9435bd73a400bd0193962e9569f
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/live_wallpaper_grid_item_padding">
|
||||
<ImageView
|
||||
android:id="@+id/thumbnail"
|
||||
android:layout_width="@dimen/live_wallpaper_grid_item_width"
|
||||
android:layout_height="@dimen/live_wallpaper_grid_item_height"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="centerCrop" />
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="22dp"
|
||||
android:layout_weight="0"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="bottom"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:shadowColor="#FF000000"
|
||||
android:shadowDx="0.0"
|
||||
android:shadowDy="1.0"
|
||||
android:shadowRadius="1.0" />
|
||||
</LinearLayout>
|
||||
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="24dp"
|
||||
android:gravity="center">
|
||||
<GridView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="636dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:numColumns="3"
|
||||
android:stretchMode="none"
|
||||
android:columnWidth="@dimen/live_wallpaper_column_width"
|
||||
android:verticalSpacing="0dp"
|
||||
android:horizontalSpacing="0dp"
|
||||
android:drawSelectorOnTop="false" />
|
||||
<!--
|
||||
android:text="@string/live_wallpaper_empty"
|
||||
-->
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:shadowColor="#FF000000"
|
||||
android:shadowDx="0.0"
|
||||
android:shadowDy="1.0"
|
||||
android:shadowRadius="1.0" />
|
||||
</FrameLayout>
|
||||
@@ -18,13 +18,34 @@
|
||||
*/
|
||||
-->
|
||||
|
||||
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_gravity="center"
|
||||
android:numColumns="3"
|
||||
android:stretchMode="spacingWidth"
|
||||
android:columnWidth="@dimen/wallpaper_chooser_grid_width"
|
||||
android:verticalSpacing="15dp"
|
||||
android:drawSelectorOnTop="false" />
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/wallpaper_list"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="24dp"
|
||||
android:paddingBottom="24dp"
|
||||
android:gravity="center">
|
||||
<GridView
|
||||
android:id="@+id/gallery"
|
||||
android:layout_width="636dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:numColumns="3"
|
||||
android:stretchMode="none"
|
||||
android:columnWidth="@dimen/live_wallpaper_column_width"
|
||||
android:verticalSpacing="0dp"
|
||||
android:horizontalSpacing="0dp"
|
||||
android:drawSelectorOnTop="false" />
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
|
||||
android:text="@string/wallpaper_chooser_empty"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
</FrameLayout>
|
||||
@@ -19,5 +19,5 @@
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
@@ -13,11 +13,16 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/wallpaper_chooser_grid_height"
|
||||
android:padding="6dp"
|
||||
android:scaleType="fitXY"
|
||||
android:adjustViewBounds="false"
|
||||
android:focusable="false" />
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/live_wallpaper_grid_item_padding">
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/wallpaper_image"
|
||||
android:layout_width="@dimen/wallpaper_chooser_grid_width"
|
||||
android:layout_height="@dimen/wallpaper_chooser_grid_height"
|
||||
android:scaleType="centerCrop"
|
||||
android:adjustViewBounds="false"
|
||||
android:focusable="false"
|
||||
android:padding="0dp" />
|
||||
</FrameLayout>
|
||||
@@ -15,6 +15,7 @@
|
||||
-->
|
||||
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/wallpaper_image"
|
||||
android:background="?android:attr/galleryItemBackground"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -53,6 +53,14 @@
|
||||
<dimen name="delete_zone_horizontal_drag_padding">20dip</dimen>
|
||||
|
||||
<!-- dimensions for the wallpaper picker wallpaper thumbnail width -->
|
||||
<dimen name="wallpaper_chooser_grid_width">230dp</dimen>
|
||||
<dimen name="wallpaper_chooser_grid_height">185dp</dimen>
|
||||
<dimen name="wallpaper_chooser_grid_width">196dp</dimen>
|
||||
<dimen name="wallpaper_chooser_grid_height">140dp</dimen>
|
||||
<dimen name="live_wallpaper_grid_item_padding">8dip</dimen>
|
||||
|
||||
<!-- live_wallpaper_grid_item_width + 2 * live_wallpaper_grid_item_padding-->
|
||||
<dimen name="live_wallpaper_column_width">212dip</dimen>
|
||||
|
||||
<!-- How much the content view of an alert dialog should be inset (currently used
|
||||
for the WallpaperChooser in XLarge mode) -->
|
||||
<dimen name="alert_dialog_content_inset">0dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* copyright (c) 2010 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="live_wallpaper_preview_button_width">200dip</dimen>
|
||||
<dimen name="live_wallpaper_grid_item_width">196dip</dimen>
|
||||
<dimen name="live_wallpaper_grid_item_height">140dip</dimen>
|
||||
<dimen name="live_wallpaper_grid_item_padding">8dip</dimen>
|
||||
|
||||
<!-- live_wallpaper_grid_item_width + 2 * live_wallpaper_grid_item_padding-->
|
||||
<dimen name="live_wallpaper_column_width">212dip</dimen>
|
||||
</resources>
|
||||
@@ -21,6 +21,9 @@
|
||||
<!-- Title of the wallpaper selection dialog [CHAR_LIMIT=40]-->
|
||||
<string name="wallpaper_dialog_title">Select wallpaper</string>
|
||||
|
||||
<!-- Text to show when there are no wallpapers [CHAR_LIMIT=40]-->
|
||||
<string name="wallpaper_chooser_empty">No wallpapers available</string>
|
||||
|
||||
<!-- Negative button text for the wallpaper selection dialog [CHAR_LIMIT=40]-->
|
||||
<string name="wallpaper_cancel">Cancel</string>
|
||||
</resources>
|
||||
@@ -44,8 +44,4 @@
|
||||
<!-- the area at the edge of the screen that makes the workspace go left
|
||||
or right while you're dragging. -->
|
||||
<dimen name="scroll_zone">20dp</dimen>
|
||||
|
||||
<!-- How much the content view of an alert dialog should be inset (currently used
|
||||
for the WallpaperChooser in XLarge mode) -->
|
||||
<dimen name="alert_dialog_content_inset">15dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -37,6 +37,7 @@ import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Gallery;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
@@ -120,10 +121,11 @@ public class WallpaperChooserDialogFragment extends DialogFragment implements
|
||||
final int viewInset =
|
||||
getResources().getDimensionPixelSize(R.dimen.alert_dialog_content_inset);
|
||||
|
||||
FrameLayout wallPaperList = (FrameLayout) v.findViewById(R.id.wallpaper_list);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setNegativeButton(R.string.wallpaper_cancel, null);
|
||||
builder.setTitle(R.string.wallpaper_dialog_title);
|
||||
builder.setView(gridView, viewInset, viewInset, viewInset, viewInset);
|
||||
builder.setView(wallPaperList, viewInset, viewInset, viewInset, viewInset);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@@ -241,14 +243,16 @@ public class WallpaperChooserDialogFragment extends DialogFragment implements
|
||||
}
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ImageView image;
|
||||
View view;
|
||||
|
||||
if (convertView == null) {
|
||||
image = (ImageView) mLayoutInflater.inflate(R.layout.wallpaper_item, parent, false);
|
||||
view = mLayoutInflater.inflate(R.layout.wallpaper_item, parent, false);
|
||||
} else {
|
||||
image = (ImageView) convertView;
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);
|
||||
|
||||
int thumbRes = mThumbs.get(position);
|
||||
image.setImageResource(thumbRes);
|
||||
Drawable thumbDrawable = image.getDrawable();
|
||||
@@ -259,7 +263,7 @@ public class WallpaperChooserDialogFragment extends DialogFragment implements
|
||||
+ position);
|
||||
}
|
||||
|
||||
return image;
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user