Search in sources :

Example 66 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project FanLayoutManager by Cleveroad.

the class FullInfoTabFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    toolbar.setTitle(sportCardModel.getSportTitle());
    toolbar.setNavigationIcon(R.drawable.ic_back);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            getActivity().onBackPressed();
        }
    });
    toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), sportCardModel.getBackgroundColorResId()));
    ivPhoto.setImageResource(sportCardModel.getImageResId());
    List<AthleticModel> items = new ArrayList<>();
    for (int i = 10; i > 0; i--) {
        int points = i * 100;
        items.add(new AthleticModel("Vae, mirabilis tumultumque", Country.ITALY, --points));
        items.add(new AthleticModel("Cobaltums favere", Country.USA, --points));
        items.add(new AthleticModel("Stella de peritus lixa", Country.ROK, --points));
    }
    ScoreAdapter scoreAdapter = new ScoreAdapter();
    scoreAdapter.addItems(items);
    rvAthletics.setAdapter(scoreAdapter);
    rvAthletics.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
    rvAthletics.setItemAnimator(new DefaultItemAnimator());
    rvAthletics.addItemDecoration(new DividerItemDecoration(getContext()));
}
Also used : AthleticModel(com.cleveroad.testrecycler.models.AthleticModel) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 67 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project Hummingbird-for-Android by xiprox.

the class AnimeSearchActivity method onCreate.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fade_in_quick, R.anim.nothing);
    setContentView(R.layout.activity_anime_search);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        getWindow().setStatusBarColor(getResources().getColor(R.color.apptheme_white_status_bar));
    api = new HummingbirdApi(this);
    mResultsRecycler = (RecyclerView) findViewById(R.id.search_results);
    mErrorText = (TextView) findViewById(R.id.search_error_text);
    mFlipper = (ViewFlipper) findViewById(R.id.search_flipper);
    mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
    mLayoutManager = new LinearLayoutManager(this);
    mResultsRecycler.setLayoutManager(mLayoutManager);
    mResultsRecycler.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    SearchView searchView = (SearchView) findViewById(R.id.search_view);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            searchFromScratch(query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String query) {
            searchInCurrentDataSet(query);
            return false;
        }
    });
}
Also used : SearchView(android.support.v7.widget.SearchView) HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TargetApi(android.annotation.TargetApi)

Example 68 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project UltimateAndroid by cymcsg.

the class MyAdapter method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recycler_view_sample);
    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    // use this setting to improve performance if you know that changes
    // in content do not change the layout size of the RecyclerView
    mRecyclerView.setHasFixedSize(true);
    // use a linear layout manager
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    // specify an adapter (see also next example)
    String[] mDataset = new String[4];
    for (int i = 0; i < 4; i++) {
        mDataset[i] = i + "hh";
    }
    mAdapter = new MyAdapter(mDataset);
    mRecyclerView.setAdapter(mAdapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    layoutManager.scrollToPosition(0);
    mRecyclerView.setLayoutManager(layoutManager);
    //        RecyclerView.ItemDecoration itemDecoration =
    //        new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST);
    //        mRecyclerView.addItemDecoration(itemDecoration);
    // this is the default;
    // this call is actually only necessary with custom ItemAnimators
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
// onClickDetection is done in this Activity's OnItemTouchListener
// with the help of a GestureDetector;
// Tip by Ian Lake on G+ in a comment to this post:
// https://plus.google.com/+LucasRocha/posts/37U8GWtYxDE
//        mRecyclerView.addOnItemTouchListener(this);
//        gesturedetector =
//        new GestureDetectorCompat(this, new RecyclerViewDemoOnGestureListener());
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 69 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project saga-android by AnandChowdhary.

the class LibraryFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_library, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(true);
    final SwipeRefreshLayout refresh = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeRefreshLayout);
    refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            songList.clear();
            getSongList();
            mRecyclerView.getAdapter().notifyDataSetChanged();
            refresh.setRefreshing(false);
        }
    });
    mAdapter = new LibraryAdapter();
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
Also used : DividerItemDecoration(get.saga.ui.DividerItemDecoration) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 70 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project saga-android by AnandChowdhary.

the class SearchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    Toolbar toolbar = (Toolbar) findViewById(R.id.search_toolbar);
    final EditText search = (EditText) findViewById(R.id.et_input);
    mSearchProgress = (ProgressBar) findViewById(R.id.search_progress);
    mDownloadProgress = (ProgressBar) findViewById(R.id.download_progress);
    mClearButton = (ImageButton) findViewById(R.id.btn_cross);
    mRecyclerView = (RecyclerView) findViewById(R.id.search_results);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(layoutManager);
    //        mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    mQueue = VolleySingleton.getInstance(this).getRequestQueue();
    mImageLoader = VolleySingleton.getInstance(this).getImageLoader();
    mTracker = ((ApplicationWrapper) getApplication()).getTracker(ApplicationWrapper.TrackerName.APP_TRACKER);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    Intent i = getIntent();
    String query = i.getStringExtra("query");
    search.setText(query);
    search.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_DONE) {
                if (textView.length() > 0) {
                    mClearButton.setVisibility(View.GONE);
                    mSearchProgress.setVisibility(View.VISIBLE);
                    getSearchResults(textView.getText().toString());
                } else {
                    Toast.makeText(getApplicationContext(), getString(R.string.enter_song), Toast.LENGTH_SHORT).show();
                }
                return true;
            }
            return false;
        }
    });
    mClearButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            search.setText("");
            mClearButton.setVisibility(View.GONE);
        }
    });
    search.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.length() > 0 && mClearButton.getVisibility() != View.VISIBLE) {
                mClearButton.setVisibility(View.VISIBLE);
            }
        }
    });
    getSearchResults(query);
}
Also used : EditText(android.widget.EditText) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) NetworkImageView(com.android.volley.toolbox.NetworkImageView) View(android.view.View) CardView(android.support.v7.widget.CardView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)73 RecyclerView (android.support.v7.widget.RecyclerView)42 View (android.view.View)36 TextView (android.widget.TextView)23 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)19 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)15 ImageView (android.widget.ImageView)14 DividerItemDecoration (com.wm.remusic.widget.DividerItemDecoration)9 Drawable (android.graphics.drawable.Drawable)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 DividerItemDecoration (io.hefuyi.listener.widget.DividerItemDecoration)7 Nullable (android.support.annotation.Nullable)6 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)6 Context (android.content.Context)5 Toolbar (android.support.v7.widget.Toolbar)5 Intent (android.content.Intent)4 ActionBar (android.support.v7.app.ActionBar)4 DividerItemDecoration (com.lzy.demo.base.DividerItemDecoration)4 DividerItemDecoration (org.michenux.drodrolib.ui.recyclerview.DividerItemDecoration)4 TargetApi (android.annotation.TargetApi)3