use of android.content.SyncAdapterType in project platform_packages_apps_Settings by BlissRoms.
the class AccountSyncPreferenceControllerTest method updateSummary_adapterInvisible_shouldNotCount.
@Test
public void updateSummary_adapterInvisible_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
false, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project platform_packages_apps_Settings by BlissRoms.
the class AccountSyncPreferenceControllerTest method updateSummary_notSameAccountType_shouldNotCount.
@Test
public void updateSummary_notSameAccountType_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type5", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project VirtualApp by asLody.
the class VContentService method parseSyncAdapterType.
private SyncAdapterType parseSyncAdapterType(Resources res, AttributeSet set) {
TypedArray obtainAttributes = res.obtainAttributes(set, R_Hide.styleable.SyncAdapter.get());
try {
String contentAuthority = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_contentAuthority.get());
String accountType = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_accountType.get());
if (contentAuthority == null || accountType == null) {
obtainAttributes.recycle();
return null;
}
boolean userVisible = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_userVisible.get(), true);
boolean supportsUploading = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_supportsUploading.get(), true);
boolean isAlwaysSyncable = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_isAlwaysSyncable.get(), true);
boolean allowParallelSyncs = obtainAttributes.getBoolean(R_Hide.styleable.SyncAdapter_allowParallelSyncs.get(), true);
String settingsActivity = obtainAttributes.getString(R_Hide.styleable.SyncAdapter_settingsActivity.get());
SyncAdapterType type;
if (SyncAdapterTypeN.ctor != null) {
type = SyncAdapterTypeN.ctor.newInstance(contentAuthority, accountType, userVisible, supportsUploading, isAlwaysSyncable, allowParallelSyncs, settingsActivity, null);
obtainAttributes.recycle();
return type;
}
type = mirror.android.content.SyncAdapterType.ctor.newInstance(contentAuthority, accountType, userVisible, supportsUploading, isAlwaysSyncable, allowParallelSyncs, settingsActivity);
obtainAttributes.recycle();
return type;
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
use of android.content.SyncAdapterType in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountSyncPreferenceControllerTest method updateSummary_adapterInvisible_shouldNotCount.
@Test
public void updateSummary_adapterInvisible_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
false, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mActivity.getString(R.string.account_sync_summary_all_off));
}
use of android.content.SyncAdapterType in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountSyncPreferenceControllerTest method updateSummary_notSyncable_shouldNotCount.
@Test
public void updateSummary_notSyncable_shouldNotCount() {
SyncAdapterType syncAdapterType = new SyncAdapterType("authority", /* authority */
"type1", /* accountType */
true, /* userVisible */
true);
SyncAdapterType[] syncAdapters = { syncAdapterType };
ShadowContentResolver.setSyncAdapterTypes(syncAdapters);
ShadowContentResolver.setSyncable("authority", 0);
mController.updateSummary(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mActivity.getString(R.string.account_sync_summary_all_off));
}
Aggregations