當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。