()
| 470 | } |
| 471 | |
| 472 | private void updateSyncSettings() { |
| 473 | Log.d(TAG, "MainActivity->updateSyncSettings()"); |
| 474 | |
| 475 | PreferenceManager mPref = new PreferenceManager(mContext); |
| 476 | int sync_interval = mPref.getInt("sync_interval", 1440); |
| 477 | |
| 478 | List<String> default_authorities = new ArrayList<String>(); |
| 479 | default_authorities.add("com.android.calendar"); |
| 480 | default_authorities.add("com.android.contacts"); |
| 481 | |
| 482 | SyncAdapterType[] list = ContentResolver.getSyncAdapterTypes(); |
| 483 | |
| 484 | Account mAccount = OdooAccountManager.getAccount(mContext, OEUser |
| 485 | .current(mContext).getAndroidName()); |
| 486 | |
| 487 | for (SyncAdapterType lst : list) { |
| 488 | if (lst.authority.contains("com.odoo") |
| 489 | && lst.authority.contains("providers")) { |
| 490 | default_authorities.add(lst.authority); |
| 491 | } |
| 492 | } |
| 493 | for (String authority : default_authorities) { |
| 494 | boolean isSyncActive = ContentResolver.getSyncAutomatically( |
| 495 | mAccount, authority); |
| 496 | if (isSyncActive) { |
| 497 | setSyncPeriodic(authority, sync_interval, 60, 1); |
| 498 | } |
| 499 | } |
| 500 | Toast.makeText(this, R.string.toast_setting_saved, Toast.LENGTH_LONG) |
| 501 | .show(); |
| 502 | } |
| 503 | |
| 504 | /* Called whenever we call invalidateOptionsMenu() */ |
| 505 | @Override |
no test coverage detected