1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-01 09:16:47 +01:00
This commit is contained in:
Mariotaku Lee 2016-06-20 14:38:23 +08:00
parent c5e0f90111
commit d72ec1508b

View File

@ -78,19 +78,24 @@ public class SearchFragment extends AbsToolbarTabPagesFragment implements Refres
@Override @Override
public boolean onOptionsItemSelected(final MenuItem item) { public boolean onOptionsItemSelected(final MenuItem item) {
final String query = getQuery();
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.save: { case R.id.save: {
final AsyncTwitterWrapper twitter = mTwitterWrapper; final AsyncTwitterWrapper twitter = mTwitterWrapper;
final Bundle args = getArguments(); final Bundle args = getArguments();
if (twitter != null && args != null) { if (twitter != null && args != null) {
twitter.createSavedSearchAsync(getAccountKey(), getQuery()); twitter.createSavedSearchAsync(getAccountKey(), query);
} }
return true; return true;
} }
case R.id.compose: { case R.id.compose: {
final Intent intent = new Intent(getActivity(), ComposeActivity.class); final Intent intent = new Intent(getActivity(), ComposeActivity.class);
intent.setAction(INTENT_ACTION_COMPOSE); intent.setAction(INTENT_ACTION_COMPOSE);
intent.putExtra(Intent.EXTRA_TEXT, String.format("#%s ", getQuery())); if (query.startsWith("@") || query.startsWith("\uff20")) {
intent.putExtra(Intent.EXTRA_TEXT, query);
} else {
intent.putExtra(Intent.EXTRA_TEXT, String.format("#%s ", query));
}
intent.putExtra(EXTRA_ACCOUNT_KEY, getAccountKey()); intent.putExtra(EXTRA_ACCOUNT_KEY, getAccountKey());
startActivity(intent); startActivity(intent);
break; break;