Kyleduo's blog!


  • 首页

  • 归档

  • 标签

Changes of RecyclerView in Android Support Library 23.2.0

发表于 2016-03-10   |   分类于 Android , 翻译文章

23.2.0给RecyclerView带来了一个重要的更新。

请检查item根布局的属性,改成WRAP_CONTENT。

阅读全文 »

小米路由器+桥接模式=高速无线网卡

发表于 2016-02-17   |   分类于 生活随笔

次卧电脑买了几个月了,有个问题虽然影响不大但还是心里不是滋味,那就是,网慢……

家里办的联通20M宽带,连到主卧的小米路由器,买了电脑之后上网成了老大难。首先电脑肯定是没有无线网卡的,翻出之前得的360随身wifi2代勉强顶上。小米路由器穿几道墙之后已经很弱了,加上360随身wifi的天线也没有那么强的性能,次卧电脑的速度能达到10M已经不错了,如果关上门,就……反正也就凑合吧。

为了解决这个问题,那之后又买了一个小米路由器mini,把无线网桥接到次卧,这样信号好了一些,但仍然达不到慢速,而且网速很不稳定。刚开始使用的是复制的模式,就是复制主wifi的SSID和密码,手机和电脑连接上也不知道连接的的哪个,总之用的不是很舒服。

这几天想到桥接之后能不能再接出来有线呢?答案自然是可以滴!

把小米路由器mini设置为桥接模式,然后SSID也重新设置了,Mac连接新SSID测试下网速,居(xi)然(da)满(pu)速(ben)!随后用网线从路由器mini的LAN口接到电脑上,自动连网,拔掉360随身wifi,测网速,仍(gan)然(ren)满(zhi)速(shen)!简直是从摩托车跳上高铁的感觉,嗖~

其实刚买小米路由器mini的时候也搜过能不能当无线网卡使用,没结果之后也就将就了,看来还是要多折腾啊~~~

netspeed

【译】Sth. about Android Activity Task

发表于 2016-01-29   |   分类于 Android

原文链接:Reference

FLAG_ACTIVITY_REORDER_TO_FRONT

如果当前包含实例,reorder到最上面,否则新建。

FLAG_ACTIVITY_BROUGHT_TO_FRONT

当启动一个已经实例化的具有singleTask配置的Activity时,系统自动添加。

阅读全文 »

Convenient Super-Class for custom view.

发表于 2016-01-26   |   分类于 Android

自定义View对于新手来说是道坎儿。基本来说有三种自定义View:

  • 继承自View,覆写onDraw方法,绘制需要的内容。
  • 继承自View的子类,如Button、RadioButton等,扩展其功能。
  • 继承自ViewGroup或XxxLayout,inflate布局,在自定义ViewGroup中控制子View。
    对于继承自View的方式,一般需要关心onMeasure,onDraw,onSizeChanged。而onMeasure基本有一套通用的处理方式,下面就来引入一个文件,一方面提供了这个通用模板,另一方面也可以直接使用作为自定义View的基类。

    更多关于SavedState的信息,转到另一篇博客查看。

RayView

也可以直接下载

阅读全文 »

Smatisan T2

发表于 2016-01-22   |   分类于 摄影 , 生活随笔

DSC_8009

DSC_8034

DSC_8029

DSC_8027

DSC_8049

Android View state saving and it's problem.

发表于 2016-01-14   |   分类于 Android

Android开发中,有一个不大不小的部分,用到的机会确实不多,甚至没有它也不会有什么明显的影响,它就是——Android状态保存。它的存在是这样的:在EditText中输入内容,旋转屏幕,EditText中的文字还在。有了状态保存,App的使用体验就会更加顺畅自然。

默认配置下,旋转屏幕后,Activity会重建,View重新创建之后,之前的内容自然消失,而如果文在还在的话,那就是状态保存机制在起作用了。Activity重新创建前后会分别调用onSaveInstanceState/onRestoreInstanceState,将Activity中的数据和寄于其中的Fragment和View的状态都保存下来,并在重建完成后还原。今天要讨论的是View级别的状态保存。

状态保存原理以及实现

阅读全文 »

Make RecyclerView support load more feature.

发表于 2015-11-19   |   分类于 Android

RecyclerView is a library from Android official. With witch, we can create rich and colorful user interface more easily.

SwipeRefreshLayout is another library from Android official and it support pull-to-refresh feature with any layout in it.

We use both of them to create list with refresh and load more abilities, but the load more feature is not supported by default, so I created LoadMoreRecyclerViewAdapter class to support it.

Github: https://github.com/kyleduo/LoadMoreRecyclerViewAdapter

It’s has only one .java file so you can just copy-paste that file to your project. I did want to use gist but was stuck by my network.

It is an Adapter for RecyclerView, so you use it just like before. There are some NOTICES.

  1. Instantiate this class with a LayoutManager object.
  2. Call RecyclerView.addOnScrollListener(LoadMoreRecyclerViewAdapter.getOnRecyclerScrollChangeListener()); to listen the scroll event of RecyclerView.
  3. Call super.onCreateViewHolder(parent, viewType); in onCreateViewHolder() method to create footer view holder.
  4. Call super.onBindViewHolder(holder, position); in onBindViewHolder() method.
  5. Override getActualItemCount() method to return actual data item count.
  6. Override onCreateLoadMoreFooter() method to create footer view that implements ILoadMoreFooter.
  7. Call setLoadMoreComplete() method to complete loading.
  8. Call setHasMore() method to configure whether have more data.

“Failed to resolve dependencies” with Gradle

发表于 2015-11-17   |   分类于 Android

Sometimes when add a dependencied from libraries in Github, you got a error like the title said.

This troubles me for a while and finally I solved this by StackOverflow -> Link.

If you CLEAN your project, properly you will get a “peer not authenticated” error. And this is way Gradle can not download the dependencies while by default binary’ url use https scheme.

In your root “build.gradle” file, add these lines.

repositories {
    jcenter({url "http://jcenter.bintray.com/"})
}

And hopefully this can also solve your problem.

SwitchButton 1.3.1 Published

发表于 2015-11-07   |   分类于 Android , 项目

SwitchButton是我的一个开源项目,用于Android平台的开关控件,样式精美、可定制程度高、使用方便。14年9月9日开源以来,已经在Github上收到近800个star。全球范围下载10000+次。Github地址为:https://github.com/kyleduo/SwitchButton

SwitchButton is one of my open source projects, which can be used for switch button in Android. It has a flat, cute, highly customizable style and it can be customized and used through a simple, direct way. Since published at 9/9/14, it has got nearly 800 stars and has been download more than 10 thousands times all around the world. Link to Github: https://github.com/kyleduo/SwitchButton

阅读全文 »

#Android Sth. about Paint

发表于 2015-11-04   |   分类于 Android

Paint的setColor()和setAlpha()是两个常用的方法,分别设置Paint的颜色和透明度,一般来说是没有问题的,但是当这两个方法同时使用的时候,就会出现冲突。

  • 如果先调用setAlpha(),后调用setColor(),那么alpha值并不会生效;
  • 反之,先调用setColor(),后调用setAlpha(),如果color中包含透明通道,那么setAlpha()的参数会覆盖color中透明通道的值。
    阅读全文 »
1…8910…15
kyleduo

kyleduo

Always follow my heart.

142 日志
30 分类
101 标签
Github Weibo
友情链接
  • CarlWe
  • Jeremy's World
© 2026 kyleduo
由 Hexo 强力驱动
主题 - NexT.Mist
京ICP备15044234号-1