protected Request createRequest() { PreferenceManager.setDefaultValues(this, R.xml.preferences, false); prefs = PreferenceManager.getDefaultSharedPreferences(this); // Get the last check time from preferences storage at startup PmNotificationService.lastCheck_ = prefs.getLong(AppConstants.PREFERENCE_LAST_PM_CHECK_TIME, 0); return ApiFactory.createUnreadPMCount(PmNotificationService.lastCheck_); }
/** Sets a Favorite for the currently Selected Image */ public void setFavorite() { pbh.showProgressDialog("Setting favorite"); Request req = ApiFactory.createAddFav(pageID); AndroidRequestWrapper arw = new AndroidRequestWrapper(requesthandler, req); arw.exec( new DataCall() { public void call() { justHideProgress(); } }); }
/** Watches the current user */ public void unwatch() { pbh.showProgressDialog("Unwatching ..."); Request req = ApiFactory.createUnWatch(authorId); AndroidRequestWrapper arw = new AndroidRequestWrapper(requesthandler, req); arw.exec( new DataCall() { public void call() { justHideProgress(); } }); }
/** * Sets the number of stars on a submission that the user wants to set * * @param stars The number of stars to set (1-5) */ public void setRating(int stars) { pbh.showProgressDialog("Rating " + stars + " stars"); Request req = ApiFactory.createSetStars(pageID, stars); AndroidRequestWrapper arw = new AndroidRequestWrapper(requesthandler, req); arw.exec( new DataCall() { public void call() { justHideProgress(); } }); }
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case AppConstants.MENU_ADDFAV: setFavorite(); return true; case AppConstants.MENU_REMFAV: unsetFavorite(); return true; case AppConstants.MENU_RATE: Intent intent = new Intent(this, RateActivity.class); startActivityForResult(intent, AppConstants.ACTIVITY_RATE); return true; case AppConstants.MENU_WATCH: watch(); return true; case AppConstants.MENU_UNWATCH: unwatch(); return true; case AppConstants.MENU_USERSSTORIES: morefromuser(AppConstants.ACTIVITY_STORIESLIST); return true; case AppConstants.MENU_USERSART: morefromuser(AppConstants.ACTIVITY_GALLERYART); return true; case AppConstants.MENU_USERSMUSIK: morefromuser(AppConstants.ACTIVITY_MUSICLIST); return true; case AppConstants.MENU_OPEN_BROWSER: // Utils.setClipboardText(this, ApiFactory.getSubmissionViewPageURL(pageID)); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ApiFactory.getSubmissionViewPageURL(pageID))); startActivity(browserIntent); return true; default: return super.onOptionsItemSelected(item); } }