Skip to content

Instantly share code, notes, and snippets.

View CarolusX74's full-sized avatar
💭
Lerning

Carlos Javier Torres Pensa CarolusX74

💭
Lerning
View GitHub Profile
package ar.com.galicia.core.services;
import android.content.Intent;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@CarolusX74
CarolusX74 / fragment_ingreso_codigo_verificacion.xml
Created August 14, 2020 20:30
fragment_ingreso_codigo_verificacion.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/titulo_ingreso_codigo"
android:layout_width="296dp"
android:layout_height="wrap_content"
@CarolusX74
CarolusX74 / GOLoginActivity.java
Last active April 1, 2020 22:38
Errores custom para loguear en firebase
package com.galicia.galiciaoffice.login.view.activity;
public abstract class GOLoginActivity extends ServiceActivity<UserData, LoginController<UserData>> implements UserController.UserCompaniesListener {
private UserController userController;
private SessionContextController sessionContextController;
@Override
protected void onResume() {
super.onResume();
@CarolusX74
CarolusX74 / AuthTokenRefreshInterceptor.java
Last active March 15, 2022 04:42
How I automatically refresh OAuth "access token" with okhttp interceptors using "refresh token". All requests will wait until token refresh finished, and then will continue with the new token. - EN (By Carlos Torres)
package com.cjtp.android.api.interceptors;
import android.util.Log;
import com.google.gson.JsonObject;
import com.inviteez.android.core.Session;
import com.inviteez.android.utils.Constant;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
@CarolusX74
CarolusX74 / gist:10581d57864df4426241230c29d73a40
Created June 27, 2017 16:05
Refreshing OAuth token with okhttp interceptors.All requests will wait until token refresh finished, and then will continue with the new token.
package com.cjtp.android.api.interceptors;
import android.util.Log;
import com.google.gson.JsonObject;
import com.inviteez.android.core.Session;
import com.inviteez.android.utils.Constant;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
@CarolusX74
CarolusX74 / gist:afaa6ba4dcaac26a4ea7ad9eea32437c
Created June 27, 2017 16:05
Refreshing OAuth token with okhttp interceptors.All requests will wait until token refresh finished, and then will continue with the new token.
package com.cjtp.android.api.interceptors;
import android.util.Log;
import com.google.gson.JsonObject;
import com.inviteez.android.core.Session;
import com.inviteez.android.utils.Constant;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
@CarolusX74
CarolusX74 / Interceptor.java
Created June 26, 2017 23:03 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@CarolusX74
CarolusX74 / MyRecyclerMultiListener.java
Created June 25, 2017 08:41
Permite implementar onClickListener y LongClickListener en un Recycler View - ES
package com.cjtp.android.utils;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
/**
@CarolusX74
CarolusX74 / Git Aliases - ES.txt
Last active April 7, 2021 18:14
Mi resumen para la creación y manejo de alias en la consola de Git CVS
Los alias son abreviaciones de uno o varios comandos de git, incluso lineas de comandos.
Con ello se ahorra tiempo y se reduce la posibilidad de equivocarse al escribir largas líneas en la consola de Git.
EJEMPLO PARA CONFIGURAR ALIAS:
$ git config --global alias.estatus status
$ git config --global alias.revisar checkout
$ git config --global alias.descartar "checkout -- ."
USO DE LOS ALIAS:
@CarolusX74
CarolusX74 / SocketFragment.java
Created March 31, 2017 12:50
Implementando ConnectionModule
package com.cjtp.apps.multitest.ui.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;