blob: 5517d9c3338417c2727856db49e95b181b4056fb [file] [log] [blame]
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -04001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.browser;
18
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040019import android.content.Context;
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040020import android.widget.GridView;
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040021
22import java.util.ArrayList;
23
Leon Scroggins892df312009-07-14 14:48:02 -040024public class BookmarkGridPage extends GridView {
25 private final static int SPACING = 10;
26 private BrowserBookmarksAdapter mAdapter;
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040027
Leon Scroggins892df312009-07-14 14:48:02 -040028 public BookmarkGridPage(Context context, BrowserBookmarksAdapter adapter) {
29 super(context);
30 setNumColumns(3);
31 mAdapter = adapter;
32 setAdapter(mAdapter);
33 setFocusable(true);
34 setFocusableInTouchMode(true);
35 setSelector(android.R.drawable.gallery_thumb);
36 setVerticalSpacing(SPACING);
37 setHorizontalSpacing(SPACING);
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040038 }
39
Leon Scroggins71bd3662009-07-06 16:40:00 -040040 @Override
Leon Scroggins892df312009-07-14 14:48:02 -040041 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
42 int thumbHeight = (h - 2 * (SPACING + getListPaddingTop()
43 + getListPaddingBottom())) / 3;
44 mAdapter.heightChanged(thumbHeight);
45 super.onSizeChanged(w, h, oldw, oldh);
Leon Scrogginsb6b7f9e2009-06-18 12:05:28 -040046 }
47}