Skip to content

Instantly share code, notes, and snippets.

Working from home


Working from home
View GitHub Profile
public static void setAlarm(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
SessionManager manager = new SessionManager(context);
int minutos = manager.getInt(context.getString(R.string.pref_key_actualizacion));
if (minutos == 0) {
minutos = 1;
View keyboard
* An OnGlobalLayoutListener interface that will adjust and resize a fullscreen scene's view when the soft keyboard is shown
* or hidden.
* <p>
* Provides custom layout behavior to the 'adjustResize' windowSoftInputMode for a View layout by enforcing an adjustable
* container with the option of a static footer view. The adjustable container is "adjusted" by increasing or decreasing the
* view's translationY property equal to the distance of the adjustable view that was obscured by the soft keyboard.
* <p>
* When adhering to this interface, be sure to set the relevant Activity's windowSoftInputMode to 'adjustResize' so that the
* onGlobalLayout method is called when the keyboard is shown and dismissed.
View NewHomeActivity.kt
val appName = getString(R.string.app_name)
val placeHolder = getString(R.string.message_sos_alert_placeholder, "displayName", appName, featureConfig.shortCutAppUrl)
SmsReceiver.sendSMS(this, "5543136233", "Monica Vargas Velasco necesita ayuda a través de SOSMex descarga la app,-99.0738685)")
View FeatureConfig.kt
package com.aboolean.sosmex.dependencies.feature
import com.aboolean.sosmex.utils.di.Country
import java.util.*
interface FeatureConfig {
val appId: String
val defaultLocale: Locale
val isCountryChooseEnabled: Boolean
oscarito9410 / Input filter alphanumeric android
Created Feb 26, 2020
Input filter alphanumeric android
View Input filter alphanumeric android
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (!Character.isLetterOrDigit(source.charAt(i))) {
return "";
return null;
public class MoneyEditText extends TextInputEditText {
public MoneyEditText(Context context) {
public MoneyEditText(Context context, AttributeSet attrs) {
super(context, attrs);
View Aes128.kt
package com.naat.codinaat.utils
import android.util.Base64
import android.util.Log
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
object Aes128 {
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
return data;
// Ref:
View cv.json
"basics": {
"name": "John Doe",
"label": "Programmer",
"picture": "",
"email": "",
"phone": "(912) 555-4321",
"website": "",
"summary": "A summary of John Doe...",
"profiles": [
oscarito9410 /
Created Jul 27, 2018 — forked from swankjesse/
This OkHttp application interceptor will replace the destination hostname in the request URL.
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
/** An interceptor that allows runtime changes to the URL hostname. */
public final class HostSelectionInterceptor implements Interceptor {
private volatile String host;