List of usage examples for android.os Bundle getBoolean
public boolean getBoolean(String key, boolean defaultValue)
From source file:com.android.ex.photo.PhotoViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActivityManager mgr = (ActivityManager) getApplicationContext() .getSystemService(Activity.ACTIVITY_SERVICE); sMemoryClass = mgr.getMemoryClass(); Intent mIntent = getIntent();//from ww w . ja va 2s .c om int currentItem = -1; if (savedInstanceState != null) { currentItem = savedInstanceState.getInt(STATE_ITEM_KEY, -1); mFullScreen = savedInstanceState.getBoolean(STATE_FULLSCREEN_KEY, false); } // uri of the photos to view; optional if (mIntent.hasExtra(Intents.EXTRA_PHOTOS_URI)) { mPhotosUri = mIntent.getStringExtra(Intents.EXTRA_PHOTOS_URI); } // projection for the query; optional // I.f not set, the default projection is used. // This projection must include the columns from the default projection. if (mIntent.hasExtra(Intents.EXTRA_PROJECTION)) { mProjection = mIntent.getStringArrayExtra(Intents.EXTRA_PROJECTION); } else { mProjection = null; } // Set the current item from the intent if wasn't in the saved instance if (mIntent.hasExtra(Intents.EXTRA_PHOTO_INDEX) && currentItem < 0) { currentItem = mIntent.getIntExtra(Intents.EXTRA_PHOTO_INDEX, -1); } mPhotoIndex = currentItem; setContentView(R.layout.photo_activity_view); // Create the adapter and add the view pager mAdapter = new PhotoPagerAdapter(this, getFragmentManager(), null); mViewPager = (PhotoViewPager) findViewById(R.id.photo_view_pager); mViewPager.setAdapter(mAdapter); mViewPager.setOnPageChangeListener(this); mViewPager.setOnInterceptTouchListener(this); // Kick off the loader getLoaderManager().initLoader(LOADER_PHOTO_LIST, null, this); final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); mActionBarHideDelayTime = getResources().getInteger(R.integer.action_bar_delay_time_in_millis); actionBar.addOnMenuVisibilityListener(this); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); }
From source file:cn.ucai.yizhesale.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null && savedInstanceState.getBoolean(Constant.ACCOUNT_REMOVED, false)) { // ??home???appcrash // fragment?? DemoHXSDKHelper.getInstance().logout(true, null); finish();/*from w ww . j av a 2 s . co m*/ startActivity(new Intent(this, LoginActivity.class)); return; } else if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) { // T??home???appcrash // fragment?? finish(); startActivity(new Intent(this, LoginActivity.class)); return; } setContentView(cn.ucai.yizhesale.R.layout.activity_main); initView(); // MobclickAgent.setDebugMode( true ); // --?-- MobclickAgent.updateOnlineConfig(this); if (getIntent().getBooleanExtra("conflict", false) && !isConflictDialogShow) { showConflictDialog(); } else if (getIntent().getBooleanExtra(Constant.ACCOUNT_REMOVED, false) && !isAccountRemovedDialogShow) { showAccountRemovedDialog(); } inviteMessgeDao = new InviteMessgeDao(this); userDao = new EMUserDao(this); // fragment??? // chatHistoryFragment = new ChatHistoryFragment(); // ?fragment chatHistoryFragment = new ChatAllHistoryFragment(); contactListFragment = new ContactlistFragment(); settingFragment = new SettingsFragment(); fragments = new Fragment[] { chatHistoryFragment, contactListFragment, settingFragment }; // fragment getSupportFragmentManager().beginTransaction() .add(cn.ucai.yizhesale.R.id.fragment_container, chatHistoryFragment) .add(cn.ucai.yizhesale.R.id.fragment_container, contactListFragment).hide(contactListFragment) .show(chatHistoryFragment).commit(); init(); //??? ((DemoHXSDKHelper) HXSDKHelper.getInstance()).getUserProfileManager().asyncGetCurrentUserInfo(); }
From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerFragment.java
/** * Called when the fragment's activity has been created and this * fragment's view hierarchy instantiated. It can be used to do final * initialization once these pieces are in place, such as retrieving * views or restoring state. It is also useful for fragments that use * {@link #setRetainInstance(boolean)} to retain their instance, * as this callback tells the fragment when it is fully associated with * the new activity instance. This is called after {@link #onCreateView} * and before {@link #onViewStateRestored(Bundle)}. * * @param savedInstanceState If the fragment is being re-created from * a previous saved state, this is the state. *//*w w w.j a v a 2 s. c om*/ @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Only if we have no state if (mCurrentPath == null) { if (savedInstanceState != null) { mode = savedInstanceState.getInt(KEY_MODE, mode); allowCreateDir = savedInstanceState.getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir); allowMultiple = savedInstanceState.getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple); mCurrentPath = getPath(savedInstanceState.getString(KEY_CURRENT_PATH)); } else if (getArguments() != null) { mode = getArguments().getInt(KEY_MODE, mode); allowCreateDir = getArguments().getBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir); allowMultiple = getArguments().getBoolean(KEY_ALLOW_MULTIPLE, allowMultiple); if (getArguments().containsKey(KEY_START_PATH)) { mCurrentPath = getPath(getArguments().getString(KEY_START_PATH)); } } // If still null if (mCurrentPath == null) { mCurrentPath = getRoot(); } } refresh(); }
From source file:com.android.tv.settings.users.AppRestrictionsFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mUser = new UserHandle(savedInstanceState.getInt(EXTRA_USER_ID)); } else {/* ww w . j a v a2s . c o m*/ Bundle args = getArguments(); if (args != null) { if (args.containsKey(EXTRA_USER_ID)) { mUser = new UserHandle(args.getInt(EXTRA_USER_ID)); } mNewUser = args.getBoolean(EXTRA_NEW_USER, false); } } if (mUser == null) { mUser = android.os.Process.myUserHandle(); } mHelper = new AppRestrictionsHelper(getContext(), mUser); mHelper.setLeanback(true); mPackageManager = getActivity().getPackageManager(); mIPm = AppGlobals.getPackageManager(); mUserManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); mRestrictedProfile = mUserManager.getUserInfo(mUser.getIdentifier()).isRestricted(); try { mSysPackageInfo = mPackageManager.getPackageInfo("android", PackageManager.GET_SIGNATURES); } catch (PackageManager.NameNotFoundException nnfe) { Log.e(TAG, "Could not find system package signatures", nnfe); } mAppList = getAppPreferenceGroup(); mAppList.setOrderingAsAdded(false); }
From source file:com.onesignal.NotificationExtenderService.java
private void processIntent(Intent intent) { Bundle bundle = intent.getExtras(); // Service maybe triggered without extras on some Android devices on boot. // https://github.com/OneSignal/OneSignal-Android-SDK/issues/99 if (bundle == null) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "No extras sent to NotificationExtenderService in its Intent!\n" + intent); return;/*from w ww .ja v a 2s. c om*/ } String jsonStrPayload = bundle.getString("json_payload"); if (jsonStrPayload == null) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "json_payload key is nonexistent from bundle passed to NotificationExtenderService: " + bundle); return; } try { currentJsonPayload = new JSONObject(jsonStrPayload); currentlyRestoring = bundle.getBoolean("restoring", false); if (bundle.containsKey("android_notif_id")) { currentBaseOverrideSettings = new OverrideSettings(); currentBaseOverrideSettings.androidNotificationId = bundle.getInt("android_notif_id"); } if (!currentlyRestoring && OneSignal.notValidOrDuplicated(this, currentJsonPayload)) return; restoreTimestamp = bundle.getLong("timestamp"); processJsonObject(currentJsonPayload, currentlyRestoring); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.app.khclub.base.easeim.activity.ContactlistFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // T??home???appcrash if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false)) return;//ww w . ja va 2 s . c om inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); listView = (ListView) getView().findViewById(R.id.list); sidebar = (Sidebar) getView().findViewById(R.id.sidebar); sidebar.setListView(listView); // ??? blackList = EMContactManager.getInstance().getBlackListUsernames(); contactList = new ArrayList<User>(); // ?contactlist getContactList(); // ? query = (EditText) getView().findViewById(R.id.query); query.setHint(R.string.search); clearSearch = (ImageButton) getView().findViewById(R.id.search_clear); query.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { adapter.getFilter().filter(s); if (s.length() > 0) { clearSearch.setVisibility(View.VISIBLE); } else { clearSearch.setVisibility(View.INVISIBLE); } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void afterTextChanged(Editable s) { } }); clearSearch.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { query.getText().clear(); hideSoftKeyboard(); } }); // adapter adapter = new ContactAdapter(getActivity(), R.layout.row_contact, contactList); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String username = adapter.getItem(position).getUsername(); if (Constant.NEW_FRIENDS_USERNAME.equals(username)) { // ? User user = ((KHHXSDKHelper) HXSDKHelper.getInstance()).getContactList() .get(Constant.NEW_FRIENDS_USERNAME); user.setUnreadMsgCount(0); startActivity(new Intent(getActivity(), NewFriendsMsgActivity.class)); } else if (Constant.GROUP_USERNAME.equals(username)) { // ?? startActivity(new Intent(getActivity(), GroupsActivity.class)); } else if (Constant.CHAT_ROOM.equals(username)) { // ?? startActivity(new Intent(getActivity(), PublicChatRoomsActivity.class)); } else if (Constant.CHAT_ROBOT.equals(username)) { // // Robot? // startActivity(new Intent(getActivity(), // RobotsActivity.class)); // ??? Intent intentToCardList = new Intent(getActivity(), CollectCardActivity.class); startActivity(intentToCardList); // ? getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } else { // demo?? // startActivity(new Intent(getActivity(), // ChatActivity.class) // .putExtra("userId", adapter.getItem(position) // .getUsername())); // ? Intent intent = new Intent(getActivity(), OtherPersonalActivity.class); intent.putExtra(OtherPersonalActivity.INTENT_KEY, KHUtils.stringToInt(adapter.getItem(position).getUsername().replace(KHConst.KH, ""))); startActivity(intent); getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } } }); listView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // ?? if (getActivity().getWindow() .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) { if (getActivity().getCurrentFocus() != null) inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } return false; } }); // ? qrImageView = new QRCodePopupMenu(getActivity()); final ImageView operateMenuView = (ImageView) getView().findViewById(R.id.iv_new_contact); // ??? operateMenuView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (null == mainMenu) { mainMenu = new MainPopupMenu(getActivity()); mainMenu.setListener(new ClickListener() { @Override public void scanQRcodeClick() { // ??? Intent intent = new Intent(); intent.setClass(getActivity(), MipcaCaptureActivity.class); startActivityForResult(intent, SCANNIN_GREQUEST_CODE); } @Override public void searchClick() { // ?? Intent intentToSearch = new Intent(getActivity(), SearchActivity.class); startActivity(intentToSearch); // ? getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } @Override public void createGroupClick() { // ? startActivity(new Intent(getActivity(), NewGroupActivity.class)); getActivity().overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } @Override public void userQRShowClick() { // TODO ? qrImageView.setQRcode(false); qrImageView.showPopupWindow((RelativeLayout) getView().findViewById(R.id.title_bar)); } }); } mainMenu.showPopupWindow(operateMenuView); // startActivity(new Intent(getActivity(), // AddContactActivity.class)); } }); registerForContextMenu(listView); progressBar = (View) getView().findViewById(R.id.progress_bar); contactSyncListener = new HXContactSyncListener(); HXSDKHelper.getInstance().addSyncContactListener(contactSyncListener); blackListSyncListener = new HXBlackListSyncListener(); HXSDKHelper.getInstance().addSyncBlackListListener(blackListSyncListener); contactInfoSyncListener = new HXContactInfoSyncListener(); ((KHHXSDKHelper) HXSDKHelper.getInstance()).getUserProfileManager() .addSyncContactInfoListener(contactInfoSyncListener); if (!HXSDKHelper.getInstance().isContactsSyncedWithServer()) { progressBar.setVisibility(View.VISIBLE); } else { progressBar.setVisibility(View.GONE); } }
From source file:es.uma.lcc.lockpic.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainactivity); System.loadLibrary("jpg"); // load native libraries // This activity is able to open images directly from a file browser. // If this is the case, we store the path, which will be used in onPostCreate Intent intent = getIntent();/*from ww w. j a v a 2 s. com*/ if (Intent.ACTION_VIEW.equals(intent.getAction()) && intent.getType() != null && (savedInstanceState == null || savedInstanceState.getBoolean("firstTime", true))) { if (intent.getType().startsWith("image/")) { mDirectDecryptPath = LockPicIO.getPathFromIntent(MainActivity.this, intent); if (mDirectDecryptPath == null) Toast.makeText(this, R.string.unknownIntent, Toast.LENGTH_SHORT).show(); } } // disable screen capture getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); }
From source file:com.android.deskclock.timer.TimerFullScreenFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.timer_full_screen_fragment, container, false); // Handle arguments from parent Bundle bundle = getArguments(); if (bundle != null && bundle.containsKey(Timers.TIMESUP_MODE)) { if (bundle.getBoolean(Timers.TIMESUP_MODE, false)) { try { mOnEmptyListListener = (OnEmptyListListener) getActivity(); } catch (ClassCastException e) { Log.wtf(TAG, getActivity().toString() + " must implement OnEmptyListListener"); }//w w w. j a v a 2 s . c o m } } mFab = (ImageButton) v.findViewById(R.id.fab); mTimersList = (StaggeredGridView) v.findViewById(R.id.timers_list); // For tablets in landscape, the count will be 2. All else will be 1. mColumnCount = getResources().getInteger(R.integer.timer_column_count); mTimersList.setColumnCount(mColumnCount); // Set this to true; otherwise adding new views to the end of the list won't cause // everything above it to be filled in correctly. mTimersList.setGuardAgainstJaggedEdges(true); mTimersListPage = v.findViewById(R.id.timers_list_page); mTimerSetup = (TimerSetupView) v.findViewById(R.id.timer_setup); mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mNotificationManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); return v; }
From source file:com.repkap11.repcast.activities.LocalPlayerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_activity); mAquery = new AQuery(this); loadViews();/*from w ww. j a v a 2 s .c o m*/ mCastManager = VideoCastManager.getInstance(); mCastManager.setCastControllerImmersive(false); setupControlsCallbacks(); setupCastListener(); String castPath; String mimeType = getIntent().getType(); String title = getIntent().getStringExtra(Intent.EXTRA_TITLE); int trackType; int mediaType; if (mimeType.equals("video/mp4")) { trackType = MediaTrack.TYPE_VIDEO; mediaType = MediaMetadata.MEDIA_TYPE_MOVIE; } else if (mimeType.equals("audio/mpeg")) { } else { trackType = MediaTrack.TYPE_UNKNOWN; mediaType = MediaMetadata.MEDIA_TYPE_GENERIC; } trackType = MediaTrack.TYPE_VIDEO; mediaType = MediaMetadata.MEDIA_TYPE_MOVIE; try { URL url = new URI(getIntent().getDataString()).toURL(); castPath = url.toExternalForm(); if (title == null) { title = new File(url.getPath()).getName(); } } catch (MalformedURLException | URISyntaxException e) { e.printStackTrace(); finish(); return; } Log.e(TAG, "Cast Path:" + castPath); MediaInfo.Builder builder = new MediaInfo.Builder(castPath); builder.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED); builder.setContentType(mimeType); MediaMetadata metadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK); metadata.putString(MediaMetadata.KEY_TITLE, title); //metadata.putString(MediaMetadata.KEY_SUBTITLE, "Sub title Text"); builder.setMetadata(metadata); JSONObject jsonObj = null; try { jsonObj = new JSONObject(); jsonObj.put(VideoProvider.KEY_DESCRIPTION, ""); } catch (JSONException e) { Log.e(TAG, "Failed to add description to the json object", e); } MediaTrack.Builder trackBuilder = new MediaTrack.Builder(1, MediaTrack.TYPE_VIDEO); //trackBuilder.setContentId(castPath); Log.e(TAG, "Setting path String: " + castPath); trackBuilder.setName(title); builder.setMediaTracks(Collections.singletonList(trackBuilder.build())); builder.setCustomData(jsonObj); mSelectedMedia = builder.build(); setupActionBar(); Bundle b = getIntent().getExtras(); boolean shouldStartPlayback = false; int startPosition = 0; if (b != null) { shouldStartPlayback = b.getBoolean("shouldStart", false); startPosition = b.getInt("startPosition", 0); } mVideoView.setVideoURI(Uri.parse(mSelectedMedia.getContentId())); Log.e(TAG, "Setting url of the VideoView to: " + Uri.parse(mSelectedMedia.getContentId())); if (shouldStartPlayback) { // this will be the case only if we are coming from the // CastControllerActivity by disconnecting from a device mPlaybackState = PlaybackState.PLAYING; updatePlaybackLocation(PlaybackLocation.LOCAL); updatePlayButton(mPlaybackState); if (startPosition > 0) { mVideoView.seekTo(startPosition); } mVideoView.start(); startControllersTimer(); } else { // we should load the video but pause it // and show the album art. if (mCastManager.isConnected()) { updatePlaybackLocation(PlaybackLocation.REMOTE); } else { updatePlaybackLocation(PlaybackLocation.LOCAL); } mPlaybackState = PlaybackState.IDLE; updatePlayButton(mPlaybackState); } if (null != mTitleView) { updateMetadata(true); } }