private boolean onQueryChanged(String query) {
    searchCriteria.setPaymentCode(query);
    orderListAdapter.setSearchCriteria(searchCriteria);

    TextView approvedOrdersCountView = (TextView) findViewById(R.id.payed_orders_count);
    approvedOrdersCountView.setText(ordersDB.getPayedOrdersCount(searchCriteria).toString());

    TextView expiredOrdersCountView = (TextView) findViewById(R.id.expired_orders_count);
    expiredOrdersCountView.setText(ordersDB.getExpiredOrdersCount(searchCriteria).toString());
    return true;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    account = createOrdersSyncAccount(this);

    contentResolver = getContentResolver();
    contentResolver.setSyncAutomatically(account, AUTHORITY, true);
    ContentResolver.addPeriodicSync(account, AUTHORITY, Bundle.EMPTY, 1L);

    setContentView(R.layout.activity_search_orders);

    handleIntent(getIntent());

    RecyclerView orderListView = (RecyclerView) findViewById(R.id.order_list);
    orderListView.setHasFixedSize(true);

    RecyclerView.LayoutManager orderListLayoutManager = new LinearLayoutManager(this);
    orderListView.setLayoutManager(orderListLayoutManager);

    ordersDB = OrdersDatabase.getDatabase(this);
    List<Order> orders = OrderFactory.generateOrders(50, 5);
    ordersDB.addOrders(orders);

    orderListAdapter = new OrderListAdapter(ordersDB, searchCriteria);
    orderListView.setAdapter(orderListAdapter);

    onQueryChanged("");

    timer.schedule(
        new TimerTask() {
          @Override
          public void run() {
            Log.d(TAG, "Called by timer");
            hander.post(
                new Runnable() {
                  @Override
                  public void run() {
                    Log.d(TAG, "Called by handler");
                    SearchOrdersActivity.this.forseSyncRequest();
                  }
                });
          }
        },
        0,
        10000);

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
  }