Skip to content

Commit

Permalink
Start a search by title if URL intent doesn't supply a media ID
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Jan 27, 2013
1 parent e8bd59f commit 6257ed3
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/de/geeksfactory/opacclient/frontend/SearchActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,25 @@ public void urlintent() {
}
}
String medianr = split[2];
Intent intent = new Intent(SearchActivity.this,
SearchResultDetailsActivity.class);
intent.putExtra("item_id", medianr);
startActivity(intent);
if (medianr.length() > 1) {
Intent intent = new Intent(SearchActivity.this,
SearchResultDetailsActivity.class);
intent.putExtra("item_id", medianr);
startActivity(intent);
} else {
String title;
try {
title = URLDecoder.decode(split[3], "UTF-8");
} catch (UnsupportedEncodingException e) {
title = URLDecoder.decode(split[3]);
}
Bundle query = new Bundle();
query.putString(OpacApi.KEY_SEARCH_QUERY_TITLE, title);
Intent intent = new Intent(SearchActivity.this,
SearchResultsActivity.class);
intent.putExtra("query", query);
startActivity(intent);
}
finish();
return;
}
Expand Down

0 comments on commit 6257ed3

Please sign in to comment.