List of usage examples for android.content SharedPreferences getInt
int getInt(String key, int defValue);
From source file:angeloid.dreamnarae.TTS_Biling.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.biling);/*from w w w. ja v a 2s .c o m*/ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(TTS_Biling.this); Biling_Friends(); int temp_isPro = sharedPrefs.getInt("License", 0); if (temp_isPro == TRUE) isPro = true; Intent intent = getIntent(); String Type = intent.getStringExtra("Type"); if (Type.equals("Narae")) { sku = "dntts_narae"; Biling_Narae(); } else if (Type.equals("Friends")) { sku = "dntts_friends"; Biling_Friends(); } bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), mServiceConn, Context.BIND_AUTO_CREATE); }
From source file:eu.liveGov.libraries.livegovtoolkit.helper.UserInformationHelper.java
public UserInformation loadUserInformartion(Context c, boolean alwaysSendUpdate) { _context = c;// ww w .j a v a 2s. c o m logger.info("loadUserInformartion;"); SharedPreferences sharedPreferences = c.getSharedPreferences("UserInformation", Context.MODE_PRIVATE); int userId = sharedPreferences.getInt(USER_ID, UserInformation.UNDEFINED_ID); UserInformation ui = new UserInformation(userId); if (userId != UserInformation.UNDEFINED_ID) { getUserInfoQuestionaire(c); if (alwaysSendUpdate) { sendAnonymousUpdated(); // If the caller wants it: let the listeners know that the anonymousUserId is ready. } } else { requestNewAnonymous(c); } return ui; }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static int getIntPref(Context context, String name, int def) { SharedPreferences prefs = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE); return prefs.getInt(name, def); }
From source file:com.tapjoy.TapjoyConnectCore.java
/** * Gets the tap points total from that was locally stored by saveTapPointsTotal. If -9999 is returned, * then no data was previously stored.//from ww w. ja v a2 s . c om * @return Amount of tap points the user has. */ public static int getLocalTapPointsTotal() { SharedPreferences settings = context.getSharedPreferences(TapjoyConstants.TJC_PREFERENCE, 0); int total = settings.getInt(TapjoyConstants.PREF_LAST_TAP_POINTS, -9999); return total; }
From source file:com.bellman.bible.android.control.page.PageControl.java
/** font size may be adjusted for certain fonts e.g. SBLGNT *///from w w w. j av a 2 s . c o m public int getDocumentFontSize(Window window) { // get base font size SharedPreferences preferences = CommonUtils.getSharedPreferences(); int fontSize = preferences.getInt("text_size_pref", 16); // if book has a special font it may require an adjusted font size Book book = window.getPageManager().getCurrentPage().getCurrentDocument(); String font = FontControl.getInstance().getFontForBook(book); int fontSizeAdjustment = FontControl.getInstance().getFontSizeAdjustment(font, book); return fontSize + fontSizeAdjustment; }
From source file:com.firesoft.member.Member.java
public int getCacheUserId() { SharedPreferences shared; SharedPreferences.Editor editor;/*from w ww . j av a2 s .c o m*/ shared = this.getSharedPreferences(MemberAppConst.USERINFO, 0); editor = shared.edit(); int userId = shared.getInt("uid", 0); return userId; }
From source file:net.bible.android.control.page.PageControl.java
/** font size may be adjusted for certain fonts e.g. SBLGNT *//*from w w w . ja va2 s . c o m*/ public int getDocumentFontSize(Screen splitScreenNo) { // get base font size SharedPreferences preferences = CommonUtils.getSharedPreferences(); int fontSize = preferences.getInt("text_size_pref", 16); // if book has a special font it may require an adjusted font size Book book = CurrentPageManager.getInstance(splitScreenNo).getCurrentPage().getCurrentDocument(); String font = FontControl.getInstance().getFontForBook(book); int fontSizeAdjustment = FontControl.getInstance().getFontSizeAdjustment(font, book); return fontSize + fontSizeAdjustment; }
From source file:com.android.talkbacktests.TestController.java
/** * Record the user action to access a {@link TestSession}. * * @param context Context object.//w w w . ja v a 2 s .c om * @param sessionId ID of the accessed {@link TestSession}. */ public void recordTestSessionAccessed(Context context, int sessionId) { final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); final int count = sharedPrefs.getInt(PREF_KEY_PREFIX_COUNT + sessionId, 0) + 1; final long time = System.currentTimeMillis(); final SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putInt(PREF_KEY_PREFIX_COUNT + sessionId, count); editor.putLong(PREF_KEY_PREFIX_TIME + sessionId, time); editor.apply(); mTestSessions[sessionId].setAccessCount(count); mTestSessions[sessionId].setLastAccessTime(time); }
From source file:com.quarterfull.newsAndroid.services.OwnCloudSyncService.java
private void finishedSync() { TeslaUnreadManager.PublishUnreadCount(this); WidgetProvider.UpdateWidget(this); syncRunning = false;/*from w ww. j a v a 2 s . com*/ syncStopWatch.stop(); Log.v(TAG, "Time needed (synchronization): " + syncStopWatch.toString()); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(OwnCloudSyncService.this); int newItemsCount = mPrefs.getInt(Constants.LAST_UPDATE_NEW_ITEMS_COUNT_STRING, 0); if (newItemsCount > 0) { ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> runningTaskInfo = am.getRunningTasks(1); ComponentName componentInfo = runningTaskInfo.get(0).topActivity; if (!componentInfo.getPackageName().equals("com.quarterfull.newsAndroid")) { Resources res = getResources(); String tickerText = res.getQuantityString(R.plurals.notification_new_items_ticker, newItemsCount, newItemsCount); String contentText = res.getQuantityString(R.plurals.notification_new_items_text, newItemsCount, newItemsCount); String title = getString(R.string.app_name); if (mPrefs.getBoolean(SettingsActivity.CB_SHOW_NOTIFICATION_NEW_ARTICLES_STRING, true))//Default is true NotificationManagerNewsReader.getInstance(OwnCloudSyncService.this).ShowMessage(title, tickerText, contentText); } } EventBus.getDefault().post(new SyncFinishedEvent()); }