List of usage examples for android.content AsyncQueryHandler startUpdate
public final void startUpdate(int token, Object cookie, Uri uri, ContentValues values, String selection, String[] selectionArgs)
From source file:com.conferenceengineer.android.iosched.util.SessionsHelper.java
public void setSessionStarred(Uri sessionUri, boolean starred, String title) { LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" + starred + " title=" + title); sessionUri = ScheduleContract.addCallerIsSyncAdapterParameter(sessionUri); final ContentValues values = new ContentValues(); values.put(ScheduleContract.Sessions.SESSION_STARRED, starred); AsyncQueryHandler handler = new AsyncQueryHandler(mActivity.getContentResolver()) { };//from w ww .j a va 2 s . c o m handler.startUpdate(-1, null, sessionUri, values, null, null); // Because change listener is set to null during initialization, these // won't fire on pageview. mActivity.sendBroadcast(ScheduleWidgetProvider.getRefreshBroadcastIntent(mActivity, false)); // Sync to the cloudz. uploadStarredSession(mActivity, sessionUri, starred); }
From source file:com.gdgdevfest.android.apps.devfestbcn.util.SessionsHelper.java
public void setSessionStarred(Uri sessionUri, boolean starred, String title) { LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" + starred + " title=" + title); sessionUri = ScheduleContract.addCallerIsSyncAdapterParameter(sessionUri); final ContentValues values = new ContentValues(); values.put(ScheduleContract.Sessions.SESSION_STARRED, starred); AsyncQueryHandler handler = new AsyncQueryHandler(mActivity.getContentResolver()) { };/*w ww .j a v a2 s . c om*/ handler.startUpdate(-1, null, sessionUri, values, null, null); EasyTracker.getTracker().sendEvent("Session", starred ? "Starred" : "Unstarred", title, 0L); // Because change listener is set to null during initialization, these // won't fire on pageview. mActivity.sendBroadcast(ScheduleWidgetProvider.getRefreshBroadcastIntent(mActivity, false)); // Sync to the cloudz. uploadStarredSession(mActivity, sessionUri, starred); }
From source file:net.abcdroid.devfest12.util.SessionsHelper.java
public void setSessionStarred(Uri sessionUri, boolean starred, String title) { LOGD(TAG, "setSessionStarred uri=" + sessionUri + " starred=" + starred + " title=" + title); sessionUri = ScheduleContract.addCallerIsSyncAdapterParameter(sessionUri); final ContentValues values = new ContentValues(); values.put(ScheduleContract.Sessions.SESSION_STARRED, starred); AsyncQueryHandler handler = new AsyncQueryHandler(mActivity.getContentResolver()) { };//from w ww . ja va2s . c om handler.startUpdate(-1, null, sessionUri, values, null, null); EasyTracker.getTracker().trackEvent("Session", starred ? "Starred" : "Unstarred", title, 0L); // Because change listener is set to null during initialization, these // won't fire on pageview. final Intent refreshIntent = new Intent(mActivity, MyScheduleWidgetProvider.class); refreshIntent.setAction(MyScheduleWidgetProvider.REFRESH_ACTION); mActivity.sendBroadcast(refreshIntent); // Sync to the cloud. final Intent updateServerIntent = new Intent(mActivity, ScheduleUpdaterService.class); updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_SESSION_ID, ScheduleContract.Sessions.getSessionId(sessionUri)); updateServerIntent.putExtra(ScheduleUpdaterService.EXTRA_IN_SCHEDULE, starred); mActivity.startService(updateServerIntent); }
From source file:org.jamienicol.episodes.EpisodeDetailsFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.episode_details_fragment, container, false); rootView = view.findViewById(R.id.root); titleView = (TextView) view.findViewById(R.id.title); overviewView = (TextView) view.findViewById(R.id.overview); dateView = (TextView) view.findViewById(R.id.date); watchedCheckBox = (CheckBox) view.findViewById(R.id.watched); watchedCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { final ContentResolver contentResolver = getActivity().getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { };/*from w w w.ja v a 2 s. co m*/ final Uri episodeUri = Uri.withAppendedPath(ShowsProvider.CONTENT_URI_EPISODES, String.valueOf(episodeId)); final ContentValues episodeValues = new ContentValues(); episodeValues.put(EpisodesTable.COLUMN_WATCHED, isChecked); handler.startUpdate(0, null, episodeUri, episodeValues, null, null); } }); return view; }
From source file:org.jamienicol.episodes.NextEpisodeFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.episode_details_fragment, container, false); rootView = view.findViewById(R.id.root); titleView = (TextView) view.findViewById(R.id.title); overviewView = (TextView) view.findViewById(R.id.overview); dateView = (TextView) view.findViewById(R.id.date); watchedCheckBox = (CheckBox) view.findViewById(R.id.watched); watchedCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // Make sure we have a next episode if (episodeId == -1) { Log.w(TAG, "Watched check changed but there is no next episode."); return; }//from ww w . j a v a 2 s .c o m final ContentResolver contentResolver = getActivity().getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { }; final Uri episodeUri = Uri.withAppendedPath(ShowsProvider.CONTENT_URI_EPISODES, String.valueOf(episodeId)); final ContentValues episodeValues = new ContentValues(); episodeValues.put(EpisodesTable.COLUMN_WATCHED, isChecked); handler.startUpdate(0, null, episodeUri, episodeValues, null, null); } }); return view; }
From source file:org.jamienicol.episodes.SeasonActivity.java
private void markSeasonWatched(boolean watched) { final ContentResolver contentResolver = getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { };// ww w . j a v a 2 s . co m final ContentValues epValues = new ContentValues(); epValues.put(EpisodesTable.COLUMN_WATCHED, watched); final String selection = String.format("%s=? AND %s=?", EpisodesTable.COLUMN_SHOW_ID, EpisodesTable.COLUMN_SEASON_NUMBER); final String[] selectionArgs = { String.valueOf(showId), String.valueOf(seasonNumber) }; handler.startUpdate(0, null, ShowsProvider.CONTENT_URI_EPISODES, epValues, selection, selectionArgs); }
From source file:org.jamienicol.episodes.ShowActivity.java
private void toggleShowStarred() { final ContentResolver contentResolver = getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { };//www .jav a 2s . c om final ContentValues values = new ContentValues(); values.put(ShowsTable.COLUMN_STARRED, !isShowStarred); final String selection = String.format("%s=?", ShowsTable.COLUMN_ID); final String[] selectionArgs = { String.valueOf(showId) }; handler.startUpdate(0, null, ShowsProvider.CONTENT_URI_SHOWS, values, selection, selectionArgs); }
From source file:org.jamienicol.episodes.ShowActivity.java
private void toggleShowArchived() { final ContentResolver contentResolver = getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { };/*from w w w . ja va 2 s . com*/ final ContentValues values = new ContentValues(); values.put(ShowsTable.COLUMN_ARCHIVED, !isShowArchived); final String selection = String.format("%s=?", ShowsTable.COLUMN_ID); final String[] selectionArgs = { String.valueOf(showId) }; handler.startUpdate(0, null, ShowsProvider.CONTENT_URI_SHOWS, values, selection, selectionArgs); }
From source file:org.jamienicol.episodes.ShowActivity.java
private void markShowWatched(boolean watched) { final ContentResolver contentResolver = getContentResolver(); final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) { };/*from ww w . j a v a 2 s .c o m*/ final ContentValues epValues = new ContentValues(); epValues.put(EpisodesTable.COLUMN_WATCHED, watched); final String selection = String.format("%s=? AND %s!=?", EpisodesTable.COLUMN_SHOW_ID, EpisodesTable.COLUMN_SEASON_NUMBER); final String[] selectionArgs = { String.valueOf(showId), "0" }; handler.startUpdate(0, null, ShowsProvider.CONTENT_URI_EPISODES, epValues, selection, selectionArgs); }