From 979d9cff22806f213b420452ab4a68fcbaf021b6 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 31 五月 2021 17:43:49 +0800
Subject: [PATCH] 1. 修复多项可能引起空指针崩溃的bug; 2. 新建子任务时默认执行人员从全体人员改为当前用户; 3. 新建子任务时默认执行时间强制固定为总任务对应的时段内,确保子任务执行时间不会超出总任务范围。
---
app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
index 17463b1..87c3ad2 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/module/base/BaseActivity.kt
@@ -1,7 +1,10 @@
package cn.flightfeather.thirdapp.module.base
+import android.annotation.SuppressLint
+import android.app.Activity
import android.content.Context
import android.content.Intent
+import android.content.pm.ActivityInfo
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
@@ -10,6 +13,9 @@
import android.support.v7.widget.Toolbar
import android.view.MenuItem
import android.view.ViewGroup
+import android.view.inputmethod.InputMethodManager
+import com.bumptech.glide.Glide
+import com.bumptech.glide.util.Util
import io.reactivex.disposables.Disposable
import org.greenrobot.eventbus.EventBus
@@ -25,8 +31,14 @@
protected val disposableList = mutableListOf<Disposable>()
+ @SuppressLint("SourceLockedOrientationActivity")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ try {
+ requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
setContentView(getLayoutId())
rootView = findViewById<ViewGroup>(android.R.id.content).getChildAt(0) as ViewGroup
}
@@ -40,6 +52,7 @@
it.dispose()
}
}
+ Glide.with(applicationContext).pauseRequests()
super.onDestroy()
}
@@ -67,3 +80,14 @@
inline fun FragmentManager.inTransaction(func: FragmentTransaction.() -> FragmentTransaction) {
beginTransaction().func().commit()
}
+
+/**
+ * 鎷撳睍fragment涓殣钘忚蒋閿洏鐨勬柟娉�
+ */
+fun Activity.hideKeyboard() {
+ this.window?.peekDecorView()?.let {
+ val inputManager =
+ this.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
+ inputManager.hideSoftInputFromWindow(it.windowToken, 0)
+ }
+}
--
Gitblit v1.9.3