Example usage for android.text TextUtils concat

List of usage examples for android.text TextUtils concat

Introduction

In this page you can find the example usage for android.text TextUtils concat.

Prototype

public static CharSequence concat(CharSequence... text) 

Source Link

Document

Returns a CharSequence concatenating the specified CharSequences, retaining their spans if any.

Usage

From source file:com.example.android.support.design.widget.AppBarLayoutUsageBase.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getLayoutId());/*from  w w  w.j a  v a2 s .  c  o  m*/

    // Retrieve the Toolbar from our content view, and set it as the action bar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_app_bar);
    if (appBarLayout != null && displayTitle()) {
        appBarLayout.setTitle(getTitle());
    }

    TextView dialog = (TextView) findViewById(R.id.textview_dialogue);
    if (dialog != null) {
        dialog.setText(TextUtils.concat(Shakespeare.DIALOGUE));
    }

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.appbar_recyclerview);
    if (recyclerView != null) {
        setupRecyclerView(recyclerView);
    }

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    if (tabLayout != null) {
        setupTabs(tabLayout);
    }

    final SwipeRefreshLayout refreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
    if (refreshLayout != null) {
        refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            private final Handler mHandler = new Handler();

            @Override
            public void onRefresh() {
                // Post a delayed runnable to reset the refreshing state in 2 seconds
                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        refreshLayout.setRefreshing(false);
                    }
                }, 2000);
            }
        });
    }
}

From source file:de.tobiasbielefeld.solitaire.ui.about.ChangeLogFragment.java

private CharSequence createText(int pos) {

    List<CharSequence> stringList = new ArrayList<>(MAX_LINES_PER_VERSION);

    //load the lines from the changelog separately
    for (int i = 1; i <= MAX_LINES_PER_VERSION; i++) {

        int ID = getResources().getIdentifier("changelog_" + Integer.toString(pos) + "_" + Integer.toString(i),
                "string", getActivity().getPackageName());

        if (ID != 0) {
            stringList.add(getString(ID));
        } else {//from   w ww  .ja va 2s  .  c om
            break;
        }
    }

    //convert to array
    CharSequence[] strings = new CharSequence[stringList.size()];

    for (int i = 0; i < strings.length; i++) {
        strings[i] = stringList.get(i);
    }

    return TextUtils.concat(createBulletParagraph(stringList.toArray(new CharSequence[stringList.size()])));
}

From source file:android.support.design.widget.AppBarLayoutBaseTest.java

@CallSuper
protected void configureContent(final @LayoutRes int layoutResId, final @StringRes int titleResId) {
    onView(withId(R.id.coordinator_stub)).perform(inflateViewStub(layoutResId));

    mAppBar = (AppBarLayout) mCoordinatorLayout.findViewById(R.id.app_bar);
    mCollapsingToolbar = (CollapsingToolbarLayout) mAppBar.findViewById(R.id.collapsing_app_bar);
    mToolbar = (Toolbar) mAppBar.findViewById(R.id.toolbar);

    final AppCompatActivity activity = mActivityTestRule.getActivity();
    InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
        @Override/*from  w w  w  .  j a  v  a  2s  .c  o  m*/
        public void run() {
            activity.setSupportActionBar(mToolbar);
        }
    });

    final CharSequence activityTitle = activity.getString(titleResId);
    activity.setTitle(activityTitle);
    if (mCollapsingToolbar != null) {
        onView(withId(R.id.collapsing_app_bar)).perform(setTitle(activityTitle));
    }

    TextView dialog = (TextView) mCoordinatorLayout.findViewById(R.id.textview_dialogue);
    if (dialog != null) {
        onView(withId(R.id.textview_dialogue)).perform(setText(TextUtils.concat(Shakespeare.DIALOGUE)));
    }

    mDefaultElevationValue = mAppBar.getResources().getDimensionPixelSize(R.dimen.design_appbar_elevation);
}

From source file:com.lzh.yuanstrom.ui.GroupActivity.java

private void createGroup(String groupName, List<UploadDeviceBean> lists, String desc,
        final CreateGroupListener listener) {
    CharSequence url = TextUtils.concat(new CharSequence[] { ConstantsUtil.UrlUtil.BASE_USER_URL, "group" });
    JSONObject obj = new JSONObject();
    obj.put("groupName", groupName);
    obj.put("deviceList", lists);
    obj.put("desc", desc);
    hekrUserAction.postHekrData(url, obj.toString(), new HekrUserAction.GetHekrDataListener() {
        public void getSuccess(Object object) {
            listener.createSuccess(JSON.parseObject(object.toString(), GroupResult.class));
        }/*from  ww w  . ja  va 2s . co  m*/

        public void getFail(int errorCode) {
            listener.createFailed(errorCode);
        }
    });
}

From source file:org.totschnig.myexpenses.dialog.HelpDialogFragment.java

private CharSequence resolveStringOrArray(String resString) {
    int resId = resolveArray(resString);
    if (resId == 0) {
        resId = resolveString(resString);
        if (resId == 0) {
            return null;
        } else {//from  www. j  a v a2 s .  c om
            return Html.fromHtml(getStringSafe(resId), this, null);
        }
    } else {
        String[] components = getResources().getStringArray(resId);
        ArrayList<CharSequence> resolvedComponents = new ArrayList<>();
        for (int i = 0; i < components.length; i++) {
            if (shouldSkip(components[i])) {
                continue;
            }
            String component = getStringSafe(resolveString(components[i]));
            if (i < components.length - 1)
                component += " ";
            resolvedComponents.add(Html.fromHtml(component, this, null));
        }
        return TextUtils.concat(resolvedComponents.toArray(new CharSequence[resolvedComponents.size()]));
    }
}