Java 类android.text.TextUtils 实例源码

项目:GitHub    文件:Kits.java   
public static String getNetworkTypeName(Context context) {
    ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo;
    String type = NETWORK_TYPE_DISCONNECT;
    if (manager == null || (networkInfo = manager.getActiveNetworkInfo()) == null) {
        return type;
    }

    if (networkInfo.isConnected()) {
        String typeName = networkInfo.getTypeName();
        if ("WIFI".equalsIgnoreCase(typeName)) {
            type = NETWORK_TYPE_WIFI;
        } else if ("MOBILE".equalsIgnoreCase(typeName)) {
            String proxyHost = android.net.Proxy.getDefaultHost();
            type = TextUtils.isEmpty(proxyHost) ? (isFastMobileNetwork(context) ? NETWORK_TYPE_3G : NETWORK_TYPE_2G)
                    : NETWORK_TYPE_WAP;
        } else {
            type = NETWORK_TYPE_UNKNOWN;
        }
    }
    return type;
}
项目:Renrentou    文件:Kits.java   
public static String getNetworkTypeName(Context context) {
    ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo;
    String type = NETWORK_TYPE_DISCONNECT;
    if (manager == null || (networkInfo = manager.getActiveNetworkInfo()) == null) {
        return type;
    }

    if (networkInfo.isConnected()) {
        String typeName = networkInfo.getTypeName();
        if ("WIFI".equalsIgnoreCase(typeName)) {
            type = NETWORK_TYPE_WIFI;
        } else if ("MOBILE".equalsIgnoreCase(typeName)) {
            String proxyHost = android.net.Proxy.getDefaultHost();
            type = TextUtils.isEmpty(proxyHost) ? (isFastMobileNetwork(context) ? NETWORK_TYPE_3G : NETWORK_TYPE_2G)
                    : NETWORK_TYPE_WAP;
        } else {
            type = NETWORK_TYPE_UNKNOWN;
        }
    }
    return type;
}
项目:Phoenix-for-VK    文件:FeedbackViewBinder.java   
/**
 * Отображение аватара первого в списке пользователя на ImageView.
 * Если у пользователя нет аватара, то будет отображено изображение
 * неизвестного пользователя
 *
 * @param owners    массив пользователей
 * @param imageView вьюв
 */
private void showFirstUserAvatarOnImageView(List<Owner> owners, ImageView imageView) {
    if (owners == null || owners.size() == 0 || TextUtils.isEmpty(owners.get(0).getMaxSquareAvatar())) {
        PicassoInstance.with()
                .load(R.drawable.ic_avatar_unknown)
                .tag(Constants.PICASSO_TAG)
                .into(imageView);
    } else {
        String url = owners.get(0).getMaxSquareAvatar();
        PicassoInstance.with()
                .load(url)
                .tag(Constants.PICASSO_TAG)
                .transform(transformation)
                .into(imageView);
    }
}
项目:OpenYOLO-Android    文件:AssetRelationshipHelper.java   
/**
 * Setup the helper and validate the input params.
 *
 * @param context Context
 * @param clientPackageName The client app's package name
 * @param sourceAssetStatements Asset statements from the 'source' (client) app
 * @param targetAssetStatements Asset statements from the various 'targets' referenced by the
 *     'source' (client) app
 */
public AssetRelationshipHelper(@NonNull Context context, @NonNull String clientPackageName,
            @NonNull List<AssetStatement> sourceAssetStatements, @NonNull List<AssetStatement>
            targetAssetStatements) {

    require(context, notNullValue());
    require(!TextUtils.isEmpty(clientPackageName), "mClientPackageName must not be null or "
                + "empty");
    require(sourceAssetStatements, notNullValue());
    require(targetAssetStatements, notNullValue());

    this.mContext = context.getApplicationContext();
    this.mClientPackageName = clientPackageName;
    this.mSourceAssetStatements = sourceAssetStatements;
    this.mTargetAssetStatements = targetAssetStatements;
}
项目:GitHub    文件:LazyHeaders.java   
/**
 * Ensures that the default header will pass OkHttp3's checks for header values.
 *
 * <p>See #2331.
 */
