Methods Summary |
---|
public boolean | isOneTimeSyncMode()Gets whether the preference is in one-time sync mode.
return mOneTimeSyncMode;
|
public void | onBindView(android.view.View view)
super.onBindView(view);
ImageView syncActiveView = (ImageView) view.findViewById(R.id.sync_active);
View syncPendingView = view.findViewById(R.id.sync_pending);
View syncFailedView = view.findViewById(R.id.sync_failed);
syncActiveView.setVisibility(mIsActive ? View.VISIBLE : View.GONE);
AnimationDrawable anim = (AnimationDrawable) syncActiveView.getDrawable();
boolean showError;
boolean showPending;
if (mIsActive) {
anim.start();
showPending = false;
showError = false;
} else {
anim.stop();
if (mIsPending) {
showPending = true;
showError = false;
} else {
showPending = false;
showError = mFailed;
}
}
syncFailedView.setVisibility(showError ? View.VISIBLE : View.GONE);
syncPendingView.setVisibility((showPending && !mIsActive) ? View.VISIBLE : View.GONE);
View checkBox = view.findViewById(android.R.id.checkbox);
if (mOneTimeSyncMode) {
checkBox.setVisibility(View.GONE);
/*
* Override the summary. Fill in the %1$s with the existing summary
* (what ends up happening is the old summary is shown on the next
* line).
*/
TextView summary = (TextView) view.findViewById(android.R.id.summary);
summary.setText(getContext().getString(R.string.sync_one_time_sync, getSummary()));
} else {
checkBox.setVisibility(View.VISIBLE);
}
|
protected void | onClick()
// When we're in one-time sync mode, we don't want a click to change the
// checkbox state
if (!mOneTimeSyncMode) {
super.onClick();
}
|
public void | setActive(boolean isActive)Set whether the sync is active.
mIsActive = isActive;
notifyChanged();
|
public void | setFailed(boolean failed)Set whether the corresponding sync failed.
mFailed = failed;
notifyChanged();
|
public void | setOneTimeSyncMode(boolean oneTimeSyncMode)Sets whether the preference is in one-time sync mode.
mOneTimeSyncMode = oneTimeSyncMode;
notifyChanged();
|
public void | setPending(boolean isPending)Set whether a sync is pending.
mIsPending = isPending;
notifyChanged();
|