@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(); }
// @Test public void create() throws Exception { Contact contact = ContactFactory.createContact("*****@*****.**", "7550"); Address_location address_location = AddressFactory.createAddress("1 Hens rd", "7945"); CorporateClient corporateClient = CorporateClientFactory.createCorpClient( "Groote schuur", "Riyaaz", "Rawoot", address_location, contact); IndividualClient individualClient = IndividualClientFactory.createIndividualClient( "Rawoot", "Riyaaz", address_location, contact); Machine machine = MachineFactory.createMachine("Washing machine"); corpClients.add(corporateClient); indivClients.add(individualClient); machines.add(machine); Orders orders = OrderFactory.createOrder( (long) 23434, new Date(), true, 32.00, corpClients, indivClients, machines); repository.save(orders); id = orders.getOrderID(); Assert.assertNotNull(orders.getOrderID()); }