@VisibleForTesting
static String getSanitizedUserAgent() {
  String defaultUserAgent = System.getProperty("http.agent");
  if (TextUtils.isEmpty(defaultUserAgent)) {
    return defaultUserAgent;
  }

  int length = defaultUserAgent.length();
  StringBuilder sb = new StringBuilder(defaultUserAgent.length());
  for (int i = 0; i < length; i++) {
    char c = defaultUserAgent.charAt(i);
    if ((c > '\u001f' || c == '\t') && c < '\u007f') {
      sb.append(c);
    } else {
      sb.append('?');
    }
  }
  return sb.toString();
}
项目:LQRWeChat-master    文件:DeleteContactMessage.java   
public byte[] encode() {
    JSONObject var1 = new JSONObject();

    try {
        if (!TextUtils.isEmpty(this.getContact_id())) {
            var1.put("contact_id", this.contact_id);
        }

        if (this.getJSONUserInfo() != null) {
            var1.put("bribery", this.getJSONUserInfo());
        }
    } catch (JSONException var4) {
        var4.printStackTrace();
    }

    try {
        return var1.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException var3) {
        var3.printStackTrace();
        return null;
    }
}
项目:Leanplum-Android-SDK    文件:Leanplum.java   
/**
 * Manually track purchase event with currency code in your application. It is advised to use
 * {@link Leanplum#trackGooglePlayPurchase} instead for in-app purchases.
 *
 * @param event Name of the event.
 * @param value The value of the event. Can be price.
 * @param currencyCode The currency code corresponding to the price.
 * @param params Key-value pairs with metrics or data associated with the event. Parameters can be
 * strings or numbers. You can use up to 200 different parameter names in your app.
 */
public static void trackPurchase(final String event, double value, String currencyCode,
    Map<String, ?> params) {
  try {
    if (TextUtils.isEmpty(event)) {
      Log.w("trackPurchase - Empty event parameter provided.");
    }

    final Map<String, String> requestArgs = new HashMap<>();
    if (!TextUtils.isEmpty(currencyCode)) {
      requestArgs.put(Constants.Params.IAP_CURRENCY_CODE, currencyCode);
    }

    LeanplumInternal.track(event, value, null, params, requestArgs);
  } catch (Throwable t) {
    Log.e("trackPurchase - Failed to track purchase event.");
    Util.handleException(t);
  }
}
项目:android-project-gallery    文件:PersistentCookieStore.java   
/**
 * Construct a persistent cookie store.
 *
 * @param context Context to attach cookie store to
 */
