#Test
just for test.
#Test
just for test.
android ViewUtil
| package com.fanhl.architecturedemo.rxjava2 | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.MutableLiveData | |
| import com.fanhl.architecturedemo.extensions.observe | |
| import io.reactivex.Observable | |
| /** | |
| * desc: | |
| * date: 2017/11/13 |
| /** | |
| * see {http://www.jianshu.com/p/ba2db41cc1c9?utm_campaign=maleskine&utm_content=note&utm_medium=pc_all_hots&utm_source=recommendation} | |
| * 规则: | |
| * 一只股票,上午9时开盘,下午16点收盘,每个时间点对应一个价格。 | |
| * 1.当天什么时间买入,什么时间卖出可获得最大利润。 | |
| * 2.只能买卖一次(额外规则) | |
| * 3.相同利润下时间段最短的优先 | |
| * | |
| * @author fanhl | |
| */ |
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.ConstraintLayout | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <!--防止页面刚加载出来时EditText获得焦点--> | |
| <View | |
| android:layout_width="0dp" | |
| android:layout_height="0dp" | |
| android:focusable="true" |
| apply plugin: 'com.android.library' | |
| apply plugin: 'kotlin-android' | |
| android { | |
| compileSdkVersion 28 | |
| defaultConfig { | |
| minSdkVersion 21 | |
| targetSdkVersion 28 | |
| versionCode 2 | |
| versionName "1.0.1" |
| headerView.rv_vote_option.addItemDecoration(object : RecyclerView.ItemDecoration() { | |
| val space = 10.px | |
| override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) { | |
| if (parent?.getChildAdapterPosition(view) ?: 0 != voteOptions.size - 1) { | |
| outRect?.set(0, 0, 0, space) | |
| } | |
| } | |
| }) |
EditText, clear focus on touch outside
Put it in your Activity and it'll apply to all EditTexts including those within fragments within that activity.
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
View v = getCurrentFocus();
if ( v instanceof EditText) {
Rect outRect = new Rect();
| public static PlayerController FindWithTag() | |
| { | |
| var playerController = GameObject.FindWithTag(Tags.Player).GetComponent<PlayerController>(); | |
| if (playerController == null) | |
| { | |
| throw new Exception("playerController not found."); | |
| } | |
| return playerController; | |
| } |