List of usage examples for android.os Bundle getLong
public long getLong(String key, long defaultValue)
From source file:com.vegnab.vegnab.MainVNActivity.java
public void onRequestGenerateExistingPlaceholders(Bundle args) { if (LDebug.ON) Log.d(LOG_TAG, "In onRequestGenerateExistingPlaceholders"); mPhProjID = args.getLong(ARG_PH_PROJ_ID, 0); mPhNameId = args.getLong(ARG_PH_NAMER_ID, 0); getSupportLoaderManager().restartLoader(VNContract.Loaders.EXISTING_PH_CODES, null, this); }
From source file:activities.PaintActivity.java
@Override protected void onRestoreInstanceState(Bundle outState) { super.onRestoreInstanceState(outState); //if already loaded, forget it // if (PaintUtility.getCurrentPaintColor() != null) { // return; // }/*from w ww . j av a2 s . com*/ if (outState != null) { //this.painter.loadFromDirectory(workingDirectory()); // Map<String,String> data = this.painter.getLayerUserData(1); // Log.d("JOEL", "Got back " + data.get("test")); if (PaintUtility.getCurrentPaintColor() == null) { Log.d("JOEL", "loading paint color from saved state"); long paintColorId = outState.getLong(PaintUtility.PAINT_COLOR_EXTRA_KEY, 0); if (paintColorId > 0) { PaintColorDataSource datasource = new PaintColorDataSource(); datasource.open(); PaintColor paintColor = datasource.getPaintColor(paintColorId); datasource.close(); PaintUtility.setCurrentPaintColor(paintColor); } } } }
From source file:com.example.mydemos.view.RingtonePickerActivity.java
/** Called when the activity is first created. */ @Override//from www .j a va 2s . co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.ringtone_picker); CharSequence sysTitle = (CharSequence) getResources().getText(R.string.sys_tone); CharSequence MusicTitle = (CharSequence) getResources().getText(R.string.sd_music); CharSequence RecordTitle = (CharSequence) getResources().getText(R.string.record_tone); Intent intent = getIntent(); toneType = intent.getIntExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, -1); Log.e("duwenhua", "ringPick get toneType:" + toneType); //! by duwenhua //if(toneType == RingtoneManager.TYPE_RINGTONE_SECOND) // toneType = RINGTONE_TYPE; //! by duwenhua mHasDefaultItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true); mUriForDefaultItem = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI); //Log.i("lys", "mUriForDefaultItem == " + mUriForDefaultItem); if (savedInstanceState != null) { mSelectedId = savedInstanceState.getLong(SAVE_CLICKED_POS, -1); } //Log.i("lys", "mUriForDefaultItem 1== " + mUriForDefaultItem+", mSelectedId =="+mSelectedId); mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); mExistingUri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI); //if(mUriForDefaultItem != null) //{ // mSelectedId = ContentUris.parseId(mUriForDefaultItem); //} //Log.i("lys", "RingtonePickerActivity.java onCreate mExistingUri == " + mExistingUri); //String action = getIntent().getAction(); //Log.i("lys", "PT Intent action == " + action); if (toneType == NOTIFICATION_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_NOTIFICATION_URI; } else if (toneType == RINGTONE_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI; } else if (toneType == ALARM_TYPE) { mUriForDefaultItem = Settings.System.DEFAULT_ALARM_ALERT_URI; } if (isAvailableToCheckRingtone() == true) { Ringtone ringtone_DefaultItem = checkRingtone_reflect(this, mUriForDefaultItem, toneType); if (ringtone_DefaultItem != null && ringtone_DefaultItem.getUri() != null) { mUriForDefaultItem = ringtone_DefaultItem.getUri(); Log.i("lys", "RingtoneManager.getRingtone mUriForDefaultItem== " + mUriForDefaultItem); } else { //mUriForDefaultItem = 'content/medial/'; /*ZTE_AUDIO_LIYANG 2014/06/30 fix bug for ringtone when remove sdcard start */ String originalRingtone = Settings.System.getString(getApplicationContext().getContentResolver(), "ringtone_original"); if (originalRingtone != null && !TextUtils.isEmpty(originalRingtone)) { mUriForDefaultItem = Uri.parse(originalRingtone); Log.e("liyang", "select riongtone error ,change to originalRingtone == " + mExistingUri); } /*ZTE_AUDIO_LIYANG 2014/06/30 fix bug for ringtone when remove sdcard end */ Log.i("lys", "mUriForDefaultItem set as default mUriForDefaultItem== 222"); } if (mExistingUri != null) { Ringtone ringtone = checkRingtone_reflect(this, mExistingUri, toneType); if (ringtone != null && ringtone.getUri() != null) { //mUriForDefaultItem = ringtone.getUri(); mExistingUri = ringtone.getUri(); Log.i("lys", "RingtoneManager.getRingtone mExistingUri== " + mExistingUri); } else { mExistingUri = mUriForDefaultItem; Log.i("lys", "mExistingUri set as default mExistingUri== " + mExistingUri); } } } boolean includeDrm = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_INCLUDE_DRM, false); Log.e("lys", "includeDrm ==" + includeDrm); mRingtoneManager = new RingtoneManager(this); mRingtoneManager.setIncludeDrm(includeDrm); if (toneType != -1) { mRingtoneManager.setType(toneType); } setVolumeControlStream(mRingtoneManager.inferStreamType()); // toneActivityType = mRingtoneManager.getActivityType(); if (toneType == ALARM_TYPE) { sysTitle = (CharSequence) getResources().getText(R.string.alarm_tone); } else if (toneType == NOTIFICATION_TYPE) { sysTitle = (CharSequence) getResources().getText(R.string.notification_tone); } listView = new ListView(this); listView.setOnItemClickListener(this); //listView.setBackgroundColor(#ff5a5a5a); listView.setFastScrollEnabled(true); //listView.setFastScrollAlwaysVisible(true); listView.setEmptyView(findViewById(android.R.id.empty)); //mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); //mHasDefaultItem = true; //temp if (mHasDefaultItem) { //chengcheng addDefaultStaticItem(listView, com.android.internal.R.string.ringtone_default); } setDefaultRingtone(); if (mHasSilentItem) { // chengcheng addSilendStaticItem(listView, com.android.internal.R.string.ringtone_silent); } audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mAudioFocusListener = new OnAudioFocusChangeListener() { public void onAudioFocusChange(int focusChange) { } }; okBtn = (Button) findViewById(R.id.ok); okBtn.setOnClickListener(this); cancelBtn = (Button) findViewById(R.id.cancel); cancelBtn.setOnClickListener(this); TabHost mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("tab_system").setIndicator(sysTitle, null).setContent(this)); mTabHost.addTab(mTabHost.newTabSpec("tab_music").setIndicator(MusicTitle, null).setContent(this)); mTabHost.addTab(mTabHost.newTabSpec("tab_record").setIndicator(RecordTitle, null).setContent(this)); mTabHost.setCurrentTab(0); mTabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { // stopMediaPlayer(); createTabContent(tabId); } }); }
From source file:com.devbrackets.android.playlistcore.service.PlaylistServiceCore.java
/** * Handles the remote actions from the big notification and media controls * to control the media playback//w w w . j ava 2s. c o m * * @param action The action from the intent to handle * @param extras The extras packaged with the intent associated with the action * @return True if the remote action was handled */ protected boolean handleRemoteAction(String action, Bundle extras) { if (action == null || action.isEmpty()) { return false; } switch (action) { case RemoteActions.ACTION_PLAY_PAUSE: performPlayPause(); break; case RemoteActions.ACTION_NEXT: performNext(); break; case RemoteActions.ACTION_PREVIOUS: performPrevious(); break; case RemoteActions.ACTION_REPEAT: performRepeat(); break; case RemoteActions.ACTION_SHUFFLE: performShuffle(); break; case RemoteActions.ACTION_STOP: performStop(); break; case RemoteActions.ACTION_SEEK_STARTED: performSeekStarted(); break; case RemoteActions.ACTION_SEEK_ENDED: performSeekEnded(extras.getLong(RemoteActions.ACTION_EXTRA_SEEK_POSITION, 0)); break; case RemoteActions.ACTION_ALLOWED_TYPE_CHANGED: //noinspection WrongConstant updateAllowedMediaType(extras.getInt(RemoteActions.ACTION_EXTRA_ALLOWED_TYPE)); break; default: return false; } return true; }
From source file:com.android.leanlauncher.LauncherTransitionable.java
/** * Restores the previous state, if it exists. * * @param savedState The previous state. *///from w w w . j a v a2 s.c om @SuppressWarnings("unchecked") private void restoreState(Bundle savedState) { if (savedState == null) { return; } State state = intToState(savedState.getInt(RUNTIME_STATE, State.WORKSPACE.ordinal())); if (state == State.APPS_CUSTOMIZE) { mOnResumeState = State.APPS_CUSTOMIZE; } final long pendingAddContainer = savedState.getLong(RUNTIME_STATE_PENDING_ADD_CONTAINER, -1); if (pendingAddContainer != ItemInfo.NO_ID) { mPendingAddInfo.container = pendingAddContainer; mPendingAddInfo.cellX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_X); mPendingAddInfo.cellY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_CELL_Y); mPendingAddInfo.spanX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_X); mPendingAddInfo.spanY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_Y); mPendingAddWidgetInfo = savedState.getParcelable(RUNTIME_STATE_PENDING_ADD_WIDGET_INFO); mPendingAddWidgetId = savedState.getInt(RUNTIME_STATE_PENDING_ADD_WIDGET_ID); setWaitingForResult(true); mRestoring = true; } // Restore the AppsCustomize tab if (mAppsCustomizeTabHost != null) { String curTab = savedState.getString("apps_customize_currentTab"); if (curTab != null) { mAppsCustomizeTabHost .setContentTypeImmediate(mAppsCustomizeTabHost.getContentTypeForTabTag(curTab)); mAppsCustomizeContent.loadAssociatedPages(mAppsCustomizeContent.getCurrentPage()); } int currentIndex = savedState.getInt("apps_customize_currentIndex"); mAppsCustomizeContent.restorePageForIndex(currentIndex); } }
From source file:com.mycelium.wallet.activity.modern.ModernMain.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _mbwManager = MbwManager.getInstance(this); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);//from w ww .j a va2s . com setContentView(mViewPager); ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(1, ActionBar.DISPLAY_SHOW_TITLE); // Load the theme-background (usually happens in styles.xml) but use a lower // pixel format, this saves around 10MB of allocated memory // persist the loaded Bitmap in the context of mbw-manager and reuse it every time this activity gets created try { BitmapDrawable background = (BitmapDrawable) _mbwManager.getBackgroundObjectsCache() .get("mainBackground", new Callable<BitmapDrawable>() { @Override public BitmapDrawable call() throws Exception { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.RGB_565; Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background_witherrors_dimmed, options); BitmapDrawable drawable = new BitmapDrawable(getResources(), background); drawable.setGravity(Gravity.CENTER); return drawable; } }); getWindow().setBackgroundDrawable(background); } catch (ExecutionException ignore) { } mTabsAdapter = new TabsAdapter(this, mViewPager, _mbwManager); mAccountsTab = bar.newTab(); mTabsAdapter.addTab(mAccountsTab.setText(getString(R.string.tab_accounts)), AccountsFragment.class, null); mBalanceTab = bar.newTab(); mTabsAdapter.addTab(mBalanceTab.setText(getString(R.string.tab_balance)), BalanceMasterFragment.class, null); mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.tab_transactions)), TransactionHistoryFragment.class, null); final Bundle addressBookConfig = new Bundle(); addressBookConfig.putBoolean(AddressBookFragment.SELECT_ONLY, false); mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.tab_addresses)), AddressBookFragment.class, addressBookConfig); bar.selectTab(mBalanceTab); _toaster = new Toaster(this); ChangeLog cl = new DarkThemeChangeLog(this); if (cl.isFirstRun() && cl.getChangeLog(false).size() > 0 && !cl.isFirstRunEver()) { cl.getLogDialog().show(); } checkTorState(); if (savedInstanceState != null) { _lastSync = savedInstanceState.getLong(LAST_SYNC, 0); _isAppStart = savedInstanceState.getBoolean(APP_START, true); } if (_isAppStart) { _mbwManager.getVersionManager().showFeatureWarningIfNeeded(this, Feature.APP_START); checkGapBug(); _isAppStart = false; } }
From source file:com.brq.wallet.activity.modern.ModernMain.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); _mbwManager = MbwManager.getInstance(this); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);//w ww . ja v a2s .co m setContentView(mViewPager); ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); //getSupportActionBar().setHomeButtonEnabled(true); //getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.mipmap.ic_launcher); //also displays wide logo getSupportActionBar().setDisplayShowTitleEnabled(true); // Load the theme-background (usually happens in styles.xml) but use a lower // pixel format, this saves around 10MB of allocated memory // persist the loaded Bitmap in the context of mbw-manager and reuse it every time this activity gets created /*try { BitmapDrawable background = (BitmapDrawable) _mbwManager.getBackgroundObjectsCache().get("mainBackground", new Callable<BitmapDrawable>() { @Override public BitmapDrawable call() throws Exception { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.RGB_565; Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.background_witherrors_dimmed, options); BitmapDrawable drawable = new BitmapDrawable(getResources(), background); drawable.setGravity(Gravity.CENTER); return drawable; } }); getWindow().setBackgroundDrawable(background); } catch (ExecutionException ignore) { }*/ //getWindow().setBackgroundDrawableResource(R.color.colorBackground); mTabsAdapter = new TabsAdapter(this, mViewPager, _mbwManager); mAccountsTab = bar.newTab(); mTabsAdapter.addTab(mAccountsTab.setText(getString(R.string.tab_accounts)), AccountsFragment.class, null); mBalanceTab = bar.newTab(); mTabsAdapter.addTab(mBalanceTab.setText(getString(R.string.tab_balance)), BalanceMasterFragment.class, null); mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.tab_transactions)), TransactionHistoryFragment.class, null); final Bundle addressBookConfig = new Bundle(); addressBookConfig.putBoolean(AddressBookFragment.SELECT_ONLY, false); mTabsAdapter.addTab(bar.newTab().setText(getString(R.string.tab_addresses)), AddressBookFragment.class, addressBookConfig); bar.selectTab(mBalanceTab); _toaster = new Toaster(this); ChangeLog cl = new DarkThemeChangeLog(this); if (cl.isFirstRun() && cl.getChangeLog(false).size() > 0 && !cl.isFirstRunEver()) { cl.getLogDialog().show(); } checkTorState(); if (savedInstanceState != null) { _lastSync = savedInstanceState.getLong(LAST_SYNC, 0); _isAppStart = savedInstanceState.getBoolean(APP_START, true); } if (_isAppStart) { _mbwManager.getVersionManager().showFeatureWarningIfNeeded(this, Feature.APP_START); checkGapBug(); _isAppStart = false; } }
From source file:org.getlantern.firetweet.util.Utils.java
public static long[] getAccountIds(Bundle args) { final long[] accountIds; if (args.containsKey(EXTRA_ACCOUNT_IDS)) { accountIds = args.getLongArray(EXTRA_ACCOUNT_IDS); } else if (args.containsKey(EXTRA_ACCOUNT_ID)) { accountIds = new long[] { args.getLong(EXTRA_ACCOUNT_ID, -1) }; } else {// w w w.j a v a2 s . c o m accountIds = null; } return accountIds; }