Skip to content

Instantly share code, notes, and snippets.

Avatar

Suleiman Ali Shakir Suleiman19

View GitHub Profile
@Suleiman19
Suleiman19 / Spinner Setup (Activity)
Last active Oct 11, 2022
Theme Aware Material Design Spinner
View Spinner Setup (Activity)
Spinner spinner = (Spinner) findViewById(R.id.main_spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(),
R.layout.spinner_list_style,
getResources().getStringArray(R.array.countries));
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
@Suleiman19
Suleiman19 / RecyclerView Click Listener Util
Last active Feb 1, 2019
Small Util class to set a click listener for RecyclerViews
View RecyclerView Click Listener Util
public class CustomRecyclerClickListener implements RecyclerView.OnItemTouchListener {
private OnItemClickListener mListener;
public interface OnItemClickListener {
public void onItemClick(View view, int position);
}
GestureDetector mGestureDetector;
public CustomRecyclerClickListener(Context context, OnItemClickListener listener) {