Skip to content

Instantly share code, notes, and snippets.

View cdmunoz's full-sized avatar

Carlos Daniel cdmunoz

View GitHub Profile
package hakerrank
import java.io.*
import java.math.*
import java.security.*
import java.text.*
import java.util.*
import java.util.concurrent.*
import java.util.function.*
import java.util.regex.*
public class MyApp extends MultiDexApplication {
private static final String TAG = MyApp.class.getName();
@Override
public void onCreate() {
super.onCreate();
AppLifecycleObserver appLifecycleObserver = new AppLifecycleObserver();
ProcessLifecycleOwner.get().getLifecycle().addObserver(appLifecycleObserver);
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)
@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
<?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 / 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"
<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"
CrashlyticsUtils.dropAuctionBreadCrumb(TAG, "intercept", 0L, "Request: "+ request.url().toString());
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);
}
}
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