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()));
}
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;
}
});
}
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());
}
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;
}
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);
}
Aggregations