List of usage examples for android.os Bundle getInt
public int getInt(String key)
From source file:org.mifos.androidclient.main.CustomerDetailsActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.customer_details); tabs = (TabHost) findViewById(R.id.customerDetails_tabhost); tabs.setup();// w w w . j a v a2 s . com TabHost.TabSpec overviewSpec = tabs.newTabSpec(getString(R.string.customerDetails_tab_overview)); overviewSpec.setIndicator(getString(R.string.customerDetails_tab_overview)); overviewSpec.setContent(R.id.customer_overview); TabHost.TabSpec accountsSpec = tabs.newTabSpec(getString(R.string.customerDetails_tab_accounts)); accountsSpec.setIndicator(getString(R.string.customerDetails_tab_accounts)); accountsSpec.setContent(R.id.customer_accounts); TabHost.TabSpec additionalSpec = tabs.newTabSpec(getString(R.string.customerDetails_tab_additional)); additionalSpec.setIndicator(getString(R.string.customerDetails_tab_additional)); additionalSpec.setContent(R.id.customer_additional); tabs.addTab(overviewSpec); tabs.addTab(accountsSpec); tabs.addTab(additionalSpec); TabColorUtils.setTabColor(tabs); tabs.setOnTabChangedListener(this); if (bundle != null) { if (bundle.containsKey(CustomerDetailsEntity.BUNDLE_KEY)) { mDetails = (CustomerDetailsEntity) bundle.getSerializable(CustomerDetailsEntity.BUNDLE_KEY); } if (bundle.containsKey(Fee.BUNDLE_KEY)) { mApplicableFees = (Map<String, Map<String, String>>) bundle.getSerializable(Fee.BUNDLE_KEY); } if (bundle.containsKey(SELECTED_TAB_BUNDLE_KEY)) { tabs.setCurrentTab(bundle.getInt(SELECTED_TAB_BUNDLE_KEY)); } } if (getIntent().hasExtra("isGroup")) { isGroup = true; } mCustomer = (AbstractCustomer) getIntent().getSerializableExtra(AbstractCustomer.BUNDLE_KEY); mCustomerService = new CustomerService(this); }
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
/** * Called when the activity starts up. Do activity initialization * here, not in a constructor./*w ww. j a va 2s . co m*/ * * @see Activity#onCreate */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CookieSyncManager.createInstance(getApplicationContext()); mSettings.loadRedditPreferences(this, mClient); setRequestedOrientation(mSettings.getRotation()); setTheme(mSettings.getTheme()); requestWindowFeature(Window.FEATURE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.inbox_list_content); registerForContextMenu(getListView()); if (mSettings.isLoggedIn()) { if (savedInstanceState != null) { mReplyTargetName = savedInstanceState.getString(Constants.REPLY_TARGET_NAME_KEY); mAfter = savedInstanceState.getString(Constants.AFTER_KEY); mBefore = savedInstanceState.getString(Constants.BEFORE_KEY); mCount = savedInstanceState.getInt(Constants.THREAD_COUNT_KEY); mLastAfter = savedInstanceState.getString(Constants.LAST_AFTER_KEY); mLastBefore = savedInstanceState.getString(Constants.LAST_BEFORE_KEY); mLastCount = savedInstanceState.getInt(Constants.THREAD_LAST_COUNT_KEY); mVoteTargetThingInfo = savedInstanceState.getParcelable(Constants.VOTE_TARGET_THING_INFO_KEY); mWhichInbox = savedInstanceState.getString(Constants.WHICH_INBOX_KEY); restoreLastNonConfigurationInstance(); if (mMessagesList == null) { // Load previous view of threads if (mLastAfter != null) { new DownloadMessagesTask(mWhichInbox, mLastAfter, null, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else if (mLastBefore != null) { new DownloadMessagesTask(mWhichInbox, null, mLastBefore, mLastCount) .execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } else { new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { // Orientation change. Use prior instance. resetUI(new MessagesListAdapter(this, mMessagesList)); } } else { Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(Constants.WHICH_INBOX_KEY)) mWhichInbox = extras.getString(Constants.WHICH_INBOX_KEY); } new DownloadMessagesTask(mWhichInbox).execute(Constants.DEFAULT_COMMENT_DOWNLOAD_LIMIT); } } else { showDialog(Constants.DIALOG_LOGIN); } setTitle(String.format(getResources().getString(R.string.inbox_title), mSettings.getUsername())); }
From source file:de.sourcestream.movieDB.controller.TVDetails.java
/** * Fired when are restoring from backState or orientation has changed. * * @param args our bundle with saved state. *//*from ww w .j a v a2 s . com*/ private void onOrientationChange(Bundle args) { // Home page homeIconCheck = args.getInt("homeIconCheck"); if (homeIconCheck == 0) homeIconUrl = args.getString("homepage"); // Gallery galleryIconCheck = args.getInt("galleryIconCheck"); if (galleryIconCheck == 0) { galleryList = new ArrayList<>(); galleryList = args.getStringArrayList("galleryList"); if (galleryList.size() == 0) activity.hideView(galleryIcon); } // More icon moreIconCheck = args.getInt("moreIconCheck"); if (homeIconCheck == 1 && galleryIconCheck == 1) { moreIconCheck = 1; moreIcon.setVisibility(View.GONE); } else moreIconCheck = 0; mSlidingTabLayout.setOnPageChangeListener(onPageChangeSelected); activity.setTVDetailsInfoBundle(save); activity.setTVDetailsCastBundle(save); activity.setTVDetailsOverviewBundle(save); castList = save.getParcelableArrayList("castList"); if (castList != null && castList.size() == 0) { noCast = true; mSlidingTabLayout.disableTabClickListener(1); } new Handler().post(new Runnable() { @Override public void run() { tvDetailsInfo = (TVDetailsInfo) tvDetailsSlideAdapter.getRegisteredFragment(0); if (currPos == 0) { moreIcon.setVisibility(View.INVISIBLE); } else if (moreIconCheck == 0) { tvDetailsInfo.getMoreIcon().setVisibility(View.INVISIBLE); updateDownPos(); } if (moreIconCheck == 1) tvDetailsInfo.getMoreIcon().setVisibility(View.GONE); else { // set listener on backdrop and poster path click to open gallery if (galleryIconCheck == 0 && galleryList.size() > 0) { tvDetailsInfo.getBackDropPath().setOnClickListener(onGalleryIconClick); tvDetailsInfo.getPosterPath().setOnClickListener(onGalleryIconClick); } adjustIconsPos(homeIcon, galleryIcon); adjustIconsPos(tvDetailsInfo.getHomeIcon(), tvDetailsInfo.getGalleryIcon()); } // disable orientation changing, enable nav drawer sliding, show toolbar if (galleryIconCheck == 0 && galleryList.size() == 1) { activity.getWindow().getDecorView().setBackgroundColor( ContextCompat.getColor(activity, R.color.background_material_light)); if (activity.getSupportActionBar() != null) activity.getSupportActionBar().show(); activity.getMDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); if (Build.VERSION.SDK_INT >= 19) activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); // Check orientation and lock to portrait if we are on phone if (getResources().getBoolean(R.bool.portrait_only)) activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } }); }
From source file:org.lol.reddit.activities.PostSubmitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit); typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type); usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username); subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit); titleEdit = (EditText) layout.findViewById(R.id.post_submit_title); textEdit = (EditText) layout.findViewById(R.id.post_submit_body); final Intent intent = getIntent(); if (intent != null) { if (intent.hasExtra("subreddit")) { final String subreddit = intent.getStringExtra("subreddit"); if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?") && subreddit.matches("/?(r/)?\\w+/?")) { subredditEdit.setText(subreddit); }/* w w w .j a va2 s . co m*/ } else if (Intent.ACTION_SEND.equalsIgnoreCase(intent.getAction()) && intent.hasExtra(Intent.EXTRA_TEXT)) { final String url = intent.getStringExtra(Intent.EXTRA_TEXT); textEdit.setText(url); } } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) { titleEdit.setText(savedInstanceState.getString("post_title")); textEdit.setText(savedInstanceState.getString("post_body")); subredditEdit.setText(savedInstanceState.getString("subreddit")); typeSpinner.setSelection(savedInstanceState.getInt("post_type")); } final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts(); final ArrayList<String> usernames = new ArrayList<String>(); for (RedditAccount account : accounts) { if (!account.isAnonymous()) { usernames.add(account.username); } } if (usernames.size() == 0) { General.quickToast(this, R.string.error_toast_notloggedin); finish(); } usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames)); typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes)); // TODO remove the duplicate code here setHint(); typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setHint(); } public void onNothingSelected(AdapterView<?> parent) { } }); final ScrollView sv = new ScrollView(this); sv.addView(layout); setContentView(sv); }
From source file:org.quantumbadger.redreader.activities.PostSubmitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit); typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type); usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username); subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit); titleEdit = (EditText) layout.findViewById(R.id.post_submit_title); textEdit = (EditText) layout.findViewById(R.id.post_submit_body); final Intent intent = getIntent(); if (intent != null) { if (intent.hasExtra("subreddit")) { final String subreddit = intent.getStringExtra("subreddit"); if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?") && subreddit.matches("/?(r/)?\\w+/?")) { subredditEdit.setText(subreddit); }//from ww w . j a va 2s.co m } else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SEND) && intent.hasExtra(Intent.EXTRA_TEXT)) { final String url = intent.getStringExtra(Intent.EXTRA_TEXT); textEdit.setText(url); } } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) { titleEdit.setText(savedInstanceState.getString("post_title")); textEdit.setText(savedInstanceState.getString("post_body")); subredditEdit.setText(savedInstanceState.getString("subreddit")); typeSpinner.setSelection(savedInstanceState.getInt("post_type")); } final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts(); final ArrayList<String> usernames = new ArrayList<String>(); for (RedditAccount account : accounts) { if (!account.isAnonymous()) { usernames.add(account.username); } } if (usernames.size() == 0) { General.quickToast(this, R.string.error_toast_notloggedin); finish(); } usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames)); typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes)); // TODO remove the duplicate code here setHint(); typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setHint(); } public void onNothingSelected(AdapterView<?> parent) { } }); final ScrollView sv = new ScrollView(this); sv.addView(layout); setContentView(sv); }
From source file:com.github.chenxiaolong.dualbootpatcher.settings.RomSettingsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getPreferenceManager().setSharedPreferencesName("settings"); addPreferencesFromResource(R.xml.rom_settings); int threads = getPreferenceManager().getSharedPreferences().getInt(KEY_PARALLEL_PATCHING, PatcherService.DEFAULT_PATCHING_THREADS); mBackupDirectoryPref = findPreference(KEY_BACKUP_DIRECTORY); mBackupDirectoryPref.setOnPreferenceClickListener(this); updateBackupDirectorySummary();// w w w .j ava2 s . c o m mBootUIInstallPref = findPreference(KEY_BOOT_UI_INSTALL); mBootUIInstallPref.setEnabled(false); mBootUIInstallPref.setSummary(R.string.please_wait); mBootUIInstallPref.setOnPreferenceClickListener(this); mBootUIUninstallPref = findPreference(KEY_BOOT_UI_UNINSTALL); mBootUIUninstallPref.setEnabled(false); mBootUIUninstallPref.setSummary(R.string.please_wait); mBootUIUninstallPref.setOnPreferenceClickListener(this); mParallelPatchingPref = findPreference(KEY_PARALLEL_PATCHING); mParallelPatchingPref.setDefaultValue(Integer.toString(threads)); mParallelPatchingPref.setOnPreferenceChangeListener(this); updateParallelPatchingSummary(threads); mUseDarkThemePref = findPreference(KEY_USE_DARK_THEME); mUseDarkThemePref.setOnPreferenceChangeListener(this); if (savedInstanceState != null) { mTaskIdCheckSupported = savedInstanceState.getInt(EXTRA_TASK_ID_CHECK_SUPPORTED); mTaskIdGetVersion = savedInstanceState.getInt(EXTRA_TASK_ID_GET_VERSION); mTaskIdInstall = savedInstanceState.getInt(EXTRA_TASK_ID_INSTALL); mTaskIdUninstall = savedInstanceState.getInt(EXTRA_TASK_ID_UNINSTALL); } }
From source file:androidx.media.MediaController2.java
void onConnectedNotLocked(Bundle data) { // is enough or should we pass it while connecting? final SessionCommandGroup2 allowedCommands = SessionCommandGroup2 .fromBundle(data.getBundle(ARGUMENT_ALLOWED_COMMANDS)); final int playerState = data.getInt(ARGUMENT_PLAYER_STATE); final int bufferingState = data.getInt(ARGUMENT_BUFFERING_STATE); final PlaybackStateCompat playbackStateCompat = data.getParcelable(ARGUMENT_PLAYBACK_STATE_COMPAT); final int repeatMode = data.getInt(ARGUMENT_REPEAT_MODE); final int shuffleMode = data.getInt(ARGUMENT_SHUFFLE_MODE); final List<MediaItem2> playlist = MediaUtils2 .fromMediaItem2ParcelableArray(data.getParcelableArray(ARGUMENT_PLAYLIST)); final MediaItem2 currentMediaItem = MediaItem2.fromBundle(data.getBundle(ARGUMENT_MEDIA_ITEM)); final PlaybackInfo playbackInfo = PlaybackInfo.fromBundle(data.getBundle(ARGUMENT_PLAYBACK_INFO)); final MediaMetadata2 metadata = MediaMetadata2.fromBundle(data.getBundle(ARGUMENT_PLAYLIST_METADATA)); if (DEBUG) {//from w ww . ja v a 2 s . c o m Log.d(TAG, "onConnectedNotLocked sessionCompatToken=" + mToken.getSessionCompatToken() + ", allowedCommands=" + allowedCommands); } boolean close = false; try { synchronized (mLock) { if (mIsReleased) { return; } if (mConnected) { Log.e(TAG, "Cannot be notified about the connection result many times." + " Probably a bug or malicious app."); close = true; return; } mAllowedCommands = allowedCommands; mPlayerState = playerState; mBufferingState = bufferingState; mPlaybackStateCompat = playbackStateCompat; mRepeatMode = repeatMode; mShuffleMode = shuffleMode; mPlaylist = playlist; mCurrentMediaItem = currentMediaItem; mPlaylistMetadata = metadata; mConnected = true; mPlaybackInfo = playbackInfo; } mCallbackExecutor.execute(new Runnable() { @Override public void run() { // Note: We may trigger ControllerCallbacks with the initial values // But it's hard to define the order of the controller callbacks // Only notify about the mCallback.onConnected(MediaController2.this, allowedCommands); } }); } finally { if (close) { // Trick to call release() without holding the lock, to prevent potential deadlock // with the developer's custom lock within the ControllerCallback.onDisconnected(). close(); } } }
From source file:org.mifos.androidclient.main.AccountDetailsActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.account_details); tabs = (TabHost) findViewById(R.id.accountDetails_tabHost); tabs.setup();/*from w ww . j a v a 2 s . co m*/ TabHost.TabSpec overviewSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_overview)); overviewSpec.setIndicator(getString(R.string.accountDetails_tab_overview)); overviewSpec.setContent(R.id.account_overview); TabHost.TabSpec additionalInfoSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_additionalInfo)); additionalInfoSpec.setIndicator(getString(R.string.accountDetails_tab_additionalInfo)); additionalInfoSpec.setContent(R.id.account_details); TabHost.TabSpec transactionSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_transaction)); transactionSpec.setIndicator(getString(R.string.accountDetails_tab_transaction)); transactionSpec.setContent(R.id.account_transaction); tabs.addTab(overviewSpec); tabs.addTab(transactionSpec); tabs.addTab(additionalInfoSpec); TabColorUtils.setTabColor(tabs); tabs.setOnTabChangedListener(this); if (bundle != null) { if (bundle.containsKey(AbstractAccountDetails.BUNDLE_KEY)) { mDetails = (AbstractAccountDetails) bundle.getSerializable(AbstractAccountDetails.BUNDLE_KEY); } if (bundle.containsKey(Fee.BUNDLE_KEY)) { mApplicableFees = (Map<String, Map<String, String>>) bundle.getSerializable(Fee.BUNDLE_KEY); } if (bundle.containsKey(SELECTED_TAB_BUNDLE_KEY)) { tabs.setCurrentTab(bundle.getInt(SELECTED_TAB_BUNDLE_KEY)); } } mAccount = (AccountBasicInformation) getIntent().getSerializableExtra(AccountBasicInformation.BUNDLE_KEY); mAccountService = new AccountService(this); mSystemSettingsService = new SystemSettingsService(this); }
From source file:com.app.uafeed.activity.EditFeedActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { UiUtils.setPreferenceTheme(this); super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_feed_edit); setResult(RESULT_CANCELED);// w ww .j a va 2 s.c o m Intent intent = getIntent(); mTabHost = (TabHost) findViewById(R.id.tabHost); mNameEditText = (EditText) findViewById(R.id.feed_title); mUrlEditText = (EditText) findViewById(R.id.feed_url); mRetrieveFulltextCb = (CheckBox) findViewById(R.id.retrieve_fulltext); mFiltersListView = (ListView) findViewById(android.R.id.list); View tabWidget = findViewById(android.R.id.tabs); View buttonLayout = findViewById(R.id.button_layout); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("feedTab").setIndicator(getString(R.string.tab_feed_title)) .setContent(R.id.feed_tab)); mTabHost.addTab(mTabHost.newTabSpec("filtersTab").setIndicator(getString(R.string.tab_filters_title)) .setContent(R.id.filters_tab)); mTabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String s) { invalidateOptionsMenu(); } }); if (savedInstanceState != null) { mTabHost.setCurrentTab(savedInstanceState.getInt(STATE_CURRENT_TAB)); } if (intent.getAction().equals(Intent.ACTION_INSERT) || intent.getAction().equals(Intent.ACTION_SEND)) { setTitle(R.string.new_feed_title); tabWidget.setVisibility(View.GONE); if (intent.hasExtra(Intent.EXTRA_TEXT)) { mUrlEditText.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); } } else if (intent.getAction().equals(Intent.ACTION_EDIT)) { setTitle(R.string.edit_feed_title); buttonLayout.setVisibility(View.GONE); mFiltersCursorAdapter = new FiltersCursorAdapter(this, null); mFiltersListView.setAdapter(mFiltersCursorAdapter); mFiltersListView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { startActionMode(mFilterActionModeCallback); mFiltersCursorAdapter.setSelectedFilter(position); mFiltersListView.invalidateViews(); return true; } }); getLoaderManager().initLoader(0, null, this); if (savedInstanceState == null) { Cursor cursor = getContentResolver().query(intent.getData(), FEED_PROJECTION, null, null, null); if (cursor.moveToNext()) { mPreviousName = cursor.getString(0); mNameEditText.setText(mPreviousName); mUrlEditText.setText(cursor.getString(1)); mRetrieveFulltextCb.setChecked(cursor.getInt(2) == 1); cursor.close(); } else { cursor.close(); Toast.makeText(EditFeedActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); finish(); } } } }