List of usage examples for java.lang String contentEquals
public boolean contentEquals(CharSequence cs)
From source file:com.homeworkreminder.Main.java
private static void generateSubjectMap() { // TODO Auto-generated method stub Iterator<String> it = subjectArray.iterator(); while (it.hasNext()) { String subject = it.next(); if (subject.contentEquals(ADD_SUBJECT)) { continue; }/* ww w . ja va 2 s .co m*/ List<Task> list = Database.queryBySubject(subject); Collections.sort(list, new Comparator<Task>() { public int compare(Task o1, Task o2) { return o1.getDue().compareTo(o2.getDue()); } }); SubjectMap.put(subject, list); } }
From source file:com.openatk.fieldnotebook.MainActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); String todo = intent.getStringExtra("todo"); if (todo != null) { if (todo.contentEquals("sync")) { //trelloController.sync(); }//from ww w. j a va2 s .c o m } }
From source file:fragment.web.BillingControllerTest.java
@Test public void testShowHistory1() { session = new MockHttpSession(); Tenant tenant = createTestTenant(accountTypeDAO.getDefaultRegistrationAccountType()); tenant.setState(com.vmops.model.Tenant.State.ACTIVE); tenant.setAccountType(accountTypeDAO.getDefaultRegistrationAccountType()); User user = createTestUserInTenant(tenant); tenantService.setOwner(tenant, user); List<ProductBundle> bundles = productBundleService.listProductBundles(0, 0); ProductBundle nonVmBundle = null;/* ww w . j av a2s . c o m*/ for (ProductBundle bundle : bundles) { if (!bundle.getResourceType().getResourceTypeName().equals("VirtualMachine")) { nonVmBundle = bundle; break; } } tenant.getOwner().setEnabled(true); Subscription subscription = subscriptionService.createSubscription(tenant.getOwner(), nonVmBundle, null, null, false, false, null, new HashMap<String, String>()); Assert.assertNotNull(subscription); request.setAttribute("isSurrogatedTenant", Boolean.TRUE); request.setAttribute("effectiveTenant", tenant); session.setAttribute("makepayment_status", "true"); String view = controller.showHistory(tenant, tenant.getParam(), user.getParam(), "1", session, map, request); Assert.assertNotNull(view); Assert.assertEquals(false, view.contentEquals("showUserProfile")); Assert.assertEquals(false, view.contentEquals("userHasCloudServiceAccount")); Assert.assertEquals(map.get("currentUser"), getRootUser()); Assert.assertNotNull(map.get("billingActivities")); Assert.assertNotNull(map.get("users")); Assert.assertEquals(map.get("showUsers"), true); Assert.assertNotNull(map.get("tenant")); Assert.assertNotNull(map.get("statusMessage")); Assert.assertNull(map.get("makepayment_status")); }
From source file:com.chen.mail.utils.NotificationUtils.java
private static void configureLatestEventInfoFromConversation(final Context context, final Account account, final FolderPreferences folderPreferences, final NotificationCompat.Builder notification, final Cursor conversationCursor, final PendingIntent clickIntent, final Intent notificationIntent, final int unreadCount, final int unseenCount, final Folder folder, final long when) { final Resources res = context.getResources(); final String notificationAccount = account.name; LogUtils.i(LOG_TAG, "Showing notification with unreadCount of %d and unseenCount of %d", unreadCount, unseenCount);//from w ww . j a va 2 s . c om String notificationTicker = null; // Boolean indicating that this notification is for a non-inbox label. final boolean isInbox = folder.folderUri.fullUri.equals(account.settings.defaultInbox); // Notification label name for user label notifications. final String notificationLabelName = isInbox ? null : folder.name; if (unseenCount > 1) { // Build the string that describes the number of new messages final String newMessagesString = res.getString(R.string.new_messages, unseenCount); // Use the default notification icon notification .setLargeIcon(getDefaultNotificationIcon(context, folder, true /* multiple new messages */)); // The ticker initially start as the new messages string. notificationTicker = newMessagesString; // The title of the notification is the new messages string notification.setContentTitle(newMessagesString); // TODO(skennedy) Can we remove this check? if (Utils.isRunningJellybeanOrLater()) { // For a new-style notification final int maxNumDigestItems = context.getResources() .getInteger(R.integer.max_num_notification_digest_items); // The body of the notification is the account name, or the label name. notification.setSubText(isInbox ? notificationAccount : notificationLabelName); final NotificationCompat.InboxStyle digest = new NotificationCompat.InboxStyle(notification); int numDigestItems = 0; do { final Conversation conversation = new Conversation(conversationCursor); if (!conversation.read) { boolean multipleUnreadThread = false; // TODO(cwren) extract this pattern into a helper Cursor cursor = null; MessageCursor messageCursor = null; try { final Uri.Builder uriBuilder = conversation.messageListUri.buildUpon(); uriBuilder.appendQueryParameter(UIProvider.LABEL_QUERY_PARAMETER, notificationLabelName); cursor = context.getContentResolver().query(uriBuilder.build(), UIProvider.MESSAGE_PROJECTION, null, null, null); messageCursor = new MessageCursor(cursor); String from = ""; String fromAddress = ""; if (messageCursor.moveToPosition(messageCursor.getCount() - 1)) { final Message message = messageCursor.getMessage(); fromAddress = message.getFrom(); if (fromAddress == null) { fromAddress = ""; } from = getDisplayableSender(fromAddress); } while (messageCursor.moveToPosition(messageCursor.getPosition() - 1)) { final Message message = messageCursor.getMessage(); if (!message.read && !fromAddress.contentEquals(message.getFrom())) { multipleUnreadThread = true; break; } } final SpannableStringBuilder sendersBuilder; if (multipleUnreadThread) { final int sendersLength = res.getInteger(R.integer.swipe_senders_length); sendersBuilder = getStyledSenders(context, conversationCursor, sendersLength, notificationAccount); } else { sendersBuilder = new SpannableStringBuilder(getWrappedFromString(from)); } final CharSequence digestLine = getSingleMessageInboxLine(context, sendersBuilder.toString(), conversation.subject, conversation.snippet); digest.addLine(digestLine); numDigestItems++; } finally { if (messageCursor != null) { messageCursor.close(); } if (cursor != null) { cursor.close(); } } } } while (numDigestItems <= maxNumDigestItems && conversationCursor.moveToNext()); } else { // The body of the notification is the account name, or the label name. notification.setContentText(isInbox ? notificationAccount : notificationLabelName); } } else { // For notifications for a single new conversation, we want to get the information from // the conversation // Move the cursor to the most recent unread conversation seekToLatestUnreadConversation(conversationCursor); final Conversation conversation = new Conversation(conversationCursor); Cursor cursor = null; MessageCursor messageCursor = null; boolean multipleUnseenThread = false; String from = null; try { final Uri uri = conversation.messageListUri.buildUpon() .appendQueryParameter(UIProvider.LABEL_QUERY_PARAMETER, folder.persistentId).build(); cursor = context.getContentResolver().query(uri, UIProvider.MESSAGE_PROJECTION, null, null, null); messageCursor = new MessageCursor(cursor); // Use the information from the last sender in the conversation that triggered // this notification. String fromAddress = ""; if (messageCursor.moveToPosition(messageCursor.getCount() - 1)) { final Message message = messageCursor.getMessage(); fromAddress = message.getFrom(); from = getDisplayableSender(fromAddress); notification.setLargeIcon(getContactIcon(context, from, getSenderAddress(fromAddress), folder)); } // Assume that the last message in this conversation is unread int firstUnseenMessagePos = messageCursor.getPosition(); while (messageCursor.moveToPosition(messageCursor.getPosition() - 1)) { final Message message = messageCursor.getMessage(); final boolean unseen = !message.seen; if (unseen) { firstUnseenMessagePos = messageCursor.getPosition(); if (!multipleUnseenThread && !fromAddress.contentEquals(message.getFrom())) { multipleUnseenThread = true; } } } // TODO(skennedy) Can we remove this check? if (Utils.isRunningJellybeanOrLater()) { // For a new-style notification if (multipleUnseenThread) { // The title of a single conversation is the list of senders. int sendersLength = res.getInteger(R.integer.swipe_senders_length); final SpannableStringBuilder sendersBuilder = getStyledSenders(context, conversationCursor, sendersLength, notificationAccount); notification.setContentTitle(sendersBuilder); // For a single new conversation, the ticker is based on the sender's name. notificationTicker = sendersBuilder.toString(); } else { from = getWrappedFromString(from); // The title of a single message the sender. notification.setContentTitle(from); // For a single new conversation, the ticker is based on the sender's name. notificationTicker = from; } // The notification content will be the subject of the conversation. notification.setContentText(getSingleMessageLittleText(context, conversation.subject)); // The notification subtext will be the subject of the conversation for inbox // notifications, or will based on the the label name for user label // notifications. notification.setSubText(isInbox ? notificationAccount : notificationLabelName); if (multipleUnseenThread) { notification.setLargeIcon(getDefaultNotificationIcon(context, folder, true)); } final NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle( notification); // Seek the message cursor to the first unread message final Message message; if (messageCursor.moveToPosition(firstUnseenMessagePos)) { message = messageCursor.getMessage(); bigText.bigText(getSingleMessageBigText(context, conversation.subject, message)); } else { LogUtils.e(LOG_TAG, "Failed to load message"); message = null; } if (message != null) { final Set<String> notificationActions = folderPreferences.getNotificationActions(account); final int notificationId = getNotificationId(account.getAccountManagerAccount(), folder); NotificationActionUtils.addNotificationActions(context, notificationIntent, notification, account, conversation, message, folder, notificationId, when, notificationActions); } } else { // For an old-style notification // The title of a single conversation notification is built from both the sender // and subject of the new message. notification.setContentTitle( getSingleMessageNotificationTitle(context, from, conversation.subject)); // The notification content will be the subject of the conversation for inbox // notifications, or will based on the the label name for user label // notifications. notification.setContentText(isInbox ? notificationAccount : notificationLabelName); // For a single new conversation, the ticker is based on the sender's name. notificationTicker = from; } } finally { if (messageCursor != null) { messageCursor.close(); } if (cursor != null) { cursor.close(); } } } // Build the notification ticker if (notificationLabelName != null && notificationTicker != null) { // This is a per label notification, format the ticker with that information notificationTicker = res.getString(R.string.label_notification_ticker, notificationLabelName, notificationTicker); } if (notificationTicker != null) { // If we didn't generate a notification ticker, it will default to account name notification.setTicker(notificationTicker); } // Set the number in the notification if (unreadCount > 1) { notification.setNumber(unreadCount); } notification.setContentIntent(clickIntent); }
From source file:com.openatk.fieldnotebook.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dbHelper = new DatabaseHelper(this); FragmentManager fm = getSupportFragmentManager(); fragmentMap = (SupportMapFragment) fm.findFragmentById(R.id.map); fragmentSlider = (FragmentSlider) fm.findFragmentByTag(FragmentSlider.class.getName()); if (fragmentSlider != null) { sliderIsShowing = 1;//from ww w . j a v a2 s .co m } if (savedInstanceState == null) { // First incarnation of this activity. fragmentMap.setRetainInstance(true); } else { // Reincarnated activity. The obtained map is the same map instance // in the previous // activity life cycle. There is no need to reinitialize it. map = fragmentMap.getMap(); } checkGPS(); //Trello //trelloController = new TrelloController(getApplicationContext()); //syncController = new SyncController(getApplicationContext(), trelloController, this); //trelloController.setSyncController(syncController); // Get last selected operation if (savedInstanceState != null) { // Find current field currentField = FindFieldById(savedInstanceState.getInt("currentField")); this.addingBoundary = savedInstanceState.getString("drawingBoundary", ""); } vgSidebar = (ViewGroup) findViewById(R.id.fragment_container_sidebar); if (vgSidebar != null) { Log.i(TAG, "onCreate: adding FragmentSidebar to MainActivity"); // Add sidebar fragment to the activity's container layout FragmentSidebar fragmentSidebar = new FragmentSidebar(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.replace(vgSidebar.getId(), fragmentSidebar, FragmentSidebar.class.getName()); // Commit the transaction fragmentTransaction.commit(); } setUpMapIfNeeded(); Intent intent = this.getIntent(); String todo = intent.getStringExtra("todo"); if (todo != null) { if (todo.contentEquals("sync")) { //trelloController.sync(); } } getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); }
From source file:com.tremolosecurity.idp.providers.OpenIDConnectIdP.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String action = (String) request.getAttribute(IDP.ACTION_NAME); if (action.contentEquals("completefed")) { this.completeFederation(request, response); } else if (action.equalsIgnoreCase("token")) { String code = request.getParameter("code"); String clientID = request.getParameter("client_id"); String clientSecret = request.getParameter("client_secret"); String redirectURI = request.getParameter("redirect_uri"); String grantType = request.getParameter("grant_type"); String refreshToken = request.getParameter("refresh_token"); if (clientID == null) { //this means that the clientid is in the Authorization header String azHeader = request.getHeader("Authorization"); azHeader = azHeader.substring(azHeader.indexOf(' ') + 1).trim(); azHeader = new String(org.apache.commons.codec.binary.Base64.decodeBase64(azHeader)); clientID = azHeader.substring(0, azHeader.indexOf(':')); clientSecret = azHeader.substring(azHeader.indexOf(':') + 1); }/*from w w w. j a va 2 s .c om*/ AuthController ac = (AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL); UrlHolder holder = (UrlHolder) request.getAttribute(ProxyConstants.AUTOIDM_CFG); holder.getApp().getCookieConfig().getTimeout(); if (refreshToken != null) { try { refreshToken(response, clientID, clientSecret, refreshToken, holder, request, ac.getAuthInfo()); } catch (Exception e) { throw new ServletException("Could not refresh token", e); } } else { completeUserLogin(request, response, code, clientID, clientSecret, holder, ac.getAuthInfo()); } } }
From source file:export.UploadManager.java
@SuppressWarnings("null") public Uploader add(ContentValues config) { if (config == null) { System.err.println("Add null!"); //assert (false); return null; }//from w w w. j av a 2 s . c o m String uploaderName = config.getAsString(Constants.DB.ACCOUNT.NAME); if (uploaderName == null) { System.err.println("name not found!"); return null; } if (uploaders.containsKey(uploaderName)) { return uploaders.get(uploaderName); } Uploader uploader = null; //if (uploaderName.contentEquals(RunKeeperUploader.NAME)) { // uploader = new RunKeeperUploader(this); if (uploaderName.contentEquals(GarminUploader.NAME)) { uploader = new GarminUploader(this); //} else if (uploaderName.contentEquals(FunBeatUploader.NAME)) { // uploader = new FunBeatUploader(this); } else if (uploaderName.contentEquals(MapMyRunUploader.NAME)) { uploader = new MapMyRunUploader(this); } else if (uploaderName.contentEquals(NikePlus.NAME)) { uploader = new NikePlus(this); //} else if (uploaderName.contentEquals(JoggSE.NAME)) { // uploader = new JoggSE(this); // } else if (uploaderName.contentEquals(Endomondo.NAME)) { // uploader = new Endomondo(this); //} else if (uploaderName.contentEquals(RunningAHEAD.NAME)) { // uploader = new RunningAHEAD(this); //} else if (uploaderName.contentEquals(RunnerUpLive.NAME)) { // uploader = new RunnerUpLive(this); // } else if (uploaderName.contentEquals(DigifitUploader.NAME)) { // uploader = new DigifitUploader(this); } else if (uploaderName.contentEquals(Strava.NAME)) { uploader = new Strava(this); } else if (uploaderName.contentEquals(Facebook.NAME)) { uploader = new Facebook(context, this); } else if (uploaderName.contentEquals(GooglePlus.NAME)) { uploader = new GooglePlus(this); } if (uploader != null) { if (!config.containsKey(Constants.DB.ACCOUNT.FLAGS)) { if (BuildConfig.DEBUG) { String s = null; s.charAt(3); } } uploader.init(config); uploaders.put(uploaderName, uploader); uploadersById.put(uploader.getId(), uploader); } return uploader; }
From source file:fragment.web.BillingControllerTest.java
@Test public void testShowHistory() { session = new MockHttpSession(); Tenant tenant = createTestTenant(accountTypeDAO.getDefaultRegistrationAccountType()); tenant.setState(com.vmops.model.Tenant.State.ACTIVE); tenant.setAccountType(accountTypeDAO.getDefaultRegistrationAccountType()); User user = createTestUserInTenant(tenant); tenantService.setOwner(tenant, user); List<ProductBundle> bundles = productBundleService.listProductBundles(0, 0); ProductBundle nonVmBundle = null;//from w w w . j a va 2 s . co m for (ProductBundle bundle : bundles) { if (!bundle.getResourceType().getResourceTypeName().equals("VirtualMachine")) { nonVmBundle = bundle; break; } } tenant.getOwner().setEnabled(true); Subscription subscription = subscriptionService.createSubscription(tenant.getOwner(), nonVmBundle, null, null, false, false, null, new HashMap<String, String>()); Assert.assertNotNull(subscription); request.setAttribute("isSurrogatedTenant", Boolean.TRUE); request.setAttribute("effectiveTenant", tenant); session.setAttribute("makepayment_status", "false"); String view = controller.showHistory(tenant, tenant.getParam(), user.getParam(), "1", session, map, request); Assert.assertNotNull(view); Assert.assertTrue(map.containsAttribute("isPayAsYouGoChosen")); Assert.assertEquals(false, view.contentEquals("showUserProfile")); Assert.assertEquals(false, view.contentEquals("userHasCloudServiceAccount")); Assert.assertEquals(map.get("currentUser"), getRootUser()); Assert.assertNotNull(map.get("billingActivities")); Assert.assertNotNull(map.get("users")); Assert.assertEquals(map.get("showUsers"), true); Assert.assertNotNull(map.get("tenant")); Assert.assertNotNull(map.get("statusMessage")); Assert.assertNull(map.get("makepayment_status")); }
From source file:com.nuvolect.deepdive.probe.DecompileApk.java
/** * Jadx converts a DEX file directly into Java files. It does not input JAR files. *///from www . ja va 2 s.c om private JSONObject jadx() { m_srcJadxFolder.mkdirs(); Thread.UncaughtExceptionHandler uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LogUtil.log(LogUtil.LogType.DECOMPILE, "Uncaught exception: " + e.toString()); m_progressStream.putStream("Uncaught exception: " + t.getName()); m_progressStream.putStream("Uncaught exception: " + e.toString()); } }; m_jadx_time = System.currentTimeMillis(); // Save start time for tracking m_jadxThread = new Thread(m_threadGroup, new Runnable() { @Override public void run() { m_progressStream.putStream("Jadx starting"); /* * Type File require, versus OmniFile, in order to provide loadFiles * a list of <File>. */ List<File> dexList = new ArrayList<>(); JadxDecompiler jadx = new JadxDecompiler(); jadx.setOutputDir(m_srcJadxFolder.getStdFile()); String loadingNames = ""; String spacer = ""; for (String fileName : m_dexFileNames) { OmniFile dexFile = new OmniFile(m_volumeId, m_appFolderPath + fileName + ".dex"); if (dexFile.exists() && dexFile.isFile()) { dexList.add(dexFile.getStdFile()); loadingNames += spacer + dexFile.getName(); spacer = ", "; if (fileName.contentEquals(OPTIMIZED_CLASSES)) break; } } try { m_progressStream.putStream("Loading: " + loadingNames); jadx.loadFiles(dexList); m_progressStream.putStream("Load complete"); } catch (Exception e) { LogUtil.logException(LogUtil.LogType.DECOMPILE, e); m_progressStream.putStream(e.toString()); } try { m_progressStream.putStream("Jadx saveSources start"); jadx.saveSources(); m_progressStream.putStream("Jadx saveSources complete"); } catch (Exception e) { LogUtil.logException(LogUtil.LogType.DECOMPILE, e); m_progressStream.putStream(e.toString()); } m_progressStream.putStream("Jadx complete: " + TimeUtil.deltaTimeHrMinSec(m_jadx_time)); m_jadx_time = 0; } }, JADX_THREAD, STACK_SIZE); m_jadxThread.setPriority(Thread.MAX_PRIORITY); m_jadxThread.setUncaughtExceptionHandler(uncaughtExceptionHandler); m_jadxThread.start(); String processKey = "jadx_thread"; // processStatus = getThreadStatus( true, m_jadxThread); String urlKey = "jadx_url"; // url = OmniHash.getHashedServerUrl( m_ctx, m_volumeId, m_srcJadxFolderPath); return processWrapper(processKey, urlKey); }
From source file:org.runnerup.export.SyncManager.java
@SuppressWarnings("null") public Synchronizer add(ContentValues config) { if (config == null) { Log.e(getClass().getName(), "Add null!"); assert (false); return null; }/* w w w . ja va 2s. com*/ String synchronizerName = config.getAsString(DB.ACCOUNT.NAME); if (synchronizerName == null) { Log.e(getClass().getName(), "name not found!"); return null; } if (synchronizers.containsKey(synchronizerName)) { return synchronizers.get(synchronizerName); } Synchronizer synchronizer = null; if (synchronizerName.contentEquals(RunKeeperSynchronizer.NAME)) { synchronizer = new RunKeeperSynchronizer(this); } else if (synchronizerName.contentEquals(GarminSynchronizer.NAME)) { synchronizer = new GarminSynchronizer(this); } else if (synchronizerName.contentEquals(FunBeatSynchronizer.NAME)) { synchronizer = new FunBeatSynchronizer(this); } else if (synchronizerName.contentEquals(MapMyRunSynchronizer.NAME)) { synchronizer = new MapMyRunSynchronizer(this); } else if (synchronizerName.contentEquals(NikePlusSynchronizer.NAME)) { synchronizer = new NikePlusSynchronizer(this); } else if (synchronizerName.contentEquals(JoggSESynchronizer.NAME)) { synchronizer = new JoggSESynchronizer(this); } else if (synchronizerName.contentEquals(EndomondoSynchronizer.NAME)) { synchronizer = new EndomondoSynchronizer(this); } else if (synchronizerName.contentEquals(RunningAHEADSynchronizer.NAME)) { synchronizer = new RunningAHEADSynchronizer(this); } else if (synchronizerName.contentEquals(RunnerUpLiveSynchronizer.NAME)) { synchronizer = new RunnerUpLiveSynchronizer(mContext); } else if (synchronizerName.contentEquals(DigifitSynchronizer.NAME)) { synchronizer = new DigifitSynchronizer(this); } else if (synchronizerName.contentEquals(StravaSynchronizer.NAME)) { synchronizer = new StravaSynchronizer(this); } else if (synchronizerName.contentEquals(FacebookSynchronizer.NAME)) { synchronizer = new FacebookSynchronizer(mContext, this); } else if (synchronizerName.contentEquals(GooglePlusSynchronizer.NAME)) { synchronizer = new GooglePlusSynchronizer(this); } else if (synchronizerName.contentEquals(RuntasticSynchronizer.NAME)) { synchronizer = new RuntasticSynchronizer(this); } else if (synchronizerName.contentEquals(GoogleFitSynchronizer.NAME)) { synchronizer = new GoogleFitSynchronizer(mContext, this); } else if (synchronizerName.contentEquals(RunningFreeOnlineSynchronizer.NAME)) { synchronizer = new RunningFreeOnlineSynchronizer(); } if (synchronizer != null) { if (!config.containsKey(DB.ACCOUNT.FLAGS)) { if (BuildConfig.DEBUG) { String s = null; s.charAt(3); } } synchronizer.init(config); synchronizer.setAuthNotice(config.getAsInteger(Constants.DB.ACCOUNT.AUTH_NOTICE)); synchronizers.put(synchronizerName, synchronizer); synchronizersById.put(synchronizer.getId(), synchronizer); } return synchronizer; }