public PersistentCookieStore(Context context) {
    cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
    cookies = new ConcurrentHashMap<String, Cookie>();

    // Load any previously stored cookies into the store
    String storedCookieNames = cookiePrefs.getString(COOKIE_NAME_STORE, null);
    if (storedCookieNames != null) {
        String[] cookieNames = TextUtils.split(storedCookieNames, ",");
        for (String name : cookieNames) {
            String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
            if (encodedCookie != null) {
                Cookie decodedCookie = decodeCookie(encodedCookie);
                if (decodedCookie != null) {
                    cookies.put(name, decodedCookie);
                }
            }
        }

        // Clear out expired cookies
        clearExpired(new Date());
    }
}
项目:Android-Code-Demos    文件:MainActivity.java   
private PApplet getSketch(String stringExtra) {
    if (TextUtils.isEmpty(stringExtra)) {
        return null;
    }

    if (getString(R.string.simple_sketch_one).equals(stringExtra)) {
        return new SimpleSketchOne(this);
    } else if (getString(R.string.simple_sketch_two).equals(stringExtra)) {
        return new SimpleSketchTwo(this);
    } else if (getString(R.string.sensor_sketch).equals(stringExtra)) {
        return new SensorSketch(this);
    } else if (getString(R.string.box2d_sketch).equals(stringExtra)) {
        return new Box2DSketch(this);
    } else if (getString(R.string.wallpapers_sketch).equals(stringExtra)) {
        return new WallpapersSketch(this);
    } else if (getString(R.string.compass_sketch).equals(stringExtra)) {
        return new CompassSketch(this);
    } else if (getString(R.string.location_sketch).equals(stringExtra)) {
        return new LocationSketch(this);
    }
    return null;
}
项目:Virtualview-Android    文件:ViewManager.java   
public void recycle(ViewBase v) {
    if (null != v) {
        String type = v.getViewType();
        if (!TextUtils.isEmpty(type)) {
            v.reset();
            List<ViewBase> vList = mViewCache.get(type);
            if (null == vList) {
                vList = new LinkedList<>();
                mViewCache.put(type, vList);
            }
            vList.add(v);
        } else {
            Log.e(TAG, "recycle type invalidate:" + type);
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Log.w(TAG, "Called: " + this, here);
        }
    }
}
项目:weex-3d-map    文件:Textarea.java   
@Override
protected void appleStyleAfterCreated(WXEditText editText) {
  super.appleStyleAfterCreated(editText);
  String rowsStr = (String) getDomObject().getStyles().get(Constants.Name.ROWS);

  int rows = TextAreaEditTextDomObject.DEFAULT_ROWS;
  try{
    if(!TextUtils.isEmpty(rowsStr)) {
      rows = Integer.parseInt(rowsStr);
    }
  }catch (NumberFormatException e){
    //ignore
    e.printStackTrace();
  }

  editText.setLines(rows);
  editText.setMinLines(rows);
}
项目:weex-uikit    文件:WXComponent.java   
public void setBorderColor(String key, String borderColor) {
  if (!TextUtils.isEmpty(borderColor)) {
    int colorInt = WXResourceUtils.getColor(borderColor);
    if (colorInt != Integer.MIN_VALUE) {
      switch (key) {
        case Constants.Name.BORDER_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.ALL, colorInt);
          break;
        case Constants.Name.BORDER_TOP_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.TOP, colorInt);
          break;
        case Constants.Name.BORDER_RIGHT_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.RIGHT, colorInt);
          break;
        case Constants.Name.BORDER_BOTTOM_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.BOTTOM, colorInt);
          break;
        case Constants.Name.BORDER_LEFT_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.LEFT, colorInt);
          break;
      }
    }
  }
}
项目:RLibrary    文件:MD5Utils.java   
public static boolean checkMD5(String md5, File updateFile) {
    if (TextUtils.isEmpty(md5) || updateFile == null) {
        Log.e(TAG, "MD5 string empty or updateFile null");
        return false;
    }

    String calculatedDigest = md5(updateFile);
    if (calculatedDigest == null) {
        Log.e(TAG, "calculatedDigest null");
        return false;
    }

    Log.v(TAG, "Calculated digest: " + calculatedDigest);
    Log.v(TAG, "Provided digest: " + md5);

    return calculatedDigest.equalsIgnoreCase(md5);
}
项目:letv    文件:LetvBaseActivity.java   
public void addFragments(Fragment... fragments) {
    if (fragments != null && fragments.length != 0) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        for (Fragment fragment : fragments) {
            if (fragment instanceof LetvFragmentListener) {
                LetvFragmentListener listener = (LetvFragmentListener) fragment;
                String tag = listener.getTagName();
                if (!TextUtils.isEmpty(tag)) {
                    int fragmentRes = listener.getContainerId();
                    if (fragmentRes > 0 && fragmentManager.findFragmentByTag(tag) == null) {
                        transaction.add(fragmentRes, fragment, tag);
                    }
                }
            }
        }
        try {
            transaction.commitAllowingStateLoss();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:keepass2android    文件:Suggest.java   
private void removeDupes() {
    final ArrayList<CharSequence> suggestions = mSuggestions;
    if (suggestions.size() < 2) return;
    int i = 1;
    // Don't cache suggestions.size(), since we may be removing items
    while (i < suggestions.size()) {
        final CharSequence cur = suggestions.get(i);
        // Compare each candidate with each previous candidate
        for (int j = 0; j < i; j++) {
            CharSequence previous = suggestions.get(j);
            if (TextUtils.equals(cur, previous)) {
                removeFromSuggestions(i);
                i--;
                break;
            }
        }
        i++;
    }
}
项目:FinalProject    文件:FrescoImageView.java   
@Override
public void loadView(String lowUrl, String url, int defaultResID) {
    try {
        mThumbnailPath = null;
        mThumbnailUrl = url;
        mLowThumbnailUrl = url;
        mDefaultResID = defaultResID;
        if (!TextUtils.isEmpty(mThumbnailUrl)
                && (mThumbnailUrl.startsWith(FrescoController.HTTP_PERFIX)
                || mThumbnailUrl.startsWith(FrescoController.HTTPS_PERFIX))) {

            this.getHierarchy().setPlaceholderImage(defaultResID);

            this.setSourceController();

            return;
        }

        this.getHierarchy().setPlaceholderImage(defaultResID);
        this.setResourceController();

    }catch (OutOfMemoryError e){
        e.printStackTrace();
    }
}
项目:boohee_v5.6    文件:WechatMoments.java   
protected void userInfor(String str) {
    if (!TextUtils.isEmpty(this.a) && !TextUtils.isEmpty(this.b)) {
        g gVar = new g(this, 23);
        gVar.a(this.a, this.b);
        try {
            gVar.a(this.listener);
        } catch (Throwable th) {
            Ln.e(th);
            if (this.listener != null) {
                this.listener.onError(this, 8, th);
            }
        }
    } else if (this.listener != null) {
        this.listener.onError(this, 8, new Throwable("The params of appID or appSecret is missing !"));
    }
}
项目:letv    文件:AuthTask.java   
public synchronized String auth(String str) {
    String a;
    if (!str.contains("bizcontext=")) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(str);
        stringBuilder.append("&bizcontext=\"");
        stringBuilder.append(new com.alipay.sdk.sys.a(this.c).toString());
        stringBuilder.append("\"");
        str = stringBuilder.toString();
    }
    Context context = this.c;
    if (a(context)) {
        a = new h(context).a(str);
        if (!TextUtils.equals(a, Constants.CALLBACK_FAILD)) {
            if (TextUtils.isEmpty(a)) {
                a = l.a();
            }
        }
    }
    a = b(context, str);
    return a;
}
项目:smart-asset-iot-android-demo    文件:MainActivity.java   
@OnClick(R.id.submit)
void submit() {
    UIUtils.hideKeyboard(this);
    if (!ClientUtils.isNetworkConnected(this)) {
        UIUtils.showInternetConnectionAlertDialog(this);
        return;
    }
    String value = assetIdEdit.getText().toString();
    if (TextUtils.isEmpty(value)) {
        assetIdEditContainer.setErrorEnabled(true);
        assetIdEditContainer.setError(getString(R.string.asset_id_empty));
        return;
    }
    if (presenter.validate(value)) {
        presenter.register(value);
        showLoading(true);
        enableAllViews(false, shakeLayout, shakeTitleLayout, photoLayout, photoTitleLayout);
    } else {
        assetIdEditContainer.setError(getString(R.string.error_get_asset_id));
    }

}
项目:simple-share-android    文件:RootedStorageProvider.java   
@Override
public String renameDocument(String documentId, String displayName) throws FileNotFoundException {
    // Since this provider treats renames as generating a completely new
    // docId, we're okay with letting the MIME type change.
    displayName = FileUtils.buildValidFatFilename(displayName);

    final RootFile before = getRootFileForDocId(documentId);
    final RootFile after = new RootFile(before.getParent(), displayName);

    if(!RootCommands.renameRootTarget(before, after)){
        throw new IllegalStateException("Failed to rename " + before);
    }
    final String afterDocId = getDocIdForRootFile(new RootFile(after.getParent(), displayName));
    if (!TextUtils.equals(documentId, afterDocId)) {
        notifyDocumentsChanged(documentId);
        return afterDocId;
    } else {
        return null;
    }
}
项目:Ghost-Android    文件:ChipsEditText.java   
public CharSequence terminateToken(CharSequence text) {
    int i = text.length();
    int lastNonSpaceIdx = i-1;
    while (lastNonSpaceIdx >= 0 && text.charAt(lastNonSpaceIdx) == ' ') {
        --lastNonSpaceIdx;
    }
    if (lastNonSpaceIdx >= 0 && text.charAt(lastNonSpaceIdx-1) == ',') {
        return text;
    } else if (text instanceof Spanned) {
        SpannableString sp = new SpannableString(text + ",");
        TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0);
        return sp;
    } else {
        return text + ",";
    }
}
项目:decoy    文件:AVChatUI.java   
private void configFromPreference(SharedPreferences preferences) {
    videoCropRatio = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_vie_crop_ratio_key), "0"));
    videoAutoRotate = preferences.getBoolean(context.getString(R.string.nrtc_setting_vie_rotation_key), true);
    videoQuality = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_vie_quality_key), 0 + ""));
    serverRecordAudio = preferences.getBoolean(context.getString(R.string.nrtc_setting_other_server_record_audio_key), false);
    serverRecordVideo = preferences.getBoolean(context.getString(R.string.nrtc_setting_other_server_record_video_key), false);
    defaultFrontCamera = preferences.getBoolean(context.getString(R.string.nrtc_setting_vie_default_front_camera_key), true);
    autoCallProximity = preferences.getBoolean(context.getString(R.string.nrtc_setting_voe_call_proximity_key), true);
    videoHwEncoderMode = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_vie_hw_encoder_key), 0 + ""));
    videoHwDecoderMode = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_vie_hw_decoder_key), 0 + ""));
    videoFpsReported = preferences.getBoolean(context.getString(R.string.nrtc_setting_vie_fps_reported_key), true);
    audioEffectAecMode = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_voe_audio_aec_key), 2 + ""));
    audioEffectNsMode = Integer.parseInt(preferences.getString(context.getString(R.string.nrtc_setting_voe_audio_ns_key), 2 + ""));
    String value1 = preferences.getString(context.getString(R.string.nrtc_setting_vie_max_bitrate_key), 0 + "");
    videoMaxBitrate = Integer.parseInt(TextUtils.isDigitsOnly(value1) && !TextUtils.isEmpty(value1) ? value1 : 0 + "");
    String value2 = preferences.getString(context.getString(R.string.nrtc_setting_other_device_default_rotation_key), 0 + "");
    deviceDefaultRotation = Integer.parseInt(TextUtils.isDigitsOnly(value2) && !TextUtils.isEmpty(value2) ? value2 : 0 + "");
    String value3 = preferences.getString(context.getString(R.string.nrtc_setting_other_device_rotation_fixed_offset_key), 0 + "");
    deviceRotationOffset = Integer.parseInt(TextUtils.isDigitsOnly(value3) && !TextUtils.isEmpty(value3) ? value3 : 0 + "");
    audioHighQuality = preferences.getBoolean(context.getString(R.string.nrtc_setting_voe_high_quality_key), false);
    audioDtx = preferences.getBoolean(context.getString(R.string.nrtc_setting_voe_dtx_key), true);
    webrtcCompat = preferences.getBoolean(context.getString(R.string.nrtc_setting_other_webrtc_compat_key), true);
}
项目:YZxing    文件:DecodeUtils.java   
@Override
protected void onPostExecute(Result result) {
    super.onPostExecute(result);
    if (result != null) {
        String text = result.getText();
        if (!TextUtils.isEmpty(text)) {
            Intent intent = new Intent(mContext.get(), ShowResultActivity.class);
            intent.putExtra(Constant.EXTRA_RESULT_TEXT_FROM_PIC, text);
            mContext.get().startActivity(intent);
            if (mContext.get() instanceof Activity) ((Activity) mContext.get()).finish();
        }
    } else {
        Toast.makeText(mContext.get(), "解码失败", Toast.LENGTH_SHORT).show();
    }

}
项目:TransLinkMe-App    文件:SearchFragment.java   
@Override
public boolean onQueryTextChange(String newText) {

    if (TextUtils.isEmpty(newText)) {
        mRecyclerView.setVisibility(View.GONE);
        mSomethingWrongLayout.setVisibility(View.GONE);
        mWelcomeLayout.setVisibility(View.VISIBLE);
    }

    if (newText.length() > 5) {
        Toast.makeText(getContext(), "Bus stops contain 5 digits.", Toast.LENGTH_SHORT).show();
        mSearchView.setQuery(newText.substring(0, 5), false);
    }

    return true;
}
项目:boohee_v5.6    文件:MiPushClient.java   
public static void subscribe(Context context, String str, String str2) {
    if (!TextUtils.isEmpty(a.a(context).c()) && !TextUtils.isEmpty(str)) {
        if (System.currentTimeMillis() - topicSubscribedTime(context, str) > com.umeng
                .analytics.a.h) {
            org.apache.thrift.b oVar = new o();
            oVar.a(generatePacketID());
            oVar.b(a.a(context).c());
            oVar.c(str);
            oVar.d(context.getPackageName());
            oVar.e(str2);
            g.a(context).a(oVar, com.xiaomi.xmpush.thrift.a.Subscription, null);
        } else if (1 == PushMessageHelper.getPushMode(context)) {
            PushMessageHandler.a(context, str2, 0, null, str);
        } else {
            List arrayList = new ArrayList();
            arrayList.add(str);
            PushMessageHelper.sendCommandMessageBroadcast(context, PushMessageHelper
                    .generateCommandMessage(COMMAND_SUBSCRIBE_TOPIC, arrayList, 0, null, null));
        }
    }
}
项目:weex-3d-map    文件:WXAnimationBean.java   
private static Pair<Float, Float> parsePivot(@Nullable String transformOrigin,
                                             int width, int height) {
  if (!TextUtils.isEmpty(transformOrigin)) {
    int firstSpace = transformOrigin.indexOf(FunctionParser.SPACE);
    if (firstSpace != -1) {
      int i = firstSpace;
      for (; i < transformOrigin.length(); i++) {
        if (transformOrigin.charAt(i) != FunctionParser.SPACE) {
          break;
        }
      }
      if (i < transformOrigin.length() && transformOrigin.charAt(i) != FunctionParser.SPACE) {
        List<String> list = new ArrayList<>(2);
        list.add(transformOrigin.substring(0, firstSpace).trim());
        list.add(transformOrigin.substring(i, transformOrigin.length()).trim());
        return parsePivot(list, width, height);
      }
    }
  }
  return parsePivot(Arrays.asList(WXAnimationBean.Style.CENTER,
                                  WXAnimationBean.Style.CENTER), width, height);
}
项目:XinFramework    文件:SPCookieStore.java   
public SPCookieStore(Context context) {
    cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, Context.MODE_PRIVATE);
    cookies = new HashMap<>();

    //将持久化的cookies缓存到内存中,数据结构为 Map<Url.host, Map<CookieToken, Cookie>>
    Map<String, ?> prefsMap = cookiePrefs.getAll();
    for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
        if ((entry.getValue()) != null && !entry.getKey().startsWith(COOKIE_NAME_PREFIX)) {
            //获取url对应的所有cookie的key,用","分割
            String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
            for (String name : cookieNames) {
                //根据对应cookie的Key,从xml中获取cookie的真实值
                String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
                if (encodedCookie != null) {
                    Cookie decodedCookie = EntityCookie.decodeCookie(encodedCookie);
                    if (decodedCookie != null) {
                        if (!cookies.containsKey(entry.getKey())) {
                            cookies.put(entry.getKey(), new ConcurrentHashMap<String, Cookie>());
                        }
                        cookies.get(entry.getKey()).put(name, decodedCookie);
                    }
                }
            }
        }
    }
}
项目:XiaoHuaCharge    文件:LoadingDialog.java   
public static void showProgress(Context context, CharSequence message) {
    mLoadingProgress = new LoadingDialog(context, R.style.loading_dialog);//自定义style文件主要让北京变成透明并去掉标题部分<!-- 自定义loading dialog -->
    mLoadingProgress.setCanceledOnTouchOutside(false);
    mLoadingProgress.setTitle("");
    mLoadingProgress.setContentView(R.layout.loading_layout);
    if (message == null || TextUtils.isEmpty(message)) {
        mLoadingProgress.findViewById(R.id.loading_tv).setVisibility(View.GONE);
    } else {
        TextView tv = (TextView) mLoadingProgress.findViewById(R.id.loading_tv);
        load = (RelativeLayout) mLoadingProgress.findViewById(R.id.loading_container);
        tv.setText(message);
    }

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            AlphaAnimation alphaAnimation = new AlphaAnimation(0.8f, 0.3f);
            alphaAnimation.setDuration(1000);
            alphaAnimation.setRepeatMode(AlphaAnimation.REVERSE);
            alphaAnimation.setRepeatCount(AlphaAnimation.INFINITE);
            load.startAnimation(alphaAnimation);
        }
    });
    mLoadingProgress.setCancelable(false);
    mLoadingProgress.show();
}
项目:boohee_v5.6    文件:DietShareActivity.java   
protected void onPostExecute(Bitmap bitmap) {
    if (bitmap != null) {
        String filePath = FileUtil.getPNGImagePath(DietShareActivity.this.activity,
                bitmap, "SHARE_4_LINECHART");
        if (!TextUtils.isEmpty(filePath)) {
            if (DietShareActivity.this.mShareBoohee) {
                StatusPostTextActivity.comeWithPicture(DietShareActivity.this.activity,
                        filePath);
            } else {
                ShareManager.shareLocalImage(DietShareActivity.this.activity, filePath);
            }
        }
        if (bitmap != null && !bitmap.isRecycled()) {
            bitmap.recycle();
        }
    }
}
项目:BubbleAlert    文件:BblDialogManager.java   
public static void showEditTextBblDialog(FragmentManager fm, LayoutInflater inflater, String content,
                                         String ok, String cancel, String drawText,
                                         IDialogListener dialogListener, Context context, String textContent,
                                         String hintText, boolean isMultiline, String TAG) {
    BblContentFragment fragment = BblContentFragment.newInstance(TAG);

    if (TextUtils.isEmpty(content)) {

        content = context.getString(R.string.err_server_error);
    }
    fragment.setContent(content, ok, cancel, null, null)
            .setHasEditText(true)
            .setMultiLine(isMultiline)
            .setHintText(hintText)
            .setTextContent(textContent)
            .setDialogListener(dialogListener);
    BblDialog sampleDialog = new BblDialog();
    sampleDialog.setHasEditText(true)
            .setContentFragment(fragment, R.layout.layout_bbl_content, inflater, content, drawText, context)
            .setDisMissCallBack(null);
    fm.beginTransaction().add(sampleDialog, "Test").commit();
}
项目:CSipSimple    文件:Local.java   
public String getLocalIpAddresses() {
    ArrayList<String> addresses = new ArrayList<String>();
    try {
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en
                .hasMoreElements();) {
            NetworkInterface intf = en.nextElement();
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr
                    .hasMoreElements();) {
                InetAddress inetAddress = enumIpAddr.nextElement();
                if (!inetAddress.isLoopbackAddress()) {
                    addresses.add(inetAddress.getHostAddress().toString());
                }
            }
        }
    } catch (SocketException ex) {
        Log.e(THIS_FILE, "Impossible to get ip address", ex);
    }
    return TextUtils.join("\n", addresses);
}
项目:Mobike    文件:PersistentCookieStore.java   
/**
 * Construct getUrl persistent cookie store.
 *
 * @param context Context to attach cookie store to
 */
