Java Code Examples for android.text.TextUtils.equals()

The following are Jave code examples for showing how to use equals() of the android.text.TextUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: RxJava2RetrofitDemo   File: ParamsInterceptor.java   Source Code and License Vote up 6 votes
private boolean canSpliceBody(Request request) {
    if (request == null) {
        return false;
    }
    if (!TextUtils.equals(request.method(), "POST")) {
        return false;
    }
    RequestBody body = request.body();
    if (body == null) {
        return true;
    }
    MediaType mediaType = body.contentType();
    if (mediaType == null) {
        return true;
    }
    if (TextUtils.equals(mediaType.subtype(), "multi-part")) {
        return false;
    }
    return true;
}
 
Example 2
Project: chromium-for-android-56-debug-video   File: WebappActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onNewIntent(Intent intent) {
    if (intent == null) return;
    super.onNewIntent(intent);

    WebappInfo newWebappInfo = createWebappInfo(intent);
    if (newWebappInfo == null) {
        Log.e(TAG, "Failed to parse new Intent: " + intent);
        finish();
    } else if (!TextUtils.equals(mWebappInfo.id(), newWebappInfo.id())) {
        mWebappInfo = newWebappInfo;
        resetSavedInstanceState();
        if (mIsInitialized) initializeUI(null);
        // TODO(dominickn): send the web app into fullscreen if mDisplayMode is
        // WebDisplayMode.Fullscreen. See crbug.com/581522
    }
}
 
Example 3
Project: boohee_v5.6   File: XMPushService.java   Source Code and License Vote up 6 votes
private boolean a(String str, Intent intent) {
    com.xiaomi.push.service.w.b b = w.a().b(str, intent.getStringExtra(y.p));
    boolean z = false;
    if (b == null || str == null) {
        return false;
    }
    Object stringExtra = intent.getStringExtra(y.B);
    String stringExtra2 = intent.getStringExtra(y.u);
    if (!(TextUtils.isEmpty(b.j) || TextUtils.equals(stringExtra, b.j))) {
        com.xiaomi.channel.commonutils.logger.b.a("session changed. old session=" + b.j + ", " +
                "new session=" + stringExtra);
        z = true;
    }
    if (stringExtra2.equals(b.i)) {
        return z;
    }
    com.xiaomi.channel.commonutils.logger.b.a("security changed. ");
    return true;
}
 
Example 4
Project: ucar-weex-core   File: WXEmbed.java   Source Code and License Vote up 6 votes
@Override
public void onException(NestedContainer container, String errCode, String msg) {
  if (TextUtils.equals(errCode, WXRenderErrorCode.WX_NETWORK_ERROR) && container instanceof WXEmbed) {
    final WXEmbed comp = ((WXEmbed)container);
    final ImageView imageView = new ImageView(comp.getContext());
    imageView.setImageResource(R.drawable.error);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ERROR_IMG_WIDTH, ERROR_IMG_HEIGHT);
    layoutParams.gravity = Gravity.CENTER;
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ImageView.ScaleType.FIT_XY);
    imageView.setAdjustViewBounds(true);
    imageView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        imageView.setOnClickListener(null);
        imageView.setEnabled(false);
        comp.loadContent();
      }
    });
    FrameLayout hostView = comp.getHostView();
    hostView.removeAllViews();
    hostView.addView(imageView);
    WXLogUtils.e("WXEmbed", "NetWork failure :" + errCode + ",\n error message :" + msg);
  }
}
 
Example 5
Project: letv   File: FirstPageCustomAdapter.java   Source Code and License Vote up 6 votes
public FirstPageCustomAdapter(Context context, ItemTouchHelper helper, List<HomeBlock> list, TextView view, RecyclerView recyclerView) {
    this.mInflater = LayoutInflater.from(context);
    if (!BaseTypeUtils.isListEmpty(list)) {
        for (HomeBlock block : list) {
            if (block != null) {
                if (TextUtils.equals(block.isLock, "1")) {
                    this.mList.add(this.mLockSize, block);
                    this.mLockSize++;
                } else {
                    this.mList.add(block);
                }
            }
        }
        this.mItemTouchHelper = helper;
        this.mContext = context;
        if (this.mLockSize == 0) {
            this.mHeadSize = 1;
        } else {
            this.mHeadSize = 2;
        }
        this.mSaveView = view;
        this.mRecyclerView = recyclerView;
    }
}
 
