Skip to content

Commit

Permalink
Merge branch 'issue-116' into release
Browse files Browse the repository at this point in the history
Conflicts:
	sample/build.gradle
	sample/src/main/AndroidManifest.xml
	sample/src/main/java/com/lapism/searchview/sample/activity/MenuItemActivity.java
	sample/src/main/java/com/lapism/searchview/sample/activity/ToggleActivity.java
	sample/src/main/java/com/lapism/searchview/sample/activity/ToolbarActivity.java
	sample/src/main/java/com/lapism/searchview/sample/base/BaseActivity.java
	sample/src/main/res/layout/activity_toggle.xml
	sample/src/main/res/values/strings.xml
	sample/src/main/res/values/styles.xml
	searchview/build.gradle
  • Loading branch information
Ivam Luz committed Jul 7, 2016
2 parents e353e9c + 33c2912 commit 3c6c30c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
**3.3.3**
- Fix for issue #108 and #72
Added two style attributes to define whether search view should be cleaned upon open/close.
More here: https://github.com/lapism/SearchView/pull/111 and here: https://github.com/lapism/SearchView/pull/114

**3.3.2**
- fixes
- Fix for issue #72
More here: https://github.com/lapism/SearchView/pull/110

**3.3.1**
- small fixes
Expand All @@ -25,4 +31,4 @@ News:
- Support libraries 24.0.0, Gradle 2.14

**3.2.1**
- SearchHistoryTable.getAllItems() is public now
- SearchHistoryTable.getAllItems() is public now
4 changes: 2 additions & 2 deletions searchview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 24
versionCode 333
versionName "3.3.3"
versionCode 336
versionName "3.3.6"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public boolean onKeyPreIme(int keyCode, KeyEvent event) {
// return super.onKeyPreIme(keyCode, event);
return super.dispatchKeyEvent(event);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

public class SearchHistoryTable {

private static int mHistorySize = 2;
private final SearchHistoryDatabase dbHelper;
private SQLiteDatabase db;

Expand Down Expand Up @@ -66,7 +67,7 @@ public List<SearchItem> getAllItems() {
String selectQuery =
"SELECT * FROM " + SearchHistoryDatabase.SEARCH_HISTORY_TABLE +
" ORDER BY " + SearchHistoryDatabase.SEARCH_HISTORY_COLUMN_ID +
" DESC LIMIT 2";
" DESC LIMIT " + mHistorySize;

db = dbHelper.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
Expand All @@ -82,6 +83,11 @@ public List<SearchItem> getAllItems() {
return list;
}

@SuppressWarnings("unused")
public void setHistorySize(int historySize) {
mHistorySize = historySize;
}

public void clearDatabase() {
db = dbHelper.getWritableDatabase();
db.delete(SearchHistoryDatabase.SEARCH_HISTORY_TABLE, null, null);
Expand Down
22 changes: 21 additions & 1 deletion searchview/src/main/java/com/lapism/searchview/SearchView.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public class SearchView extends FrameLayout implements View.OnClickListener {
private boolean mShadow = true;
private boolean mVoice = true;
private boolean mIsSearchOpen = false;

private boolean mShouldClearOnClose;
private boolean mShouldClearOnOpen;

Expand Down Expand Up @@ -546,6 +547,26 @@ public void setElevation(float elevation) {
invalidate();
}

@SuppressWarnings("unused")
public boolean shouldClearOnClose() {
return mShouldClearOnClose;
}

@SuppressWarnings("unused")
public void setShouldClearOnClose(boolean shouldClearOnClose) {
mShouldClearOnClose = shouldClearOnClose;
}

@SuppressWarnings("unused")
public boolean shouldClearOnOpen() {
return mShouldClearOnOpen;
}

@SuppressWarnings("unused")
public void setShouldClearOnOpen(boolean shouldClearOnOpen) {
mShouldClearOnOpen = shouldClearOnOpen;
}

// ---------------------------------------------------------------------------------------------
public void setAdapter(SearchAdapter adapter) {
mSearchAdapter = adapter;
Expand Down Expand Up @@ -847,7 +868,6 @@ public void onClick(View v) {
if (mEditText.length() > 0) {
mEditText.getText().clear();
}
setHint("");
} else if (v == mShadowView) {
close(true);
}
Expand Down

0 comments on commit 3c6c30c

Please sign in to comment.