List of usage examples for android.os Bundle getInt
public int getInt(String key)
From source file:com.dsna.android.main.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.demo_activity_main); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); _initMenu();/* ww w . ja va2s . c o m*/ mDrawerToggle = new CustomActionBarDrawerToggle(this, mDrawer); mDrawer.setDrawerListener(mDrawerToggle); //----------------------------------------------------------------- //BaseFragment baseFragment = null; if (savedInstanceState != null) { mSelectedFragment = savedInstanceState.getInt(BUNDLE_SELECTEDFRAGMENT); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); if (fragmentManager.findFragmentById(R.id.fragment_main) == null) mBaseFragment = selectFragment(mSelectedFragment); //if (mBaseFragment==null) // mBaseFragment = selectFragment(mSelectedFragment); } else { mBaseFragment = new NewFeedsFragment(feeds); openFragment(mBaseFragment); } // Store the booting information to pass to the service mBootIp = getIntent().getStringExtra(bIp); mBootPort = getIntent().getStringExtra(bPort); mBindPort = getIntent().getStringExtra(biPort); mUsername = getIntent().getStringExtra(uName); // Initiate database helper dbHelper = new DatabaseHandler(this, mUsername); // Initiate cipher parameters publicKeys = null; secretKeys = null; ps06 = new PS06(); cd07 = new IBBECD07(); GoogleAccountCredential credential = GoogleAccountCredential.usingOAuth2(this, java.util.Arrays.asList(DriveScopes.DRIVE)); credential.setSelectedAccountName(mUsername); new googleCloudAuthorizationRequestTask().execute(credential); }
From source file:com.romanenco.gitt.BrowserActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_browse); filterBar = findViewById(R.id.filter_bar); findViewById(R.id.filter_close).setOnClickListener(new View.OnClickListener() { @Override// w w w .j a v a2 s .co m public void onClick(View v) { showFilterBar(false); } }); filterText = (EditText) findViewById(R.id.filter_text); filterText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { adapter.reFilter(s.toString()); } }); if (savedInstanceState == null) { current = (Repo) getIntent().getSerializableExtra(REPO); path = browseCache.get(current.getFolder()); if (path == null) { path = "."; } } else { current = (Repo) savedInstanceState.getSerializable(REPO); path = savedInstanceState.getString(PATH); filterBar.setVisibility(savedInstanceState.getInt(FILTER)); } updateTitleWithPath(); adapter = new FileListAdapter(this, current, path); getListView().setAdapter(adapter); }
From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java
private void handleCancelSubscription() { if (asyncTask != null) return;/*from w w w. ja v a 2 s .c om*/ asyncTask = new AsyncTask<Void, Void, Bundle>() { @Override protected void onPreExecute() { Log.d(TAG, "handleCancelSubscription()"); subscriptionActivity.setProgressBarIndeterminateVisibility(true); subscriptionActivity.setProgressBarVisibility(true); } @Override protected Bundle doInBackground(Void... params) { Bundle result = new Bundle(); RegistrationApi registrationApi = new RegistrationApi(subscriptionActivity); try { registrationApi.cancelSubscription(subscriptionActivity.davAccount); AccountStore.setSubscriptionPlan(subscriptionActivity, SubscriptionPlan.PLAN_NONE); AccountStore.setAutoRenew(subscriptionActivity, false); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (RegistrationApiException e) { ErrorToaster.handleBundleError(e, result); } catch (JsonProcessingException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } return result; } @Override protected void onPostExecute(Bundle result) { asyncTask = null; subscriptionActivity.setProgressBarIndeterminateVisibility(false); subscriptionActivity.setProgressBarVisibility(false); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { Toast.makeText(subscriptionActivity, R.string.subscription_canceled, Toast.LENGTH_SHORT).show(); subscriptionActivity.updateFragmentWithPlanType(SubscriptionPlan.PLAN_TYPE_NONE); } else { ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result); handleUpdateUi(); } } }.execute(); }
From source file:com.tealeaf.TeaLeaf.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PluginManager.init(this); instance = this; setFullscreenFlag();/* w w w .j ava 2 s . c o m*/ configureActivity(); String appID = findAppID(); options = new TeaLeafOptions(this); PluginManager.callAll("onCreate", this, savedInstanceState); //check intent for test app info Bundle bundle = getIntent().getExtras(); boolean isTestApp = false; if (bundle != null) { isTestApp = bundle.getBoolean("isTestApp", false); if (isTestApp) { options.setAppID(appID); boolean isPortrait = bundle.getBoolean("isPortrait", false); if (isPortrait) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } options.setCodeHost(bundle.getString("hostValue")); options.setCodePort(bundle.getInt("portValue")); String simulateID = bundle.getString("simulateID"); options.setSimulateID(simulateID); } } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); group = new FrameLayout(this); setContentView(group); // TextEditViewHandler setup textEditView = new TextEditViewHandler(this); settings = new Settings(this); remoteLogger = (ILogger) getLoggerInstance(this); checkUpdate(); compareVersions(); setLaunchUri(); // defer building all of these things until we have the absolutely correct options logger.buildLogger(this, remoteLogger); resourceManager = new ResourceManager(this, options); contactList = new ContactList(this, resourceManager); soundQueue = new SoundQueue(this, resourceManager); localStorage = new LocalStorage(this, options); // start push notifications, but defer for 10 seconds to give us time to start up PushBroadcastReceiver.scheduleNext(this, 10); glView = new TeaLeafGLSurfaceView(this); glViewPaused = false; // default screen dimensions Display display = getWindow().getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); int orientation = getRequestedOrientation(); // gets real screen dimensions without nav bars on recent API versions if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Point screenSize = new Point(); try { display.getRealSize(screenSize); width = screenSize.x; height = screenSize.y; } catch (NoSuchMethodError e) { } } // flip width and height based on orientation if ((orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && height > width) || (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && width > height)) { int tempWidth = width; width = height; height = tempWidth; } final AbsoluteLayout absLayout = new AbsoluteLayout(this); absLayout.setLayoutParams(new android.view.ViewGroup.LayoutParams(width, height)); absLayout.addView(glView, new android.view.ViewGroup.LayoutParams(width, height)); group.addView(absLayout); editText = EditTextView.Init(this); if (isTestApp) { startGame(); } soundQueue.playSound(SoundQueue.LOADING_SOUND); doFirstRun(); remoteLogger.sendLaunchEvent(this); paused = false; menuButtonHandler = MenuButtonHandlerFactory.getButtonHandler(this); group.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { // get visible area of the view Rect r = new Rect(); group.getWindowVisibleDisplayFrame(r); int visibleHeight = r.bottom; // TODO // maybe this should be renamed if (visibleHeight != lastVisibleHeight) { lastVisibleHeight = visibleHeight; EventQueue.pushEvent(new KeyboardScreenResizeEvent(visibleHeight)); } } }); }
From source file:com.example.smsquickform.Homescreen.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_homescreen); ActivityHelper.initialize(this); //This is to ensure that the rotation persists across activities and not just this one Log.d(TAG, "Created"); Intent intent = getIntent();/*from ww w . j a va 2s. c o m*/ mBtnSearch = (Button) findViewById(R.id.btnSearch); mBtnConnect = (Button) findViewById(R.id.btnConnect); mButtonAnak = (Button) findViewById(R.id.buttonAnak); mButtonIbu = (Button) findViewById(R.id.buttonIbu); heading = (TextView) findViewById(R.id.txtListHeading); mLstDevices = (ListView) findViewById(R.id.lstDevices); /* *Check if there is a savedInstanceState. If yes, that means the onCreate was probably triggered by a configuration change *like screen rotate etc. If that's the case then populate all the views that are necessary here */ if (savedInstanceState != null) { ArrayList<BluetoothDevice> list = savedInstanceState.getParcelableArrayList(DEVICE_LIST); if (list != null) { initList(list); MyAdapter adapter = (MyAdapter) mLstDevices.getAdapter(); int selectedIndex = savedInstanceState.getInt(DEVICE_LIST_SELECTED); if (selectedIndex != -1) { adapter.setSelectedIndex(selectedIndex); mBtnConnect.setEnabled(true); } } else { initList(new ArrayList<BluetoothDevice>()); } } else { initList(new ArrayList<BluetoothDevice>()); } //IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); //this.registerReceiver(mReceiver, filter); // Register for broadcasts when discovery has finished //filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); //this.registerReceiver(mReceiver, filter); mBtnSearch.setOnClickListener(new OnClickListener() { List<BluetoothDevice> listDevices; @Override public void onClick(View arg0) { mBTAdapter = BluetoothAdapter.getDefaultAdapter(); heading.setText("Searching"); mBtnSearch.setEnabled(false); if (mBTAdapter == null) { Toast.makeText(getApplicationContext(), "Bluetooth not found", Toast.LENGTH_SHORT).show(); } else if (!mBTAdapter.isEnabled()) { Intent enableBT = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBT, BT_ENABLE_REQUEST); } else { //listDevices = new ArrayList<BluetoothDevice>(); /*for (BluetoothDevice device : pairedDevices) { listDevices.add(device); }*/ new SearchDevices().execute(); } } }); mButtonIbu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (mLstDevices != null) { ArrayList<BluetoothDevice> devices = (ArrayList<BluetoothDevice>) ((MyAdapter) (mLstDevices .getAdapter())).getEntireList(); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.putExtra(DEVICES_LISTS, devices); try { } catch (NullPointerException ex) { } intent.putExtra(DEVICE_UUID, mDeviceUUID.toString()); intent.putExtra(BUFFER_SIZE, mBufferSize); startActivity(intent); } } }); mBtnConnect.setOnClickListener(new OnClickListener() { /** * connect to all paired devices */ @Override public void onClick(View arg0) { List<BluetoothDevice> devices = ((MyAdapter) (mLstDevices.getAdapter())).getEntireList(); for (int i = 0; i < devices.size(); i++) { BluetoothDevice device = devices.get(i); msg(device.getName()); Intent intent = new Intent(getApplicationContext(), MainActivity.class); intent.putExtra(DEVICE_EXTRA, device); intent.putExtra(DEVICE_UUID, mDeviceUUID.toString()); intent.putExtra(BUFFER_SIZE, mBufferSize); startActivity(intent); } } }); }
From source file:org.anhonesteffort.flock.SubscriptionStripeFragment.java
private void handleCancelSubscription() { if (asyncTask != null) return;// w ww .j a v a 2 s . com asyncTask = new AsyncTask<Void, Void, Bundle>() { @Override protected void onPreExecute() { Log.d(TAG, "handleCancelSubscription()"); subscriptionActivity.setProgressBarIndeterminateVisibility(true); subscriptionActivity.setProgressBarVisibility(true); } @Override protected Bundle doInBackground(Void... params) { Bundle result = new Bundle(); RegistrationApi registrationApi = new RegistrationApi(subscriptionActivity); try { registrationApi.cancelSubscription(subscriptionActivity.davAccount); AccountStore.setLastChargeFailed(subscriptionActivity, false); AccountStore.setSubscriptionPlan(subscriptionActivity, SubscriptionPlan.PLAN_NONE); AccountStore.setAutoRenew(subscriptionActivity, false); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (RegistrationApiException e) { ErrorToaster.handleBundleError(e, result); } catch (JsonProcessingException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } return result; } @Override protected void onPostExecute(Bundle result) { asyncTask = null; subscriptionActivity.setProgressBarIndeterminateVisibility(false); subscriptionActivity.setProgressBarVisibility(false); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { new AccountSyncScheduler(subscriptionActivity).requestSync(); Toast.makeText(subscriptionActivity, R.string.subscription_canceled, Toast.LENGTH_SHORT).show(); subscriptionActivity.updateFragmentWithPlanType(SubscriptionPlan.PLAN_TYPE_NONE); } else { ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result); handleUpdateUi(); } } }.execute(); }
From source file:com.ichi2.anki.NoteEditor.java
@Override protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); super.onCreate(savedInstanceState); setContentView(R.layout.note_editor); Intent intent = getIntent();/*w w w . j av a2 s. co m*/ if (savedInstanceState != null) { mCaller = savedInstanceState.getInt("caller"); mAddNote = savedInstanceState.getBoolean("addFact"); mCurrentDid = savedInstanceState.getLong("did"); mSelectedTags = new ArrayList<>(Arrays.asList(savedInstanceState.getStringArray("tags"))); mSavedFields = savedInstanceState.getBundle("editFields"); } else { mCaller = intent.getIntExtra(EXTRA_CALLER, CALLER_NOCALLER); if (mCaller == CALLER_NOCALLER) { String action = intent.getAction(); if (action != null && (ACTION_CREATE_FLASHCARD.equals(action) || ACTION_CREATE_FLASHCARD_SEND.equals(action))) { mCaller = CALLER_CARDEDITOR_INTENT_ADD; } } } startLoadingCollection(); }
From source file:de.sourcestream.movieDB.controller.CastDetails.java
/** * Fired when are restoring from backState or orientation has changed. * * @param args our bundle with saved state. */// ww w . j av a 2 s .c o m 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.setCastDetailsInfoBundle(save); activity.setCastDetailsCreditsBundle(save); activity.setCastDetailsBiographyBundle(save); moviesList = save.getParcelableArrayList("moviesList"); if (moviesList != null && moviesList.size() == 0) { noCredits = true; mSlidingTabLayout.disableTabClickListener(1); } new Handler().post(new Runnable() { @Override public void run() { castDetailsInfo = (CastDetailsInfo) castDetailsSlideAdapter.getRegisteredFragment(0); castDetailsCredits = (CastDetailsCredits) castDetailsSlideAdapter.getRegisteredFragment(1); if (currPos == 0) { moreIcon.setVisibility(View.INVISIBLE); } else if (moreIconCheck == 0) { castDetailsInfo.getMoreIcon().setVisibility(View.INVISIBLE); updateDownPos(); } if (moreIconCheck == 1) castDetailsInfo.getMoreIcon().setVisibility(View.GONE); else { // set listener on backdrop click to open gallery if (galleryIconCheck == 0 && galleryList.size() > 0) castDetailsInfo.getProfilePath().setOnClickListener(onGalleryIconClick); adjustIconsPos(homeIcon, galleryIcon); adjustIconsPos(castDetailsInfo.getHomeIcon(), castDetailsInfo.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); } if (castDetailsCredits.getMoviesList().size() < 7) activity.hideView(castDetailsInfo.getShowMoreButton()); } }); }
From source file:com.dycody.android.idealnote.ListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (savedInstanceState != null) { if (savedInstanceState.containsKey("listViewPosition")) { listViewPosition = savedInstanceState.getInt("listViewPosition"); listViewPositionOffset = savedInstanceState.getInt("listViewPositionOffset"); searchQuery = savedInstanceState.getString("searchQuery"); searchTags = savedInstanceState.getString("searchTags"); }/* w w w . j a va 2 s . c o m*/ keepActionMode = false; } View view = inflater.inflate(R.layout.fragment_list, container, false); ButterKnife.bind(this, view); return view; }
From source file:android.support.v17.leanback.app.BrowseFragment.java
private void readArguments(Bundle args) { if (args == null) { return;//from w w w.j a v a 2 s .c o m } if (args.containsKey(ARG_TITLE)) { setTitle(args.getString(ARG_TITLE)); } if (args.containsKey(ARG_HEADERS_STATE)) { setHeadersState(args.getInt(ARG_HEADERS_STATE)); } }