|
|
@ -328,14 +328,14 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
mSearch.setOnEditorActionListener(search); |
|
|
|
mSearch.setOnEditorActionListener(search); |
|
|
|
mSearch.setOnTouchListener(search); |
|
|
|
mSearch.setOnTouchListener(search); |
|
|
|
|
|
|
|
|
|
|
|
new Thread(new Runnable() { |
|
|
|
BrowserApp.getTaskThread().execute(new Runnable() { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
initializeSearchSuggestions(mSearch); |
|
|
|
initializeSearchSuggestions(mSearch); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}).run(); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, GravityCompat.END); |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_right_shadow, GravityCompat.END); |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_left_shadow, GravityCompat.START); |
|
|
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_left_shadow, GravityCompat.START); |
|
|
@ -1480,42 +1480,49 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements |
|
|
|
* previously searched URLs |
|
|
|
* previously searched URLs |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) { |
|
|
|
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) { |
|
|
|
getUrl.setThreshold(1); |
|
|
|
|
|
|
|
getUrl.setDropDownWidth(-1); |
|
|
|
|
|
|
|
getUrl.setDropDownAnchor(R.id.toolbar_layout); |
|
|
|
|
|
|
|
getUrl.setOnItemClickListener(new OnItemClickListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mSearchAdapter = new SearchAdapter(this, mDarkTheme, isIncognito()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getUrl.post(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) { |
|
|
|
public void run() { |
|
|
|
String url = null; |
|
|
|
getUrl.setThreshold(1); |
|
|
|
CharSequence urlString = ((TextView) view.findViewById(R.id.url)).getText(); |
|
|
|
getUrl.setDropDownWidth(-1); |
|
|
|
if (urlString != null) { |
|
|
|
getUrl.setDropDownAnchor(R.id.toolbar_layout); |
|
|
|
url = urlString.toString(); |
|
|
|
getUrl.setOnItemClickListener(new OnItemClickListener() { |
|
|
|
} |
|
|
|
|
|
|
|
if (url == null || url.startsWith(BrowserActivity.this.getString(R.string.suggestion))) { |
|
|
|
@Override |
|
|
|
CharSequence searchString = ((TextView) view.findViewById(R.id.title)).getText(); |
|
|
|
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) { |
|
|
|
if (searchString != null) { |
|
|
|
String url = null; |
|
|
|
url = searchString.toString(); |
|
|
|
CharSequence urlString = ((TextView) view.findViewById(R.id.url)).getText(); |
|
|
|
|
|
|
|
if (urlString != null) { |
|
|
|
|
|
|
|
url = urlString.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (url == null || url.startsWith(BrowserActivity.this.getString(R.string.suggestion))) { |
|
|
|
|
|
|
|
CharSequence searchString = ((TextView) view.findViewById(R.id.title)).getText(); |
|
|
|
|
|
|
|
if (searchString != null) { |
|
|
|
|
|
|
|
url = searchString.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (url == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getUrl.setText(url); |
|
|
|
|
|
|
|
searchTheWeb(url); |
|
|
|
|
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
|
|
|
|
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0); |
|
|
|
|
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
if (currentTab != null) { |
|
|
|
|
|
|
|
currentTab.requestFocus(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (url == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getUrl.setText(url); |
|
|
|
|
|
|
|
searchTheWeb(url); |
|
|
|
|
|
|
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
|
|
|
|
|
|
|
imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0); |
|
|
|
|
|
|
|
final LightningView currentTab = mTabsManager.getCurrentTab(); |
|
|
|
|
|
|
|
if (currentTab != null) { |
|
|
|
|
|
|
|
currentTab.requestFocus(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
getUrl.setSelectAllOnFocus(true); |
|
|
|
getUrl.setSelectAllOnFocus(true); |
|
|
|
mSearchAdapter = new SearchAdapter(this, mDarkTheme, isIncognito()); |
|
|
|
getUrl.setAdapter(mSearchAdapter); |
|
|
|
getUrl.setAdapter(mSearchAdapter); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|