自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(168)
  • 资源 (1)
  • 收藏
  • 关注

原创 日志工具

平时用到日志的地方不多,这里举两个例子。https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor方便打印请求日志。 OkHttpClient.Builder() .addInterceptor( HttpLoggingInt...

2020-03-22 19:19:19 213

原创 记录

class OneAct : BaseAct(), MovieView, TrainView { // ===== override ===== override val layoutResId = R.layout.act_one override fun injectDependencies() { movieRepository = Compo

2017-10-06 15:06:08 310

原创 RxJava2

111

2017-10-05 17:18:29 486

原创 RxJava 1

111

2017-10-05 12:53:35 311

原创 Dagger & Konlin

111

2017-10-03 09:39:27 392

原创 Android Clean 架构 3

上一步是使用了 Dagger2,这一步使用 RxJava,为啥不用2,还没学。RxJava 我刚看了一点,大致就是查询数据,回调,处理数据,可能的分发,最终 subscriber 中处理。这里就是把 Presenter 作为最终响应的地方,其他层都是回调再回调。RxJava 的回调比自己用 Callback 实现的回调优雅些。Data 层

2017-01-12 19:48:28 458

原创 Android Clean 架构

把内容精简了下,并且初步使用了 Dagger2。先看 Thread 部分:// 线程池/** * The interface Thread executor. */public interface ThreadExecutor { /** * Execute. * * @param runnable the runnable */

2017-01-08 15:21:11 1452

原创 Android Clean 架构

https://github.com/android10/Android-CleanArchitecture这个项目很多的代码,实现了很简单的列表跳转功能。首先是 Data 层,/** * 一个简单的实体类 */public class User { private String id; private String name; pu

2017-01-07 09:19:06 552

原创 使用 ViewDragHelper 实现左右侧滑

1

2016-04-24 09:36:33 731

原创 学学下拉刷新

推荐http://android-ultra-ptr.liaohuqiu.net/cn/因为用的都是 LinearLayout 和 FrameLayout,所以都习惯于认为 Parent View 在位置上应该包含 Child View。但这里的 PullLayout 不是。public class PullLayout extends ViewGrou

2016-04-11 11:05:36 476

原创 ImageView 的 src 属性

一般都是在 ImageView 中展示图片:

2016-04-09 15:59:59 2008

原创 从加载图片OOM说起

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.big); Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.big); Bitmap bitmap3 = BitmapFact

2016-04-09 13:07:38 1437

原创 跑马灯效果

一句话概括,平移再画一次。

2016-04-07 23:01:34 747

原创 ColorProgress

类似百度手机助手的下载进度条。

2016-04-06 14:07:56 515

原创 ValueAnimator

#

2016-04-05 22:35:47 546

原创 IOSRadioGroup

