Skip to content

Instantly share code, notes, and snippets.

@zty5678
zty5678 / LogUtil.java
Last active July 15, 2016 10:15
可以显示行号的Logcat工具类
import android.util.Log;
public class LogUtil {
static boolean isDebug =BuildConfig.DEBUG;
static boolean SHOW_LINE_NUMBER_IN_LOG = isDebug;// 是否在log中显示行号
static final String TAG = "log";
@zty5678
zty5678 / OomExceptionHandler.java
Created January 11, 2016 13:43 — forked from pyricau/OomExceptionHandler.java
Dump the heap on OutOfMemoryError crashes in your debug builds.
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@zty5678
zty5678 / CurlLoggingInterceptor.java
Created January 19, 2016 07:36 — forked from jgilfelt/CurlLoggingInterceptor.java
An OkHttp interceptor that logs requests as curl shell commands
/*
* Copyright (C) 2016 Jeff Gilfelt.
*
* 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
@zty5678
zty5678 / RenameAndCopyDemo.java
Created April 10, 2016 16:20
将@2x.png这样的文件重命名并复制到drawable-xxhdpi里
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
package test.test_couponview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import butterknife.Bind;
import butterknife.ButterKnife;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* Adds interior dividers to a RecyclerView with a GridLayoutManager.
*/
public class GridDividerItemDecoration extends RecyclerView.ItemDecoration {
@zty5678
zty5678 / FamiliarDefaultItemDecoration.java
Created April 15, 2017 14:18
FamiliarRecyclerView, 使用LinearLayoutManager.Vertical时, 默认第一项是没有divider的. 修改了两处代码, 给第一项的顶部加了divider.
package cn.iwgang.familiarrecyclerview;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
@zty5678
zty5678 / nested_scroll_view.dart
Created June 2, 2019 11:25 — forked from collinjackson/nested_scroll_view.dart
nestedscrollview example
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() {
runApp(new TestApp());
}
adb shell am broadcast -a com.android.systemui.demo -e command exit
@zty5678
zty5678 / LogUtils.dart
Last active June 8, 2023 17:28
flutter LOGD 打印行号
import 'package:flutter/foundation.dart';
void LOGD(Object message, StackTrace trace) {
try {
if (kDebugMode) {
CustomTrace programInfo = CustomTrace(trace);
// print("[(${programInfo.fileName}:${programInfo.lineNumber})]$message");
print("[(${programInfo.methodFullInfo})]$message");
}
} catch (e) {