Skip to content

Instantly share code, notes, and snippets.

View venshine's full-sized avatar
:octocat:
I may be slow to respond.

venshine

:octocat:
I may be slow to respond.
View GitHub Profile
@dlew
dlew / script.sh
Created November 9, 2018 16:36
Simple AndroidX Migration Script
#!/usr/bin/env bash
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very
# well, so I wrote my own script to do the simple job of converting package names.
#
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
#
# It'll run faster on a clean build because then there are fewer files to scan over.
#
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`.
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
@tianbin-dev
tianbin-dev / TagSpan.java
Last active July 1, 2019 07:48
在TextView控件中添加背景为圆角矩形的Tag
public class TagSpan extends ReplacementSpan {
// span width
private int mSize;
// text and background wireframe color
private int mColor;
// tag text size
private int mTextSizePx;
// background radius
private int mRadiusPx;
@nikhiljha
nikhiljha / AddCookiesInterceptor.java
Created July 29, 2016 04:35
Retrofit2/OkHttp3 Cookies (Drag and Drop, One Size Fits 99%)
// Original written by tsuharesu
// Adapted to create a "drop it in and watch it work" approach by Nikhil Jha.
// Just add your package statement and drop it in the folder with all your other classes.
import android.content.Context;
import android.preference.PreferenceManager;
import android.util.Log;
import java.io.IOException;
import java.util.HashSet;
@venshine
venshine / Android Studio .gitignore
Last active July 19, 2016 07:43
A .gitignore file for Android Studio
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
@venshine
venshine / bintray.gradle
Created April 27, 2016 09:54
bintray.gradle
https://raw.githubusercontent.com/venshine/gradle-bintray-upload/master/bintray.gradle
@tsuharesu
tsuharesu / AddCookiesInterceptor.java
Last active April 11, 2024 12:37
Handle Cookies easily with Retrofit/OkHttp
/**
* This interceptor put all the Cookies in Preferences in the Request.
* Your implementation on how to get the Preferences MAY VARY.
* <p>
* Created by tsuharesu on 4/1/15.
*/
public class AddCookiesInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
@treesouth
treesouth / get_all_app_info.java
Created February 14, 2015 07:44
android获取系统内所有app的信息
import java.util.ArrayList;  
import java.util.Collections;  
import java.util.List;  
  
import android.content.Context;  
import android.content.pm.ApplicationInfo;  
import android.content.pm.PackageManager;  
import android.util.Log;  
  
  
@CreatorB
CreatorB / OnBackPressed.java
Last active September 17, 2019 13:16
How to Exit App When Press Back Button - Android
///////////////////////////////BACK-BUTTON-PRESSED/////////////////////////////
//////////////////////////////////creatorb////////////////////////////////////
//You can choose one method ;)
//PopUp
@Override
public void onBackPressed() {
new AlertDialog.Builder(this)
.setTitle("Really Exit?")
@Frank-Zhu
Frank-Zhu / HttpClientSslHelper.java
Last active April 18, 2023 08:55
Android HTTPS SSL双向验证
package com.ecloud.ssldemo;
import android.content.Context;
import android.util.Log;
import com.squareup.okhttp.OkHttpClient;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.scheme.Scheme;