Java Code Examples for com.tencent.open.utils.Util#isEmpty()

The following examples show how to use com.tencent.open.utils.Util#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecordActivity.java    From Android-Application-ZJB with Apache License 2.0 6 votes vote down vote up
@Override
public void onCancel() { // 录音取消
    timer.cancel();
    setSaveClickable(false);
    // 取消之后,有本地录音,则应该显示播放界面
    if (Util.isEmpty(mViewModel.gDownloadRecordPath)) {
        timeTv.setText("00:00");
        noticeTv.setText("");
        stateRecordNotExit();
    } else {
        mViewModel.gNowPath = mViewModel.gDownloadRecordPath;
        mPlayerUtil.setResource(mViewModel.gNowPath);
        Logger.i("onCancel", "not ok  2 " + mPlayerUtil.getDuration());
        second2TextShow(mPlayerUtil.getDuration() / 1000);
        stateRecordExit();
    }
}
 
Example 2
Source File: QzoneShare.java    From letv with Apache License 2.0 5 votes vote down vote up
private StringBuffer a(StringBuffer stringBuffer, Bundle bundle) {
    f.c(f.d, "fillShareToQQParams() --start");
    ArrayList stringArrayList = bundle.getStringArrayList("imageUrl");
    Object string = bundle.getString("appName");
    int i = bundle.getInt("req_type", 1);
    String string2 = bundle.getString("title");
    String string3 = bundle.getString("summary");
    bundle.putString("appId", this.mToken.getAppId());
    bundle.putString("sdkp", "a");
    bundle.putString("sdkv", Constants.SDK_VERSION);
    bundle.putString("status_os", VERSION.RELEASE);
    bundle.putString("status_machine", Build.MODEL);
    String str = "...";
    if (!Util.isEmpty(string2) && string2.length() > 40) {
        bundle.putString("title", string2.substring(0, 40) + "...");
    }
    if (!Util.isEmpty(string3) && string3.length() > 80) {
        bundle.putString("summary", string3.substring(0, 80) + "...");
    }
    if (!TextUtils.isEmpty(string)) {
        bundle.putString("site", string);
    }
    if (stringArrayList != null) {
        int size = stringArrayList.size();
        String[] strArr = new String[size];
        for (int i2 = 0; i2 < size; i2++) {
            strArr[i2] = (String) stringArrayList.get(i2);
        }
        bundle.putStringArray("imageUrl", strArr);
    }
    bundle.putString("type", String.valueOf(i));
    stringBuffer.append("&" + Util.encodeUrl(bundle).replaceAll("\\+", "%20"));
    f.c(f.d, "fillShareToQQParams() --end");
    return stringBuffer;
}
 
