Skip to content

Instantly share code, notes, and snippets.

@MachFour
MachFour / CustomAutoCompleteTextView.kt
Last active April 10, 2024 19:41
A (Material) AutoCompleteTextView that automatically hides the keyboard when scrolling the dropdown list. Uses reflection and is very hacky.
package com.machfour.example.app
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.util.Log
import android.view.inputmethod.InputMethodManager
import android.widget.AbsListView
import android.widget.AutoCompleteTextView
import android.widget.ListPopupWindow
/*
* Let function f() be the DES confusion function, without the bit
* permutation PC. It has two inputs (32-bit value x, which is the
* right-half of the current DES block, and 48-bit subkey k) and
* a 32-bit output.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@LeonardoCardoso
LeonardoCardoso / ScrollTextView.java
Last active January 21, 2022 07:37
TextView with continuous scroll marquee animation no matter where the Activity focus is.
public class ScrollTextView extends TextView {
public ScrollTextView(Context context) {
super(context);
}
public ScrollTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@ar
ar / Parity.java
Created January 23, 2011 00:42
Adjust parity
public class Util {
/**
* DES Keys use the LSB as the odd parity bit. This method can
* be used enforce correct parity.
*
* @param bytes the byte array to set the odd parity on.
*/
public static void adjustDESParity (byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {