Loading src/com/android/settings/display/AutoBrightnessPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.provider.Settings; import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; import com.android.settings.DisplaySettings; import com.android.settings.core.PreferenceController; import com.android.settings.search.DatabaseIndexingUtils; import com.android.settings.search.InlineSwitchPayload; Loading Loading @@ -69,7 +70,7 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp @Override public ResultPayload getResultPayload() { final Intent intent = DatabaseIndexingUtils.buildSubsettingIntent(mContext, getClass().getName(), mAutoBrightnessKey, DisplaySettings.class.getName(), mAutoBrightnessKey, mContext.getString(R.string.display_settings)); return new InlineSwitchPayload(SCREEN_BRIGHTNESS_MODE, Loading src/com/android/settings/search/SearchResultsAdapter.java +4 −2 Original line number Diff line number Diff line Loading @@ -106,8 +106,10 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> view = inflater.inflate(R.layout.search_intent_item, parent, false); return new IntentSearchViewHolder(view); case ResultPayload.PayloadType.INLINE_SWITCH: view = inflater.inflate(R.layout.search_inline_switch_item, parent, false); return new InlineSwitchViewHolder(view, context); // TODO (b/62807132) replace layout InlineSwitchViewHolder and return an // InlineSwitchViewHolder. view = inflater.inflate(R.layout.search_intent_item, parent, false); return new IntentSearchViewHolder(view); case ResultPayload.PayloadType.SAVED_QUERY: view = inflater.inflate(R.layout.search_saved_query_item, parent, false); return new SavedQueryViewHolder(view); Loading tests/robotests/src/com/android/settings/search/SearchResultsAdapterTest.java +15 −17 Original line number Diff line number Diff line Loading @@ -112,19 +112,20 @@ public class SearchResultsAdapterTest { } @Test public void testCreateViewHolder_returnsInlineSwitchResult() { public void testCreateViewHolder_returnsIntentSwitchResult() { // TODO (b/62807132) test for InlineResult ViewGroup group = new FrameLayout(mContext); SearchViewHolder view = mAdapter.onCreateViewHolder(group, ResultPayload.PayloadType.INLINE_SWITCH); assertThat(view).isInstanceOf(InlineSwitchViewHolder.class); assertThat(view).isInstanceOf(IntentSearchViewHolder.class); } @Test public void testEndToEndSearch_properResultsMerged_correctOrder() { mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(getDummyAppResults()), mAdapter.addSearchResults(new HashSet<>(getDummyAppResults()), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(getDummyDbResults()), mAdapter.addSearchResults(new HashSet<>(getDummyDbResults()), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); Loading @@ -145,17 +146,17 @@ public class SearchResultsAdapterTest { List<SearchResult> dbResults = getDummyDbResults(); mAdapter.initializeSearch(""); // Add two individual items mAdapter.addSearchResults(new HashSet<SearchResult>(appResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(appResults.subList(0, 1)), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(dbResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(dbResults.subList(0, 1)), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); // Add super-set of items mAdapter.initializeSearch(""); mAdapter.addSearchResults( new HashSet<SearchResult>(appResults), InstalledAppResultLoader.class.getName()); new HashSet<>(appResults), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults( new HashSet<SearchResult>(dbResults), DatabaseResultLoader.class.getName()); new HashSet<>(dbResults), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); List<SearchResult> results = mAdapter.getSearchResults(); Loading @@ -176,14 +177,14 @@ public class SearchResultsAdapterTest { List<SearchResult> dbResults = getDummyDbResults(); // Add list of items mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(appResults), mAdapter.addSearchResults(new HashSet<>(appResults), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(dbResults), mAdapter.addSearchResults(new HashSet<>(dbResults), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); // Add subset of items mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(appResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(appResults.subList(0, 1)), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<>(dbResults.subList(0, 1)), DatabaseResultLoader.class.getName()); Loading Loading @@ -568,12 +569,9 @@ public class SearchResultsAdapterTest { private List<Pair<String, Float>> getDummyRankingScores() { List<SearchResult> results = getDummyDbResults(); List<Pair<String, Float>> scores = new ArrayList<>(); scores.add( new Pair<String, Float>(Long.toString(results.get(2).stableId), 0.9f)); // charlie scores.add( new Pair<String, Float>(Long.toString(results.get(0).stableId), 0.8f)); // alpha scores.add( new Pair<String, Float>(Long.toString(results.get(1).stableId), 0.2f)); // bravo scores.add(new Pair<>(Long.toString(results.get(2).stableId), 0.9f)); // charlie scores.add(new Pair<>(Long.toString(results.get(0).stableId), 0.8f)); // alpha scores.add(new Pair<>(Long.toString(results.get(1).stableId), 0.2f)); // bravo return scores; } } Loading
src/com/android/settings/display/AutoBrightnessPreferenceController.java +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.provider.Settings; import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; import com.android.settings.DisplaySettings; import com.android.settings.core.PreferenceController; import com.android.settings.search.DatabaseIndexingUtils; import com.android.settings.search.InlineSwitchPayload; Loading Loading @@ -69,7 +70,7 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp @Override public ResultPayload getResultPayload() { final Intent intent = DatabaseIndexingUtils.buildSubsettingIntent(mContext, getClass().getName(), mAutoBrightnessKey, DisplaySettings.class.getName(), mAutoBrightnessKey, mContext.getString(R.string.display_settings)); return new InlineSwitchPayload(SCREEN_BRIGHTNESS_MODE, Loading
src/com/android/settings/search/SearchResultsAdapter.java +4 −2 Original line number Diff line number Diff line Loading @@ -106,8 +106,10 @@ public class SearchResultsAdapter extends RecyclerView.Adapter<SearchViewHolder> view = inflater.inflate(R.layout.search_intent_item, parent, false); return new IntentSearchViewHolder(view); case ResultPayload.PayloadType.INLINE_SWITCH: view = inflater.inflate(R.layout.search_inline_switch_item, parent, false); return new InlineSwitchViewHolder(view, context); // TODO (b/62807132) replace layout InlineSwitchViewHolder and return an // InlineSwitchViewHolder. view = inflater.inflate(R.layout.search_intent_item, parent, false); return new IntentSearchViewHolder(view); case ResultPayload.PayloadType.SAVED_QUERY: view = inflater.inflate(R.layout.search_saved_query_item, parent, false); return new SavedQueryViewHolder(view); Loading
tests/robotests/src/com/android/settings/search/SearchResultsAdapterTest.java +15 −17 Original line number Diff line number Diff line Loading @@ -112,19 +112,20 @@ public class SearchResultsAdapterTest { } @Test public void testCreateViewHolder_returnsInlineSwitchResult() { public void testCreateViewHolder_returnsIntentSwitchResult() { // TODO (b/62807132) test for InlineResult ViewGroup group = new FrameLayout(mContext); SearchViewHolder view = mAdapter.onCreateViewHolder(group, ResultPayload.PayloadType.INLINE_SWITCH); assertThat(view).isInstanceOf(InlineSwitchViewHolder.class); assertThat(view).isInstanceOf(IntentSearchViewHolder.class); } @Test public void testEndToEndSearch_properResultsMerged_correctOrder() { mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(getDummyAppResults()), mAdapter.addSearchResults(new HashSet<>(getDummyAppResults()), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(getDummyDbResults()), mAdapter.addSearchResults(new HashSet<>(getDummyDbResults()), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); Loading @@ -145,17 +146,17 @@ public class SearchResultsAdapterTest { List<SearchResult> dbResults = getDummyDbResults(); mAdapter.initializeSearch(""); // Add two individual items mAdapter.addSearchResults(new HashSet<SearchResult>(appResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(appResults.subList(0, 1)), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(dbResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(dbResults.subList(0, 1)), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); // Add super-set of items mAdapter.initializeSearch(""); mAdapter.addSearchResults( new HashSet<SearchResult>(appResults), InstalledAppResultLoader.class.getName()); new HashSet<>(appResults), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults( new HashSet<SearchResult>(dbResults), DatabaseResultLoader.class.getName()); new HashSet<>(dbResults), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); List<SearchResult> results = mAdapter.getSearchResults(); Loading @@ -176,14 +177,14 @@ public class SearchResultsAdapterTest { List<SearchResult> dbResults = getDummyDbResults(); // Add list of items mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(appResults), mAdapter.addSearchResults(new HashSet<>(appResults), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<SearchResult>(dbResults), mAdapter.addSearchResults(new HashSet<>(dbResults), DatabaseResultLoader.class.getName()); mAdapter.notifyResultsLoaded(); // Add subset of items mAdapter.initializeSearch(""); mAdapter.addSearchResults(new HashSet<SearchResult>(appResults.subList(0, 1)), mAdapter.addSearchResults(new HashSet<>(appResults.subList(0, 1)), InstalledAppResultLoader.class.getName()); mAdapter.addSearchResults(new HashSet<>(dbResults.subList(0, 1)), DatabaseResultLoader.class.getName()); Loading Loading @@ -568,12 +569,9 @@ public class SearchResultsAdapterTest { private List<Pair<String, Float>> getDummyRankingScores() { List<SearchResult> results = getDummyDbResults(); List<Pair<String, Float>> scores = new ArrayList<>(); scores.add( new Pair<String, Float>(Long.toString(results.get(2).stableId), 0.9f)); // charlie scores.add( new Pair<String, Float>(Long.toString(results.get(0).stableId), 0.8f)); // alpha scores.add( new Pair<String, Float>(Long.toString(results.get(1).stableId), 0.2f)); // bravo scores.add(new Pair<>(Long.toString(results.get(2).stableId), 0.9f)); // charlie scores.add(new Pair<>(Long.toString(results.get(0).stableId), 0.8f)); // alpha scores.add(new Pair<>(Long.toString(results.get(1).stableId), 0.2f)); // bravo return scores; } }