TextView Button RadioButtonpublic class Button extends TextView { public Button(Context context) { this(context, null); } public Button(Context context, AttributeSet attrs) {

2016-04-03 17:16:01 1089

原创 FlatButton

关键就是实现平滑地改变上层 chlid drawable 的 inset。平滑,又是 Scroller 那一套,重画后要求重画自己。今天我从书上看到,重画间隔是 16 毫秒。TransationDrawable 是改变透明度,Scroller 是改变 mScrollX,这里是要改变 inset。本质是一样的,利用重画间隔,不断重画,达到平滑的效果。

2016-04-03 13:02:58 1602

原创 FlatUI

https://github.com/eluleci/FlatUI

2016-04-03 09:48:08 936

原创 ColorEditText

public class ColorEditText extends EditText { public ColorEditText(Context context) { super(context); } // public ColorEditText(Context context, AttributeSet attrs) {

2016-04-03 09:45:56 531

原创 FlycoRoundView

用的知识点是 StateListDrawable 和 ColorStateList。这里使用了一个 Delegete (代理),使得无论是父类是谁,都能很方便地实现功能。 public RoundTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs,

2016-04-03 08:54:33 1008

原创 FadingColorButton

之前实现了 ColorFulButton ,但又见到过类似这种渐变的按钮,又正好学到了 TransitionDrawable, 所以也实现了下。实现思路想到两种,添加 ToucnListener 侦听 DOWN 和 UP 或者利用内部 onStateChange ,最后用的是后者。public class FadingDrawable extends TransitionDrawable

2016-04-02 22:04:59 320

原创 ColorFulButton2

public class ColorFulButton2 extends TextView { public ColorFulButton2(Context context) { super(context); } // public ColorFulButton2(Context context, AttributeSet attrs) {

2016-04-02 18:04:03 325

原创 LayerDrawable

像 DrawableContainer 一样,LayerDrawable 也管理着多个 child drawable。但不同的是,LayerDrawable 会依次绘制所有 child drawable 。 @Override public void draw(Canvas canvas) { final ChildDrawable[] array = mLa

2016-04-02 14:17:11 670

原创 DrawableContainer

和 DrawableWrapper 一样,DrawableContainer 本身不处理绘画的工作。它内部保存了 mDrawables ,然后以适当的方式切换它们。StateListDrawable 是它的实现类主要就是保存了 int[][] mStateSets,再结合父类的中的 mDrawables 根据 state 进行切换。 @Override pro

2016-04-02 11:19:13 867

原创 ColorFulButton

只能用在 api21 上,所以没什么实际作用。public class ColorFulButton extends TextView { public ColorFulButton(Context context) { super(context); } // public ColorFulButton(Context c

2016-04-02 10:15:16 509

原创 RoundCornerTextview2

public class RoundCornerTextView2 extends TextView { public RoundCornerTextView2(Context context) { super(context); } // public RoundCornerTextView2(Context context, Attribu

2016-04-01 22:02:50 586

原创 GradientDrawable

GradientDrawable 可以画出渐变的颜色,但现在的 APP 好像已经不流行渐变色的按钮了。GradientDrawable 的功能是非常强大,有了它,几乎不需要使用 ShapeDrawable 了。setCornerRadii有时候你

2016-04-01 20:06:55 952

原创 DrawableWrapper

1

2016-04-01 15:39:57 1095

原创 RoundCornnerTextView

public class RoundCornerTextView extends TextView { public RoundCornerTextView(Context context) { super(context); } // public RoundCornerTextView(Context context, Attrib

2016-04-01 14:50:00 929

原创 ShapeDrawable

#

2016-04-01 13:45:23 770

原创 ColorDrawable

ColorDrawable 是非常简单的 Drawable,也是平时用的最多的,比如: android:background="@color/colorAccent"加断点后可以看到:

2016-04-01 13:34:58 455

原创 Drawable

1. Canvas 是爹首先,需要认识到一个事情,Android 中的爹是画布。无论是画背景,画内容,画滚动条,实现滚动效果,都是靠爹来完成的。许多类的存在都是为了辅助爹,Drawable 就是其中之一。2. Drawable 综述Drawable 比 View 要来的轻量级。所以遇到需求时,首选应该考虑 Drawable 能不能胜任。Drawable

2016-04-01 10:20:09 923

原创 StateListDrawable

1. GIF

2016-03-31 14:37:50 590

原创 View 绘制

三步骤终于走到了最后一步,迎来丰收的日子。1. onDrawpublic void draw(Canvas canvas) { final int privateFlags = mPrivateFlags; final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_D

2016-03-28 12:06:52 375

原创 View 定位

预计是 onLayout onDraw 或者三者关系的什么。

2016-03-27 22:56:32 828

原创 View 测量大小

View 的绘制要经过 Measure ,Layout 和 Draw 这三部分,这篇记录下测量时的关键点。1. measure* * The actual measurement work of a view is performed in * {@link #onMeasure(int, int)}, called by this method. There

2016-03-27 20:28:24 501

原创 View 事件处理

让我自己看源码是看不懂的,还好有这么多大神。1. dispatchTouchEventViewGroup 在分发事件时会调用子 View 的 dispatchTouchEvent 方法。该方法的返回值表示这个事件是否被消费了,true 表示消费了。public class MyView extends View { public MyView(Context co

2016-03-25 10:47:15 456

原创 ActivityStack 详解

http://android.xsoftlab.net/guide/components/tasks-and-back-stack.html我花了不少时间看了些,资料和书籍。结论是吊用没有啊,我看到的术语有 TaskStack ActivityStack Task ActivityRecord TaskRecord 等等等。这些都是在源码中出现过的,还有 back stack。

2016-03-24 13:42:34 2115 4

原创 SQL 学习笔记

SQL是操作数据库的语言。ANSI SQL是标准的SQL,具有通用性。不同数据库会有自身的拓展,比如 Oracle的PL/SQL,SQL Server 的Transact-SQL。

2016-03-21 21:33:46 346

原创 怎么获取navigationbar 的高度

Resources resources = activity.getResources();int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");if (resourceId > 0) { return resources.getDimensionPixelSize(r

2016-03-03 22:07:03 775

How Tomcat Works 中文版/英文版 + 源码

How Tomcat Works 中文版/英文版 以及源码

2014-01-04

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除