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
var path = require("path"); | |
var currentDate = new Date(); | |
var year = currentDate.getFullYear(); | |
var month = currentDate.getMonth() + 1; | |
month = month < 10 ? '0' + month : month; | |
var day = currentDate.getDate(); | |
day = day < 10 ? '0' + day : day; | |
var date = year + month + day; | |
console.log(date); |
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
// hacking mac | |
public static String getMacAddress(Context context) { | |
String macAddress = null; | |
try { | |
String wifiInterfaceName = "wlan0"; | |
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); | |
while (interfaces.hasMoreElements()) { | |
NetworkInterface iF = interfaces.nextElement(); | |
if (iF.getName().equalsIgnoreCase(wifiInterfaceName)) { | |
byte[] addr = iF.getHardwareAddress(); |
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
/** | |
* 获取当前连接到的WiFi名称 | |
* | |
* 注意:当“APILevel >=17”时,返回的字符串会多一对双引号 | |
* https://code.google.com/p/android/issues/detail?id=40144 | |
* http://stackoverflow.com/questions/13563032/jelly-bean-issue-wifimanager-getconnectioninfo-getssid-extra | |
*/ | |
public String getWifiSsid() { | |
String ssid = null; | |
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
/** 手动到项目下的”./idea"文件夹中配置 */ | |
<component name="ChangeListManager"> | |
... | |
<ignored path="android.iws" /> | |
<ignored path=".idea/workspace.xml" /> | |
<ignored mask="*.iml" /> | |
<ignored path="gradle/" /> | |
<ignored path="build/" /> | |
<ignored path=".idea/" /> | |
<ignored path="YourModuleA/build/" /> |
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
/** | |
* 检查图片是否损坏:通过指定inJustDecodeBounds = true来得到解析图片以后的Options | |
* | |
* @param filePath | |
* @return | |
*/ | |
public static boolean checkImgDamage(String filePath) { | |
BitmapFactory.Options options = null; | |
if (options == null) { | |
options = new BitmapFactory.Options(); |
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
//1. 先新建一个圆角矩形,并包装成一个ShapeDrawable | |
ShapeDrawable backgroundDrawable = new ShapeDrawable(new RoundRectShape(new float[] {10, 10, 10, 10, 10, 10, 10, 10}, | |
null, null)); | |
//2. 设置背景颜色 | |
backgroundDrawable.getPaint().setColor(Color.parseColor("#1fbaf3")); | |
//3. 设置透明度 | |
backgroundDrawable.setsetAlpha(100); |
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.tiktokview.utils; | |
import android.content.Context; | |
/** | |
* dp,sp和px互转工具类 | |
* Created by noughtchen on 2015/12/2. | |
*/ | |
public class PxUtils { |