This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.quinn.xmpp.ui.widget; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.drawable.Drawable; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import com.quinn.xmpp.R; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cc.aa; | |
import android.os.Environment; | |
import android.view.MotionEvent; | |
import android.view.View; | |
public class UnderstandDispatchTouchEvent { | |
/** | |
* dispatchTouchEvent()源码学习及其注释 | |
* 常说事件传递中的流程是:dispatchTouchEvent->onInterceptTouchEvent->onTouchEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 冒泡排序 | |
* | |
* @param a | |
*/ | |
public static void bubbleSort(int[] a) { | |
int temp; | |
for (int i = 0; i < a.length; i++) | |
for (int j = 0; j < a.length - i - 1; j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder() | |
//.setUsernameAndPassword("peter", "123456") | |
.setServiceName("quinndemacbook-pro.local") | |
.setDebuggerEnabled(true) | |
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled) | |
.setHost("10.180.145.92") | |
.setPort(5222) | |
.build(); | |
conn = new XMPPTCPConnection(config); | |
new Thread(new Runnable() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
adb shell screencap -p /sdcard/test.png | |
#adb pull /sdcard/test.png ~/Desktop/test.png | |
dir=~/Desktop/ | |
curr=`date "+%Y-%m-%d %H:%M:%S"` | |
name=${dir}"screenshot"${curr}".png" | |
echo "${name}" | |
adb pull /sdcard/test.png "$name" | |
adb shell rm /sdcard/test.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
adb shell screenrecord --time-limit 12 /sdcard/demo.mp4 | |
dir=~/Desktop/ | |
curr=`date "+%Y-%m-%d %H:%M:%S"` | |
name=${dir}"screenrecord"${curr}".mp4" | |
echo "${name}" | |
adb pull /sdcard/demo.mp4 "$name" | |
adb shell rm /sdcard/demo.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private X509TrustManager findTrustManagerFromSocketFactory(SSLContext mCtx) { | |
try { | |
//SSLContext --> contextSpi(OpenSSLContextImpl) --> sslParameters(SSLParametersImpl) --> x509TrustManager(X509TrustManager) | |
// find OpenSSLContextImpl | |
Field contextSpiField = mCtx.getClass().getDeclaredField("contextSpi"); | |
contextSpiField.setAccessible(true); | |
Object openSSLContextImplObj = contextSpiField.get(mCtx); | |
// find SSLParametersImpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 18(samsung) 19 (oppo) sslSocketFactory -- sslParameters -- trustManager | |
// 22(oppo) 24(hw) 27(nexus) sslSocketFactory -- sslParameters -- x509TrustManager | |
public TrustManager getTrustManagerFromSSLSocketFactory(SSLSocketFactory sslSocketFactory) { | |
try { | |
TrustManager result = null; | |
Field fieldSslPm = sslSocketFactory.getClass().getDeclaredField("sslParameters"); | |
fieldSslPm.setAccessible(true); | |
Object objSSLParameters = fieldSslPm.get(sslSocketFactory); | |
if(Build.VERSION.SDK_INT > 19) { | |
Field fieldTmg = objSSLParameters.getClass().getDeclaredField("x509TrustManager"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取图片大小 | |
*/ | |
public static Dimension getDimensionFromAnchor(Picture picture) { | |
ClientAnchor anchor = picture.getClientAnchor(); | |
boolean isHSSF = (anchor instanceof HSSFClientAnchor); | |
Sheet sheet = picture.getSheet(); | |
double w = 0; | |
int col2 = anchor.getCol1(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package be.brol | |
import android.os.Binder | |
import android.os.Bundle | |
import android.support.v4.app.BundleCompat | |
import android.support.v4.app.Fragment | |
/** | |
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate | |
* Just write the property in newInstance and read it like any other property after the fragment has been created |
OlderNewer