public PersistentCookieStore(Context context) {
    cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
    cookies = new ConcurrentHashMap<String, Cookie>();

    // Load any previously stored cookies into the store
    String storedCookieNames = cookiePrefs.getString(COOKIE_NAME_STORE, null);
    if (storedCookieNames != null) {
        String[] cookieNames = TextUtils.split(storedCookieNames, ",");
        for (String name : cookieNames) {
            String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
            if (encodedCookie != null) {
                Cookie decodedCookie = decodeCookie(encodedCookie);
                if (decodedCookie != null) {
                    cookies.put(name, decodedCookie);
                }
            }
        }

        // Clear out expired cookies
        clearExpired(new Date());
    }
}
项目:rongyunDemo    文件:SealUserInfoManager.java   
/**
 * 异步接口,获取1个好友信息
 *
 * @param userID 好友ID
 * @param callback 获取好友信息回调
 */
public void getFriendByID(final String userID, final ResultCallback<Friend> callback) {
    if (TextUtils.isEmpty(userID)) {
        if (callback != null)
            callback.onError(null);
    } else {
        mWorkHandler.post(new Runnable() {
            @Override
            public void run() {
                Friend friend = null;
                if (mFriendDao != null) {
                    friend = mFriendDao.queryBuilder().where(FriendDao.Properties.UserId.eq(userID)).unique();
                }
                if (callback != null)
                    callback.onCallback(friend);
            }
        });
    }
}
项目:letv    文件:AuthActivity.java   
private boolean a(String str) {
    if (TextUtils.isEmpty(str) || str.startsWith("http://") || str.startsWith("https://")) {
        return false;
    }
    if (!"SDKLite://h5quit".equalsIgnoreCase(str)) {
        if (TextUtils.equals(str, this.d)) {
            str = str + "?resultCode=150";
        }
        h.a((Activity) this, str);
    }
    finish();
    return true;
}
项目:iosched-reader    文件:LUtils.java   
public void startActivityWithTransition(Intent intent, final View clickedView,
                                            final String transitionName) {
        ActivityOptions options = null;
        if (hasL() && clickedView != null && !TextUtils.isEmpty(transitionName)) {
//            options = ActivityOptions.makeSceneTransitionAnimation(
//                    mActivity, clickedView, transitionName);
        }

        mActivity.startActivity(intent, (options != null) ? options.toBundle() : null);
    }
