Skip to content

Instantly share code, notes, and snippets.

View LuiguiBalarezo's full-sized avatar
🏠
Working from home

ScriptGO LuiguiBalarezo

🏠
Working from home
View GitHub Profile
@riyazMuhammad
riyazMuhammad / CustomItemClickListener.java
Last active December 30, 2020 15:10
Easy Implementation of RecyclerView custom onItemClickListener
public interface CustomItemClickListener {
public void onItemClick(View v, int position);
}
@NikolaDespotoski
NikolaDespotoski / ToolbarNavigationUtil.java
Last active October 7, 2020 12:03
Util for finding components of Toolbar such as navigation icon view
public class ToolbarNavigationUtil{
public static View getToolbarNavigationIcon(Toolbar toolbar){
//check if contentDescription previously was set
boolean hadContentDescription = TextUtils.isEmpty(toolbar.getNavigationContentDescription());
String contentDescription = !hadContentDescription ? toolbar.getNavigationContentDescription() : "navigationIcon";
toolbar.setNavigationContentDescription(contentDescription);
ArrayList<View> potentialViews = new ArrayList<View>();
//find the view based on it's content description, set programatically or with android:contentDescription
toolbar.findViewsWithText(potentialViews,contentDescription, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
//Nav icon is always instantiated at this point because calling setNavigationContentDescription ensures its existence