Example 3
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.save_tv)
private void save(View view) {
	nickName = mNickET.getText().toString().trim();
	if(Util.isEmpty(nickName)) {
		mNickET.requestFocus();
		ToastUtils.showMessage(getApplicationContext(), R.string.nick_null);
		return;
	}
	nickName = ToolsUtils.Html2Text(nickName);
	if(Util.isEmpty(nickName)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	ToolsUtils.hideKeyboard(mNickET);
	if (App.currentUser == null) {
		finishWithAnimation();
		return;
	}
	try {
		ProgressDialogUtils.showProgressDialog(this, "正在处理中...");
		mUserService.setNickAndSex(mHandler, String.valueOf(App.currentUser.getId()), 
				URLEncoder.encode(nickName, "UTF-8"), String.valueOf(mSexFlag));
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
}
 
Example 4
Source File: QzoneShare.java    From letv with Apache License 2.0 4 votes vote down vote up
private void a(Activity activity, Bundle bundle, IUiListener iUiListener) {
    f.c(f.d, "doshareToQzone() --start");
    StringBuffer stringBuffer = new StringBuffer("mqqapi://share/to_qzone?src_type=app&version=1&file_type=news");
    ArrayList stringArrayList = bundle.getStringArrayList("imageUrl");
    Object string = bundle.getString("title");
    Object string2 = bundle.getString("summary");
    Object string3 = bundle.getString("targetUrl");
    String string4 = bundle.getString("audio_url");
    int i = bundle.getInt("req_type", 1);
    Object string5 = bundle.getString("appName");
    int i2 = bundle.getInt("cflag", 0);
    String string6 = bundle.getString("share_qq_ext_str");
    CharSequence appId = this.mToken.getAppId();
    String openId = this.mToken.getOpenId();
    f.b("doshareToQzone", "openId:" + openId);
    if (stringArrayList != null) {
        StringBuffer stringBuffer2 = new StringBuffer();
        int size = stringArrayList.size() > 9 ? 9 : stringArrayList.size();
        for (int i3 = 0; i3 < size; i3++) {
            stringBuffer2.append(URLEncoder.encode((String) stringArrayList.get(i3)));
            if (i3 != size - 1) {
                stringBuffer2.append(";");
            }
        }
        stringBuffer.append("&image_url=" + Base64.encodeToString(Util.getBytesUTF8(stringBuffer2.toString()), 2));
    }
    if (!TextUtils.isEmpty(string)) {
        stringBuffer.append("&title=" + Base64.encodeToString(Util.getBytesUTF8(string), 2));
    }
    if (!TextUtils.isEmpty(string2)) {
        stringBuffer.append("&description=" + Base64.encodeToString(Util.getBytesUTF8(string2), 2));
    }
    if (!TextUtils.isEmpty(appId)) {
        stringBuffer.append("&share_id=" + appId);
    }
    if (!TextUtils.isEmpty(string3)) {
        stringBuffer.append("&url=" + Base64.encodeToString(Util.getBytesUTF8(string3), 2));
    }
    if (!TextUtils.isEmpty(string5)) {
        stringBuffer.append("&app_name=" + Base64.encodeToString(Util.getBytesUTF8(string5), 2));
    }
    if (!Util.isEmpty(openId)) {
        stringBuffer.append("&open_id=" + Base64.encodeToString(Util.getBytesUTF8(openId), 2));
    }
    if (!Util.isEmpty(string4)) {
        stringBuffer.append("&audioUrl=" + Base64.encodeToString(Util.getBytesUTF8(string4), 2));
    }
    stringBuffer.append("&req_type=" + Base64.encodeToString(Util.getBytesUTF8(String.valueOf(i)), 2));
    if (!Util.isEmpty(string6)) {
        stringBuffer.append("&share_qq_ext_str=" + Base64.encodeToString(Util.getBytesUTF8(string6), 2));
    }
    stringBuffer.append("&cflag=" + Base64.encodeToString(Util.getBytesUTF8(String.valueOf(i2)), 2));
    f.b("doshareToQzone, url: ", stringBuffer.toString());
    a.a(Global.getContext(), this.mToken, "requireApi", "shareToNativeQQ");
    this.mActivityIntent = new Intent("android.intent.action.VIEW");
    this.mActivityIntent.setData(Uri.parse(stringBuffer.toString()));
    this.mActivityIntent.putExtra("pkg_name", activity.getPackageName());
    if (SystemUtils.compareQQVersion(activity, SystemUtils.QQ_VERSION_NAME_4_6_0) < 0) {
        if (hasActivityForIntent()) {
            startAssitActivity(activity, iUiListener);
        }
        f.c(f.d, "doShareToQzone() -- QQ Version is < 4.6.0");
    } else {
        f.c(f.d, "doShareToQzone() -- QQ Version is > 4.6.0");
        Object obj = TemporaryStorage.set(SystemUtils.QZONE_SHARE_CALLBACK_ACTION, iUiListener);
        if (obj != null) {
            f.c(f.d, "doShareToQzone() -- do listener onCancel()");
            ((IUiListener) obj).onCancel();
        }
        if (hasActivityForIntent()) {
            startAssistActivity(activity, Constants.REQUEST_QZONE_SHARE);
        }
    }
    if (hasActivityForIntent()) {
        d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_SHARE_TO_QZONE, "11", "3", "0", this.mViaShareQzoneType, "0", "1", "0");
        d.a().a(0, "SHARE_CHECK_SDK", Constants.DEFAULT_UIN, this.mToken.getAppId(), String.valueOf(4), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
    } else {
        d.a().a(this.mToken.getOpenId(), this.mToken.getAppId(), Constants.VIA_SHARE_TO_QZONE, "11", "3", "1", this.mViaShareQzoneType, "0", "1", "0");
        d.a().a(1, "SHARE_CHECK_SDK", Constants.DEFAULT_UIN, this.mToken.getAppId(), String.valueOf(4), Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "hasActivityForIntent fail");
    }
    f.c(f.d, "doShareToQzone() --end");
}
 
Example 5
Source File: JokeServiceImpl.java    From QiQuYing with Apache License 2.0 4 votes vote down vote up
@Override
public void addComment(final Handler handler, Integer jokeId, String content) {
	if(App.currentUser == null || Util.isEmpty(content)) {
		return;
	}
	HttpUtils http = new HttpUtils();
	http.configDefaultHttpCacheExpiry(1000 * 60 * 10); //缓存超期时间10分钟
	http.configTimeout(Constants.REQUEST_TIME_OUT);  //设置超时时间
	RequestParams params = new RequestParams();
	params.addQueryStringParameter("jokeId", String.valueOf(jokeId));
	params.addQueryStringParameter("userId", String.valueOf(App.currentUser.getId()));
	params.addQueryStringParameter("userPortrait", App.currentUser.getPortraitUrl());
	try {
		params.addQueryStringParameter("userNick", 
				URLEncoder.encode(App.currentUser.getUserNike(), "UTF-8"));
		params.addQueryStringParameter("content", 
				URLEncoder.encode(content, "UTF-8"));
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	http.send(HttpRequest.HttpMethod.POST,
		RcpUri.INTERFACE_URI_COMMENT, params,
		new RequestCallBack<String>() {
			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				String rs = responseInfo.result;
				Map map = FastjsonUtil.json2Map(rs);
				int code = Integer.parseInt(String.valueOf(map.get("code")));
				if (code != 200) {
					//请求失败
					Log.e(TAG, "comment failure");
					ToastUtils.showMessage(mContext, R.string.comment_fail);
					handler.sendEmptyMessage(Constants.FAILURE_1);
					return;
				}
				Log.e(TAG, "comment success");
				handler.sendEmptyMessage(Constants.SUCCESS_1);
			}
			@Override
			public void onFailure(HttpException error, String msg) {
				Log.e(TAG, "comment failure", error);
				handler.sendEmptyMessage(Constants.FAILURE_1);
				if(!HttpUtil.isNetworkAvailable(mContext)) {
					ToastUtils.showMessage(mContext, R.string.no_net);
				} else {
					ToastUtils.showMessage(mContext, R.string.comment_fail);
				}
			}
		});
}