Java Code Examples for com.gianlu.commonutils.CommonUtils#join()

The following examples show how to use com.gianlu.commonutils.CommonUtils#join() . 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: NotificationService.java    From Aria2App with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
private String describeServiceStatus() {
    switch (startedFrom) {
        case GLOBAL:
            List<String> notNotify = getByMode(Mode.NOT_NOTIFY_EXCLUSIVE);
            if (notNotify.isEmpty())
                return CommonUtils.join(profiles, ", ", true);
            else
                return CommonUtils.join(profiles, ", ", true) + " except " + CommonUtils.join(notNotify, ", ", true);
        case DOWNLOAD:
            List<String> notify = getByMode(Mode.NOTIFY_EXCLUSIVE);
            if (notify.isEmpty())
                return "Should stop, not notifying anything."; // Should never appear on notification
            else
                return CommonUtils.join(profiles, ", ", true) + " for " + CommonUtils.join(notify, ", ", true);
        default:
        case NOT:
            return "Not started"; // Should never appear on notification
    }
}
 
Example 2
Source File: AddDownloadBundlesAdapter.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
    final AddDownloadBundle bundle = bundles.get(position);

    String text = null;
    int textColorRes = 0;
    if (bundle instanceof AddUriBundle) {
        text = CommonUtils.join(((AddUriBundle) bundle).uris, ", ");
        textColorRes = R.color.colorSecondaryVariant;
    } else if (bundle instanceof AddTorrentBundle) {
        text = ((AddTorrentBundle) bundle).filename;
        textColorRes = R.color.colorTorrentVariant;
    } else if (bundle instanceof AddMetalinkBundle) {
        text = ((AddMetalinkBundle) bundle).filename;
        textColorRes = R.color.colorMetalinkVariant;
    }

    if (text != null)
        holder.text.setText(text);
    if (textColorRes != 0)
        CommonUtils.setTextColor(holder.text, textColorRes);

    holder.remove.setOnClickListener(v -> removeItem(holder.getAdapterPosition()));
    holder.edit.setOnClickListener(v -> {
        if (listener != null) listener.onEdit(holder.getAdapterPosition(), bundle);
    });
}
 
Example 3
Source File: Translators.java    From CommonUtils with Apache License 2.0 4 votes vote down vote up
Item(@NonNull JSONObject obj) throws JSONException {
    name = obj.getString("name");
    link = obj.getString("link");
    languages = CommonUtils.join(obj.getJSONArray("languages"), ", ");
}
 
Example 4
Source File: OptionsMap.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
@NonNull
public String strings(@NonNull String separator) {
    if (values.length == 0) return "";
    else if (values.length == 1) return values[0];
    return CommonUtils.join(values, separator);
}
 
Example 5
Source File: MultiProfile.java    From Aria2App with GNU General Public License v3.0 4 votes vote down vote up
public String getFormal(Context context) {
    return type.getFormal(context) + (type == Type.WIFI ? ": " + CommonUtils.join(ssids, ", ") : "");
}