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
@LuiguiBalarezo
LuiguiBalarezo / ToolbarNavigationUtil.java
Created April 30, 2018 03:16 — forked from NikolaDespotoski/ToolbarNavigationUtil.java
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
package com.aaplab.robird.util;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Handler;
import android.os.Looper;