Use more columns in CorpusSelectionDialog when in landscape mode.

bug: http://b/issue?id=2641580
Change-Id: I23a88091b0b739ef12b6c0a828d771e1eec98cfc
diff --git a/res/layout/corpus_selection_dialog.xml b/res/layout/corpus_selection_dialog.xml
index 2968396..c826f86 100644
--- a/res/layout/corpus_selection_dialog.xml
+++ b/res/layout/corpus_selection_dialog.xml
@@ -52,6 +52,7 @@
             android:layout_gravity="top|left"
             android:horizontalSpacing="2dip"
             android:verticalSpacing="2dip"
+            android:numColumns="@integer/corpus_selection_dialog_columns"
             android:listSelector="@drawable/corpus_grid_item_bg"
             />
 
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
new file mode 100644
index 0000000..502f746
--- /dev/null
+++ b/res/values-land/styles.xml
@@ -0,0 +1,21 @@
+<?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>
+    <!-- The number of columns in the business listing launcher GridView -->
+    <integer name="corpus_selection_dialog_columns">6</integer>
+
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 4cec2ac..1dd2adf 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -41,4 +41,7 @@
         <item name="android:windowExitAnimation">@anim/corpus_selector_close</item>
     </style>
 
+    <!-- The number of columns in the business listing launcher GridView -->
+    <integer name="corpus_selection_dialog_columns">4</integer>
+
 </resources>
diff --git a/src/com/android/quicksearchbox/CorpusSelectionDialog.java b/src/com/android/quicksearchbox/CorpusSelectionDialog.java
index 1d84e78..8a72c62 100644
--- a/src/com/android/quicksearchbox/CorpusSelectionDialog.java
+++ b/src/com/android/quicksearchbox/CorpusSelectionDialog.java
@@ -42,10 +42,10 @@
     private static final boolean DBG = false;
     private static final String TAG = "QSB.SelectSearchSourceDialog";
 
-    private static final int NUM_COLUMNS = 4;
-
     private GridView mCorpusGrid;
 
+    private final int mGridColumns;
+
     private OnCorpusSelectedListener mListener;
 
     private Corpus mCorpus;
@@ -54,6 +54,7 @@
 
     public CorpusSelectionDialog(Context context) {
         super(context, R.style.Theme_SelectSearchSource);
+        mGridColumns = context.getResources().getInteger(R.integer.corpus_selection_dialog_columns);
     }
 
     /**
@@ -74,7 +75,6 @@
     protected void onCreate(Bundle savedInstanceState) {
         setContentView(R.layout.corpus_selection_dialog);
         mCorpusGrid = (GridView) findViewById(R.id.corpus_grid);
-        mCorpusGrid.setNumColumns(NUM_COLUMNS);
         mCorpusGrid.setOnItemClickListener(new CorpusClickListener());
         // TODO: for some reason, putting this in the XML layout instead makes
         // the list items unclickable.
@@ -133,7 +133,7 @@
         }
         // Dismiss dialog on up move when nothing, or an item on the top row, is selected.
         if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
-            int selectedRow = mCorpusGrid.getSelectedItemPosition() / NUM_COLUMNS;
+            int selectedRow = mCorpusGrid.getSelectedItemPosition() / mGridColumns;
             if (selectedRow <= 0) {
                 cancel();
                 return true;
diff --git a/src/com/android/quicksearchbox/SearchableItemsSettings.java b/src/com/android/quicksearchbox/SearchableItemsSettings.java
index 468657b..5dc4cf8 100644
--- a/src/com/android/quicksearchbox/SearchableItemsSettings.java
+++ b/src/com/android/quicksearchbox/SearchableItemsSettings.java
@@ -16,14 +16,11 @@
 
 package com.android.quicksearchbox;
 
-import android.app.SearchManager;
-import android.content.Intent;
 import android.os.Bundle;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.util.Log;
 
diff --git a/src/com/android/quicksearchbox/SuggestionsProviderImpl.java b/src/com/android/quicksearchbox/SuggestionsProviderImpl.java
index 36edb19..a492df4 100644
--- a/src/com/android/quicksearchbox/SuggestionsProviderImpl.java
+++ b/src/com/android/quicksearchbox/SuggestionsProviderImpl.java
@@ -19,14 +19,12 @@
 import com.android.quicksearchbox.util.BatchingNamedTaskExecutor;
 import com.android.quicksearchbox.util.Consumer;
 import com.android.quicksearchbox.util.NamedTaskExecutor;
-import com.android.quicksearchbox.util.Util;
 
 import android.os.Handler;
 import android.util.Log;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 
 /**
  * Suggestions provider implementation.
diff --git a/src/com/android/quicksearchbox/ui/SuggestionsView.java b/src/com/android/quicksearchbox/ui/SuggestionsView.java
index d12f0d9..a73f1fa 100644
--- a/src/com/android/quicksearchbox/ui/SuggestionsView.java
+++ b/src/com/android/quicksearchbox/ui/SuggestionsView.java
@@ -22,7 +22,6 @@
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.util.Log;
-import android.view.MotionEvent;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ListView;