- 博客(13)
- 收藏
- 关注
原创 Kotlin Coroutines Exception
Kotlin Coroutines Exception官方文档:https://www.kotlincn.net/docs/reference/coroutines/exception-handling.htmlkotlin coroutines的exception有几种容易混淆的处理情形,在这里列举一下:withContextGlobalScope.launch(Dispatchers....
2019-01-02 20:55:45 610
原创 Android LiveData Transformations
Android LiveData Transformations官方文档:https://developer.android.com/reference/android/arch/lifecycle/Transformations在使用LiveData时,有时候我们想改变LiveData的值在LiveData通知其Observers之前,或者在有些时候我们的数据源Repository会返回不同...
2019-01-01 02:00:36 8093 2
原创 StaticTextView ---TextView优化
StaticTextView —TextView优化最近项目在做RecycerView的相关优化工作,发现系统提供的TextView效率不够高,setText方法每次总会消耗大概3-5ms左右,TextView作为很多view的基类,处理了很多事情比如文字变化的监听等,大大影响了bindViewHolder的时间,所以自定义了一个功能简化的TextView。由于不需要其它特殊的功能支持,比...
2018-12-26 14:28:59 565
原创 Android PrecomputedTextCompat
Android PrecomputedTextCompat官方文档:https://developer.android.com/reference/androidx/core/text/PrecomputedTextCompat官方视频:https://www.youtube.com/watch?v=x-FcOX6ErdIRelated Blog:https://medium.com/min...
2018-12-26 14:27:17 984
原创 Android 两种轮询的简单写法
Android 两种轮询的简单写法public void startPolling() { subscriber = Observable.interval(0, POLLING_INTERVAL, TimeUnit.MILLISECONDS). doOnNext(new Action1<Long>() { @Ov...
2018-05-12 00:57:09 7032
原创 RecyclerView 自定义item间隔
RecyclerView 自定义item间隔通过继承RecyclerView.ItemDecoration实现自定义item间隔recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() { @Override public void getItemOffsets(Rect outRect, View view,
2018-04-15 15:43:57 535
原创 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The
2018-01-27 13:59:23 238
原创 442. Find All Duplicates in an Array
题目描述 Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array. Could you do it
2018-01-26 14:42:31 210
原创 62. Unique Paths
题目描述 A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is try
2018-01-26 13:42:42 250
原创 27. Remove Element
27. Remove Element先排序再记录下val的起始位置,然后把val之后的其它元素填入val的位置代码int removeElement(vector<int>& nums, int val) { if (nums.empty()) { return 0; } sort(nums.begin(), nums.end()); int
2017-12-23 18:52:06 202
原创 119. Pascal’s Triangle II
119. Pascal’s Triangle II杨辉三角,主要是要在O(n)的空间复杂度实现 如果直接用组合数公式推导,阶乘计算会溢出 所以还是逐行递推下去,不过每次都从末尾开始更新,因为ans[j]=ans[j]+ans[j-1],不会擦除掉下一个要用的数据,再处理下边界就行。代码vector<int> getRow(int rowIndex){ if (rowIndex == 0
2017-12-23 18:09:01 331
原创 Qt代码配色VS2015风格
Qt代码配色VS2015风格本人所用Qt版本Qt Creator 4.4.0通过本文的方法可以将VS2015的深色主题界面应用到Qt上,对于喜欢VS代码风格配色的人应该会比较有用效果图: 1. 设置IDE主题为了配合vs深色的代码编辑背景,将Qt的主题也换成深色版本2. 添加自定义代码主题文件将自定义的xml文件放在下图中的目录下xml配色文件内容如下:<?xml version="1.0" en
2017-10-05 22:19:53 2745 2
原创 C# 委托和事件
C# 委托和事件1.方法作为函数参数时使用委托作为其类型的声明namespace normal{ public class test { public delegate void SimpleDelegate(string m); public void ShowMessage(string message) {
2017-05-20 16:51:57 335
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人