private void checkIfAutoAdvance() { boolean isAutoAdvance = false; Advanceable target = getAdvanceable(); if (target != null) { isAutoAdvance = true; target.fyiWillBeAdvancedByHostKThx(); } boolean wasAutoAdvance = sAutoAdvanceWidgetIds.indexOfKey(getAppWidgetId()) >= 0; if (isAutoAdvance != wasAutoAdvance) { if (isAutoAdvance) { sAutoAdvanceWidgetIds.put(getAppWidgetId(), true); } else { sAutoAdvanceWidgetIds.delete(getAppWidgetId()); } maybeRegisterAutoAdvance(); } }
private Advanceable getAdvanceable() { AppWidgetProviderInfo info = getAppWidgetInfo(); if (info == null || info.autoAdvanceViewId == NO_ID || !mIsAttachedToWindow) { return null; } View v = findViewById(info.autoAdvanceViewId); return (v instanceof Advanceable) ? (Advanceable) v : null; }
private void runAutoAdvance() { Advanceable target = getAdvanceable(); if (target != null) { target.advance(); } scheduleNextAdvance(); }
private void addWidgetToAutoAdvanceIfNeeded(View hostView, AppWidgetProviderInfo appWidgetInfo) { if (appWidgetInfo == null || appWidgetInfo.autoAdvanceViewId == -1) return; View v = hostView.findViewById(appWidgetInfo.autoAdvanceViewId); if (v instanceof Advanceable) { mWidgetsToAdvance.put(hostView, appWidgetInfo); ((Advanceable) v).fyiWillBeAdvancedByHostKThx(); updateAutoAdvanceState(); } }
void addWidgetToAutoAdvanceIfNeeded(View hostView, AppWidgetProviderInfo appWidgetInfo) { if (appWidgetInfo == null || appWidgetInfo.autoAdvanceViewId == -1) return; View v = hostView.findViewById(appWidgetInfo.autoAdvanceViewId); if (v instanceof Advanceable) { mWidgetsToAdvance.put(hostView, appWidgetInfo); ((Advanceable) v).fyiWillBeAdvancedByHostKThx(); updateAutoAdvanceState(); } }
void addWidgetToAutoAdvanceIfNeeded(View hostView, AppWidgetProviderInfo appWidgetInfo) { if (appWidgetInfo == null || appWidgetInfo.autoAdvanceViewId == -1) return; View v = hostView.findViewById(appWidgetInfo.autoAdvanceViewId); if (v instanceof Advanceable) { mWidgetsToAdvance.put(hostView, appWidgetInfo); ((Advanceable) v).fyiWillBeAdvancedByHostKThx(); updateRunning(); } }