项目:rongyunDemo    文件:ContactsFragment.java   
private String replaceFirstCharacterWithUppercase(String spelling) {
    if (!TextUtils.isEmpty(spelling)) {
        char first = spelling.charAt(0);
        char newFirst = first;
        if (first >= 'a' && first <= 'z') {
            newFirst -= 32;
        }
        return spelling.replaceFirst(String.valueOf(first), String.valueOf(newFirst));
    } else {
        return "#";
    }
}
项目:airgram    文件:MessagesStorage.java   
public ArrayList<TLRPC.User> getUsers(final ArrayList<Integer> uids) {
    ArrayList<TLRPC.User> users = new ArrayList<>();
    try {
        getUsersInternal(TextUtils.join(",", uids), users);
    } catch (Exception e) {
        users.clear();
        FileLog.e("tmessages", e);
    }
    return users;
}
项目:androidtools    文件:DateUtils.java   
/**
 * Calculates the number of days in which two dates differ, whether or not to take absolute values.
 *
 * @param date1 first date
 * @param date2 Second date
 * @param isAbs Do you take absolute values?
 * @return dim dd
 */
public static int getDaysUnAbs(String date1, String date2, boolean isAbs) {
    int day = 0;
    if (TextUtils.isEmpty(date1) || TextUtils.isEmpty(date2))
        return 0;
    try {
        Date date = mDataFormat.parse(date1);
        Date myDate = mDataFormat.parse(date2);
        day = (int) ((date.getTime() - myDate.getTime()) / (24 * 60 * 60 * 1000));
    } catch (ParseException e) {
        e.printStackTrace();
        Log.e(TAG, e.getMessage());
    }
    return isAbs ? Math.abs(day) : day;
}
项目:LuaViewPlayground    文件:UDCanvas.java   
@Override
public Varargs invoke(Varargs args) {
    if (args.narg() >= 2) {
        final String typeface = args.optjstring(2, null);
        if (!TextUtils.isEmpty(typeface)) {
            getDefaultPaint(null).setTypeface(getLuaResourceFinder().findTypeface(typeface));
        }
    }
    return UDCanvas.this;
}
项目:Tangram-Android    文件:PojoGroupBasicAdapter.java   
@Override
public Range<Integer> getCardRange(String id) {
    if (TextUtils.isEmpty(id)) {
        return Range.create(0, 0);
    }

    List<Card> cards = getGroups();
    for (int i = 0, size = cards.size(); i < size; i++) {
        Card c = cards.get(i);
        if (id.equals(c.id)) {
            return getCardRange(c);
        }
    }
    return Range.create(0, 0);
}