This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2014 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypedValue outValue = new TypedValue(); | |
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); | |
setBackgroundResource(outValue.resourceId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf8 | |
set showcmd | |
set showmatch | |
set nocompatible | |
set ruler | |
set tabstop=2 | |
set shiftwidth=2 | |
set backspace=2 | |
set expandtab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onScrollChanged(int l, int t, int oldl, int oldt) { | |
super.onScrollChanged(l, t, oldl, oldt); | |
if (lastTouchAction == MotionEvent.ACTION_UP) { | |
if (t > oldt && direction != Direction.UP2DOWN) { | |
direction = Direction.DOWN2UP; | |
if (scrollListener != null) { | |
scrollListener.onScrollDownTop(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Bundle appData = new Bundle(); | |
appData.putLong("data", data); | |
// use reflection to call hidden method | |
Method setAppSearchData = searchView.getClass().getMethod("setAppSearchData", Bundle.class); | |
setAppSearchData.invoke(searchView, appData); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onSuggestionClick(int position) { | |
CursorWrapper cursor = (CursorWrapper) searchView.getSuggestionsAdapter().getItem(position); | |
String query = cursor.getString(cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1)); | |
searchView.setQuery(query, true); | |
return true; | |
} |