use of ingage.ingage20.handlers.SearchHandler in project iNGAGE by davis123123.
the class MainActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
MenuItem myActionMenuItem = menu.findItem(R.id.action_search);
searchView = (android.support.v7.widget.SearchView) myActionMenuItem.getActionView();
final FragmentManager fragmentManager = this.getSupportFragmentManager();
final Class fragmentClass = SearchResultFragment.class;
searchView.setOnSearchClickListener(this);
searchView.setOnQueryTextListener(new android.support.v7.widget.SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Log.d("SEARCH", s);
SearchHandler searchHandler = new SearchHandler();
String result = "";
session.updateSearch(s);
final Fragment fragment = Fragment.instantiate(getApplicationContext(), fragmentClass.getName());
fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment, fragmentClass.getSimpleName()).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
return false;
}
@Override
public boolean onQueryTextChange(String s) {
Log.d("SEARCH", "yes");
return false;
}
});
return true;
}
use of ingage.ingage20.handlers.SearchHandler in project iNGAGE by davis123123.
the class SearchResultFragment method getThreadsJSON.
public void getThreadsJSON(int rowCount, String searchString) {
searchHandler = new SearchHandler();
Log.d("ROWCOUNT", " result : " + searchString);
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String type = user.get(SessionManager.PAGE_TYPE);
try {
json_string = searchHandler.execute(String.valueOf(rowCount), searchString).get();
Log.d("STATE", "query result : " + json_string);
threadListAdapter.setLoaded(false);
inflateThreads();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
use of ingage.ingage20.handlers.SearchHandler in project iNGAGE by davis123123.
the class MainActivity method onSearch.
private void onSearch() {
final FragmentManager fragmentManager = this.getSupportFragmentManager();
final Class fragmentClass = SearchResultFragment.class;
searchView.setOnSearchClickListener(this);
searchView.setOnQueryTextListener(new android.support.v7.widget.SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Log.d("SEARCH", "submit");
SearchHandler searchHandler = new SearchHandler();
String result = "";
try {
result = searchHandler.execute("0", s).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
final Fragment fragment = Fragment.instantiate(getApplicationContext(), fragmentClass.getName());
fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment, fragmentClass.getSimpleName()).setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).commit();
return false;
}
@Override
public boolean onQueryTextChange(String s) {
Log.d("SEARCH", "yes");
return false;
}
});
}
Aggregations