Example 6
Project: letv   File: LetvBaseParser.java   Source Code and License Vote up 6 votes
public boolean isTokenInvalid(JSONObject object) {
    if (isChatRoomTokenInvalid(object) || isHotPointTokenInvalid(object) || isPlayRecordTokenInvalid(object) || isCommentTokenInvalid(object) || isCreditTokenInvalid(object)) {
        return true;
    }
    String errorCode = object.optString("errorCode");
    if (TextUtils.isEmpty(errorCode)) {
        return false;
    }
    if (TextUtils.equals(errorCode, "1002") && object.has("action") && TextUtils.isEmpty(object.optString("action"))) {
        return true;
    }
    if (TextUtils.equals(errorCode, ERROR_CODE_1014) || TextUtils.equals(errorCode, ERROR_CODE_1020)) {
        return true;
    }
    return false;
}
 
Example 7
Project: chromium-for-android-56-debug-video   File: RemoteVideoInfo.java   Source Code and License Vote up 6 votes
@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof RemoteVideoInfo)) {
        return false;
    }

    RemoteVideoInfo other = (RemoteVideoInfo) obj;
    return durationMillis == other.durationMillis
           && currentTimeMillis == other.currentTimeMillis
           && state == other.state
           && TextUtils.equals(title, other.title)
           && TextUtils.equals(errorMessage, other.errorMessage);
}
 
Example 8
Project: DroidPlugin   File: IWifiManagerHookHandle.java   Source Code and License Vote up 5 votes
@Override
protected boolean beforeInvoke(Object receiver, Method method, Object[] args) throws Throwable {
    //callingPackage
    final int index = 0;
    if (args != null && args.length > index && args[index] instanceof String) {
        String callingPackage = (String) args[index];
        if (!TextUtils.equals(callingPackage, mHostContext.getPackageName())) {
            args[index] = mHostContext.getPackageName();
        }
    }
    return super.beforeInvoke(receiver, method, args);
}
 
