This file contains hidden or 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 class APIException extends RuntimeException { | |
private int code; | |
private String msg; | |
public APIException(int code, String msg) { | |
this.code = code; | |
this.msg = msg; | |
} |
This file contains hidden or 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
// 关闭代理:adb shell settings put global http_proxy :0 | |
// 开启代理:adb shell settings put global http_proxy 192.168.1.50:8080 | |
// 封装函数,自动获取电脑ip,一键设置代理。adbproxy 8080/off | |
adbproxy(){ | |
if [[ -z $1 ]]; | |
then adb shell settings put global http_proxy "$(ifconfig | grep 192 | awk '{ print $2 ;}'):8080" | |
return | |
fi |
This file contains hidden or 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
import android.view.View; | |
public abstract class OneClickListener implements View.OnClickListener { | |
private long lastClickTime = 0; | |
private static long DIFF = 1000; | |
@Override | |
public void onClick(View v) { | |
if (!isFastDoubleClick()) { |
This file contains hidden or 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 static final long SECOND_MILLIS = 1000; | |
private static final long MINUTE_MILLIS = 60 * SECOND_MILLIS; | |
private static final long HOUR_MILLIS = 60 * MINUTE_MILLIS; | |
private static final long DAY_MILLIS = 24 * HOUR_MILLIS; | |
private static final long MONTH_MILLIS = 30 * DAY_MILLIS; | |
private static final long YEAR_MILLIS = 12 * MONTH_MILLIS; | |
public static String getTimeAgo(long time) { | |
if (time < 1000000000000L) { |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
@Override | |
public void onWindowFocusChanged(boolean hasFocus) { | |
super.onWindowFocusChanged(hasFocus); | |
if (hasFocus) { | |
if (Build.VERSION.SDK_INT < 16) { | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | |
WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
} else { | |
View decorView = getWindow().getDecorView(); | |
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; |
This file contains hidden or 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
__author__ = 'yava' | |
from PIL import Image | |
from PIL import ExifTags | |
import os | |
import datetime | |
def getImageTime(path): | |
try: |
This file contains hidden or 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.cleanmaster.photosync.widget; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.webkit.WebView; | |
import android.widget.ProgressBar; | |
public class ProgressWebView extends WebView { | |
private ProgressBar mProgressbar; |
This file contains hidden or 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
/* | |
* Copyright (c) 2013 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License | |
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
This file contains hidden or 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
import java.util.HashMap; | |
import android.content.ContentResolver; | |
import android.database.Cursor; | |
import android.net.Uri; | |
import android.os.Build; |
NewerOlder