List of usage examples for android.text TextUtils equals
public static boolean equals(CharSequence a, CharSequence b)
From source file:com.alibaba.weex.WXPageActivity.java
@Override public void onException(WXSDKInstance instance, String errCode, String msg) { if (mWxAnalyzerDelegate != null) { mWxAnalyzerDelegate.onException(instance, errCode, msg); }//from w w w . j ava 2 s . c om mProgressBar.setVisibility(View.GONE); if (!TextUtils.isEmpty(errCode) && errCode.contains("|")) { String[] errCodeList = errCode.split("\\|"); String code = errCodeList[1]; String codeType = errCode.substring(0, errCode.indexOf("|")); if (TextUtils.equals("1", codeType)) { String errMsg = "codeType:" + codeType + "\n" + " errCode:" + code + "\n" + " ErrorInfo:" + msg; degradeAlert(errMsg); return; } else { Toast.makeText(getApplicationContext(), "errCode:" + errCode + " Render ERROR:" + msg, Toast.LENGTH_SHORT).show(); } } }
From source file:im.vector.fragments.PeopleFragment.java
/** * Trigger a request to search known contacts. * * @param isNewSearch true if the search is a new one */// ww w . j ava 2 s .co m private void startRemoteKnownContactsSearch(boolean isNewSearch) { if (!TextUtils.isEmpty(mCurrentFilter)) { // display the known contacts section if (isNewSearch) { mAdapter.setFilteredKnownContacts(new ArrayList<ParticipantAdapterItem>(), mCurrentFilter); showKnownContactLoadingView(); } final String fPattern = mCurrentFilter; mSession.searchUsers(mCurrentFilter, MAX_KNOWN_CONTACTS_FILTER_COUNT, new HashSet<String>(), new ApiCallback<SearchUsersResponse>() { @Override public void onSuccess(SearchUsersResponse searchUsersResponse) { if (TextUtils.equals(fPattern, mCurrentFilter)) { hideKnownContactLoadingView(); List<ParticipantAdapterItem> list = new ArrayList<>(); if (null != searchUsersResponse.results) { for (User user : searchUsersResponse.results) { list.add(new ParticipantAdapterItem(user)); } } mAdapter.setKnownContactsExtraTitle(null); mAdapter.setKnownContactsLimited( (null != searchUsersResponse.limited) ? searchUsersResponse.limited : false); mAdapter.setFilteredKnownContacts(list, mCurrentFilter); } } private void onError(String errorMessage) { Log.e(LOG_TAG, "## startRemoteKnownContactsSearch() : failed " + errorMessage); // if (TextUtils.equals(fPattern, mCurrentFilter)) { hideKnownContactLoadingView(); mAdapter.setKnownContactsExtraTitle( PeopleFragment.this.getContext().getString(R.string.offline)); mAdapter.filterAccountKnownContacts(mCurrentFilter); } } @Override public void onNetworkError(Exception e) { onError(e.getMessage()); } @Override public void onMatrixError(MatrixError e) { onError(e.getMessage()); } @Override public void onUnexpectedError(Exception e) { onError(e.getMessage()); } }); } }
From source file:im.neon.util.VectorUtils.java
/** * Set the default vector avatar for a member. * * @param imageView the imageView to set. * @param userId the member userId. * @param displayName the member display name. *//*w ww . j a v a2 s .c om*/ private static void setDefaultMemberAvatar(final ImageView imageView, final String userId, final String displayName) { // sanity checks if (null != imageView && !TextUtils.isEmpty(userId)) { final Bitmap bitmap = VectorUtils.getAvatar(imageView.getContext(), VectorUtils.getAvatarColor(userId), TextUtils.isEmpty(displayName) ? userId : displayName, true); if (Looper.getMainLooper().getThread() == Thread.currentThread()) { imageView.setImageBitmap(bitmap); } else { final String tag = userId + " - " + displayName; imageView.setTag(tag); mUIHandler.post(new Runnable() { @Override public void run() { if (TextUtils.equals(tag, (String) imageView.getTag())) { imageView.setImageBitmap(bitmap); } } }); } } }
From source file:com.github.stkent.landmarkedlocationprovider.SendMockLocationService.java
@Override public int onStartCommand(Intent startIntent, int flags, int startId) { // Get the type of test to run mTestRequest = startIntent.getAction(); /*//from w ww .ja v a 2 s .c o m * If the incoming Intent was a request to run a one-time or continuous test */ if ((TextUtils.equals(mTestRequest, LocationUtils.ACTION_START_ONCE)) || (TextUtils.equals(mTestRequest, LocationUtils.ACTION_START_CONTINUOUS))) { // Get the pause interval and injection interval mPauseInterval = startIntent.getIntExtra(LocationUtils.EXTRA_PAUSE_VALUE, 2); mInjectionInterval = startIntent.getIntExtra(LocationUtils.EXTRA_SEND_INTERVAL, 1); // Post a notification in the notification bar that a test is starting postNotification(getString(R.string.notification_content_test_start)); googleApiClient = new GoogleApiClient.Builder(this.getApplicationContext()).addApi(LocationServices.API) .addConnectionCallbacks(this).addOnConnectionFailedListener(this).build(); googleApiClient.connect(); } else if (TextUtils.equals(mTestRequest, LocationUtils.ACTION_STOP_TEST)) { // Remove any existing notifications removeNotification(); // Send a message back to the main activity that the test is stopping sendBroadcastMessage(LocationUtils.CODE_TEST_STOPPED, 0); // Stop this Service stopSelf(); } /* * Tell the system to keep the Service alive, but to discard the Intent that * started the Service */ return Service.START_STICKY; }
From source file:com.taobao.weex.dom.WXStyle.java
public static Layout.Alignment getTextAlignment(Map<String, Object> style) { Layout.Alignment alignment = Layout.Alignment.ALIGN_NORMAL; String textAlign = (String) style.get(Constants.Name.TEXT_ALIGN); if (TextUtils.equals(Constants.Value.LEFT, textAlign)) { alignment = Layout.Alignment.ALIGN_NORMAL; } else if (TextUtils.equals(Constants.Value.CENTER, textAlign)) { alignment = Layout.Alignment.ALIGN_CENTER; } else if (TextUtils.equals(Constants.Value.RIGHT, textAlign)) { alignment = Layout.Alignment.ALIGN_OPPOSITE; }//from w w w .ja v a2s. c o m return alignment; }
From source file:com.alibaba.weex.WXPageActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (!TextUtils.equals("file", mUri.getScheme())) { getMenuInflater().inflate(R.menu.refresh, menu); }//from www.j a v a 2 s .c o m return true; }
From source file:com.google.android.apps.dashclock.api.ExtensionData.java
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass") @Override/*from w ww. j av a 2 s. co m*/ public boolean equals(Object o) { if (o == null) { return false; } try { ExtensionData other = (ExtensionData) o; return other.mVisible == mVisible && other.mIcon == mIcon && objectEquals(other.mIconUri, mIconUri) && TextUtils.equals(other.mStatus, mStatus) && TextUtils.equals(other.mExpandedTitle, mExpandedTitle) && TextUtils.equals(other.mExpandedBody, mExpandedBody) && objectEquals(other.mClickIntent, mClickIntent) && TextUtils.equals(other.mContentDescription, mContentDescription); } catch (ClassCastException e) { return false; } }
From source file:com.alibaba.weex.WXPageActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { finish();/*w ww . jav a 2 s . c o m*/ return true; } else if (id == R.id.action_refresh) { String scheme = mUri.getScheme(); if (mUri.isHierarchical() && (TextUtils.equals(scheme, "http") || TextUtils.equals(scheme, "https"))) { String weexTpl = mUri.getQueryParameter(Constants.WEEX_TPL_KEY); String url = TextUtils.isEmpty(weexTpl) ? mUri.toString() : weexTpl; loadWXfromService(url); return true; } } return super.onOptionsItemSelected(item); }
From source file:com.taobao.weex.dom.WXStyle.java
public static TextUtils.TruncateAt getTextOverflow(Map<String, Object> style) { TextUtils.TruncateAt truncateAt = null; String ellipse = (String) style.get(Constants.Name.TEXT_OVERFLOW); if (TextUtils.equals(Constants.Name.ELLIPSIS, ellipse)) { truncateAt = TextUtils.TruncateAt.END; }// w ww . ja va 2 s . c o m return truncateAt; }
From source file:com.lee.sdk.utils.Utils.java
/** * ??//www . ja v a 2s . c o m * * ?? * * @return true:?; false ?/mounted/?? */ public static boolean isExternalStorageWriteable() { boolean writealbe = false; long start = System.currentTimeMillis(); if (TextUtils.equals(Environment.MEDIA_MOUNTED, Environment.getExternalStorageState())) { File esd = Environment.getExternalStorageDirectory(); if (esd.exists() && esd.canWrite()) { File file = new File(esd, ".696E5309-E4A7-27C0-A787-0B2CEBF1F1AB"); if (file.exists()) { writealbe = true; } else { try { writealbe = file.createNewFile(); } catch (IOException e) { if (DEBUG) { Log.w(TAG, "isExternalStorageWriteable() can't create test file."); } } } } } long end = System.currentTimeMillis(); if (DEBUG) { Log.i(TAG, "Utility.isExternalStorageWriteable(" + writealbe + ") cost " + (end - start) + "ms."); } return writealbe; }