|
|
|
|
@ -6,7 +6,6 @@ import android.os.Build;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.os.Handler;
|
|
|
|
|
import android.os.Message;
|
|
|
|
|
import android.support.v4.app.Fragment;
|
|
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
|
|
import android.text.Editable;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
@ -19,7 +18,6 @@ import android.view.inputmethod.InputMethodManager;
|
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
import android.widget.TextView.OnEditorActionListener;
|
|
|
|
|
|
|
|
|
|
@ -37,7 +35,6 @@ import com.gh.gamecenter.search.SearchGameListFragment;
|
|
|
|
|
import com.gh.gamecenter.search.SearchHistoryFragment;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -47,7 +44,6 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
private SearchGameListFragment game_list_fragment;
|
|
|
|
|
private SearchHistoryFragment search_history_fragment;
|
|
|
|
|
|
|
|
|
|
private RelativeLayout searchBack;
|
|
|
|
|
private EditText searchInput;
|
|
|
|
|
private ImageView searchCancel;
|
|
|
|
|
private TextView searchButton;
|
|
|
|
|
@ -163,7 +159,6 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
});
|
|
|
|
|
searchButton = (TextView) findViewById(R.id.btnSearch);
|
|
|
|
|
searchCancel = (ImageView) findViewById(R.id.ivDeleteText);
|
|
|
|
|
searchBack = (RelativeLayout) findViewById(R.id.btnGoBack);
|
|
|
|
|
|
|
|
|
|
if (isFromHome && !TextUtils.isEmpty(hint)) {
|
|
|
|
|
isSearchDetail = true;
|
|
|
|
|
@ -241,7 +236,7 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
searchBack.setOnClickListener(new OnClickListener() {
|
|
|
|
|
findViewById(R.id.btnGoBack).setOnClickListener(new OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
finish();
|
|
|
|
|
@ -252,43 +247,16 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
|
|
|
|
|
private void setResultPresentModel(int model) {
|
|
|
|
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
|
|
|
|
hideFragments(transaction);
|
|
|
|
|
switch (model) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (search_history_fragment == null) {
|
|
|
|
|
List<Fragment> list = getSupportFragmentManager().getFragments();
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (Fragment fragment : list) {
|
|
|
|
|
if (fragment.getClass().equals(SearchHistoryFragment.class)) {
|
|
|
|
|
transaction.remove(fragment);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
transaction.remove(search_history_fragment);
|
|
|
|
|
}
|
|
|
|
|
search_history_fragment = new SearchHistoryFragment();
|
|
|
|
|
transaction.add(R.id.search_result, search_history_fragment);
|
|
|
|
|
transaction.replace(R.id.search_result, search_history_fragment);
|
|
|
|
|
currentTab = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
if (game_list_fragment == null) {
|
|
|
|
|
List<Fragment> list = getSupportFragmentManager().getFragments();
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (Fragment fragment : list) {
|
|
|
|
|
if (fragment.getClass().equals(SearchGameListFragment.class)) {
|
|
|
|
|
transaction.remove(fragment);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
transaction.remove(game_list_fragment);
|
|
|
|
|
}
|
|
|
|
|
game_list_fragment = new SearchGameListFragment();
|
|
|
|
|
game_list_fragment.setKey(searchKey);
|
|
|
|
|
transaction.add(R.id.search_result, game_list_fragment);
|
|
|
|
|
transaction.replace(R.id.search_result, game_list_fragment);
|
|
|
|
|
currentTab = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
@ -299,22 +267,9 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
map.put("from", "搜索页面");
|
|
|
|
|
DataCollectionManager.onEvent(this, "search", map);
|
|
|
|
|
|
|
|
|
|
if (game_detail_fragment == null) {
|
|
|
|
|
List<Fragment> list = getSupportFragmentManager().getFragments();
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (Fragment fragment : list) {
|
|
|
|
|
if (fragment.getClass().equals(SearchGameDetailFragment.class)) {
|
|
|
|
|
transaction.remove(fragment);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
transaction.remove(game_detail_fragment);
|
|
|
|
|
}
|
|
|
|
|
game_detail_fragment = new SearchGameDetailFragment();
|
|
|
|
|
game_detail_fragment.setKey(searchKey);
|
|
|
|
|
transaction.add(R.id.search_result, game_detail_fragment);
|
|
|
|
|
transaction.replace(R.id.search_result, game_detail_fragment);
|
|
|
|
|
currentTab = 2;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
@ -323,24 +278,6 @@ public class SearchActivity extends BaseFragmentActivity {
|
|
|
|
|
transaction.commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void hideFragments(FragmentTransaction transaction) {
|
|
|
|
|
if (game_detail_fragment != null) {
|
|
|
|
|
transaction.hide(game_detail_fragment);
|
|
|
|
|
}
|
|
|
|
|
if (game_list_fragment != null) {
|
|
|
|
|
transaction.hide(game_list_fragment);
|
|
|
|
|
}
|
|
|
|
|
if (search_history_fragment != null) {
|
|
|
|
|
transaction.hide(search_history_fragment);
|
|
|
|
|
}
|
|
|
|
|
List<Fragment> list = getSupportFragmentManager().getFragments();
|
|
|
|
|
if (list != null) {
|
|
|
|
|
for (Fragment fragment : list) {
|
|
|
|
|
transaction.hide(fragment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onEvent(EBSearch search) {
|
|
|
|
|
isSearchDetail = true;
|
|
|
|
|
String str = search.getKey();
|
|
|
|
|
|