List of usage examples for android.os Bundle putBoolean
public void putBoolean(@Nullable String key, boolean value)
From source file:com.imalu.alyou.activity.MainActivity.java
/** * ?listener/*from w w w.ja v a2 s .c o m*/ * */ // private class MyConnectionListener implements EMConnectionListener { // // @Override // public void onConnected() { // runOnUiThread(new Runnable() { // // @Override // public void run() { // chatHistoryFragment.errorItem.setVisibility(View.GONE); // } // // }); // } // // @Override // public void onDisconnected(final int error) { // runOnUiThread(new Runnable() { // // @Override // public void run() { // if (error == EMError.CONNECTION_CONFLICT) { // // ??dialog // showConflictDialog(); // } else { // chatHistoryFragment.errorItem.setVisibility(View.VISIBLE); // if (NetUtils.hasNetwork(MainActivity.this)) // chatHistoryFragment.errorText.setText("???"); // else // chatHistoryFragment.errorText.setText("???"); // // } // } // // }); // } // } // // /** // * MyGroupChangeListener // */ // private class MyGroupChangeListener implements GroupChangeListener { // // @Override // public void onInvitationReceived(String groupId, String groupName, String inviter, String reason) { // boolean hasGroup = false; // for (EMGroup group : EMGroupManager.getInstance().getAllGroups()) { // if (group.getGroupId().equals(groupId)) { // hasGroup = true; // break; // } // } // if (!hasGroup) // return; // // // // EMMessage msg = EMMessage.createReceiveMessage(Type.TXT); // msg.setChatType(ChatType.GroupChat); // msg.setFrom(inviter); // msg.setTo(groupId); // msg.setMsgId(UUID.randomUUID().toString()); // msg.addBody(new TextMessageBody(inviter + "?")); // // ?? // EMChatManager.getInstance().saveMessage(msg); // // ??? // EMNotifier.getInstance(getApplicationContext()).notifyOnNewMsg(); // // runOnUiThread(new Runnable() { // public void run() { // updateUnreadLabel(); // // ui // if (currentTabIndex == 0) // chatHistoryFragment.refresh(); // if (CommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) { // GroupsActivity.instance.onResume(); // } // } // }); // // } // // @Override // public void onInvitationAccpted(String groupId, String inviter, String reason) { // // } // // @Override // public void onInvitationDeclined(String groupId, String invitee, String reason) { // // } // // @Override // public void onUserRemoved(String groupId, String groupName) { // // ??Tdemo? // // ui // runOnUiThread(new Runnable() { // public void run() { // try { // updateUnreadLabel(); // if (currentTabIndex == 0) // chatHistoryFragment.refresh(); // if (CommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) { // GroupsActivity.instance.onResume(); // } // } catch (Exception e) { // EMLog.e(TAG, "refresh exception " + e.getMessage()); // } // // } // }); // } // // @Override // public void onGroupDestroy(String groupId, String groupName) { // // // // ??,demo? // // ui // runOnUiThread(new Runnable() { // public void run() { // updateUnreadLabel(); // if (currentTabIndex == 0) // chatHistoryFragment.refresh(); // if (CommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) { // GroupsActivity.instance.onResume(); // } // } // }); // // } // // @Override // public void onApplicationReceived(String groupId, String groupName, String applyer, String reason) { // // ? // InviteMessage msg = new InviteMessage(); // msg.setFrom(applyer); // msg.setTime(System.currentTimeMillis()); // msg.setGroupId(groupId); // msg.setGroupName(groupName); // msg.setReason(reason); // Log.d(TAG, applyer + " ?" + groupName); // msg.setStatus(InviteMesageStatus.BEAPPLYED); // notifyNewIviteMessage(msg); // } // // @Override // public void onApplicationAccept(String groupId, String groupName, String accepter) { // // ?? // EMMessage msg = EMMessage.createReceiveMessage(Type.TXT); // msg.setChatType(ChatType.GroupChat); // msg.setFrom(accepter); // msg.setTo(groupId); // msg.setMsgId(UUID.randomUUID().toString()); // msg.addBody(new TextMessageBody(accepter + "???")); // // ???? // EMChatManager.getInstance().saveMessage(msg); // // ??? // EMNotifier.getInstance(getApplicationContext()).notifyOnNewMsg(); // // runOnUiThread(new Runnable() { // public void run() { // updateUnreadLabel(); // // ui // if (currentTabIndex == 0) // chatHistoryFragment.refresh(); // if (CommonUtils.getTopActivity(MainActivity.this).equals(GroupsActivity.class.getName())) { // GroupsActivity.instance.onResume(); // } // } // }); // } // // @Override // public void onApplicationDeclined(String groupId, String groupName, String decliner, String reason) { // // ?demo // } // // } // // @Override // protected void onResume() { // super.onResume(); // if (!isConflict) { // updateUnreadLabel(); // updateUnreadAddressLable(); // EMChatManager.getInstance().activityResumed(); // } // // } @Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean("isConflict", isConflict); super.onSaveInstanceState(outState); }
From source file:com.amaze.filemanager.fragments.ZipExplorerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (openmode == ZIP_FILE) { outState.putParcelableArrayList(KEY_ELEMENTS, elements); }//w w w .ja v a 2s . co m outState.putInt(KEY_OPEN_MODE, openmode); outState.putString(KEY_PATH, relativeDirectory); outState.putString(KEY_URI, realZipFile.getPath()); outState.putString(KEY_FILE, realZipFile.getPath()); outState.putParcelableArrayList(KEY_CACHE_FILES, files); outState.putBoolean(KEY_OPEN, isOpen); }
From source file:com.krayzk9s.imgurholo.activities.ImgurHoloActivity.java
public void imageSelected(ArrayList<JSONParcelable> data, int position) { FrameLayout displayFrag = (FrameLayout) findViewById(R.id.frame_layout_child); if (displayFrag == null) { // DisplayFragment (Fragment B) is not in the layout (handset layout), // so start DisplayActivity (Activity B) // and pass it the info about the selected item if (getApiCall().settings.getBoolean("ImagePagerEnabled", false) == false) { Intent intent = new Intent(); intent.putExtra("id", data.get(position)); Log.d("data", data.get(position).toString()); intent.setAction(ImgurHoloActivity.IMAGE_INTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent);// w w w. j a v a 2 s.c om } else { Intent intent = new Intent(); intent.putExtra("ids", data); intent.putExtra("start", position); intent.setAction(ImgurHoloActivity.IMAGE_PAGER_INTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent); } } else { // DisplayFragment (Fragment B) is in the layout (tablet layout), // so tell the fragment to update try { if (data.get(position).getJSONObject().has("is_album") && data.get(position).getJSONObject().getBoolean("is_album")) { ImagesFragment fragment = new ImagesFragment(); Bundle bundle = new Bundle(); bundle.putString("imageCall", "3/album/" + data.get(position).getJSONObject().getString("id")); bundle.putString("id", data.get(position).getJSONObject().getString("id")); bundle.putParcelable("albumData", data.get(position)); fragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout_child, fragment).commitAllowingStateLoss(); } else { SingleImageFragment singleImageFragment = new SingleImageFragment(); Bundle bundle = new Bundle(); bundle.putBoolean("gallery", true); bundle.putParcelable("imageData", data.get(position)); singleImageFragment.setArguments(bundle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.frame_layout_child, singleImageFragment) .commitAllowingStateLoss(); } } catch (JSONException e) { Log.e("Error!", e.toString()); } } }
From source file:cw.kop.autobackground.sources.SourceInfoFragment.java
private void showAlbumFragment(String type, int position, ArrayList<String> names, ArrayList<String> images, ArrayList<String> links, ArrayList<String> nums, boolean use) { AlbumFragment albumFragment = new AlbumFragment(); Bundle arguments = new Bundle(); arguments.putString("type", type); arguments.putInt("position", position); arguments.putBoolean("use", use); arguments.putStringArrayList("album_names", names); arguments.putStringArrayList("album_images", images); arguments.putStringArrayList("album_links", links); arguments.putStringArrayList("album_nums", nums); albumFragment.setArguments(arguments); albumFragment.setTargetFragment(this, -1); FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager != null) { fragmentManager.beginTransaction().add(R.id.content_frame, albumFragment, "album_fragment") .addToBackStack(null).commit(); }//from w w w . j a va2s . c o m }
From source file:com.android.email.activity.zx.MessageView.java
private void onNext() { Bundle extras = new Bundle(1); extras.putBoolean(EXTRA_NEXT, true); MessageView.actionView(this, mAccount, mFolder, mNextMessageUid, mFolderUids, extras); finish();/*from w w w. ja v a 2 s .c om*/ }
From source file:com.frostwire.android.gui.activities.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { if (outState != null) { // MIGHT DO: save checkedNavViewMenuItemId in bundle. outState.putBoolean("updateAvailable", getIntent().getBooleanExtra("updateAvailable", false)); super.onSaveInstanceState(outState); saveLastFragment(outState);// w ww.ja v a 2 s . c o m saveFragmentsStack(outState); } }
From source file:li.barter.http.HttpResponseParser.java
/** * Method for parsing the search results * * @param response//from w w w . ja v a 2 s . c o m * @return * @throws JSONException If the Json resposne is malformed */ private ResponseInfo parseSearchBooksResponse(final String response) throws JSONException { final ResponseInfo responseInfo = new ResponseInfo(); final JSONObject responseObject = new JSONObject(response); final JSONArray searchResults = JsonUtils.readJSONArray(responseObject, HttpConstants.SEARCH, true, true); JSONObject bookObject = null; final ContentValues values = new ContentValues(); final String selection = DatabaseColumns.ID + SQLConstants.EQUALS_ARG; final String[] args = new String[1]; for (int i = 0; i < searchResults.length(); i++) { bookObject = JsonUtils.readJSONObject(searchResults, i, false, false); args[0] = readBookDetailsIntoContentValues(bookObject, values, true, false); //First try to update the table if a book already exists if (DBInterface.update(TableSearchBooks.NAME, values, selection, args, false) == 0) { // Unable to update, insert the item DBInterface.insert(TableSearchBooks.NAME, null, values, false); } } DBInterface.notifyChange(TableSearchBooks.NAME); final Bundle responseBundle = new Bundle(); if (searchResults.isNull(0)) { responseBundle.putBoolean(Keys.NO_BOOKS_FLAG_KEY, true); } else { responseBundle.putBoolean(Keys.NO_BOOKS_FLAG_KEY, false); } responseInfo.responseBundle = responseBundle; return responseInfo; }
From source file:com.codeim.coxin.LoginActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mLoginTask != null && mLoginTask.getStatus() == GenericTask.Status.RUNNING) { // If the task was running, want to start it anew when the // Activity restarts. // This addresses the case where you user changes orientation // in the middle of execution. outState.putBoolean(SIS_RUNNING_KEY, true); }//from w ww .ja va 2 s .c o m }
From source file:com.android.contacts.group.GroupMembersFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActionBarAdapter != null) { mActionBarAdapter.setListener(null); mActionBarAdapter.onSaveInstanceState(outState); }// w w w . j ava 2s .c o m outState.putBoolean(KEY_IS_EDIT_MODE, mIsEditMode); outState.putParcelable(KEY_GROUP_URI, mGroupUri); outState.putParcelable(KEY_GROUP_METADATA, mGroupMetaData); }
From source file:com.test.onesignal.GenerateNotificationRunner.java
@Test public void shouldProcessRestore() throws Exception { Bundle bundle = createInternalPayloadBundle(getBaseNotifBundle()); bundle.putInt("android_notif_id", 0); bundle.putBoolean("restoring", true); NotificationBundleProcessor_ProcessFromGCMIntentService_NoWrap(blankActivity, bundle, null); Assert.assertEquals("UnitTestApp", ShadowRoboNotificationManager.getLastShadowNotif().getContentTitle()); }