Example 9
Project: letv   File: LetvPushService.java   Source Code and License Vote up 5 votes
private void forceAlert() {
    boolean isOpen = TextUtils.equals("1", TipUtils.getTipTitle(DialogMsgConstantId.CONSTANT_90006, "0"));
    if (isOpen) {
        String lastLaunchDate = PreferencesManager.getInstance().getLatestLaunchDate();
        LogInfo.log("save_", "最后一起启动app的日期为:" + lastLaunchDate);
        if (TextUtils.isEmpty(lastLaunchDate)) {
            PreferencesManager.getInstance().saveLatestLaunchTime();
            return;
        }
        String nowDate = StringUtils.timeString(System.currentTimeMillis());
        String nowMinute = StringUtils.timeClockString();
        int dateBetween = 0;
        try {
            dateBetween = StringUtils.daysBetween(lastLaunchDate, nowDate);
        } catch (Exception e) {
            e.printStackTrace();
        }
        LogInfo.log("save_", "强制弹框日期应为:" + lastLaunchDate + " + " + Integer.valueOf(PreferencesManager.getInstance().getCurrentForceAlertDistanceDays()));
        if (dateBetween >= Integer.valueOf(PreferencesManager.getInstance().getCurrentForceAlertDistanceDays()).intValue()) {
            int minuteBetween = 0;
            try {
                minuteBetween = StringUtils.calMinuteBetween(TipUtils.getTipMessage(DialogMsgConstantId.CONSTANT_90005, "16:00"), nowMinute);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            if (minuteBetween <= PreferencesManager.getInstance().getPushDistance() / 60) {
                DialogService.launch(this, DialogType.TYPE_FORCE_ALERT_OPEN, TipUtils.getTipTitle(DialogMsgConstantId.CONSTANT_90004, 2131100136), TipUtils.getTipMessage(DialogMsgConstantId.CONSTANT_90004, 2131100134));
                showForceLocalNotification(TipUtils.getTipMessage(DialogMsgConstantId.CONSTANT_90004, 2131100134));
                LogInfo.log("save_", "minuteBetween = " + minuteBetween + " , show force dialog");
                return;
            }
            LogInfo.log("save_", " minuteBetween = " + minuteBetween + " , saved alerttime is = " + TipUtils.getTipMessage(DialogMsgConstantId.CONSTANT_90005, "16:00"));
            return;
        }
        LogInfo.log("save_", " dateBetween = " + dateBetween + " , saved current distance = " + Integer.valueOf(PreferencesManager.getInstance().getCurrentForceAlertDistanceDays()));
        return;
    }
    LogInfo.log("save_", "强制弹框开关为:" + isOpen);
}
 
Example 10
Project: GravityBox   File: TorchService.java   Source Code and License Vote up 5 votes
@Override
public void onTorchModeUnavailable(String cameraId) {
    if (DEBUG) Log.d(TAG, "onTorchModeUnavailable: cameraId=" + cameraId);
    if (TextUtils.equals(cameraId, getCameraId())) {
        resetTimeout();
        mTorchStatus = TORCH_STATUS_ERROR;
        maybeProcessStartIntent();
        TorchService.this.stopForeground(true);
        broadcastStatus();
        stopSelf();
    }
}
 
Example 11
Project: chromium-for-android-56-debug-video   File: ActivityDelegate.java   Source Code and License Vote up 5 votes
/**
 * Parse out the URL for a document Intent.
 * @param intent Intent to check.
 * @return The URL that the Intent was fired to display, or null if it couldn't be retrieved.
 */
public static String getInitialUrlForDocument(Intent intent) {
    if (intent == null || intent.getData() == null) return null;
    Uri data = intent.getData();
    return TextUtils.equals(data.getScheme(), UrlConstants.DOCUMENT_SCHEME)
            ? data.getQuery() : null;
}
 
Example 12
Project: boohee_v5.6   File: AuthActivity.java   Source Code and License Vote up 5 votes
private boolean a(String str) {
    if (TextUtils.isEmpty(str) || str.startsWith(TimeLinePatterns.WEB_SCHEME) || 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;
}
 
Example 13
Project: Exoplayer2Radio   File: DefaultTrackSelector.java   Source Code and License Vote up 5 votes
/**
 * Returns a {@link Parameters} instance with the provided preferred language for audio and
 * forced text tracks.
 *
 * @param preferredAudioLanguage The preferred language as defined by RFC 5646. {@code null} to
 *     select the default track, or first track if there's no default.
 * @return A {@link Parameters} instance with the provided preferred language for audio and
 *     forced text tracks.
 */
public Parameters withPreferredAudioLanguage(String preferredAudioLanguage) {
  preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  if (TextUtils.equals(preferredAudioLanguage, this.preferredAudioLanguage)) {
    return this;
  }
  return new Parameters(preferredAudioLanguage, preferredTextLanguage,
      allowMixedMimeAdaptiveness, allowNonSeamlessAdaptiveness, maxVideoWidth, maxVideoHeight,
      maxVideoBitrate, exceedVideoConstraintsIfNecessary, exceedRendererCapabilitiesIfNecessary,
      viewportWidth, viewportHeight, orientationMayChange);
}
 
Example 14
Project: chromium-for-android-56-debug-video   File: ContextualSearchFieldTrial.java   Source Code and License Vote up 5 votes
/**
 * Gets a boolean Finch parameter, assuming the <paramName>="true" format.  Also checks for a
 * command-line switch with the same name, for easy local testing.
 * @param paramName The name of the Finch parameter (or command-line switch) to get a value for.
 * @return Whether the Finch param is defined with a value "true", if there's a command-line
 *         flag present with any value.
 */
private static boolean getBooleanParam(String paramName) {
    if (CommandLine.getInstance().hasSwitch(paramName)) {
        return true;
    }
    return TextUtils.equals(ENABLED_VALUE,
            VariationsAssociatedData.getVariationParamValue(FIELD_TRIAL_NAME, paramName));
}
 
Example 15
Project: letv   File: StarRankActivity.java   Source Code and License Vote up 5 votes
private void refreshView(LTStarRankModelPB result) {
    if (result == null || BaseTypeUtils.isListEmpty(result.data)) {
        LogInfo.log("zhaoxiang", System.currentTimeMillis() + "");
        showTitleView(false);
        this.mRootView.dataError(false);
        return;
    }
    showTitleView(true);
    this.mRootView.finishLayout();
    this.mLoadingView.clearAnimation();
    this.mLoadingView.setVisibility(8);
    this.mIsRefrence = false;
    if (this.mStarRankAdapter == null) {
        this.mStarRankAdapter = new StarRankAdapter(this.mContext);
    }
    if (this.oldStarRank != null) {
        if (TextUtils.equals(result.is_rank, "1")) {
            this.oldStarRank.setVisibility(0);
        } else {
            this.oldStarRank.setVisibility(8);
        }
    }
    if (BaseTypeUtils.getElementFromList(result.data, 0) != null) {
        addHeadView((LTStarRankModelDetailPB) result.data.get(0));
    }
    this.mListView.setAdapter(this.mStarRankAdapter);
    this.mStarRankAdapter.setList((ExpandableListView) this.mListView.getRootView(), result.data);
}
 
Example 16
Project: weex-3d-map   File: DefautDebugAdapter.java   Source Code and License Vote up 5 votes
@Override
public View wrapContainer(WXSDKInstance instance, View wxView) {
  if (wxView != null && wxView.getContext() != null && wxView.getParent() == null && TextUtils.equals(getDebugOptions(SHOW_3D_LAYER),"true")) {
    ScalpelFrameLayout scalpelFrameLayout = new ScalpelFrameLayout(wxView.getContext());
    WXDebugTool.updateScapleView(scalpelFrameLayout);
    scalpelFrameLayout.addView(wxView);
    instance.registerActivityStateListener(new DebugActivityState(wxView));
    return scalpelFrameLayout;
  }
  return wxView;
}
 
Example 17
Project: GitHub   File: UserActivity.java   Source Code and License Vote up 5 votes
@Override
public void initView() {
    initUser(user);
    mPresenter.initAdapterPresenter(mViewBinding.lvComment.getPresenter(), user);
    if (SpUtil.getUser() != null && TextUtils.equals(user.objectId, SpUtil.getUser().objectId)) {
        mViewBinding.fab.setImageResource(R.drawable.ic_menu_camera);
        mViewBinding.fab.setOnClickListener(v -> takePhoto());
    } else mViewBinding.fab.setOnClickListener(v -> ToastUtil.show("ok"));
}
 
Example 18
Project: letv   File: AlbumLoadController.java   Source Code and License Vote up 5 votes
public void onJumpErr() {
    if (this.mActivity.getFlow() != null) {
        AlbumPlayFlow flow = this.mActivity.getFlow();
        flow.mCdeStatusCode = -1;
        if (flow.mCurrentPlayingVideo != null) {
            VideoBean video = flow.mCurrentPlayingVideo;
            String type = video.jumptype;
            if (TextUtils.equals(type, "WEB_JUMP")) {
                if (!TextUtils.isEmpty(video.jumpLink)) {
                    if (video.openby == 1) {
                        new LetvWebViewActivityConfig(this.mActivity).launch(video.jumpLink, true, false, 16);
                        return;
                    }
                    try {
                        this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(video.jumpLink)));
                    } catch (Exception e) {
                    }
                }
            } else if (TextUtils.equals(type, "TV_JUMP")) {
                if (TextUtils.equals(this.mLoadLayout.getJumpBtnText(), TipUtils.getTipMessage("100057", this.mActivity.getString(R.string.dialog_understand_screen_projection)))) {
                    new LetvWebViewActivityConfig(this.mActivity).launch(TipUtils.getTipMessage("100065", UNDERSTAND), true, false, 16);
                } else {
                    this.mActivity.getVideoController().processScreenProjection(this.mActivity, 0, this);
                }
            }
        }
    }
}
 
