pip install fake-useragent
from fake_useragent import UserAgent
ua = UserAgent()
ua.ie
监听布局的变化来计算输入法的高度,这种方式在Activity的配置中配置为"android:windowSoftInputMode="adjustResize""时没有问题,可以正确获取输入法的高度,因为布局此时确实会动态的调整。 但是当Activity配置为"android:windowSoftInputMode="adjustNothing""时,布局不会在输入法弹出时进行调整
KeyboardHeightObserver.java
/**
* The observer that will be notified when the height of
* the keyboard has changed
*/
public interface KeyboardHeightObserver {
package xmaihh.pay.zxing; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.PointF; | |
import android.view.Gravity; | |
import android.view.View; | |
import android.widget.TextView; |
/**
* 节气计算类
*/
public final class SolarTerm {
// 提供定位的年份
private static final int baseYear = 1901;
/**
* 计算公历年当月的中气,公历月从0起始!
Android中ImageView加载Base64图片其实非常简单,并不需要引入第三方库,方法如下:
import android.util.Base64;
String base64 = "data:image/png;base64, x.xx.x.xx..."
byte[] decodedString = Base64.decode(base64, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imageView.setImageBitmap(decodedByte);
public class SendEmailUtils {
/**
* 邮件发送程序
*
* 接收邮件的address
* @param subject
* 邮件主题
* @param content
private val HEX_CHARS = "0123456789ABCDEF".toCharArray() | |
fun ByteArray.toHex() : String{ | |
val result = StringBuffer() | |
forEach { | |
val octet = it.toInt() | |
val firstIndex = (octet and 0xF0).ushr(4) | |
val secondIndex = octet and 0x0F | |
result.append(HEX_CHARS[firstIndex]) |
#!/bin/bash | |
echo "*********************************" | |
echo "Close the progress by name!" | |
echo "usage: ./close_p.sh progressName" | |
echo "*********************************" | |
echo | |
#echo "PID of this script: $$" | |
#echo "PPID of this script: $PPID" |