Search in sources :

Example 6 with VectorDrawable

use of carbon.drawable.VectorDrawable in project Carbon by ZieIony.

the class IconTextListItemActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listcomponent);
    Samples.initToolbar(this, getString(R.string.iconTextListItemActivity_title));
    RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
    recycler.setLayoutManager(new LinearLayoutManager(this));
    RowListAdapter adapter = new RowListAdapter<>(DefaultIconTextItem.class, IconTextRow::new);
    adapter.addFactory(DefaultIconSearchItem.class, parent -> new IconSearchRow(parent, new ArraySearchDataProvider(new String[] {}), filterResults -> {
    }));
    recycler.setAdapter(adapter);
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(new ColorDrawable(Carbon.getThemeColor(this, R.attr.carbon_dividerColor)), getResources().getDimensionPixelSize(R.dimen.carbon_1dip));
    dividerItemDecoration.setDrawRules(position -> position == 0);
    recycler.addItemDecoration(dividerItemDecoration);
    VectorDrawable drawable = new VectorDrawable(getResources(), R.raw.ic_face_24px);
    adapter.setItems(Arrays.asList(new DefaultIconSearchItem(this), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text"), new DefaultIconTextItem(drawable, "text")));
}
Also used : Arrays(java.util.Arrays) Bundle(android.os.Bundle) IconSearchRow(carbon.component.IconSearchRow) DividerItemDecoration(carbon.recycler.DividerItemDecoration) IconTextRow(carbon.component.IconTextRow) ColorDrawable(android.graphics.drawable.ColorDrawable) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultIconTextItem(carbon.component.DefaultIconTextItem) DefaultIconSearchItem(carbon.component.DefaultIconSearchItem) Carbon(carbon.Carbon) RecyclerView(carbon.widget.RecyclerView) SamplesActivity(tk.zielony.carbonsamples.SamplesActivity) VectorDrawable(carbon.drawable.VectorDrawable) R(tk.zielony.carbonsamples.R) RowListAdapter(carbon.recycler.RowListAdapter) Nullable(android.support.annotation.Nullable) ArraySearchDataProvider(carbon.widget.ArraySearchDataProvider) Samples(tk.zielony.carbonsamples.Samples) DefaultIconSearchItem(carbon.component.DefaultIconSearchItem) ColorDrawable(android.graphics.drawable.ColorDrawable) IconTextRow(carbon.component.IconTextRow) RowListAdapter(carbon.recycler.RowListAdapter) RecyclerView(carbon.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(carbon.recycler.DividerItemDecoration) DefaultIconTextItem(carbon.component.DefaultIconTextItem) IconSearchRow(carbon.component.IconSearchRow) VectorDrawable(carbon.drawable.VectorDrawable) ArraySearchDataProvider(carbon.widget.ArraySearchDataProvider)

Example 7 with VectorDrawable

use of carbon.drawable.VectorDrawable in project Carbon by ZieIony.

the class RegisterActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_listcomponent);
    Samples.initToolbar(this, getString(R.string.registerActivity_title));
    RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
    RowListAdapter adapter = new RowListAdapter<>(DefaultIconEditTextItem.class, IconEditTextRow.FACTORY);
    adapter.addFactory(DividerItem.class, DividerRow.FACTORY);
    adapter.addFactory(DefaultIconPasswordItem.class, IconPasswordRow.FACTORY);
    adapter.addFactory(DefaultIconDropDownItem.class, IconDropDownRow.FACTORY);
    recycler.setAdapter(adapter);
    adapter.setItems(Arrays.asList(new DefaultIconEditTextItem(new VectorDrawable(getResources(), R.raw.profile), "login", ""), new DefaultIconEditTextItem(new VectorDrawable(getResources(), R.raw.email), "email", ""), new DefaultIconPasswordItem(new VectorDrawable(getResources(), R.raw.lock), "password", ""), new DefaultIconPasswordItem(null, "retype password", ""), new DefaultIconDropDownItem<>(new VectorDrawable(getResources(), R.raw.gender), "sex", new String[] { "Male", "Female" }, "Male")));
}
Also used : RowListAdapter(carbon.recycler.RowListAdapter) RecyclerView(carbon.widget.RecyclerView) DefaultIconPasswordItem(carbon.component.DefaultIconPasswordItem) DefaultIconDropDownItem(carbon.component.DefaultIconDropDownItem) VectorDrawable(carbon.drawable.VectorDrawable) DefaultIconEditTextItem(carbon.component.DefaultIconEditTextItem)

Aggregations

VectorDrawable (carbon.drawable.VectorDrawable)7 TypedArray (android.content.res.TypedArray)2 TypedValue (android.util.TypedValue)2 RowListAdapter (carbon.recycler.RowListAdapter)2 RecyclerView (carbon.widget.RecyclerView)2 Paint (android.graphics.Paint)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 ContextThemeWrapper (android.view.ContextThemeWrapper)1 Carbon (carbon.Carbon)1 DefaultIconDropDownItem (carbon.component.DefaultIconDropDownItem)1 DefaultIconEditTextItem (carbon.component.DefaultIconEditTextItem)1 DefaultIconPasswordItem (carbon.component.DefaultIconPasswordItem)1 DefaultIconSearchItem (carbon.component.DefaultIconSearchItem)1 DefaultIconTextItem (carbon.component.DefaultIconTextItem)1 IconSearchRow (carbon.component.IconSearchRow)1 IconTextRow (carbon.component.IconTextRow)1 DropDownMenu (carbon.internal.DropDownMenu)1