当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil类代码示例

本文整理汇总了Java中com.netease.nim.uikit.common.util.string.StringUtil的典型用法代码示例。如果您正苦于以下问题:Java StringUtil类的具体用法?Java StringUtil怎么用?Java StringUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringUtil类属于com.netease.nim.uikit.common.util.string包,在下文中一共展示了StringUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMarkerInfoView

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
private View getMarkerInfoView(Marker pmarker) {
	String text = null;
	if (pmarker.equals(desMaker)) {
		text = desAddressInfo;
	} else if (pmarker.equals(myMaker)) {
		if (!StringUtil.isEmpty(myAddressInfo)) {
			text = String.format(myLocationFormatText, myAddressInfo);
		}
	}
	if (StringUtil.isEmpty(text)) {
		return null;
	}
	View view = getLayoutInflater().inflate(R.layout.amap_marker_window_info, null);
	TextView textView = (TextView) view.findViewById(R.id.title);
	textView.setText(text);
	return view;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:18,代码来源:NavigationAmapActivity.java

示例2: onGetLocalVideoResult

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
/**
 * 获取本地相册视频回调操作
 */
public void onGetLocalVideoResult(final Intent data) {
    if (data == null) {
        return;
    }

    String filePath = filePathFromIntent(data);
    if (StringUtil.isEmpty(filePath) || !checkVideoFile(filePath)) {
        return;
    }

    String md5 = MD5.getStreamMD5(filePath);
    String filename = md5 + "." + FileUtil.getExtensionName(filePath);
    String md5Path = StorageUtil.getWritePath(filename, StorageType.TYPE_VIDEO);

    if (AttachmentStore.copy(filePath, md5Path) != -1) {
        if (listener != null) {
            listener.onVideoPicked(new File(md5Path), md5);
        }
    } else {
        Toast.makeText(activity, R.string.video_exception, Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:26,代码来源:VideoMessageHelper.java

示例3: refreshStatus

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
private void refreshStatus() {
    FileAttachment attachment = (FileAttachment) message.getAttachment();
    if (TextUtils.isEmpty(attachment.getPath()) && TextUtils.isEmpty(attachment.getThumbPath())) {
        if (message.getAttachStatus() == AttachStatusEnum.fail || message.getStatus() == MsgStatusEnum.fail) {
            alertButton.setVisibility(View.VISIBLE);
        } else {
            alertButton.setVisibility(View.GONE);
        }
    }

    if (message.getStatus() == MsgStatusEnum.sending
            || (isReceivedMessage() && message.getAttachStatus() == AttachStatusEnum.transferring)) {
        progressCover.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.VISIBLE);
        progressLabel.setVisibility(View.VISIBLE);
        progressLabel.setText(StringUtil.getPercentString(getMsgAdapter().getProgress(message)));
    } else {
        progressCover.setVisibility(View.GONE);
        progressBar.setVisibility(View.GONE);
        progressLabel.setVisibility(View.GONE);
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:23,代码来源:MsgViewHolderThumbBase.java

示例4: afterTextChanged

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
	if (editText == null)
		return;
	int editStart = editText.getSelectionStart();
	int editEnd = editText.getSelectionEnd();
	editText.removeTextChangedListener(this);
	while (StringUtil.counterChars(s.toString()) > maxLength) {
		s.delete(editStart - 1, editEnd);
		editStart--;
		editEnd--;
	}
	editText.setSelection(editStart);
	editText.addTextChangedListener(this);
	if (show && lengthTV != null) {
		long remainLength = maxLength - StringUtil.counterChars(s.toString());
		lengthTV.setText("" + remainLength / 2);
		lengthTV.setVisibility(View.VISIBLE);
	}
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:21,代码来源:EasyEditDialog.java

示例5: getMimeType

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
public static String getMimeType(String filePath) {
    if (TextUtils.isEmpty(filePath)) {
        return "";
    }
    String type = null;
    String extension = getExtensionName(filePath.toLowerCase());
    if (!TextUtils.isEmpty(extension)) {
        MimeTypeMap mime = MimeTypeMap.getSingleton();
        type = mime.getMimeTypeFromExtension(extension);
    }
    Log.i(TAG, "url:" + filePath + " " + "type:" + type);

    // FIXME
    if (StringUtil.isEmpty(type) && filePath.endsWith("aac")) {
        type = "audio/aac";
    }

    return type;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:20,代码来源:FileUtil.java

示例6: refreshStatus

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
private void refreshStatus() {
    FileAttachment attachment = (FileAttachment) message.getAttachment();
    if (TextUtils.isEmpty(attachment.getPath()) && TextUtils.isEmpty(attachment.getThumbPath())) {
        if (message.getAttachStatus() == AttachStatusEnum.fail || message.getStatus() == MsgStatusEnum.fail) {
            alertButton.setVisibility(View.VISIBLE);
        } else {
            alertButton.setVisibility(View.GONE);
        }
    }

    if (message.getStatus() == MsgStatusEnum.sending || message.getAttachStatus() == AttachStatusEnum.transferring) {
        progressCover.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.VISIBLE);
    } else {
        progressCover.setVisibility(View.GONE);
    }
    progressLabel.setText(StringUtil.getPercentString(getAdapter().getProgress(message)));
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:19,代码来源:MsgViewHolderThumbBase.java

示例7: afterTextChanged

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    if (editText == null)
        return;
    int editStart = editText.getSelectionStart();
    int editEnd = editText.getSelectionEnd();
    editText.removeTextChangedListener(this);
    while (StringUtil.counterChars(s.toString()) > maxLength) {
        s.delete(editStart - 1, editEnd);
        editStart--;
        editEnd--;
    }
    editText.setSelection(editStart);
    editText.addTextChangedListener(this);
    if (show && lengthTV != null) {
        long remainLength = maxLength - StringUtil.counterChars(s.toString());
        lengthTV.setText("" + remainLength / 2);
        lengthTV.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:netease-im,项目名称:NIM_Android_UIKit,代码行数:21,代码来源:EasyEditDialog.java

示例8: refreshStatus

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
private void refreshStatus() {
    thumbnailImageView.setBackgroundResource(isReceivedMessage() ? R.drawable.message_view_holder_left_snapchat : R.drawable.message_view_holder_right_snapchat);

    if (message.getStatus() == MsgStatusEnum.sending || message.getAttachStatus() == AttachStatusEnum.transferring) {
        progressCover.setVisibility(View.VISIBLE);
        progressBar.setVisibility(View.VISIBLE);
    } else {
        progressCover.setVisibility(View.GONE);
    }

    progressLabel.setText(StringUtil.getPercentString(getMsgAdapter().getProgress(message)));
    readReceiptTextView.setVisibility(View.GONE);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:14,代码来源:MsgViewHolderSnapChat.java

示例9: afterTextChanged

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
    int editEnd = regularTeamNickname.getSelectionEnd();
    regularTeamNickname.removeTextChangedListener(this);
    while (StringUtil.counterChars(s.toString()) > MAX_LENGTH && editEnd > 0) {
        s.delete(editEnd - 1, editEnd);
        editEnd--;
    }
    regularTeamNickname.setSelection(editEnd);
    regularTeamNickname.addTextChangedListener(this);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:12,代码来源:AdvancedTeamNicknameActivity.java

示例10: chooseVideoFromCamera

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
/**
 * 拍摄视频
 */
protected void chooseVideoFromCamera() {
    if (!StorageUtil.hasEnoughSpaceForWrite(activity,
            StorageType.TYPE_VIDEO, true)) {
        return;
    }
    videoFilePath = StorageUtil.getWritePath(
            activity, StringUtil.get36UUID()
                    + C.FileSuffix.MP4, StorageType.TYPE_TEMP);
    videoFile = new File(videoFilePath);

    // 启动视频录制
    CaptureVideoActivity.start(activity, videoFilePath, captureRequestCode);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:17,代码来源:VideoMessageHelper.java

示例11: checkSendButtonEnable

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
/**
 * 显示发送或更多
 *
 * @param editText
 */
private void checkSendButtonEnable(EditText editText) {
    if (isRobotSession) {
        return;
    }
    String textMessage = editText.getText().toString();
    if (!TextUtils.isEmpty(StringUtil.removeBlanks(textMessage)) && editText.hasFocus()) {
        moreFuntionButtonInInputBar.setVisibility(View.GONE);
        sendMessageButtonInInputBar.setVisibility(View.VISIBLE);
    } else {
        sendMessageButtonInInputBar.setVisibility(View.GONE);
        moreFuntionButtonInInputBar.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:19,代码来源:InputPanel.java

示例12: onPreviewImageActivityResult

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
/**
 * 拍摄回调
 */
private void onPreviewImageActivityResult(int requestCode, Intent data) {
    if (data.getBooleanExtra(PreviewImageFromCameraActivity.RESULT_SEND, false)) {
        sendImageAfterPreviewPhotoActivityResult(data);
    } else if (data.getBooleanExtra(PreviewImageFromCameraActivity.RESULT_RETAKE, false)) {
        String filename = StringUtil.get32UUID() + JPG;
        String path = StorageUtil.getWritePath(filename, StorageType.TYPE_TEMP);

        if (requestCode == RequestCode.PREVIEW_IMAGE_FROM_CAMERA) {
            PickImageActivity.start(getActivity(), makeRequestCode(RequestCode.PICK_IMAGE), PickImageActivity.FROM_CAMERA, path);
        }
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:16,代码来源:PickImageAction.java

示例13: checkSendButtonEnable

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
/**
 * 显示发送或更多
 *
 * @param editText
 */
private void checkSendButtonEnable(EditText editText) {
    String textMessage = editText.getText().toString();
    if (!TextUtils.isEmpty(StringUtil.removeBlanks(textMessage)) && editText.hasFocus()) {
        moreFuntionButtonInInputBar.setVisibility(View.GONE);
        sendMessageButtonInInputBar.setVisibility(View.VISIBLE);
    } else {
        sendMessageButtonInInputBar.setVisibility(View.GONE);
        moreFuntionButtonInInputBar.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:16,代码来源:InputPanel.java

示例14: onSelectedAccountsResult

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
public void onSelectedAccountsResult(final ArrayList<String> accounts) {
    LogUtil.ui("start teamVideo " + getAccount() + " accounts = " + accounts);

    if (!checkTransactionValid()) {
        return;
    }

    final String roomName = StringUtil.get32UUID();
    LogUtil.ui("create room " + roomName);
    // 创建房间
    boolean webRTCCompat = PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean(getActivity().getString(R.string.nrtc_setting_other_webrtc_compat_key), true);
    AVChatManager.getInstance().createRoom(roomName, null, webRTCCompat, new AVChatCallback<AVChatChannelInfo>() {
        @Override
        public void onSuccess(AVChatChannelInfo avChatChannelInfo) {
            LogUtil.ui("create room " + roomName + " success !");
            if (!checkTransactionValid()) {
                return;
            }
            onCreateRoomSuccess(roomName, accounts);
            transaction.setRoomName(roomName);

            String teamName = TeamDataCache.getInstance().getTeamName(transaction.getTeamID());

            TeamAVChatHelper.sharedInstance().setTeamAVChatting(true);
            TeamAVChatActivity.startActivity(getActivity(), false, transaction.getTeamID(), roomName, accounts, teamName);
            transaction = null;
        }

        @Override
        public void onFailed(int code) {
            if (!checkTransactionValid()) {
                return;
            }
            onCreateRoomFail();
        }

        @Override
        public void onException(Throwable exception) {
            if (!checkTransactionValid()) {
                return;
            }
            onCreateRoomFail();
        }
    });
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:46,代码来源:TeamAVChatAction.java

示例15: tempFile

import com.netease.nim.uikit.common.util.string.StringUtil; //导入依赖的package包/类
private String tempFile() {
    String filename = StringUtil.get32UUID() + JPG;
    return StorageUtil.getWritePath(filename, StorageType.TYPE_TEMP);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:5,代码来源:PickImageAction.java


注:本文中的com.netease.nim.uikit.common.util.string.StringUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。