Skip to content

Instantly share code, notes, and snippets.

View cdmunoz's full-sized avatar

Carlos Daniel cdmunoz

View GitHub Profile
@cdmunoz
cdmunoz / EditTextWithItemHint.java
Created October 13, 2018 23:18
EditTextWithItemHint: Verifies if a text matches the text of an EditText hint
public static Matcher<View> editTextwithItemHint(final String matcherText) {
return new BoundedMatcher<View, EditText>(EditText.class) {
@Override
public void describeTo(Description description) {
description.appendText("with item hint: " + matcherText);
}
@Override
protected boolean matchesSafely(EditText editTextField) {
@cdmunoz
cdmunoz / TextViewColorMatcher.java
Created October 13, 2018 23:19
TextViewColorMatcher: Verifies that a TextView has an specific color
public static Matcher<View> textViewTextColorMatcher(final int matcherColor) {
return new BoundedMatcher<View, TextView>(TextView.class) {
@Override
public void describeTo(Description description) {
description.appendText("with text color: " + matcherColor);
}
@Override
protected boolean matchesSafely(TextView textView) {
return matcherColor == textView.getCurrentTextColor();
}
FirebaseInstanceId.getInstance().getInstanceId()
.addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "getInstanceId failed", task.getException());
return;
}
// Get new Instance ID token
public class CrashlyticsUtils {
public static void dropAuctionBreadCrumb(String className, String methodName, Long auctionId, String generalData) {
String breadCrumb = String.format("%s - %s - %s - %s", className, methodName, String.valueOf(auctionId), generalData);
Crashlytics.log(breadCrumb);
}
}
CrashlyticsUtils.dropAuctionBreadCrumb(TAG, "intercept", 0L, "Request: "+ request.url().toString());
<android.support.design.widget.BottomNavigationView
android:id="@+id/main_bottom_navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="@color/bottombar_background"
android:theme="@style/Widget.BottomNavigationView"
app:itemBackground="@color/bottombar_background"
@cdmunoz
cdmunoz / activity_main.xml
Created January 21, 2019 00:39
Bottom Navigation View with no shift mode using labelVisibilityMode
<android.support.design.widget.BottomNavigationView
android:id="@+id/main_bottom_navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="@color/bottombar_background"
android:theme="@style/Widget.BottomNavigationView"
app:itemBackground="@color/bottombar_background"
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/bottomnav_home"
android:icon="@drawable/bottomnav_home"
android:title="@string/title_home" />
<item
android:id="@+id/bottomnav_my_stuff"
@cdmunoz
cdmunoz / cdmi_android.md
Last active February 12, 2020 22:13
Carlos Daniel Muñoz and Android Community

Community Impact: Carlos Daniel Munoz Idarraga

Summary

Impact Description Total
Direct Impact Meetups, confs and talks +1.1k
Indirect Impact Articles, Stack overflow +135k
People Trained Workshops +60
public class AppLifecycleObserver implements LifecycleObserver {
public static final String TAG = AppLifecycleObserver.class.getName();
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onEnterForeground() {
//run the code we need
}
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)