Example 19
Project: mapbox-navigation-android   File: ManeuverView.java   Source Code and License Vote up 4 votes
public void setManeuverType(String maneuverType) {
  if (!TextUtils.equals(this.maneuverType, maneuverType)) {
    this.maneuverType = maneuverType;
    invalidate();
  }
}
 
Example 20
Project: redpacketui-open   File: AuthResult.java   Source Code and License Vote up 0 votes
AuthResult(Map<String, String> rawResult, boolean removeBrackets) {
        if (rawResult == null) {
            return;
        }

        for (String key : rawResult.keySet()) {
            if (TextUtils.equals(key, "resultStatus")) {
                resultStatus = rawResult.get(key);
            } else if (TextUtils.equals(key, "result")) {
                result = rawResult.get(key);
            } else if (TextUtils.equals(key, "memo")) {
                memo = rawResult.get(key);
            }
        }

        String[] resultValue = result.split("&");
        for (String value : resultValue) {

            if (value.startsWith("auth_code")) {
                authCode = removeBrackets(getValue("auth_code=", value), removeBrackets);
                continue;
            }
            if (value.startsWith("result_code")) {
                resultCode = removeBrackets(getValue("result_code=", value), removeBrackets);
                continue;
            }
            if (value.startsWith("user_id")) {
                userId = removeBrackets(getValue("user_id=", value), removeBrackets);
            }
        }

    }